protected override void CreateComponents() { var options = GetTextEditorOptions(); this.editors = new [] { new MonoTextEditor(new TextDocument(), options), new MonoTextEditor(new TextDocument(), options), }; if (!viewOnly) { originalComboBox = new DropDownBox(); originalComboBox.WindowRequestFunc = CreateComboBoxSelector; originalComboBox.Text = GettextCatalog.GetString("Loading…"); originalComboBox.Sensitive = false; originalComboBox.Tag = editors[1]; diffComboBox = new DropDownBox(); diffComboBox.WindowRequestFunc = CreateComboBoxSelector; diffComboBox.Text = GettextCatalog.GetString("Loading…"); diffComboBox.Sensitive = false; diffComboBox.Tag = editors[0]; this.headerWidgets = new [] { diffComboBox, originalComboBox }; } }
protected override void CreateComponents() { this.editors = new [] { new MonoTextEditor(new TextDocument(), CommonTextEditorOptions.Instance), new MonoTextEditor(new TextDocument(), CommonTextEditorOptions.Instance), }; if (!viewOnly) { originalComboBox = new DropDownBox(); originalComboBox.WindowRequestFunc = CreateComboBoxSelector; originalComboBox.Text = "Local"; originalComboBox.Tag = editors[1]; diffComboBox = new DropDownBox(); diffComboBox.WindowRequestFunc = CreateComboBoxSelector; diffComboBox.Text = "Base"; diffComboBox.Tag = editors[0]; this.headerWidgets = new [] { diffComboBox, originalComboBox }; } }
protected override void CreateComponents() { this.editors = new [] { new TextEditor(), new TextEditor() }; DiffEditor.Document.ReadOnly = true; if (viewOnly) { OriginalEditor.Document.ReadOnly = true; } else { originalComboBox = new DropDownBox(); originalComboBox.WindowRequestFunc = CreateComboBoxSelector; originalComboBox.Text = "Local"; originalComboBox.Tag = editors[1]; diffComboBox = new DropDownBox(); diffComboBox.WindowRequestFunc = CreateComboBoxSelector; diffComboBox.Text = "Base"; diffComboBox.Tag = editors[0]; this.headerWidgets = new [] { diffComboBox, originalComboBox }; } }
Gtk.Window CreateComboBoxSelector(DropDownBox box) { DropDownBoxListWindow window = new DropDownBoxListWindow(new ComboBoxSelector(this, box)); return(window); }
public ComboBoxSelector(ComparisonWidget widget, DropDownBox box) { this.widget = widget; this.box = box; }
public ComparisonWidget(VersionControlDocumentInfo info) { vAdjustment = new Adjustment(0, 0, 0, 0, 0, 0); vAdjustment.Changed += HandleAdjustmentChanged; vScrollBar = new VScrollbar(vAdjustment); AddChild(vScrollBar); vScrollBar.Hide(); hAdjustment = new Adjustment(0, 0, 0, 0, 0, 0); hAdjustment.Changed += HandleAdjustmentChanged; leftHScrollBar = new HScrollbar(hAdjustment); AddChild(leftHScrollBar); rightHScrollBar = new HScrollbar(hAdjustment); AddChild(rightHScrollBar); originalComboBox = new DropDownBox(); originalComboBox.Text = "Local"; AddChild(originalComboBox); originalEditor = new TextEditor(); AddChild(originalEditor); originalEditor.SetScrollAdjustments(hAdjustment, vAdjustment); diffComboBox = new DropDownBox(); diffComboBox.Text = "Base"; AddChild(diffComboBox); diffEditor = new TextEditor(); AddChild(diffEditor); diffEditor.Document.ReadOnly = true; diffEditor.SetScrollAdjustments(hAdjustment, vAdjustment); this.vAdjustment.ValueChanged += delegate { middleArea.QueueDraw(); }; overview = new OverviewRenderer(this); AddChild(overview); middleArea = new MiddleArea(this); AddChild(middleArea); prev = new Button(); prev.Add(new Arrow(ArrowType.Up, ShadowType.None)); AddChild(prev); prev.ShowAll(); prev.Clicked += delegate { if (this.Diff == null) { return; } originalEditor.GrabFocus(); int line = originalEditor.Caret.Line; int max = -1, searched = -1; foreach (Diff.Hunk hunk in this.Diff) { if (hunk.Same) { continue; } max = System.Math.Max(hunk.Left.Start, max); if (hunk.Left.Start < line) { searched = System.Math.Max(hunk.Left.Start, searched); } } if (max >= 0) { originalEditor.Caret.Line = searched < 0 ? max : searched; originalEditor.CenterToCaret(); } }; next = new Button(); next.BorderWidth = 0; next.Add(new Arrow(ArrowType.Down, ShadowType.None)); next.Clicked += delegate { if (this.Diff == null) { return; } originalEditor.GrabFocus(); int line = originalEditor.Caret.Line; int min = Int32.MaxValue, searched = Int32.MaxValue; foreach (Diff.Hunk hunk in this.Diff) { if (hunk.Same) { continue; } min = System.Math.Min(hunk.Left.Start, min); if (hunk.Left.Start > line) { searched = System.Math.Min(hunk.Left.Start, searched); } } if (min < Int32.MaxValue) { originalEditor.Caret.Line = searched == Int32.MaxValue ? min : searched; originalEditor.CenterToCaret(); } }; AddChild(next); next.ShowAll(); this.DoubleBuffered = true; originalEditor.ExposeEvent += HandleLeftEditorExposeEvent; diffEditor.ExposeEvent += HandleRightEditorExposeEvent; }