public UMLEditableField(UMLEntry entry, bool resizable)
            : base((CanvasGroup) entry)
        {
            _textwidget = new CanvasWidget ((CanvasGroup) entry);
            _entry = entry;
            _is_resizable = resizable;
            _textview = new TextView ();
            TextBuffer tb = _textview.Buffer;
            tb.Text = _entry.Text;

            double x = entry.TextX, y = entry.TextY;
            _textwidget.W2i (ref x, ref y);
            X = x + entry.X;
            Y = y + entry.Y;

            _textwidget.Widget = _textview;
            _textwidget.Width = entry.TextWidth + 10;//FIXME?
            _textwidget.Height = entry.TextHeight + 10; //FIXME?
            _textview.KeyReleaseEvent += LookingEsc;
            _textview.Show ();
            Width = _textwidget.Width;
            Height = _textwidget.Height;
            //TODO: Dejar esto como estaba
            //CreateUMLControlPointGroup ();

            Resized += ElementResized;
            _entry.Root.CanvasEvent += ClickCanvasEvent;
        }
		private Widget GetWidget (CustomAttributeCollection cac)
		{
			FontDescription fd = FontDescription.FromString ("Courier 10 Pitch 10");

			VBox vbox = new VBox (false, 0);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.AddWithViewport (vbox);
			
			if ((cac != null) && (cac.Count > 0)) {
				foreach (CustomAttribute ca in cac) {
 					TextView textview = new TextView ();
					textview.Editable = false;
					textview.Buffer.Text = Format (ca);
					textview.ModifyFont (fd);
					
					Expander expander = new Expander (ca.Constructor.DeclaringType.FullName);
					expander.Add (textview);
					
					vbox.Add (expander);
				}
			}
			
			sw.ShowAll ();
			return sw;
 		}
Exemple #3
0
		public ConsoleGtk ()
		{
			Window win = new Window ("MonoLOGO");
			win.DeleteEvent += new EventHandler (Window_Delete);
			win.BorderWidth = 4;
			win.DefaultSize = new Size (450, 300);
			
			VBox vbox = new VBox (false, 4);
			win.EmitAdd (vbox);
			
			ScrolledWindow swin = new ScrolledWindow (new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
			swin.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			swin.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			swin.ShadowType = Gtk.ShadowType.In;
			vbox.PackStart (swin, true, true, 0);
			
			TextBuffer buf = new TextBuffer (new TextTagTable ());
			Out = new TextWriterGtk (buf);
			TextView text = new TextView (buf);
			text.Editable = false;
			swin.EmitAdd (text);

			Entry entry = new Entry ();
			entry.Activate += new EventHandler (Entry_Activate);
			vbox.PackStart (entry, false, false, 0);
			
			win.ShowAll ();
		}
        ////////////////////////////////////////////////////////////////////
        ///<summary>
        ///ThrowMessage receives a msg and show a window. 
        ///Is intended to show exception messages
        ///</summary>
        // FIXME: Draw a better interface with l10n messages
        public static void ThrowMessage(string Msg, string short_msg)
        {
            Gtk.Window msgwindow = new Gtk.Window("Exception");
                Gtk.VBox box = new Gtk.VBox(false, 0);
                Gtk.ScrolledWindow scrWin = new Gtk.ScrolledWindow();
                Gtk.TextView txtView = new Gtk.TextView();
                Gtk.TextBuffer buffer = txtView.Buffer;
                buffer.Text = "Critical exception: " + short_msg;
                buffer.Text += "\r\n \r\nReport for developers : " + Msg;
                Gtk.Button buttonAccept = new Button("Accept");
                Gtk.Button buttonExit = new Button("Exit");

                msgwindow.DeleteEvent += new DeleteEventHandler(OnDelete);
                buttonExit.Clicked += new EventHandler(OnDelete);
                msgwindow.DestroyEvent += new DestroyEventHandler(OnContinue);
                buttonAccept.Clicked += new EventHandler(OnContinue);
                msgwindow.Add(scrWin);
                scrWin.Add(txtView);
                box.Spacing = 20;
                box.PackStart(scrWin);
                box.PackStart(buttonExit);
                box.PackStart(buttonAccept);
                //txtView.Show();
                //buttonExit.Show();
                //box.Show();
                msgwindow.DefaultHeight = 300;
                msgwindow.DefaultWidth  = 600;
                msgwindow.SetPosition(WindowPosition.Center);
                msgwindow.ShowAll();
                msgwindow.Present();
        }
        public WorkbenchView(WorkbenchController controller)
        {
            SplashWindow.Update ("Creating GUI");
            XML gxml = new Glade.XML (null,
                          WorkbenchSingleton.GLADEFILE,
                          "Workbench",
                          null);

            window = (Gtk.Window) gxml["Workbench"];
            Gtk.VPaned splitter = (Gtk.VPaned) gxml["mainPane"];

            editorNotebook = new EditorNotebook ();
            splitter.Pack1 (editorNotebook, true, false);

            ScrolledWindow sw = new ScrolledWindow ();
            console = new TextView ();
            console.Editable = false;
            console.WrapMode = WrapMode.Word;
            sw.Add (console);

            Notebook bottomNotebook = new Notebook ();
            bottomNotebook.AppendPage (sw, new Label ("Console"));
            splitter.Pack2 (bottomNotebook, true, false);

                        window.Icon = icon;
            this.WindowTitle = "";
            gxml.Autoconnect (controller);
            bottomNotebook.ShowAll ();
            editorNotebook.ShowAll ();
            SplashWindow.Update ("Simetron is ready!");
        }
		public LogView ()
		{
			buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
			textEditorControl = new Gtk.TextView (buffer);
			textEditorControl.Editable = false;
			
			ShadowType = ShadowType.None;
			Add (textEditorControl);

			bold = new TextTag ("bold");
			bold.Weight = Pango.Weight.Bold;
			buffer.TagTable.Add (bold);
			
			errorTag = new TextTag ("error");
			errorTag.Foreground = "red";
			errorTag.Weight = Pango.Weight.Bold;
			buffer.TagTable.Add (errorTag);
			
			consoleLogTag = new TextTag ("consoleLog");
			consoleLogTag.Foreground = "darkgrey";
			buffer.TagTable.Add (consoleLogTag);
			
			tag = new TextTag ("0");
			tag.LeftMargin = 10;
			buffer.TagTable.Add (tag);
			tags.Add (tag);
			
			endMark = buffer.CreateMark ("end-mark", buffer.EndIter, false);

			UpdateCustomFont (IdeApp.Preferences.CustomOutputPadFont);
			IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomFontChanged;
			
			outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);
		}
Exemple #7
0
    public void on_search_button_find_activate(object o, EventArgs ea)
    {
        Gtk.TextView   tv       = (Gtk.TextView)gxml["search_simple_keywords_view"];
        Gtk.TextBuffer tb       = tv.Buffer;
        string         kwstring = tb.GetText(tb.StartIter, tb.EndIter, false).Trim();

//        Console.WriteLine("kwstring: " + kwstring);

        if (kwstring == "")
        {
            return;
        }

        string[] kws = kwstring.Split(',', '\n', '\r');

        if (kws.Length <= 0)
        {
            return;
        }

        for (int i = 0; i < kws.Length; i++)
        {
            kws[i] = kws[i].Trim();
            Console.WriteLine("kw " + i + ": " + kws[i]);
        }
        IIconListAdapter search_adapter = new SimpleSearchIconListAdapter
                                              (repo, kws);

        icon_list.Adapter = search_adapter;
    }
Exemple #8
0
        private ScrolledWindow CreateText(TextBuffer buffer, bool IsSource)
        {
            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            scrolledWindow.ShadowType = ShadowType.In;

            TextView textView = new TextView (buffer);
            textView.Editable = false;
            textView.CursorVisible = false;

            scrolledWindow.Add (textView);

            if (IsSource) {
                FontDescription fontDescription = FontDescription.FromString ("monospace");
                textView.OverrideFont (fontDescription);
                textView.WrapMode = Gtk.WrapMode.None;
            } else {
                // Make it a bit nicer for text
                textView.WrapMode = Gtk.WrapMode.Word;
                textView.PixelsAboveLines = 2;
                textView.PixelsBelowLines = 2;
            }

            return scrolledWindow;
        }
