public override void Initialize(IPadWindow window) { base.Initialize(window); // Call ctors inputEditor = new TextEditor() { Name = "input", Events = Gdk.EventMask.AllEventsMask, HeightRequest = 80 }; editor = new TextEditor() { Name = "output", Events = Gdk.EventMask.AllEventsMask }; vpaned = new Gtk.VPaned(); var scr1 = new Gtk.ScrolledWindow(); var scr2 = new Gtk.ScrolledWindow(); // Init layout scr1.ShadowType = Gtk.ShadowType.In; scr1.Child = inputEditor; vpaned.Add1(scr1); scr1.ShowAll(); inputEditor.ShowAll(); scr2.ShadowType = Gtk.ShadowType.In; scr2.Child = editor; vpaned.Add2(scr2); scr2.ShowAll(); editor.ShowAll(); vpaned.ShowAll(); // Init editors var o = editor.Options; inputEditor.Options = o; o.ShowLineNumberMargin = false; o.ShowFoldMargin = false; o.ShowIconMargin = false; editor.Document.ReadOnly = true; inputEditor.Text = PropertyService.Get(lastInputStringPropId, string.Empty); editor.Text = string.Empty; editor.Document.SyntaxMode = new Highlighting.DSyntaxMode(); inputEditor.Document.SyntaxMode = new Highlighting.DSyntaxMode(); editor.Document.MimeType = Formatting.DCodeFormatter.MimeType; inputEditor.Document.MimeType = Formatting.DCodeFormatter.MimeType; // Init toolbar var tb = window.GetToolbar(Gtk.PositionType.Top); executeButton = new Gtk.Button(); executeButton.Image = new Gtk.Image(Gtk.Stock.Execute, Gtk.IconSize.Menu); executeButton.TooltipText = "Evaluates the expression typed in the upper input editor."; executeButton.Clicked += Execute; tb.Add(executeButton); abortButton = new Gtk.Button(); abortButton.Sensitive = false; abortButton.Image = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu); abortButton.TooltipText = "Stops the evaluation."; abortButton.Clicked += (object sender, EventArgs e) => AbortExecution(); tb.Add(abortButton); tb.ShowAll(); }
public override void Initialize(IPadWindow pad) { base.Initialize(pad); // Init editor outputEditor = new TextEditor(); outputEditor.Events = Gdk.EventMask.AllEventsMask; outputEditor.Name = "outputEditor"; outputEditor.TabsToSpaces = false; scrolledWindow = new Gtk.ScrolledWindow(); scrolledWindow.Child = outputEditor; scrolledWindow.ShadowType = Gtk.ShadowType.In; scrolledWindow.ShowAll(); outputEditor.ShowAll(); var o = outputEditor.Options; outputEditor.Document.MimeType = Formatting.DCodeFormatter.MimeType; o.ShowLineNumberMargin = false; o.ShowFoldMargin = false; o.ShowIconMargin = false; outputEditor.Document.ReadOnly = true; // Init toolbar var tb = pad.GetToolbar(Gtk.PositionType.Top); var ch = new Gtk.ToggleButton(); ch.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu); ch.Active = EnableCaretTracking; ch.TooltipText = "Toggle automatic update after the caret has been moved."; ch.Toggled += (object s, EventArgs ea) => EnableCaretTracking = ch.Active; tb.Add(ch); abortButton = new Gtk.Button(); abortButton.Sensitive = false; abortButton.Image = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu); abortButton.TooltipText = "Stops the evaluation."; abortButton.Clicked += (object sender, EventArgs e) => AbortExecution(); tb.Add(abortButton); tb.ShowAll(); Instance = this; }