public void SetHeaderContent (IWidgetBackend backend) { if (toolbar.Child != null) { WidgetBackend.RemoveChildPlacement (toolbar.Child); toolbar.Remove (toolbar.Child); } if (backend != null) { toolbar.Child = WidgetBackend.GetWidgetWithPlacement (backend); toolbar.Show (); } else { toolbar.Hide (); } }
public LogWidget(VersionControlDocumentInfo info) { this.Build(); this.info = info; if (info.Document != null) { this.preselectFile = info.Item.Path; } var separator = new HeaderBox(); separator.SetMargins(1, 0, 0, 0); separator.HeightRequest = 4; separator.ShowAll(); hpaned1 = hpaned1.ReplaceWithWidget(new HPanedThin(), true); vpaned1 = vpaned1.ReplaceWithWidget(new VPanedThin() { HandleWidget = separator }, true); revertButton = new DocumentToolButton("vc-revert-command", GettextCatalog.GetString("Revert changes from this revision")); // revertButton.Sensitive = false; revertButton.Clicked += new EventHandler(RevertRevisionClicked); revertToButton = new DocumentToolButton("vc-revert-command", GettextCatalog.GetString("Revert to this revision")); // revertToButton.Sensitive = false; revertToButton.Clicked += new EventHandler(RevertToRevisionClicked); searchEntry = new SearchEntry(); searchEntry.WidthRequest = 200; searchEntry.ForceFilterButtonVisible = true; searchEntry.EmptyMessage = GettextCatalog.GetString("Search"); searchEntry.Changed += HandleSearchEntryFilterChanged; searchEntry.Ready = true; searchEntry.Show(); messageRenderer.Ellipsize = Pango.EllipsizeMode.End; TreeViewColumn colRevMessage = new TreeViewColumn(); colRevMessage.Title = GettextCatalog.GetString("Message"); var graphRenderer = new RevisionGraphCellRenderer(); colRevMessage.PackStart(graphRenderer, false); colRevMessage.SetCellDataFunc(graphRenderer, GraphFunc); colRevMessage.PackStart(messageRenderer, true); colRevMessage.SetCellDataFunc(messageRenderer, MessageFunc); colRevMessage.Sizing = TreeViewColumnSizing.Autosize; treeviewLog.AppendColumn(colRevMessage); colRevMessage.MinWidth = 350; colRevMessage.Resizable = true; TreeViewColumn colRevDate = new TreeViewColumn(GettextCatalog.GetString("Date"), textRenderer); colRevDate.SetCellDataFunc(textRenderer, DateFunc); colRevDate.Resizable = true; treeviewLog.AppendColumn(colRevDate); TreeViewColumn colRevAuthor = new TreeViewColumn(); colRevAuthor.Title = GettextCatalog.GetString("Author"); colRevAuthor.PackStart(pixRenderer, false); colRevAuthor.PackStart(textRenderer, true); colRevAuthor.SetCellDataFunc(textRenderer, AuthorFunc); colRevAuthor.SetCellDataFunc(pixRenderer, AuthorIconFunc); colRevAuthor.Resizable = true; treeviewLog.AppendColumn(colRevAuthor); TreeViewColumn colRevNum = new TreeViewColumn(GettextCatalog.GetString("Revision"), textRenderer); colRevNum.SetCellDataFunc(textRenderer, RevisionFunc); colRevNum.Resizable = true; treeviewLog.AppendColumn(colRevNum); treeviewLog.Model = logstore; treeviewLog.Selection.Changed += TreeSelectionChanged; treeviewFiles = new FileTreeView(); treeviewFiles.DiffLineActivated += HandleTreeviewFilesDiffLineActivated; scrolledwindowFiles.Child = treeviewFiles; scrolledwindowFiles.ShowAll(); changedpathstore = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), // icon/file name typeof(Gdk.Pixbuf), typeof(string), // icon/operation typeof(string), // path typeof(string), // revision path (invisible) typeof(string[]) // diff ); TreeViewColumn colChangedFile = new TreeViewColumn(); var crp = new CellRendererPixbuf(); var crt = new CellRendererText(); colChangedFile.Title = GettextCatalog.GetString("File"); colChangedFile.PackStart(crp, false); colChangedFile.PackStart(crt, true); colChangedFile.AddAttribute(crp, "pixbuf", 2); colChangedFile.AddAttribute(crt, "text", 3); treeviewFiles.AppendColumn(colChangedFile); TreeViewColumn colOperation = new TreeViewColumn(); colOperation.Title = GettextCatalog.GetString("Operation"); colOperation.PackStart(crp, false); colOperation.PackStart(crt, true); colOperation.AddAttribute(crp, "pixbuf", 0); colOperation.AddAttribute(crt, "text", 1); treeviewFiles.AppendColumn(colOperation); TreeViewColumn colChangedPath = new TreeViewColumn(); colChangedPath.Title = GettextCatalog.GetString("Path"); diffRenderer.DrawLeft = true; colChangedPath.PackStart(diffRenderer, true); colChangedPath.SetCellDataFunc(diffRenderer, SetDiffCellData); treeviewFiles.AppendColumn(colChangedPath); treeviewFiles.Model = changedpathstore; treeviewFiles.TestExpandRow += HandleTreeviewFilesTestExpandRow; treeviewFiles.Events |= Gdk.EventMask.PointerMotionMask; textviewDetails.WrapMode = Gtk.WrapMode.Word; labelAuthor.Text = ""; labelDate.Text = ""; labelRevision.Text = ""; vbox2.Remove(scrolledwindow1); HeaderBox tb = new HeaderBox(); tb.Show(); tb.SetMargins(1, 0, 0, 0); tb.ShowTopShadow = true; tb.ShadowSize = 4; tb.SetPadding(8, 8, 8, 8); tb.UseChildBackgroundColor = true; tb.Add(scrolledwindow1); vbox2.PackStart(tb, true, true, 0); }
public LogWidget(VersionControlDocumentInfo info) { this.Build(); this.info = info; if (info.Document != null) { this.preselectFile = info.Item.Path; } var separator = new HeaderBox(); separator.SetMargins(1, 0, 0, 0); separator.HeightRequest = 4; separator.ShowAll(); hpaned1 = hpaned1.ReplaceWithWidget(new HPanedThin(), true); vpaned1 = vpaned1.ReplaceWithWidget(new VPanedThin() { HandleWidget = separator }, true); revertButton = new DocumentToolButton("vc-revert-command", GettextCatalog.GetString("Revert changes from this revision")); revertButton.GetNativeWidget <Gtk.Widget> ().Sensitive = false; revertButton.Clicked += new EventHandler(RevertRevisionClicked); revertToButton = new DocumentToolButton("vc-revert-command", GettextCatalog.GetString("Revert to this revision")); revertToButton.GetNativeWidget <Gtk.Widget> ().Sensitive = false; revertToButton.Clicked += new EventHandler(RevertToRevisionClicked); refreshButton = new DocumentToolButton(Gtk.Stock.Refresh, GettextCatalog.GetString("Refresh")); refreshButton.Clicked += new EventHandler(RefreshClicked); searchEntry = new SearchEntry(); searchEntry.WidthRequest = 200; searchEntry.ForceFilterButtonVisible = true; searchEntry.EmptyMessage = GettextCatalog.GetString("Search"); searchEntry.Changed += HandleSearchEntryFilterChanged; searchEntry.Ready = true; searchEntry.Show(); messageRenderer.Ellipsize = Pango.EllipsizeMode.End; TreeViewColumn colRevMessage = new TreeViewColumn(); colRevMessage.Title = GettextCatalog.GetString("Message"); var graphRenderer = new RevisionGraphCellRenderer(); colRevMessage.PackStart(graphRenderer, false); colRevMessage.SetCellDataFunc(graphRenderer, GraphFunc); colRevMessage.PackStart(messageRenderer, true); colRevMessage.SetCellDataFunc(messageRenderer, MessageFunc); colRevMessage.Sizing = TreeViewColumnSizing.Autosize; treeviewLog.AppendColumn(colRevMessage); colRevMessage.MinWidth = 350; colRevMessage.Resizable = true; TreeViewColumn colRevDate = new TreeViewColumn(GettextCatalog.GetString("Date"), textRenderer); colRevDate.SetCellDataFunc(textRenderer, DateFunc); colRevDate.Resizable = true; treeviewLog.AppendColumn(colRevDate); TreeViewColumn colRevAuthor = new TreeViewColumn(); colRevAuthor.Title = GettextCatalog.GetString("Author"); colRevAuthor.PackStart(pixRenderer, false); colRevAuthor.PackStart(textRenderer, true); colRevAuthor.SetCellDataFunc(textRenderer, AuthorFunc); colRevAuthor.SetCellDataFunc(pixRenderer, AuthorIconFunc); colRevAuthor.Resizable = true; treeviewLog.AppendColumn(colRevAuthor); TreeViewColumn colRevNum = new TreeViewColumn(GettextCatalog.GetString("Revision"), textRenderer); colRevNum.SetCellDataFunc(textRenderer, RevisionFunc); colRevNum.Resizable = true; treeviewLog.AppendColumn(colRevNum); treeviewLog.Model = logstore; treeviewLog.Selection.Changed += TreeSelectionChanged; treeviewFiles = new FileTreeView(); treeviewFiles.DiffLineActivated += HandleTreeviewFilesDiffLineActivated; scrolledwindowFiles.Child = treeviewFiles; scrolledwindowFiles.ShowAll(); changedpathstore = new TreeStore(typeof(Xwt.Drawing.Image), typeof(string), // icon/file name typeof(Xwt.Drawing.Image), typeof(string), // icon/operation typeof(string), // path typeof(string), // revision path (invisible) typeof(string []) // diff ); TreeViewColumn colChangedFile = new TreeViewColumn(); var crp = new CellRendererImage(); var crt = new CellRendererText(); colChangedFile.Title = GettextCatalog.GetString("File"); colChangedFile.PackStart(crp, false); colChangedFile.PackStart(crt, true); colChangedFile.SetCellDataFunc(crp, HandleNodeCellDataFunc); colChangedFile.AddAttribute(crt, "text", 3); treeviewFiles.AppendColumn(colChangedFile); TreeViewColumn colOperation = new TreeViewColumn(); colOperation.Title = GettextCatalog.GetString("Operation"); colOperation.PackStart(crp, false); colOperation.PackStart(crt, true); colOperation.AddAttribute(crp, "image", 0); colOperation.AddAttribute(crt, "text", 1); treeviewFiles.AppendColumn(colOperation); TreeViewColumn colChangedPath = new TreeViewColumn(); colChangedPath.Title = GettextCatalog.GetString("Path"); diffRenderer.DrawLeft = true; colChangedPath.PackStart(diffRenderer, true); colChangedPath.SetCellDataFunc(diffRenderer, SetDiffCellData); treeviewFiles.AppendColumn(colChangedPath); treeviewFiles.Model = changedpathstore; treeviewFiles.TestExpandRow += HandleTreeviewFilesTestExpandRow; treeviewFiles.Events |= Gdk.EventMask.PointerMotionMask; textviewDetails.WrapMode = Gtk.WrapMode.Word; textviewDetails.AddEvents((int)Gdk.EventMask.ButtonPressMask); textviewDetails.ButtonPressEvent += TextviewDetails_ButtonPressEvent; labelAuthor.Text = ""; labelDate.Text = ""; labelRevision.Text = ""; labelDate.AddEvents((int)Gdk.EventMask.ButtonPressMask); labelDate.ButtonPressEvent += LabelDate_ButtonPressEvent; labelAuthor.AddEvents((int)Gdk.EventMask.ButtonPressMask); labelAuthor.ButtonPressEvent += LabelAuthor_ButtonPressEvent; labelRevision.AddEvents((int)Gdk.EventMask.ButtonPressMask); labelRevision.ButtonPressEvent += LabelRevision_ButtonPressEvent; vbox2.Remove(scrolledwindow1); HeaderBox tb = new HeaderBox(); tb.Show(); tb.SetMargins(1, 0, 0, 0); tb.ShowTopShadow = true; tb.ShadowSize = 4; tb.SetPadding(8, 8, 8, 8); tb.UseChildBackgroundColor = true; tb.Add(scrolledwindow1); vbox2.PackStart(tb, true, true, 0); (Platform.IsMac ? Xwt.Toolkit.NativeEngine : Xwt.Toolkit.CurrentEngine).Invoke(() => { popupMenu = new Xwt.Menu(); var copyItem = new Xwt.MenuItem(GettextCatalog.GetString("Copy")); popupMenu.Items.Add(copyItem); copyItem.Clicked += (sender, e) => { var selectedText = GetSelectedText(); if (!string.IsNullOrEmpty(selectedText)) { LogView.CopyToClipboard(selectedText); } }; }); UpdateStyle(); Ide.Gui.Styles.Changed += HandleStylesChanged; }