Exemple #9
0
 public String evalMAEK(String input, String type, int lineNumber, ref Hashtable symbolTable, TextView consoleText)
 {
     //Check if the type is valid
     if (!(type.Equals ("TROOF") || type.Equals ("YARN") || type.Equals ("NUMBR") || type.Equals ("NUMBAR") || type.Equals ("NOOB"))) {
         consoleText.Buffer.Text += "Syntax error at line: " + lineNumber + ". " + type + " is undefinded\n";
         return "UNDEFINED";
     }
     //Return value based on type requested
     switch (type) {
     case "TROOF":
         {
             //String literal no content
             if (Regex.IsMatch (input, @"\s*^""""$")) {
                 return "FAIL";
             } else if (Regex.IsMatch (input, @"\s*^""\.+""$")) { //string literal with content
                 return "WIN";
             } else if (Regex.IsMatch (input, @"^\-?[0]*.?[0]+\s*")) { // IF 0
                 return "FAIL";
             } else {
                 return "WIN";
             }
         }
     case "YARN":
         {
             //If yarn literal already
             if (Regex.IsMatch (input, @"\s*^""\.""$")) {
                 //Do not modify
                 return input;
             } else {
                 //Add quotes and return
                 return "\"" + input + "\"";
             }
         }
     case "NOOB":
         {
             return "NOOB";
         }
     case "NUMBR":
         {
             //consoleText.Buffer.Text += "to Numbr";
             if (Regex.IsMatch (input, @"^"".*""$")) {
                 consoleText.Buffer.Text += "String to Numbr";
                 input = comp.removeQuotes (input);
                 int answer;
                 Boolean isInteger = Int32.TryParse (input, out answer);
                 if (isInteger) {
                     return answer.ToString ();
                 }
                 return "BAWAL ITO.";
             }
             return (input.Equals ("WIN") ? "1" : "0");
         }
     case "NUMBAR":
         {
             input = comp.removeQuotes (input);
             return input;
         }
     }
     return "UNDEFINED";
 }
		public MultiLineTextTool (IDrawingEditor editor, MultiLineTextFigure fig, ITool dt): base (editor, fig, dt) {	
			_textview = new Gtk.TextView ();
			_textview.Buffer.Changed += new System.EventHandler (ChangedHandler);
			_textview.ModifyFont (fig.PangoLayout.FontDescription.Copy ());
			_textview.RightMargin = 5;
			_textview.Justification = ConvertJustificaton ();
		}
Exemple #11
0
    public DocsTreeView(Gtk.TextView rtv, OurParserTask r)
    {
        tv = rtv;
        AppendColumn("Name", new Gtk.CellRendererText());
        AppendColumn("Result", new Gtk.CellRendererPixbuf());

        RulesHint = true;

        Columns[0].SetCellDataFunc(Columns[0].CellRenderers[0],
                new Gtk.TreeCellDataFunc(RenderName));
        Columns[1].SetCellDataFunc(Columns[1].CellRenderers[0],
                new Gtk.TreeCellDataFunc(RenderIcon));

        Columns[0].Expand = true;

        Gtk.TreeStore mres_store = new Gtk.TreeStore(
                typeof(IParsed));
        Model = mres_store;

        Selection.Changed += new EventHandler(OnSelection);

        Gtk.TreeIter iter = new Gtk.TreeIter();
        foreach (ParsedDocument doc in r.Docs) {
            iter = mres_store.AppendValues(doc);
            foreach (IParsed m in doc.Results)
                if (m.Result > 0)
                    mres_store.AppendValues(iter, m);
        }
    }
		private void AttachWidgets (TextView textView)
		{
			// This is really different from the C version, but the
			// C versions seems a little pointless.

			Button button = new Button ("Click Me");
			button.Clicked +=  new EventHandler(EasterEggCB);
			textView.AddChildAtAnchor (button, buttonAnchor);
			button.ShowAll ();

			ComboBox combo = ComboBox.NewText ();
			combo.AppendText ("Option 1");
			combo.AppendText ("Option 2");
			combo.AppendText ("Option 3");

 			textView.AddChildAtAnchor (combo, menuAnchor);

			HScale scale = new HScale (null);
			scale.SetRange (0,100);
			scale.SetSizeRequest (70, -1);
			textView.AddChildAtAnchor (scale, scaleAnchor);
			scale.ShowAll ();

			Gtk.Image image = Gtk.Image.LoadFromResource ("floppybuddy.gif");
			textView.AddChildAtAnchor (image, animationAnchor);
			image.ShowAll ();

			Entry entry = new Entry ();
			textView.AddChildAtAnchor (entry, entryAnchor);
			entry.ShowAll ();
		}
Exemple #13
0
        private void build_page_1()
        {
            TextView tv1 = new TextView ();

            try
            {
                string rez = "Adeptus.Resources.resources";
                string key = "mystring1";
                string resourceType = "";
                byte[] resourceData;
                ResourceReader r = new ResourceReader(rez);
                r.GetResourceData (key, out resourceType, out resourceData);
                r.Close();
                System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
                tv1.Buffer.Text = enc.GetString (resourceData);
            }
            catch (Exception exp)
            {
                tv1.Buffer.Text = exp.Message;
            }

            tv1.WrapMode = WrapMode.Word;
            tv1.Editable = false;

            this.AppendPage (tv1);
            this.SetPageTitle (tv1, "Introduction");
            this.SetPageType (tv1, AssistantPageType.Intro);
            this.SetPageComplete (tv1, true);
        }
		public DemoTextView () : base ("TextView")
		{
			SetDefaultSize (450,450);
			BorderWidth = 0;

			VPaned vpaned = new VPaned ();
			vpaned.BorderWidth = 5;
			Add (vpaned);

			// For convenience, we just use the autocreated buffer from
			// the first text view; you could also create the buffer
			// by itself, then later create a view widget.
			view1 = new TextView ();
			TextBuffer buffer = view1.Buffer;
			view2 = new TextView (buffer);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vpaned.Add1 (sw);
			sw.Add (view1);

			sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vpaned.Add2 (sw);
			sw.Add (view2);

			CreateTags (buffer);
			InsertText (buffer);

			AttachWidgets (view1);
			AttachWidgets (view2);

			ShowAll ();
		}
Exemple #15
0
    public NoteWindow(NoteData note_data, Window parent) : base("Note")
    {
        this.data         = note_data;
        TransientFor      = parent;
        DestroyWithParent = true;
        SetSizeRequest(250, 210);
        Resizable = false;
        Move(this.data.get_pos_x(), this.data.get_pos_y());
        Decorated       = false;
        SkipPagerHint   = true;
        SkipTaskbarHint = true;
        BorderWidth     = 12;
        ConfigureEvent += window_position_changed;

        Gdk.Color note_color = new Gdk.Color();
        Gdk.Color.Parse(note_data.get_color(), ref note_color);

        ModifyBg(StateType.Normal, note_color);

        this.view          = new Gtk.TextView();
        this.view.WrapMode = Gtk.WrapMode.WordChar;
        this.view.ModifyBase(StateType.Normal, note_color);

        this.view.KeyReleaseEvent += new KeyReleaseEventHandler(this.check_deletion);

        this.buffer          = this.view.Buffer;
        this.buffer.Text     = this.data.get_text();
        this.buffer.Changed += this.text_change;
        this.font_size       = "14";
        this.max_lines       = 8;
        this.resize_font();

        //image = new Gdk.Pixbuf( "noise.png" );
        Add(view);
    }
Exemple #16
0
        private StatusLogPage()
        {
            m_TextView = new TextView();
            m_TextView.Editable = false;

            ScrolledWindow swindow = new ScrolledWindow();
            swindow.Add(m_TextView);

            this.PackStart(swindow, true, true, 0);
            swindow.ShowAll();

            var tag = new TextTag("Error");
            tag.Foreground = "darkred";
            m_TextView.Buffer.TagTable.Add(tag);

            tag = new TextTag("Fatal");
            tag.Foreground = "darkred";
            m_TextView.Buffer.TagTable.Add(tag);

            tag = new TextTag("Warn");
            tag.Foreground = "darkorange";
            m_TextView.Buffer.TagTable.Add(tag);

            tag = new TextTag("Info");
            tag.Foreground = "darkgreen";
            m_TextView.Buffer.TagTable.Add(tag);

            tag = new TextTag("Debug");
            tag.Foreground = "darkblue";
            m_TextView.Buffer.TagTable.Add(tag);

            m_TextView.Buffer.CreateMark("end", m_TextView.Buffer.EndIter, false);

            LoggingService.AddLogger(this);
        }
Exemple #17
0
        public void Initialize() {
            Window = (Window) _builder.GetObject("LauncherWindow");
            Window.Title = _setup.Title;
            Window.Hidden += (sender, eventArgs) => Application.Quit();
            Window.Show();
            PatchNotes = (TextView)_builder.GetObject("PatchNotes");
            ProgressBar = (ProgressBar) _builder.GetObject("ProgressBar");
            PlayButton = (Button) _builder.GetObject("PlayButton");
            PlayButton.Clicked += (sender, args) => {
                Program.StartGame(_setup);
            };

            HeaderImage = (Image)_builder.GetObject("HeaderImage");
            var headerLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LaunchHeader.png");
            if (File.Exists(headerLocation))
                HeaderImage.Pixbuf = new Gdk.Pixbuf(headerLocation);

            var changeLogFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "changelog.txt");
            string patchNotesText = "You're using a BETA version of our custom launcher. Please report all issues on the forum at http://onemoreblock.com/.";

            if (File.Exists(changeLogFile))
                patchNotesText += "\n\n" + File.ReadAllText(changeLogFile);

            PatchNotes.Buffer.Text = patchNotesText;

            Task.Run(() => CheckAndUpdate());
        }
		public DemoApplicationWindow () : base ("Application Window")
		{
			SetDefaultSize (200, 200);

			vbox = new VBox (false, 0);
			Add (vbox);

			AddActions ();

			statusbar = new Statusbar ();
			UpdateStatus ();
			vbox.PackEnd (statusbar, false, false, 0);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			sw.ShadowType = ShadowType.In;
			vbox.PackEnd (sw, true, true, 0);

			TextView textview = new TextView ();
			textview.Buffer.MarkSet += new MarkSetHandler (MarkSet);
			sw.Add (textview);

			textview.GrabFocus ();

			ShowAll ();
		}
Exemple #19
0
		public DialogError(string message, Exception e, Window parent) : base("Error", parent, DialogFlags.Modal, Stock.Ok, ResponseType.Ok)
		{
			HBox hbox = new HBox();
			Image icon = new Image(Stock.DialogError,IconSize.Dialog);
			Label label = new Label(message);
			Expander exp = new Expander("Details");
			ScrolledWindow sw = new ScrolledWindow();
			TextView tview = new TextView();
			
			hbox.BorderWidth = 6;
			hbox.Spacing = 6;
			label.SetAlignment(0f, 0.5f);
			exp.BorderWidth = 6;
			tview.Buffer.Text = e.Message;
			tview.Buffer.Text += "\n";
			tview.Buffer.Text += e.StackTrace;
			
			sw.Add(tview);
			exp.Add(sw);
			hbox.PackStart(icon, false, false, 0);
			hbox.PackStart(label, true, true, 0);
			this.VBox.PackStart(hbox, false, false, 0);
			this.VBox.PackStart(exp, true, true, 0);
			this.ShowAll();
			
		}
        public PasswordWindow()
            : base(WindowType.Toplevel)
        {
            Password = null;
            Cancelled = true;

            box = new HBox(true, 3);

            label = new Label("Wachtwoord:");
            box.PackStart(label);

            TextTagTable textTagTable = new TextTagTable();
            passwordField = new TextView(new TextBuffer(new TextTagTable()));
            box.PackStart(passwordField);

            button = new Button();
            button.Label = "Ok";
            button.Clicked += delegate {
                Password = passwordField.Buffer.Text;
                Cancelled = false;
                Hide();
            };
            box.PackStart(button);

            Add(box);
            ShowAll();
        }
        public windowTerminalGTK(clsHost host)
            : base(String.Format("{0} - {1}:{2}",host.Name,host.RemoteHost,host.RemoteSSHPort))
        {
            SSH = new clsSSHTerminal(host);
            Host = host;

            ScrolledWindow scrolledWindow = new ScrolledWindow();
            textview1 = new TextView();

            this.SetSizeRequest(800,600);

            scrolledWindow.Add(textview1);
            textview1.ModifyFont(FontDescription.FromString(host.TerminalFont));

            this.Add(scrolledWindow);

            this.CanFocus = true;

            ShowAll ();

            SSH.TerminalData += (string text) =>
            {
                Gtk.Application.Invoke (delegate {
                    TextIter mIter = textview1.Buffer.EndIter;
                    textview1.Buffer.Insert(ref mIter, text);
                    textview1.ScrollToIter(textview1.Buffer.EndIter, 0, false, 0, 0);
                });
            };
        }
	/* Private methods */

	public void DrawMargin (TextView textView) {

    	/* Get char count info  */
    	int[,] info;
    	GetCharCountDrawInfo(textView, out info);

    	/* Set margin and window */
    	int marginWidth = (this.marginSpace * 2) + (this.marginDigitCount * this.marginCharWidth);
    	textView.SetBorderWindowSize(TextWindowType.Right, marginWidth);
    	Gdk.Window window = textView.GetWindow(TextWindowType.Right);
    	window.Clear();

    	/* Draw line */
    	window.DrawLine(this.lineGC, 0, 0, 0, textView.Allocation.Height);

    	/* Draw text */
    	int infoCount = info.GetLength(0);
    	for (int i = 0 ; i < infoCount ; i++) {
    		int charCount = info[i, 0];
    		int y = info[i, 1];

    		this.textLayout.SetText(charCount.ToString());
    		int textLayoutWidth, textLayoutHeight;
    		this.textLayout.GetPixelSize(out textLayoutWidth, out textLayoutHeight);
    		window.DrawLayout(this.textGC, this.marginSpace, y - textLayoutHeight/2, this.textLayout);
		}
    }
Exemple #23
0
    public static int GetLineCount(Gtk.TextView GtkTextView, int LineHeight)
    {
        int y, height;

        GtkTextView.GetLineYrange(GtkTextView.Buffer.EndIter, out y, out height);
        return((y + height) / LineHeight);
    }
Exemple #24
0
 public GtkTextViewEditor(TextView textView)
 {
     _textView = textView;
     ConfigureEvents();
     ConfigureTags();
     _waitForDeletionKey = false;
 }
Exemple #25
0
        public LogView()
        {
            buffer                     = new Gtk.TextBuffer(new Gtk.TextTagTable());
            textEditorControl          = new LogTextView(buffer);
            textEditorControl.Editable = false;

            ShadowType = ShadowType.None;
            Add(textEditorControl);

            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add(bold);

            errorTag            = new TextTag("error");
            errorTag.Foreground = "red";
            errorTag.Weight     = Pango.Weight.Bold;
            buffer.TagTable.Add(errorTag);

            consoleLogTag            = new TextTag("consoleLog");
            consoleLogTag.Foreground = "darkgrey";
            buffer.TagTable.Add(consoleLogTag);

            tag            = new TextTag("0");
            tag.LeftMargin = 10;
            buffer.TagTable.Add(tag);
            tags.Add(tag);

            endMark = buffer.CreateMark("end-mark", buffer.EndIter, false);

            UpdateCustomFont();
            IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomFontChanged;

            outputDispatcher = new GLib.TimeoutHandler(outputDispatchHandler);
        }
		public Action (SecurityAction action)
		{
			this.action = action;
			this.TextView = new TextView ();
			this.TextView.Editable = false;
			this.Expander = new Expander (action.ToString ());
			this.Expander.Add (this.TextView);
		}
Exemple #27
0
 public MultiLineTextTool(IDrawingEditor editor, MultiLineTextFigure fig, ITool dt) : base(editor, fig, dt)
 {
     _textview = new Gtk.TextView();
     _textview.Buffer.Changed += new System.EventHandler(ChangedHandler);
     _textview.ModifyFont(fig.PangoLayout.FontDescription.Copy());
     _textview.RightMargin   = 5;
     _textview.Justification = ConvertJustificaton();
 }
Exemple #28
0
    public static int GetLineHeight(Gtk.TextView GtkTextView)
    {
        int y, height;

        GtkTextView.Buffer.Text = "";
        GtkTextView.GetLineYrange(GtkTextView.Buffer.StartIter, out y, out height);
        return(height);
    }
 public BestellingBevestigenWindow(IEnumerable<Bestelling> bestellingen)
     : base(Gtk.WindowType.Toplevel)
 {
     box = new VBox(false, 3);
     overzicht = new TextView(new TextBuffer(new TextTagTable()));
     overzicht.Buffer.Text = formatBestellingOverzicht(bestellingen);
     Add(box);
 }
Exemple #30
0
        public StyleWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            SetSizeRequest(800, 800);

            var box = new VBox();
            Add(box);

            var tab = new TextTagTable();
            buf = new TextBuffer(tab);
            buf.Text = System.IO.File.ReadAllText("res/theme/gtk.css");
            var en = new TextView(buf);
            sv = new ScrolledWindow();
            sv.Add(en);
            box.PackStart(sv, true, true, 0);

            var cssProvider = new CssProvider();
            StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);

            var isDefault = true;

            var but = new Button();
            but.Label = "Save";
            but.HeightRequest = 30;
            box.PackEnd(but, false, false, 0);
            but.Clicked += (s, e) => {
                System.IO.File.WriteAllText("res/theme/gtk.css", buf.Text);
            };

            buf.Changed += (s, e) => {
                bool error = false;
                try {
                    //StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                    cssProvider.LoadFromData(buf.Text);
                    //StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);
                } catch (Exception ex) {
                    error = true;
                }
                if (error) {
                    if (!isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider, uint.MaxValue);
                        isDefault = true;
                    }

                } else {
                    if (isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue);
                        isDefault = false;
                    }
                }

            };

            ShowAll();
        }
Exemple #31
0
		public static void Recheck (TextView tv)
		{
			Debug.Assert (IsSupported);
			Debug.Assert (tv != null);
			Debug.Assert (tv.Handle != IntPtr.Zero);
			IntPtr ptr = gtkspell_get_from_text_view (tv.Handle);
			if (ptr != IntPtr.Zero)
				gtkspell_recheck_all (ptr);
		}
 public iFolderAcceptDialog(iFolderWeb ifolder, string initialPath)
     : base()
 {
     this.Title =
     string.Format(Util.GS("Download \"{0}\"..."), ifolder.Name);
        this.SetDefaultSize (600, 500);
        this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder24.png"));
        this.ifolder = ifolder;
        this.initialPath = initialPath;
        VBox dialogBox = new VBox();
        dialogBox.Spacing = 10;
        dialogBox.BorderWidth = 10;
        dialogBox.Homogeneous = false;
        this.VBox.PackStart(dialogBox, true, true, 0);
        VBox detailBox = new VBox();
        dialogBox.PackStart(detailBox, false, false, 0);
        Label l = new Label(Util.GS("Details:"));
        l.Xalign = 0;
        detailBox.PackStart(l, false, false, 0);
        TextView tv = new TextView();
        tv.LeftMargin = 10;
        tv.RightMargin = 10;
        tv.Editable = false;
        tv.CursorVisible = false;
        TextBuffer buffer = tv.Buffer;
        buffer.Text = string.Format(Util.GS("Name: {0}\nShared by: {1}\nAccess: {2}"), ifolder.Name, ifolder.Owner, GetDisplayRights(ifolder.CurrentUserRights));
        ScrolledWindow sw = new ScrolledWindow();
        sw.ShadowType = Gtk.ShadowType.EtchedIn;
        sw.Add(tv);
        detailBox.PackStart(sw, false, false, 0);
        l = new Label(Util.GS("The iFolder will be downloaded into this folder:"));
        l.LineWrap = false;
        l.Xalign = 0; l.Yalign = 1;
        dialogBox.PackStart(l, false, false, 0);
        previewPath = new Label();
        previewPath.Xalign = 0; previewPath.Yalign = 0;
        previewPath.Wrap = true;
        dialogBox.PackStart(previewPath, false, false, 0);
        fileChooserWidget =
     new FileChooserWidget(FileChooserAction.SelectFolder, "");
        fileChooserWidget.SelectMultiple = false;
        fileChooserWidget.LocalOnly = true;
        fileChooserWidget.CurrentName = ifolder.Name;
        if (this.initialPath != null && this.initialPath.Length > 0)
     fileChooserWidget.SetCurrentFolder(this.initialPath);
        fileChooserWidget.SelectionChanged +=
     new EventHandler(OnFileChooserSelectionChanged);
        dialogBox.PackStart(fileChooserWidget, true, true, 0);
        this.VBox.ShowAll();
        this.AddButton(Stock.Cancel, ResponseType.Cancel);
        this.AddButton(Stock.Ok, ResponseType.Ok);
        if (this.initialPath != null && this.initialPath.Length > 0)
     this.SetResponseSensitive(ResponseType.Ok, true);
        else
     this.SetResponseSensitive(ResponseType.Ok, false);
 }
Exemple #33
0
        public QueryDebugger () : base ("Hyena.Query Debugger")
        {
            SetDefaultSize (800, 600);

            VBox input_box = new VBox ();
            input_box.Spacing = 8;
            ScrolledWindow sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            input = new TextView ();
            input.AcceptsTab = false;
            input.KeyReleaseEvent += delegate (object o, KeyReleaseEventArgs args) {
                if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter) {
                    input.Buffer.Text = input.Buffer.Text.Trim ();
                    OnParseUserQuery (null, EventArgs.Empty);
                }
            };
            input.WrapMode = WrapMode.Word;
            sw.Add (input);
            input_box.PackStart (sw, true, true, 0);
            HBox button_box = new HBox ();
            Button parse = new Button ("Parse as User Query");
            parse.Clicked += OnParseUserQuery;
            button_box.PackStart (parse, false, false, 0);
            input_box.PackStart (button_box, false, false, 0);

            HBox output_box = new HBox ();
            output_box.Spacing = 8;
            sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            sql = new TextView ();
            sql.WrapMode = WrapMode.Word;
            sw.Add (sql);
            output_box.PackStart (sw, true, true, 0);
            sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            xml = new TextView ();
            xml.WrapMode = WrapMode.Word;
            sw.Add (xml);
            output_box.PackStart (sw, true, true, 0);

            VPaned pane = new VPaned ();
            pane.Add1 (input_box);
            pane.Add2 (output_box);
            pane.Position = 100;

            Add (pane);
            pane.ShowAll ();

            input.HasFocus = true;

            LoadQueryFieldSet ();
        }
Exemple #34
0
        /// <summary>Crea el editor para el código en ensamblador.</summary>
        /// <returns>Un widget que contiene el campo de texto para
        /// editar código ensamblador.</returns>

        private Gtk.Widget CrearEditorEnsamblador()
        {
            textoCodigo =
                new Gtk.TextBuffer((Gtk.TextTagTable)null);
            Gtk.TextView       view = new Gtk.TextView(textoCodigo);
            Gtk.ScrolledWindow sw   = new Gtk.ScrolledWindow();
            sw.Add(view);
            textoCodigo.MarkSet +=
                new Gtk.MarkSetHandler(ActualizadaPosicionCursor);
            return(sw);
        }
Exemple #35
0
        /// <summary>Crea el editor para mostrar los errores producidos
        /// al ensamblar el código en ensamblador.</summary>
        /// <returns>Un widget con el campo de texto para mostrar
        /// los errores y advertencias del ensamblador.</returns>

        private Gtk.Widget CrearErroresEnsamblador()
        {
            textoErrores =
                new Gtk.TextBuffer((Gtk.TextTagTable)null);
            Gtk.TextView view = new Gtk.TextView(textoErrores);
            view.Editable = false;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            sw.Add(view);
            return(sw);
        }
        private TextView textView; // Textview to hold landmark information.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SLAM.MapWindow"/> class.
        /// </summary>
        /// <param name="mapView">Map view contained in this window.</param>
        public MapWindow(MapView mapView)
            : base("Map")
        {
            robot = mapView.RobotView.Robot;

            this.mapView = mapView;

            // Subscribe to events.
            mapView.MapModel.MapUpdated += new EventHandler<MapUpdateEventArgs> (Map_Update);
            mapView.RobotView.Robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Robot_Update);

            SetPosition (WindowPosition.Center);
            Resizable = false;

            DeleteEvent += delegate
            {
                Application.Quit ();
            };

            TextBuffer textBuffer = new TextBuffer (new TextTagTable ());

            textView = new TextView ();
            textView.Indent = 10;
            textView.Editable = false;
            textView.Buffer = textBuffer;
            textView.CursorVisible = false;
            textView.SetSizeRequest (mapView.ViewWidth, 150);

            foreach (Landmark landmark in mapView.MapModel.Landmarks)
            {
                this.textView.Buffer.Text += landmark.ToString ();
            }

            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.Add (textView);

            commandEntry = new Entry ();
            commandEntry.Activated += CommandEntry_OnActivated;

            sendButton = new Button ("Send");
            sendButton.Clicked += SendButton_OnClick;

            HBox hbox = new HBox (false, 0);
            hbox.Add (commandEntry);
            hbox.Add (sendButton);

            VBox vbox = new VBox (false, 0);
            vbox.Add (this.mapView);
            vbox.Add (scrolledWindow);
            vbox.Add (hbox);

            Add (vbox);
            Shown += OnShown;
        }
        public static void RegisterCommandLineElements(TextView output, Entry entry, Button send_button)
        {
            // Register UI elements with the controller
            CommandLineOutput = output;
            OutputBuffer = output.Buffer;
            CommandLineEntry = entry;
            CommandLineSendButton = send_button;

            CommandLineEntry.Text = ""; //Clear the entry box
            OutputBuffer.Text = ""; //Clear the output box
        }
	public SubtitleEditTextView (TextView textView) {
		this.textView = textView;

		/* Init tags */
    	underlineTag.Underline = Pango.Underline.Single;
    	this.textView.Buffer.TagTable.Add(underlineTag);

		/* Init margin */
		new SubtitleEditTextViewMargin(this.textView);

		Base.InitFinished += OnBaseInitFinished;
	}
Exemple #39
0
      private void InitializeComponent()
      {
         this.Title = "Search Errors";
         this.Modal = false;
         this.WindowPosition = Gtk.WindowPosition.CenterOnParent;
         this.Resizable = true;
         this.SetDefaultSize(480, 320);         
         this.IconName = Stock.DialogError;
         this.AddButton(Stock.Close, Gtk.ResponseType.Close);

         Gtk.Frame treeFrame = new Gtk.Frame();
         treeFrame.Shadow = ShadowType.In;
         Gtk.ScrolledWindow treeWin = new Gtk.ScrolledWindow();
         tvErrors = new Gtk.TreeView ();
         tvErrors.SetSizeRequest(480,200);
         tvErrors.Selection.Mode = SelectionMode.Single;

         tvErrors.AppendColumn(CreateTreeViewColumn("Name", 60, 0));
         tvErrors.AppendColumn(CreateTreeViewColumn("Located In", 200, 1));

         lsErrors = new Gtk.ListStore(typeof (string), typeof (string), typeof(string));
         tvErrors.Model = lsErrors;
         tvErrors.Selection.Changed += new EventHandler(tvErrors_Selection_Changed);
                  
         treeWin.Add(tvErrors);
         treeFrame.BorderWidth = 0;
         treeFrame.Add(treeWin);

         for (int i=0; i< alErrors.Count; i++)
         {
            MessageEventArgs args = (MessageEventArgs)alErrors[i];
            if (args.ErrorFile == null)
               lsErrors.AppendValues("General Error", string.Empty, args.Message);
            else
               lsErrors.AppendValues(args.ErrorFile.Name, args.ErrorFile.DirectoryName, args.Message);
         }

         Gtk.Frame txtFrame = new Gtk.Frame();
         txtFrame.Shadow = ShadowType.In;
         Gtk.ScrolledWindow txtScrollWin = new Gtk.ScrolledWindow();
         txtErrorDetails = new TextView();
         txtErrorDetails.WrapMode = Gtk.WrapMode.WordChar;
         txtErrorDetails.Editable = false;
         txtScrollWin.Add(txtErrorDetails);
         txtFrame.BorderWidth = 0;
         txtFrame.Add(txtScrollWin);

         this.VBox.PackStart(treeFrame, true, true, 3);
         this.VBox.PackEnd(txtFrame, true, true, 3);
         this.VBox.ShowAll();
      }
Exemple #40
0
        public void Build()
        {
            this.window = new Window("BattleNames");
            this.window.SetDefaultSize(800, 600);
            this.window.DeleteEvent += HandleWindowDeleteEvent;

            this.vbox = new VBox();
            {
                this.tbar = new Toolbar();
                this.tbar.ToolbarStyle = ToolbarStyle.BothHoriz;
                {
                    this.generatebutton             = new ToolButton(Stock.New);
                    this.generatebutton.TooltipText = "Generate a new battle name";
                    this.generatebutton.Label       = "Generate";
                    this.generatebutton.IsImportant = true;
                    this.generatebutton.Clicked    += HandleGeneratebuttonClicked;
                    this.clearbutton             = new ToolButton(Stock.Clear);
                    this.clearbutton.TooltipText = "Clear output";
                    this.clearbutton.Label       = "Clear";
                    this.clearbutton.Clicked    += HandleClearbuttonClicked;
                }
                this.tbar.Add(this.generatebutton);
                this.tbar.Add(this.clearbutton);

                this.hpaned = new HPaned();
                {
                    this.treescrolledwindow = new ScrolledWindow();
                    this.treeview           = new TreeView();
                    this.treeview.AppendColumn("Name", new CellRendererText(), "text", 0);
                    this.treeview.HeadersVisible = true;
                    this.treeview.Model          = this.treestore;
                    this.treescrolledwindow.Add(this.treeview);

                    this.textscrolledwindow = new ScrolledWindow();
                    this.textview           = new TextView();
                    this.textview.Editable  = false;
                    this.textscrolledwindow.Add(this.textview);
                }
                this.hpaned.Pack1(this.treescrolledwindow, false, true);
                this.hpaned.Pack2(this.textscrolledwindow, true, true);
                this.hpaned.Position = 200;

                this.sbar = new Statusbar();
            }
            this.vbox.PackStart(this.tbar, false, true, 0);
            this.vbox.PackStart(this.hpaned, true, true, 0);
            this.vbox.PackEnd(this.sbar, false, true, 0);

            this.window.Add(this.vbox);
        }
Exemple #41
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        public TalkFrame(UserInfo userInfo)
        {
            // Initialize User Info
            this.userInfo = userInfo;

            // VPaned Position
            this.Position = 120;

            Gtk.Frame frame;

            // Output Text View
            this.talkView = new TalkView();

            // Output Scrolled Window
            this.scrolledWindowOut                  = new Gtk.ScrolledWindow(null, null);
            this.scrolledWindowOut.ShadowType       = Gtk.ShadowType.None;
            this.scrolledWindowOut.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            this.scrolledWindowOut.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            this.scrolledWindowOut.Add(this.talkView);

            // Output Frame
            frame            = new Gtk.Frame();
            frame.Shadow     = ShadowType.EtchedOut;
            frame.ShadowType = ShadowType.EtchedOut;
            frame.Add(this.scrolledWindowOut);
            this.Add1(frame);

            // Input Text View
            this.inputView = new Gtk.TextView();
            this.inputView.HeightRequest    = 25;
            this.inputView.KeyReleaseEvent += new KeyReleaseEventHandler(OnKeyReleaseEvent);

            // Input Scrolled Window
            this.scrolledWindowIn                  = new Gtk.ScrolledWindow(null, null);
            this.scrolledWindowIn.ShadowType       = Gtk.ShadowType.None;
            this.scrolledWindowIn.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            this.scrolledWindowIn.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            this.scrolledWindowIn.Add(this.inputView);

            // Input Frame
            frame            = new Gtk.Frame();
            frame.Shadow     = ShadowType.EtchedOut;
            frame.ShadowType = ShadowType.EtchedOut;
            frame.Add(this.scrolledWindowIn);
            this.Add2(frame);

            // Show All
            this.ShowAll();
        }
Exemple #42
0
 public WindowMenuSystem(TextBox tb, Menu parentMenu, Label labelPause,
                         Window window)
 {
     _parent = window;
     this.tb = tb;
     //TODO this.tb.Disposed += new EventHandler(tb_Disposed);
     this.labelPause = labelPause;
     this.parentMenu = parentMenu;
     //
     _uiThread = System.Threading.Thread.CurrentThread;
     SynchronizationContext.SetSynchronizationContext(
         new GtkSynchronizationContext(_parent));
     //
     SetupPauseControls();
     LoadKnownAddresses();
 }
Exemple #43
0
 private void ShowSource(object o, EventArgs args)
 {
     Gtk.Window win = new Gtk.Window("Source");
     win.SetDefaultSize(800, 500);
     Gtk.ScrolledWindow sw = new ScrolledWindow();
     sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
     sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
     Gtk.TextView view = new Gtk.TextView();
     view.CursorVisible = false;
     view.Editable      = false;
     Gtk.TextBuffer buffer = view.Buffer;
     buffer.Text = canvas.Source;
     view.Buffer = buffer;
     sw.Add(view);
     win.Add(sw);
     win.ShowAll();
 }
Exemple #44
0
 void HandleBrowseExisting(object sender, System.EventArgs args)
 {
     if (listwindow == null)
     {
         listwindow = new Gtk.Window("Pending files to write");
         listwindow.SetDefaultSize(400, 200);
         listwindow.DeleteEvent += delegate(object o, Gtk.DeleteEventArgs e) { (o as Gtk.Window).Destroy(); listwindow = null; };
         Gtk.TextView       view = new Gtk.TextView();
         Gtk.ScrolledWindow sw   = new Gtk.ScrolledWindow();
         sw.Add(view);
         listwindow.Add(sw);
     }
     else
     {
         ((listwindow.Child as Gtk.ScrolledWindow).Child as Gtk.TextView).Buffer.Text = "";
     }
     ListAll(((listwindow.Child as Gtk.ScrolledWindow).Child as Gtk.TextView).Buffer, dest);
     listwindow.ShowAll();
 }
Exemple #45
0
        public static void Main(string[] args)
        {
            Application.Init();
            MainWindow win = new MainWindow();

            win.Show();

            Gtk.TextView   view;
            Gtk.TextBuffer buffer;

            view   = new Gtk.TextView();
            buffer = view.Buffer;

            buffer.Text = "Hello, this is some text";

            win.Add(view);
            win.ShowAll();
            Application.Run();
        }
Exemple #46
0
    public DemoApp(string[] args, params object[] props) : base("DemoApp", "0.1", Modules.UI, args, props)
    {
        ParseArgs(args);

        Glade.XML gxml = new Glade.XML("sourceview.glade", "win", null);
        gxml.Autoconnect(this);

        if (win == null)
        {
            throw new Exception("GladeWidgetAttribute is broken.");
        }

        Gtk.TextView tw = (Gtk.TextView)gxml.GetWidget("tw");

        System.IO.StreamReader stream = new StreamReader(this.file);
        string text = stream.ReadToEnd();

        tw.Buffer.Insert(tw.Buffer.EndIter, text);

        Console.WriteLine("here we go");
        Config     conf = new Config();
        Highlights hl   = new Highlights(conf.patterns);

        ConnectTextTagTable(tw.Buffer.TagTable, conf.styles);

        hl.DebugPrint();
        Token [] tokens = hl.Search(text);

        foreach (Token t in tokens)
        {
            Gtk.TextIter siter, eiter;

            tw.Buffer.GetIterAtOffset(out siter, t.sindex);
            tw.Buffer.GetIterAtOffset(out eiter, t.eindex);

            //Console.WriteLine("*** {3} - {4}*** <{0}>{1}</{0}:{2}>",
            //t.style.name, tw.Buffer.GetText(siter, eiter, false), t.style.pattern, t.sindex, t.eindex + 1);

            tw.Buffer.ApplyTag(tw.Buffer.TagTable.Lookup(t.style.path), siter, eiter);
        }
    }
Exemple #47
0
        public gsOutput() : base(Gtk.WindowType.Toplevel)
        {
            this.SetDefaultSize(500, 500);
            this.Title = "GhostPDL Standard Output";

            m_scrolledWindow             = new ScrolledWindow();
            m_scrolledWindow.BorderWidth = 5;
            m_scrolledWindow.ShadowType  = ShadowType.In;

            DeleteEvent += Handle_DeleteEvent;

            m_textView          = new Gtk.TextView();
            m_textView.Editable = false;

            /* To force resize and scroll to bottom when text view is update */
            m_scrolledWindow.Add(m_textView);

            Add(m_scrolledWindow);
            ShowAll();
            Hide();
        }
Exemple #48
0
    TextViewSample()
    {
        Application.Init();
        Window win = new Window("TextViewSample");

        win.DeleteEvent += new DeleteEventHandler(OnWinDelete);
        win.SetDefaultSize(600, 400);

        Gtk.TextView   view;
        Gtk.TextBuffer buffer;

        view   = new Gtk.TextView();
        buffer = view.Buffer;

        buffer.Text = "Hello, this is some text";

        win.Add(view);
        win.ShowAll();

        Application.Run();
    }
Exemple #49
0
        private Gtk.Widget MakeEditPage()
        {
            Gtk.VBox vbox = new Gtk.VBox(false, 0);
            vbox.BorderWidth = 6;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            sw.ShadowType       = Gtk.ShadowType.EtchedIn;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;

            textView             = new Gtk.TextView();
            textView.WrapMode    = Gtk.WrapMode.Word;
            textView.Editable    = true;
            textView.Buffer.Text = text;
            textView.CanFocus    = true;
            textView.NoShowAll   = true;
            textView.SetSizeRequest(-1, 60);
            sw.Add(textView);
            sw.Show();
            vbox.PackStart(sw, true, true, 0);

            Gtk.HButtonBox hButtonBox = new Gtk.HButtonBox();
            hButtonBox.Layout = Gtk.ButtonBoxStyle.End;

            cancelButton           = new Gtk.Button(Gtk.Stock.Cancel);
            cancelButton.Clicked  += OnEditCanceled;
            cancelButton.NoShowAll = true;
            hButtonBox.PackStart(cancelButton, false, false, 0);

            saveButton           = new Gtk.Button(Gtk.Stock.Save);
            saveButton.Clicked  += OnSaveButtonClicked;
            saveButton.NoShowAll = true;
            hButtonBox.PackStart(saveButton, false, false, 0);

            hButtonBox.Show();
            vbox.PackStart(hButtonBox, false, false, 6);

            vbox.Show();
            return(vbox);
        }
Exemple #50
0
        private void InitializeComponent()
        {
            quitButton         = new Gtk.Button();
            nextPlotButton     = new Gtk.Button();
            prevPlotButton     = new Gtk.Button();
            printButton        = new Gtk.Button();
            exampleNumberLabel = new Gtk.Label();

            // Create the two display panes for the samples
            plotWidget = new PlotWidget();
            infoBox    = new Gtk.TextView();

            quitButton.Name = "quitButton";
            //quitButton.TabIndex = 14;
            quitButton.Label    = "Close";
            quitButton.Clicked += new System.EventHandler(quitButton_Click);

            nextPlotButton.Name = "nextPlotButton";
            //nextPlotButton.TabIndex = 17;
            nextPlotButton.Label    = "Next";
            nextPlotButton.Clicked += new System.EventHandler(nextPlotButton_Click);

            printButton.Name = "printButton";
            //printButton.TabIndex = 9;
            printButton.Label    = "Print";
            printButton.Clicked += new System.EventHandler(printButton_Click);

            prevPlotButton.Name = "prevPlotButton";
            //prevPlotButton.TabIndex = 15;
            prevPlotButton.Label    = "Prev";
            prevPlotButton.Clicked += new System.EventHandler(prevPlotButton_Click);

            exampleNumberLabel.Name = "exampleNumberLabel";

            infoBox.Name = "infoBox";
            //infoBox.TabIndex = 18;

            SetSizeRequest(632, 520);
            //
            // Define 11x8 table on which to lay out the plot, test buttons, etc
            //
            layout             = new Gtk.Table(11, 8, true);
            layout.BorderWidth = 4;
            Add(layout);

            infoFrame            = new Frame();
            infoFrame.ShadowType = Gtk.ShadowType.In;
            infoFrame.Add(infoBox);

            AttachOptions opt = AttachOptions.Expand | AttachOptions.Fill;
            uint          xpad = 2, ypad = 10;

            layout.Attach(infoFrame, 0, 8, 9, 11);
            layout.Attach(plotWidget, 0, 8, 0, 8);
            layout.Attach(quitButton, 3, 4, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(printButton, 2, 3, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(prevPlotButton, 0, 1, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(exampleNumberLabel, 4, 5, 8, 9);
            layout.Attach(nextPlotButton, 1, 2, 8, 9, opt, opt, xpad, ypad);
            Name = "PlotSurface Samples";
        }
Exemple #51
0
 /// <summary>
 /// Parse the specified resultdisplay, options and mode.
 /// </summary>
 /// <param name='resultdisplay'>
 /// An Gtk.TextView which should contains the result.
 /// </param>
 /// <param name='options'>
 /// Options.
 /// </param>
 /// <param name='mode'>
 /// Mode.
 /// </param>
 public void parse(ref Gtk.TextView resultdisplay, RegexOptions options, libTerminus.ParsingMode mode)
 {
     try {
         DateTime _Begin = DateTime.Now;
         //BackgroundWorker bgw = new BackgroundWorker ();
         //bgw.DoWork += HandleDoWork;
         string result = "";
         bool   success;
         string dataSource = DataSource.Buffer.Text;
         string expression = Expression.Buffer.Text;
         //if (bgw.IsBusy)
         //bgw.CancelAsync ();
         if (dataSource != "" && expression != "")
         {
             //bgw.RunWorkerAsync ();
             //this.g_DataSource = DataSource.Buffer.Text;
             //this.g_Expression = Expression.Buffer.Text;
             //TODO: If any bug appears, comment this line
             g_options = options;
             //g_mode = mode;
             //g_resultdisplay = resultdisplay;
             Regex rgx = new Regex(expression, options);
             success = rgx.IsMatch(dataSource);
             int count = 0;
             if (mode == ParsingMode.All)
             {
                 foreach (Match mt in rgx.Matches(dataSource))
                 {
                     result += "[" + count + "] " + mt.Value + "\n";
                     count++;
                     for (int i = 0; i < mt.Groups.Count; i++)
                     {
                         if (result.Contains("[" + rgx.GetGroupNames() [i] + "] " + mt.Groups [i].Value) == false)
                         {
                             result += "-> [" + rgx.GetGroupNames() [i] + "] " + mt.Groups [i].Value + "\n";
                         }
                     }
                 }
             }
             else if (mode == ParsingMode.OnlyGroups)
             {
                 foreach (Match mt in rgx.Matches(dataSource))
                 {
                     for (int i = 0; i < mt.Groups.Count; i++)
                     {
                         if (result.Contains("[" + rgx.GetGroupNames() [i] + "] " + mt.Groups [i].Value) == false)
                         {
                             result += "-> [" + rgx.GetGroupNames() [i] + "] " + mt.Groups [i].Value + "\n";
                         }
                     }
                 }
             }
             else if (mode == ParsingMode.OnlyRegular)
             {
                 foreach (Match mt in rgx.Matches(dataSource))
                 {
                     result += "[" + count + "] " + mt.Value + "\n";
                     count++;
                 }
             }
             //new MessageBox().Show(expression + ";" + dataSource + ";" + result  + success.ToString(),"",Gtk.ButtonsType.Close,Gtk.MessageType.Info);
             resultdisplay.Buffer.Text = result;
             g_lastresult = result;
             DateTime _End = DateTime.Now;
             cTerminus.g_lastResultTimeSpan = _End - _Begin;
             new cRevertData().setRestoredData(DateTime.Now, expression, "");
         }
         else
         {
             MessageBox.Show("Die Daten enthalten keinen Ausdruck", cTerminus.g_programName, Gtk.ButtonsType.Ok, Gtk.MessageType.Warning);
         }
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error);
     }
 }
Exemple #52
0
        public TServers(CInterfaceGateway in_krnGateway, Glade.XML gxml, Gtk.TextView log)

        /*public TServers (Gtk.TreeView tv, Gtk.TextView log, CInterfaceGateway in_krnGateway,
         *                                      Gtk.Button btn1,Gtk.Button btn2,Gtk.Entry txt1,Gtk.Entry txt2,Gtk.Entry txt3)*/
        {
            krnGateway = in_krnGateway;
            krnGateway.OnLogMessage += new LogEvent(m_Log);
            krnGateway.OnNewServer  += new ServerEvent(OnNewServer);
            //btnAddServer = btn1;
            btnAddServer = (gxml.GetWidget("btnAddServer") as Button);
            //btnDownloadServers = btn2;
            btnDownloadServers = (gxml.GetWidget("btnDownloadServers") as Button);
            //txtDownloadServers = txt1;
            txtDownloadServers = (gxml.GetWidget("txtDownloadServers") as Entry);
            //txtServerIp = txt2;
            txtServerIp = (gxml.GetWidget("txtServerIp") as Entry);
            //txtServerPort = txt3;
            txtServerPort = (gxml.GetWidget("txtServerPort") as Entry);
            txtServerLog  = log;            //I don't use gxml due to problems with buffer
            buffer        = txtServerLog.Buffer;
            /*tvServers = tv;*/
            tvServers = (gxml.GetWidget("tvServers") as TreeView);

            stServers = new TreeStore(typeof(string), typeof(string), typeof(string),
                                      typeof(string), typeof(string), typeof(string));
            tvServers.Model = stServers;

            Gtk.TreeViewColumn tvc = new TreeViewColumn("Server Name", new CellRendererText(), "text", 0);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 0;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Address", new CellRendererText(), "text", 1);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 1;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Failed", new CellRendererText(), "text", 2);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 2;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Files", new CellRendererText(), "text", 3);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 3;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Users", new CellRendererText(), "text", 4);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 4;
            tvc.Resizable    = true;

            tvc = new TreeViewColumn("Priority", new CellRendererText(), "text", 5);
            tvServers.AppendColumn(tvc);
            tvc.SortColumnId = 5;
            tvc.Resizable    = true;

            menu = new Gtk.Menu();
            MenuItem it_Connect = new MenuItem("Connect");

            it_Connect.Activated += new EventHandler(ConnectTo);
            MenuItem it_Copy = new MenuItem("Copy to clipboard");

            it_Copy.Activated += new EventHandler(CopyLink);
            MenuItem it_Delete = new MenuItem("Delete");

            it_Delete.Activated += new EventHandler(Delete);

            menu.Append(it_Connect);
            menu.Append(it_Copy);
            menu.Append(it_Delete);

            tvServers.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressEvent);
            // tvServers.PopupMenu += new PopupMenuHandler(PopupMenuEvent);
            loadServers();
        }
        private static Gtk.ResponseType showErrDialog(Exception e, bool canContinue)
        {
            Gtk.Table          pnlError;
            Gtk.Image          pctError;
            Gtk.Label          lblError;
            Gtk.ScrolledWindow scrError;
            Gtk.TextView       txtError;
            Gtk.Button         cmdReport;
            Gtk.Button         cmdIgnore;
            Gtk.Button         cmdExit;

            pnlError               = new Gtk.Table(2, 2, false);
            pnlError.Name          = "pnlError";
            pnlError.RowSpacing    = 6;
            pnlError.ColumnSpacing = 6;

            pctError      = new Gtk.Image();
            pctError.Name = "pctError";
            pctError.Xpad = 8;
            pctError.Ypad = 8;
            if (CurrentOS.IsMac)
            {
                pctError.Pixbuf = Gdk.Pixbuf.LoadFromResource("RestrictionTrackerGTK.Resources.config.os_x.advanced_nettest_error.png");
            }
            else
            {
                pctError.Pixbuf = Gdk.Pixbuf.LoadFromResource("RestrictionTrackerGTK.Resources.config.linux.advanced_nettest_error.png");
            }
            pnlError.Attach(pctError, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            lblError        = new Gtk.Label();
            lblError.Name   = "lblError";
            lblError.Xalign = 0F;
            lblError.Yalign = 0.5F;
            if (e.TargetSite == null)
            {
                lblError.LabelProp = "<span size=\"12000\" weight=\"bold\">" + modFunctions.ProductName + " has Encountered an Error</span>";
            }
            else
            {
                lblError.LabelProp = "<span size=\"12000\" weight=\"bold\">" + modFunctions.ProductName + " has Encountered an Error in " + e.TargetSite.Name + "</span>";
            }
            var signal = GLib.Signal.Lookup(lblError, "size-allocate", typeof(SizeAllocatedArgs));

            signal.AddDelegate(new EventHandler <SizeAllocatedArgs>(SizeAllocateLabel));
            lblError.LineWrap  = true;
            lblError.UseMarkup = true;
            pnlError.Attach(lblError, 1, 2, 0, 1, AttachOptions.Shrink | AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0);

            scrError                  = new Gtk.ScrolledWindow();
            scrError.Name             = "scrError";
            scrError.VscrollbarPolicy = PolicyType.Automatic;
            scrError.HscrollbarPolicy = PolicyType.Never;
            scrError.ShadowType       = ShadowType.In;

            txtError            = new Gtk.TextView();
            txtError.CanFocus   = true;
            txtError.Name       = "txtError";
            txtError.Editable   = false;
            txtError.AcceptsTab = false;
            txtError.WrapMode   = WrapMode.Word;

            scrError.Add(txtError);
            pnlError.Attach(scrError, 1, 2, 1, 2, AttachOptions.Shrink | AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink | AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            txtError.Buffer.Text = "Error: " + e.Message;
            if (!string.IsNullOrEmpty(e.StackTrace))
            {
                if (e.StackTrace.Contains("\n"))
                {
                    txtError.Buffer.Text += "\n" + e.StackTrace.Substring(0, e.StackTrace.IndexOf("\n"));
                }
                else
                {
                    txtError.Buffer.Text += "\n" + e.StackTrace;
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(e.Source))
                {
                    txtError.Buffer.Text += "\n @ " + e.Source;
                    if (e.TargetSite != null)
                    {
                        txtError.Buffer.Text += "." + e.TargetSite.Name;
                    }
                }
                else
                {
                    if (e.TargetSite != null)
                    {
                        txtError.Buffer.Text += "\n @ " + e.TargetSite.Name;
                    }
                }
            }

            cmdReport              = new Gtk.Button();
            cmdReport.CanDefault   = true;
            cmdReport.CanFocus     = true;
            cmdReport.Name         = "cmdReport";
            cmdReport.UseUnderline = false;
            cmdReport.Label        = "Report Error";

            if (canContinue)
            {
                cmdIgnore              = new Gtk.Button();
                cmdIgnore.CanDefault   = true;
                cmdIgnore.CanFocus     = true;
                cmdIgnore.Name         = "cmdIgnore";
                cmdIgnore.UseUnderline = false;
                cmdIgnore.Label        = "Ignore and Continue";
            }
            else
            {
                cmdIgnore = null;
            }

            cmdExit              = new global::Gtk.Button();
            cmdExit.CanFocus     = true;
            cmdExit.Name         = "cmdExit";
            cmdExit.UseUnderline = true;
            cmdExit.Label        = global::Mono.Unix.Catalog.GetString("Exit Application");

            Gtk.Dialog dlgErr = new Gtk.Dialog("Error in " + modFunctions.ProductName, null, DialogFlags.Modal | DialogFlags.DestroyWithParent, cmdReport);

            dlgErr.TypeHint        = Gdk.WindowTypeHint.Dialog;
            dlgErr.WindowPosition  = WindowPosition.CenterAlways;
            dlgErr.SkipPagerHint   = true;
            dlgErr.SkipTaskbarHint = true;
            dlgErr.AllowShrink     = true;
            dlgErr.AllowGrow       = true;

            VBox pnlErrorDialog = dlgErr.VBox;

            pnlErrorDialog.Name        = "pnlErrorDialog";
            pnlErrorDialog.BorderWidth = 2;
            pnlErrorDialog.Add(pnlError);

            Box.BoxChild pnlError_BC = (Box.BoxChild)pnlErrorDialog[pnlError];
            pnlError_BC.Position = 0;

            Gtk.HButtonBox dlgErrorAction = dlgErr.ActionArea;
            dlgErrorAction.Name        = "dlgErrorAction";
            dlgErrorAction.Spacing     = 10;
            dlgErrorAction.BorderWidth = 5;
            dlgErrorAction.LayoutStyle = ButtonBoxStyle.End;

            dlgErr.AddActionWidget(cmdReport, ResponseType.Ok);
            if (canContinue)
            {
                dlgErr.AddActionWidget(cmdIgnore, ResponseType.No);
            }
            dlgErr.AddActionWidget(cmdExit, ResponseType.Reject);

            dlgErr.ShowAll();
            Gdk.Geometry minGeo = new Gdk.Geometry();
            minGeo.MinWidth  = dlgErr.Allocation.Width;
            minGeo.MinHeight = dlgErr.Allocation.Height;
            if (minGeo.MinWidth > 1 & minGeo.MinHeight > 1)
            {
                dlgErr.SetGeometryHints(null, minGeo, Gdk.WindowHints.MinSize);
            }

            Gtk.ResponseType dRet;
            do
            {
                dRet = (Gtk.ResponseType)dlgErr.Run();
            } while (dRet == ResponseType.None);
            dlgErr.Hide();
            dlgErr.Destroy();
            dlgErr = null;
            return(dRet);
        }
Exemple #54
0
        public OutputConsole()
        {
            buffer                     = new Gtk.TextBuffer(new Gtk.TextTagTable());
            textEditorControl          = new Gtk.TextView(buffer);
            textEditorControl.Editable = true;

            sw = new ScrolledWindow();

            sw.ShadowType = ShadowType.Out;
            sw.Add(textEditorControl);

            this.PackStart(sw, true, true, 0);

            vbt = new VBox();

            Gdk.Pixbuf clear_pixbuf = MainClass.Tools.GetIconFromStock("file-new.png", IconSize.SmallToolbar);
            Button     btnClear     = new Button(new Gtk.Image(clear_pixbuf));

            btnClear.TooltipText  = MainClass.Languages.Translate("clear");
            btnClear.Relief       = ReliefStyle.None;
            btnClear.CanFocus     = false;
            btnClear.WidthRequest = btnClear.HeightRequest = 24;
            btnClear.Clicked     += delegate(object sender, EventArgs e) {
                Clear();
            };

            Gdk.Pixbuf save_pixbuf = MainClass.Tools.GetIconFromStock("save.png", IconSize.SmallToolbar);
            Button     btnSave     = new Button(new Gtk.Image(save_pixbuf));

            btnSave.TooltipText  = MainClass.Languages.Translate("save");
            btnSave.Relief       = ReliefStyle.None;
            btnSave.CanFocus     = false;
            btnSave.WidthRequest = btnSave.HeightRequest = 24;
            btnSave.Clicked     += delegate(object sender, EventArgs e) {
                Save();
            };

            vbt.WidthRequest = 24;
            vbt.PackStart(btnClear, false, false, 0);
            vbt.PackStart(btnSave, false, false, 0);

            this.PackEnd(vbt, false, false, 0);

            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add(bold);

            errorTag            = new TextTag("error");
            errorTag.Foreground = "red";
            buffer.TagTable.Add(errorTag);

            consoleLogTag            = new TextTag("consoleLog");
            consoleLogTag.Foreground = "darkgrey";
            buffer.TagTable.Add(consoleLogTag);

            tag            = new TextTag("0");
            tag.LeftMargin = 10;
            buffer.TagTable.Add(tag);
            tags.Add(tag);

            endMark = buffer.CreateMark("end-mark", buffer.EndIter, false);

            outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);

            customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
            textEditorControl.ModifyFont(customFont);

            textEditorControl.KeyPressEvent += HandleTextEditorControlKeyPressEvent;
            this.ShowAll();
        }
Exemple #55
0
        public DemoMain()
        {
            window = new Gtk.Window("TestForm1");
            Gtk.HBox hbox = new Gtk.HBox(false, 0);
            hbox1 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox2 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox3 = new Gtk.HBox(false, 0);
            hbox.Add(hbox1);
            window.SetDefaultSize(600, 400);
            window.DeleteEvent += new DeleteEventHandler(WindowDelete);

            button1          = new Gtk.Button("button1");
            button1.Clicked += Button1Clicked;
            button2          = new Gtk.Button("button2");
            button3          = new Gtk.Button("button3");
            Gtk.Button button4 = new Gtk.Button("button4");
            button4.Clicked += Button4Clicked;
            Gtk.Button button5 = new Gtk.Button("button5");
            Gtk.Button button6 = new Gtk.Button("button6");
            Gtk.Button button7 = new Gtk.Button("button7");
            button7.Sensitive = false;

            scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]);

            hbox1.Add(hbox3);
            hbox1.Add(hbox2);
            hbox1.Add(button3);
            hbox1.Add(button2);

            button3.Accessible.Description = "help text 3";
            button3.Sensitive = false;

            label1 = new Gtk.Label("label1");

            textBox1 = new Gtk.Entry();
            Gtk.Entry textBox2 = new Gtk.Entry();
            textBox2.Visibility = false;
            textBox2.Sensitive  = false;
            textBox2.IsEditable = false;
            textBox3            = new Gtk.TextView();
            // TODO: scrollbars
            Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1");
            Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2");
            checkbox2.Sensitive = false;

            Gtk.TreeStore   store = new Gtk.TreeStore(typeof(string), typeof(string));
            Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 1", "item 1 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 1a", "item 1a (2)");
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 2", "item 2 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2a", "item 2a (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2b", "item 2b (2)");
            treeView1 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView1, 0, "column 1");
            treeView1.CollapseAll();

            treeView2 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView2, 0, "column 1");
            AddTreeViewColumn(treeView2, 1, "column 2");
            treeView2.CollapseAll();
            treeView2.Accessible.Name = "treeView2";

            tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
            iters [0]  = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "False", "Alice", "24", "");
            iters [0] = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "True", "Bob", "28", "");
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            AddTreeViewColumn(dataGridView1, 0, "Gender");
            AddTreeViewColumn(dataGridView1, 1, "Name");
            AddTreeViewColumn(dataGridView1, 2, "Age");
            dataGridView1.Accessible.Name = "dataGridView1";

            hboxPanel = new Gtk.HBox();
            Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove");
            btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
            Gtk.Button btnAddTextBox = new Gtk.Button("Add");
            btnAddTextBox.Clicked     += AddTextBoxClicked;
            txtCommand                 = new Gtk.Entry();
            txtCommand.Accessible.Name = "txtCommand";
            Gtk.Button btnRun = new Gtk.Button("Run");
            btnRun.Clicked += btnRunClicked;
            hboxPanel.Add(btnRemoveTextBox);
            hboxPanel.Add(btnAddTextBox);

            Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string));
            Gtk.TreeIter  iter      = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 0");
            iter = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 1");
            listView1 = new Gtk.TreeView(treeStore);
            AddTreeViewColumn(listView1, 0, "items");
            listView1.Accessible.Name = "listView1";
            listView1.ExpandAll();

            hbox2.Add(button5);
            hbox2.Add(checkbox1);
            hbox2.Add(checkbox2);
            hbox2.Add(button4);
            hbox2.Accessible.Name = "groupBox2";

            hbox3.Add(button7);
            hbox3.Add(button6);
            hbox3.Sensitive       = false;
            hbox3.Accessible.Name = "groupBox3";

            hbox.Add(textBox3);
            hbox.Add(textBox2);
            hbox.Add(textBox1);
            hbox.Add(label1);
            hbox.Add(button1);
            hbox.Add(treeView1);
            hbox.Add(treeView2);
            hbox.Add(listView1);
            hbox.Add(dataGridView1);
            hbox.Add(txtCommand);
            hbox.Add(btnRun);
            hbox.Add(hboxPanel);
            hbox.Add(scaleButton1);

            Gtk.Menu file = new Gtk.Menu();
            file.Append(new Gtk.MenuItem("_New"));
            file.Append(new Gtk.MenuItem("_Open"));
            file.Append(new Gtk.CheckMenuItem("Check"));
            Gtk.MenuItem fileItem = new Gtk.MenuItem("File");
            fileItem.Submenu = file;
            Gtk.Menu edit = new Gtk.Menu();
            edit.Append(new Gtk.MenuItem("_Undo"));
            edit.Append(new Gtk.SeparatorMenuItem());
            edit.Append(new Gtk.MenuItem("_Cut"));
            edit.Append(new Gtk.MenuItem("Copy"));
            edit.Append(new Gtk.MenuItem("_Paste"));
            Gtk.MenuItem editItem = new Gtk.MenuItem("Edit");
            editItem.Submenu = edit;
            Gtk.MenuBar menuBar = new Gtk.MenuBar();
            menuBar.Append(fileItem);
            menuBar.Append(editItem);
            hbox.Add(menuBar);

            hbox.Add(new Gtk.SpinButton(0, 100, 1));
            hbox.Add(new Gtk.ToggleButton("ToggleButton"));
            Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100,
                                                    1, 10, 10);
            hbox.Add(new Gtk.VScrollbar(adj));

            window.Add(hbox);
            window.ShowAll();
        }
Exemple #56
0
        private Gtk.VBox GenerateResults()

        {
            VBox box = new VBox();

            Gdk.Color white = new Gdk.Color(255, 255, 255);

            Gdk.Color black = new Gdk.Color(0, 0, 0);

            Gdk.Color blue = new Gdk.Color(0, 0, 255);



            // Match Colors

            btnMatchForeColor = new ColorButton(blue);

            btnMatchBackColor = new ColorButton(white);

            btnMatchForeColor.ColorSet += new EventHandler(btnMatchForeColor_ColorSet);

            btnMatchBackColor.ColorSet += new EventHandler(btnMatchBackColor_ColorSet);



            Frame matchFrame = new Frame("Results Match");

            matchFrame.BorderWidth = 5;

            HBox frameBox = new HBox();

            frameBox.BorderWidth = 5;



            HBox foreBox = new HBox(false, 3);

            btnMatchForeColor.WidthRequest = 100;

            foreBox.PackStart(new Label("Fore Color"), false, false, 3);

            foreBox.PackStart(btnMatchForeColor, false, true, 3);



            HBox backBox = new HBox(false, 3);

            btnMatchBackColor.WidthRequest = 100;

            backBox.PackStart(new Label("Back Color"), false, false, 3);

            backBox.PackStart(btnMatchBackColor, false, true, 3);



            frameBox.PackStart(foreBox, true, true, 5);

            frameBox.PackStart(backBox, true, true, 5);

            matchFrame.Add(frameBox);



            // Window Colors

            btnResultsForeColor = new ColorButton(black);

            btnResultsBackColor = new ColorButton(white);

            btnResultsForeColor.ColorSet += new EventHandler(btnResultsForeColor_ColorSet);

            btnResultsBackColor.ColorSet += new EventHandler(btnResultsBackColor_ColorSet);



            Frame resultsFrame = new Frame("Results Window");

            resultsFrame.BorderWidth = 5;

            frameBox = new HBox();

            frameBox.BorderWidth = 5;



            foreBox = new HBox(false, 3);

            btnResultsForeColor.WidthRequest = 100;

            foreBox.PackStart(new Label("Fore Color"), false, false, 3);

            foreBox.PackStart(btnResultsForeColor, false, true, 3);



            backBox = new HBox(false, 3);

            btnResultsBackColor.WidthRequest = 100;

            backBox.PackStart(new Label("Back Color"), false, false, 3);

            backBox.PackStart(btnResultsBackColor, false, true, 3);



            frameBox.PackStart(foreBox, true, true, 5);

            frameBox.PackStart(backBox, true, true, 5);

            resultsFrame.Add(frameBox);



            // Results display

            Frame results = new Frame("Results Preview");

            results.BorderWidth = 5;

            Frame ScrolledWindowFrm = new Gtk.Frame();

            ScrolledWindowFrm.Shadow = ShadowType.In;

            ScrolledWindowFrm.BorderWidth = 5;

            txtResults = new TextView();

            txtResults.Buffer.Text = "(21)  Example results line and, match, displayed";
            txtResults.Editable    = false;

            ScrolledWindowFrm.HeightRequest = 50;

            ScrolledWindowFrm.Add(txtResults);

            results.Add(ScrolledWindowFrm);



            box.PackStart(matchFrame, false, true, 3);

            box.PackStart(resultsFrame, false, true, 3);

            box.PackEnd(results, false, true, 3);

            return(box);
        }
Exemple #57
0
		public TaskOptionsDialog(Gtk.Window parent,
		                         Gtk.DialogFlags flags,
		                         Task task)
: base (Catalog.GetString ("Task Options"), parent, flags)
		{
			HasSeparator = false;
			//BorderWidth = 0;
			Resizable = false;
			//Decorated = false;
			this.SetDefaultSize (400, 300);
			this.task = task;

//   Frame frame = new Frame();
//   frame.Shadow = ShadowType.Out;
//   frame.Show();
//   VBox.PackStart (frame, true, true, 0);

			VBox vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;
			vbox.Show ();
			VBox.PackStart (vbox, true, true, 0);
//   frame.Add (vbox);

			ActionArea.Layout = Gtk.ButtonBoxStyle.End;

			accel_group = new Gtk.AccelGroup ();
			AddAccelGroup (accel_group);

//   Gtk.Label l = new Gtk.Label (
//     string.Format (
//      "<span weight=\"bold\">{0}</span>",
//      Catalog.GetString ("Task Options")));
//   l.UseMarkup = true;
//   l.Show ();
//   vbox.PackStart (l, false, false, 0);

			///
			/// Summary
			///
			Gtk.Label l = new Label (Catalog.GetString ("_Summary:"));
			l.Xalign = 0;
			l.Show ();
			vbox.PackStart (l, false, false, 0);

			summary_entry = new Gtk.Entry ();
			l.MnemonicWidget = summary_entry;
			summary_entry.Text = task.Summary;
			summary_entry.Show ();
			vbox.PackStart (summary_entry, false, false, 0);

			///
			/// Details
			///
			l = new Label (Catalog.GetString ("_Details:"));
			l.Xalign = 0;
			l.Show ();
			vbox.PackStart (l, false, false, 0);

			details_text_view = new TextView ();
			l.MnemonicWidget = details_text_view;
			details_text_view.WrapMode = WrapMode.Word;
			details_text_view.Show ();

			ScrolledWindow sw = new ScrolledWindow ();
			sw.ShadowType = Gtk.ShadowType.EtchedIn;
			sw.Add (details_text_view);
			sw.Show ();

			vbox.PackStart (sw, true, true, 0);

			///
			/// Completion Checkbox
			///
			HBox hbox = new Gtk.HBox (false, 4);

			completed_check_button = new Gtk.CheckButton (
			        task.IsComplete ?
			        Catalog.GetString ("_Completed:") :
			        Catalog.GetString ("_Complete"));
			if (task.IsComplete)
				completed_check_button.Active = true;
			completed_check_button.UseUnderline = true;
			completed_check_button.Toggled += OnCompletedCheckButtonToggled;
			completed_check_button.Show ();
			hbox.PackStart (completed_check_button, false, false, 0);

			completed_label = new Gtk.Label (
			        task.IsComplete ?
			        GuiUtils.GetPrettyPrintDate (task.CompletionDate, true) :
			        string.Empty);
			completed_label.Xalign = 0;
			completed_label.Show ();
			hbox.PackStart (completed_label, true, true, 0);

			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			///
			/// Due Date
			///
			hbox = new HBox (false, 4);
			due_date_check_button = new CheckButton (Catalog.GetString ("Due Date:"));
			if (task.DueDate != DateTime.MinValue)
				due_date_check_button.Active = true;
			due_date_check_button.Toggled += OnDueDateCheckButtonToggled;
			due_date_check_button.Show ();
			hbox.PackStart (due_date_check_button, false, false, 0);

			due_date_button =
			        new Gtk.Extras.DateButton (task.DueDate, false);
			if (task.DueDate == DateTime.MinValue)
				due_date_button.Sensitive = false;
			due_date_button.Show ();
			hbox.PackStart (due_date_button, false, false, 0);

			// Spacer
			hbox.PackStart (new Gtk.Label (string.Empty), true, true, 0);

			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			///
			/// Priority
			///
			hbox = new HBox (false, 4);
			priority_check_button = new CheckButton (Catalog.GetString ("Priority:"));
			if (task.Priority != TaskPriority.Undefined)
				priority_check_button.Active = true;
			priority_check_button.Toggled += OnPriorityCheckButtonToggled;
			priority_check_button.Show ();
			hbox.PackStart (priority_check_button, false, false, 0);

			priority_combo_box = ComboBox.NewText ();
			priority_combo_box.AppendText (Catalog.GetString ("None"));
			priority_combo_box.AppendText (Catalog.GetString ("Low"));
			priority_combo_box.AppendText (Catalog.GetString ("Normal"));
			priority_combo_box.AppendText (Catalog.GetString ("High"));
			if (task.Priority == TaskPriority.Undefined)
				priority_combo_box.Sensitive = false;
			priority_combo_box.Active = (int) task.Priority;
			priority_combo_box.Changed += OnPriorityComboBoxChanged;
			priority_combo_box.Show ();
			hbox.PackStart (priority_combo_box, false, false, 0);

			// Spacer
			hbox.PackStart (new Gtk.Label (string.Empty), true, true, 0);
			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
			AddButton (Gtk.Stock.Save, Gtk.ResponseType.Ok, true);

//   if (parent != null)
//    TransientFor = parent;

//   if ((int) (flags & Gtk.DialogFlags.Modal) != 0)
//    Modal = true;

//   if ((int) (flags & Gtk.DialogFlags.DestroyWithParent) != 0)
//    DestroyWithParent = true;
		}
Exemple #58
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();


        MainNotebook = new Notebook();
        dg           = DieGenerator.getDieGenerator();
        //MainNotebook.AppendPage(new Button("Meowth"), new Label("Meowth"));
        MainNotebook.AppendPage(new Table(3, 3, false), new Label("Character Table"));
        MainNotebook.ShowAll();


        dieTypeComboBox = new ComboBox(new string[] {
            "d4",
            "d6",
            "d8",
            "d10",
            "d12",
            "d20",
            "d100"
        });
        numberofdieTextBox = new Entry();


        VBox vertDieFormula = new VBox(false, 2);

        vertDieFormula.PackStart(new Label("Number of Die"), false, false, 3);
        vertDieFormula.PackStart(numberofdieTextBox, false, false, 1);
        vertDieFormula.PackStart(new Label("Die Type"), false, false, 3);
        vertDieFormula.PackStart(dieTypeComboBox, false, false, 1);
        //vertDieFormula.PackStart(new Entry(), false, false, 1);

        Button rolldieButton = new Button("Roll");

        rolldieButton.Clicked += callback;

        ScrolledWindow sw = new ScrolledWindow();

        dieRollTextBox             = new Gtk.TextView();
        dieRollTextBox.Editable    = false;
        dieRollTextBox.BorderWidth = 3;
        dieRollTextBox.WrapMode    = WrapMode.Word;
        sw.Add(dieRollTextBox);

        MainTable = new Table(5, 3, true);
        MainTable.ColumnSpacing = 20;
        MainTable.RowSpacing    = 10;
        MainTable.BorderWidth   = 10;
        MainTable.Attach(MainNotebook, 0, 3, 0, 4);
        MainTable.Attach(vertDieFormula, 0, 1, 4, 5);
        MainTable.Attach(rolldieButton, 1, 2, 4, 5);
        MainTable.Attach(sw, 2, 3, 4, 5);

        MainTable.ShowAll();
        this.Add(MainTable);

        this.DeleteEvent += delegate(object o, DeleteEventArgs args)
        {
            MessageDialog md = new MessageDialog(this, DialogFlags.Modal,
                                                 MessageType.Question, ButtonsType.YesNo,
                                                 "Are you sure you would like to exit?");
            int toDestroy = md.Run();

            if (toDestroy == (int)ResponseType.Yes)
            {
                Console.WriteLine("THIS SHOULD RUN");
                Application.Quit();
            }
            else
            {
                args.RetVal = true;
                md.Destroy();
            }
        };
    }
Exemple #59
0
 public Status(Gtk.TextView StatusText, TextBuffer StatusTextBuffer)
 {
     stv = StatusText;
     stb = StatusTextBuffer;
 }
    private void processScrollEvent(ConvertMode convertMode, Boolean isSend)
    {
//				String textviewString = null;
        Gtk.ScrolledWindow    scrolledWindow = null;
        Gtk.TextView          textView       = null;
        ScrolledTextViewMover mover          = null;

//				int offset = 0;
        if (isSend)
        {
            switch (convertMode)
            {
            case ConvertMode.Text:
                scrolledWindow = GtkScrolledWindowTextS;
                textView       = textviewTextS;
                mover          = moverTextS;
                break;

            case ConvertMode.Hex:
                scrolledWindow = GtkScrolledWindowHexS;
                textView       = textviewHexS;
                mover          = moverHexS;
                break;

            case ConvertMode.Dec:
                scrolledWindow = GtkScrolledWindowDecS;
                textView       = textviewDecS;
                mover          = moverDecS;
                break;
            }
        }
        else
        {
            switch (convertMode)
            {
            case ConvertMode.Text:
                scrolledWindow = GtkScrolledWindowText;
                textView       = textviewText;
//								offset = textviewTextOffset;
//								textviewString = textviewTextString;
                mover = moverText;
                break;

            case ConvertMode.Hex:
                scrolledWindow = GtkScrolledWindowHex;
                textView       = textviewHex;
//								offset = textviewHexOffset;
//								textviewString = textviewHexString;
                mover = moverHex;
                break;

            case ConvertMode.Dec:
                scrolledWindow = GtkScrolledWindowDec;
                textView       = textviewDec;
//								offset = textviewDecOffset;
//								textviewString = textviewDecString;
                mover = moverDec;
                break;
            }
        }
        double vadjustmentLower    = scrolledWindow.Vadjustment.Lower;
        double vadjustmentUpper    = scrolledWindow.Vadjustment.Upper;
        double vadjustmentValue    = scrolledWindow.Vadjustment.Value;
        double vadjustmentPageSize = scrolledWindow.Vadjustment.PageSize;
        double vadjustmentPosition = (vadjustmentValue - vadjustmentLower) / (vadjustmentUpper - vadjustmentPageSize - vadjustmentLower);
        //Console.WriteLine ("VADJ:" + vadjustmentPosition);

//				if (textviewString.Length < 3 * textViewDataBytesMaxCount) {
//						int forwardBytes = textviewString.Length - offset;
//						if (forwardBytes > 0) {
//								TextIter iter = textView.Buffer.EndIter;
//								textView.Buffer.Insert (ref iter, textviewString.Substring (offset, forwardBytes));
//								offset += forwardBytes;
//								//						if (textviewText.Buffer.CharCount > 2 * textViewDataBytesMaxCount) {
//								//								TextIter iterStart = textviewText.Buffer.StartIter;
//								//								TextIter iterEnd = textviewText.Buffer.StartIter;
//								//								if (iterEnd.ForwardChars (textviewText.Buffer.CharCount - textViewDataBytesMaxCount)) {
//								//										textviewText.Buffer.Delete (ref iterStart, ref iterEnd);
//								//										textviewTextOffset += textviewText.Buffer.CharCount - textViewDataBytesMaxCount;
//								//								}
//								//						}
//						}
//
//				} else {
//						if (vadjustmentPosition > 0.9) {
//								Console.WriteLine ("Count:" + textView.Buffer.CharCount.ToString ());
//								int forwardBytes = textviewString.Length - offset;
//								if (forwardBytes > textViewDataBytesMaxCount) {
//										forwardBytes = textViewDataBytesMaxCount;
//								}
//								if (forwardBytes > 0) {
//										TextIter iter = textView.Buffer.EndIter;
//										textView.Buffer.Insert (ref iter, textviewString.Substring (offset, forwardBytes));
//										offset += forwardBytes;
//										int deleteBytes = textView.Buffer.CharCount - 3 * textViewDataBytesMaxCount;
//
//										if (deleteBytes > 0) {
//												Console.WriteLine ("Delete:" + deleteBytes.ToString ());
//												TextIter iterStart = textView.Buffer.StartIter;
//												TextIter iterEnd = textView.Buffer.StartIter;
//												if (iterEnd.ForwardChars (deleteBytes)) {
//														textView.Buffer.Delete (ref iterStart, ref iterEnd);
//												}
//										}
//								}
//						}
//						if (vadjustmentPosition < 0.1) {
//								Console.WriteLine ("Delete:" + textView.Buffer.CharCount.ToString ());
//								if (offset >= textViewDataBytesMaxCount * 3) {
//										int offsetEnd = offset - textViewDataBytesMaxCount * 3;
//										int offsetStart = offsetEnd - textViewDataBytesMaxCount;
//										if (offsetStart < 0) {
//												offsetStart = 0;
//										}
//										int backwardBytes = offsetEnd - offsetStart;
//										if (backwardBytes > 0) {
//												TextIter iter = textView.Buffer.StartIter;
//												textView.Buffer.Insert (ref iter, textviewString.Substring (offsetStart, backwardBytes));
//												offset -= backwardBytes;
//										}
//								}
//						}
//				}
//				if (isSend) {
//						switch (convertMode) {
//						case ConvertMode.Text:
//								break;
//						case ConvertMode.Hex:
//								break;
//						case ConvertMode.Dec:
//								break;
//						}
//				} else {
//						switch (convertMode) {
//						case ConvertMode.Text:
//								break;
//						case ConvertMode.Hex:
//								//textviewHexOffset = offset;
//								break;
//						case ConvertMode.Dec:
//								//textviewDecOffset = offset;
//								break;
//						}
//				}
        bool isAutoScroll = false;

        if (isSend)
        {
            isAutoScroll = checkbuttonAutoScrollSend.Active;
        }
        else
        {
            isAutoScroll = checkbuttonAutoScrollReceive.Active;
        }
        if (isAutoScroll)
        {
            if (scrolledWindow.VScrollbar.Visible == false || vadjustmentPosition > 0.98)
            {
                if (mover != null)
                {
                    mover.StepSize = mover.WindowSize / 10;
                    mover.MoveDown();
                    TextIter iter = textView.Buffer.EndIter;
                    textView.Buffer.CreateMark("EndMark", iter, false);
                    textView.ScrollToMark(textView.Buffer.CreateMark("EndMark", iter, false), 0, false, 0, 0);
                    textView.Buffer.DeleteMark("EndMark");
                }
            }
            else
            if (vadjustmentPosition < 0.02)
            {
                if (mover != null)
                {
                    mover.StepSize = mover.WindowSize / 10;
                    mover.MoveUp();
                    TextIter iter = textView.Buffer.StartIter;
                    textView.Buffer.CreateMark("StartMark", iter, false);
                    textView.ScrollToMark(textView.Buffer.CreateMark("StartMark", iter, false), 0, false, 0, 0);
                    textView.Buffer.DeleteMark("StartMark");
                }
            }
            else
            if (vadjustmentPosition > 0.7)
            {
                if (mover != null)
                {
                    mover.StepSize = mover.WindowSize / 100;
                    mover.MoveDown();
                    TextIter iter = textView.Buffer.EndIter;
                }
            }
            else
            if (vadjustmentPosition < 0.3)
            {
                if (mover != null)
                {
                    mover.StepSize = mover.WindowSize / 100;
                    mover.MoveUp();
                    TextIter iter = textView.Buffer.StartIter;
                }
            }
            else
            if (vadjustmentPosition > 0.55)
            {
                if (mover != null)
                {
                    mover.StepSize = mover.WindowSize / 300;
                    mover.MoveDown();
                    TextIter iter = textView.Buffer.EndIter;
                }
            }
            else
            if (vadjustmentPosition < 0.45)
            {
                if (mover != null)
                {
                    mover.StepSize = mover.WindowSize / 300;
                    mover.MoveUp();
                    TextIter iter = textView.Buffer.StartIter;
                }
            }
        }
        else
        {
            if (vadjustmentPosition > 0.9)
            {
                if (mover != null)
                {
                    mover.StepSize = mover.WindowSize / 100;
                    mover.MoveDown();
                }
            }
            else
            if (vadjustmentPosition < 0.1)
            {
                if (mover != null)
                {
                    mover.StepSize = mover.WindowSize / 100;
                    mover.MoveUp();
                }
            }
        }
    }