void SetDiffCellData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { CellRendererDiff rc = (CellRendererDiff)cell; string[] lines = (string[])changedpathstore.GetValue(iter, colDiff); if (lines == null) { lines = new string[] { (string)changedpathstore.GetValue(iter, colOperation) } } ; rc.InitCell(treeviewFiles, changedpathstore.IterDepth(iter) != 0, lines, changedpathstore.GetPath(iter)); }
static void SetDiffCellData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { CellRendererDiff rc = (CellRendererDiff)cell; string[] lines = (string[])model.GetValue(iter, colDiff); if (lines == null) { lines = new string[] { (string)model.GetValue(iter, colOperation) } } ; rc.InitCell(tree_column.TreeView, ((TreeStore)model).IterDepth(iter) != 0, lines, model.GetPath(iter)); }
protected override void OnDestroyed() { base.OnDestroyed(); disposed = true; if (colCommit != null) { colCommit.Destroy(); colCommit = null; } if (this.diffRenderer != null) { this.diffRenderer.Destroy(); this.diffRenderer = null; } }
void SetDiffCellData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { if (disposed) { return; } CellRendererDiff rc = (CellRendererDiff)cell; string[] lines = (string[])filestore.GetValue(iter, ColPath); TreePath path = filestore.GetPath(iter); if (filestore.IterDepth(iter) == 0) { rc.InitCell(filelist, false, lines, path); } else { rc.InitCell(filelist, true, lines, path); } }
public override void Dispose () { disposed = true; if (colCommit != null) { colCommit.Destroy (); colCommit = null; } if (colRemote != null) { colRemote.Destroy (); colRemote = null; } if (colFile != null) { colFile.Destroy (); colFile = null; } if (filelist != null) { filelist.DoPopupMenu = null; filelist.RowActivated -= OnRowActivated; filelist.DiffLineActivated -= OnDiffLineActivated; filelist.CommitSelectionToggled -= OnCommitSelectionToggled; filelist.TestExpandRow -= OnTestExpandRow; filelist.Selection.Changed -= OnCursorChanged; filelist.Destroy (); filelist = null; } if (cellToggle != null) { cellToggle.Toggled -= OnCommitCellToggled; cellToggle.Destroy (); cellToggle = null; } if (this.diffRenderer != null) { this.diffRenderer.Destroy (); this.diffRenderer = null; } VersionControlService.FileStatusChanged -= OnFileStatusChanged; if (widget != null) { widget.Destroy (); widget = null; } localDiff.Clear (); remoteDiff.Clear (); base.Dispose (); }
void Init () { main = new VBox(false, 6); widget = main; buttonCommit = new Gtk.Button () { Image = new Xwt.ImageView (Xwt.Drawing.Image.FromResource ("commit-16.png")).ToGtkWidget (), Label = GettextCatalog.GetString ("Commit..."), Name = "buttonCommit" }; buttonCommit.Image.Show (); buttonRevert = new Gtk.Button () { Image = new Xwt.ImageView (Xwt.Drawing.Image.FromResource ("revert-16.png")).ToGtkWidget (), Label = GettextCatalog.GetString ("Revert") }; buttonRevert.Image.Show (); showRemoteStatus = new Gtk.Button () { Image = new Xwt.ImageView (Xwt.Drawing.Image.FromResource ("remote-status-16.png")).ToGtkWidget (), Label = GettextCatalog.GetString ("Show Remote Status") }; showRemoteStatus.Image.Show (); status = new Label(""); main.PackStart(status, false, false, 0); scroller = new ScrolledWindow(); scroller.ShadowType = Gtk.ShadowType.None; filelist = new FileTreeView(); filelist.Selection.Mode = Gtk.SelectionMode.Multiple; scroller.Add(filelist); scroller.HscrollbarPolicy = PolicyType.Automatic; scroller.VscrollbarPolicy = PolicyType.Automatic; filelist.RowActivated += OnRowActivated; filelist.DiffLineActivated += OnDiffLineActivated; filelist.CommitSelectionToggled += OnCommitSelectionToggled; cellToggle = new CellRendererToggle(); cellToggle.Toggled += new ToggledHandler(OnCommitCellToggled); var crc = new CellRendererImage (); crc.StockId = "vc-comment"; colCommit = new TreeViewColumn (); colCommit.Spacing = 2; colCommit.Widget = new Xwt.ImageView (Xwt.Drawing.Image.FromResource ("commit-16.png")).ToGtkWidget (); colCommit.Widget.Show (); colCommit.PackStart (cellToggle, false); colCommit.PackStart (crc, false); colCommit.AddAttribute (cellToggle, "active", ColCommit); colCommit.AddAttribute (cellToggle, "visible", ColShowToggle); colCommit.AddAttribute (crc, "visible", ColShowComment); CellRendererText crt = new CellRendererText(); var crp = new CellRendererImage (); TreeViewColumn colStatus = new TreeViewColumn (); colStatus.Title = GettextCatalog.GetString ("Status"); colStatus.PackStart (crp, false); colStatus.PackStart (crt, true); colStatus.AddAttribute (crp, "image", ColIcon); colStatus.AddAttribute (crp, "visible", ColShowStatus); colStatus.AddAttribute (crt, "text", ColStatus); colStatus.AddAttribute (crt, "foreground", ColStatusColor); colFile = new TreeViewColumn (); colFile.Title = GettextCatalog.GetString ("File"); colFile.Spacing = 2; crp = new CellRendererImage (); diffRenderer = new CellRendererDiff (); colFile.PackStart (crp, false); colFile.PackStart (diffRenderer, true); colFile.AddAttribute (crp, "image", ColIconFile); colFile.AddAttribute (crp, "visible", ColShowStatus); colFile.SetCellDataFunc (diffRenderer, new TreeCellDataFunc (SetDiffCellData)); crt = new CellRendererText(); crp = new CellRendererImage (); colRemote = new TreeViewColumn (); colRemote.Title = GettextCatalog.GetString ("Remote Status"); colRemote.PackStart (crp, false); colRemote.PackStart (crt, true); colRemote.AddAttribute (crp, "image", ColRemoteIcon); colRemote.AddAttribute (crt, "text", ColRemoteStatus); colRemote.AddAttribute (crt, "foreground", ColStatusColor); filelist.AppendColumn(colStatus); filelist.AppendColumn(colRemote); filelist.AppendColumn(colCommit); filelist.AppendColumn(colFile); colRemote.Visible = false; filestore = new TreeStore (typeof (Xwt.Drawing.Image), typeof (string), typeof (string[]), typeof (string), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof (bool), typeof(Xwt.Drawing.Image), typeof(bool), typeof (Xwt.Drawing.Image), typeof(string), typeof(bool), typeof(bool)); filelist.Model = filestore; filelist.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow); commitBox = new VBox (); HeaderBox commitMessageLabelBox = new HeaderBox (); commitMessageLabelBox.SetPadding (6, 6, 6, 6); commitMessageLabelBox.SetMargins (1, 1, 0, 0); HBox labBox = new HBox (); labelCommit = new Gtk.Label (GettextCatalog.GetString ("Commit message:")); labelCommit.Xalign = 0; labBox.PackStart (new Xwt.ImageView (Xwt.Drawing.Image.FromResource ("comment-16.png")).ToGtkWidget (), false, false, 0); labBox.PackStart (labelCommit, true, true, 3); commitMessageLabelBox.Add (labBox); commitMessageLabelBox.ShowAll (); //commitBox.PackStart (commitMessageLabelBox, false, false, 0); Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow (); frame.HeightRequest = 75; frame.ShadowType = ShadowType.None; commitText = new TextView (); commitText.WrapMode = WrapMode.WordChar; commitText.Buffer.Changed += OnCommitTextChanged; frame.Add (commitText); commitBox.PackStart (frame, true, true, 0); var paned = new VPanedThin (); paned.HandleWidget = commitMessageLabelBox; paned.Pack1 (scroller, true, true); paned.Pack2 (commitBox, false, false); main.PackStart (paned, true, true, 0); main.ShowAll(); status.Visible = false; filelist.Selection.Changed += new EventHandler(OnCursorChanged); VersionControlService.FileStatusChanged += OnFileStatusChanged; filelist.HeadersClickable = true; filestore.SetSortFunc (0, CompareNodes); colStatus.SortColumnId = 0; filestore.SetSortFunc (1, CompareNodes); colRemote.SortColumnId = 1; filestore.SetSortFunc (2, CompareNodes); colCommit.SortColumnId = 2; filestore.SetSortFunc (3, CompareNodes); colFile.SortColumnId = 3; filestore.SetSortColumnId (3, Gtk.SortType.Ascending); filelist.DoPopupMenu = DoPopupMenu; StartUpdate(); }
public override void Dispose () { disposed = true; if (colCommit != null) { colCommit.Destroy (); colCommit = null; } if (colRemote != null) { colRemote.Destroy (); colRemote = null; } if (filestore != null) { filestore.Dispose (); filestore = null; } if (this.diffRenderer != null) { this.diffRenderer.Destroy (); this.diffRenderer = null; } VersionControlService.FileStatusChanged -= OnFileStatusChanged; if (widget != null) { widget.Destroy (); widget = null; } base.Dispose (); }
public ChangeSetView() { ShadowType = Gtk.ShadowType.In; filelist = new FileTreeView(); filelist.Selection.Mode = SelectionMode.Multiple; Add(filelist); HscrollbarPolicy = PolicyType.Automatic; VscrollbarPolicy = PolicyType.Automatic; filelist.RowActivated += OnRowActivated; filelist.DiffLineActivated += OnDiffLineActivated; CellRendererToggle cellToggle = new CellRendererToggle(); // cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); var crc = new CellRendererIcon(); crc.StockId = "vc-comment"; colCommit = new TreeViewColumn(); colCommit.Spacing = 2; colCommit.Widget = new Gtk.Image("vc-commit", Gtk.IconSize.Menu); colCommit.Widget.Show(); colCommit.PackStart(cellToggle, false); colCommit.PackStart(crc, false); colCommit.AddAttribute(cellToggle, "active", ColCommit); colCommit.AddAttribute(cellToggle, "visible", ColShowToggle); colCommit.AddAttribute(crc, "visible", ColShowComment); colCommit.Visible = false; CellRendererText crt = new CellRendererText(); var crp = new CellRendererPixbuf(); TreeViewColumn colStatus = new TreeViewColumn(); colStatus.Title = GettextCatalog.GetString("Status"); colStatus.PackStart(crp, false); colStatus.PackStart(crt, true); colStatus.AddAttribute(crp, "pixbuf", ColIcon); colStatus.AddAttribute(crp, "visible", ColShowStatus); colStatus.AddAttribute(crt, "text", ColStatus); colStatus.AddAttribute(crt, "foreground", ColStatusColor); TreeViewColumn colFile = new TreeViewColumn(); colFile.Title = GettextCatalog.GetString("File"); colFile.Spacing = 2; crp = new CellRendererPixbuf(); diffRenderer = new CellRendererDiff(); colFile.PackStart(crp, false); colFile.PackStart(diffRenderer, true); colFile.AddAttribute(crp, "pixbuf", ColIconFile); colFile.AddAttribute(crp, "visible", ColShowStatus); colFile.SetCellDataFunc(diffRenderer, new TreeCellDataFunc(SetDiffCellData)); filelist.AppendColumn(colStatus); filelist.AppendColumn(colCommit); filelist.AppendColumn(colFile); filestore = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string[]), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof(bool), typeof(Gdk.Pixbuf), typeof(bool), typeof(string)); filelist.Model = filestore; filelist.TestExpandRow += new Gtk.TestExpandRowHandler(OnTestExpandRow); ShowAll(); filelist.Selection.Changed += new EventHandler(OnCursorChanged); filelist.HeadersClickable = true; filestore.SetSortFunc(0, CompareNodes); colStatus.SortColumnId = 0; filestore.SetSortFunc(1, CompareNodes); colCommit.SortColumnId = 1; filestore.SetSortFunc(2, CompareNodes); colFile.SortColumnId = 2; filestore.SetSortColumnId(2, Gtk.SortType.Ascending); }
public StatusView(string filepath, Repository vc) : base(Path.GetFileName(filepath) + " Status") { this.vc = vc; this.filepath = filepath; changeSet = vc.CreateChangeSet(filepath); main = new VBox(false, 6); widget = main; commandbar = new Toolbar(); commandbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; commandbar.IconSize = Gtk.IconSize.Menu; main.PackStart(commandbar, false, false, 0); buttonCommit = new Gtk.ToolButton(new Gtk.Image("vc-commit", Gtk.IconSize.Menu), GettextCatalog.GetString("Commit...")); buttonCommit.IsImportant = true; buttonCommit.Clicked += new EventHandler(OnCommitClicked); commandbar.Insert(buttonCommit, -1); Gtk.ToolButton btnRefresh = new Gtk.ToolButton(new Gtk.Image(Gtk.Stock.Refresh, IconSize.Menu), GettextCatalog.GetString("Refresh")); btnRefresh.IsImportant = true; btnRefresh.Clicked += new EventHandler(OnRefresh); commandbar.Insert(btnRefresh, -1); buttonRevert = new Gtk.ToolButton(new Gtk.Image("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString("Revert")); buttonRevert.IsImportant = true; buttonRevert.Clicked += new EventHandler(OnRevert); commandbar.Insert(buttonRevert, -1); showRemoteStatus = new Gtk.ToolButton(new Gtk.Image("vc-remote-status", Gtk.IconSize.Menu), GettextCatalog.GetString("Show Remote Status")); showRemoteStatus.IsImportant = true; showRemoteStatus.Clicked += new EventHandler(OnShowRemoteStatusClicked); commandbar.Insert(showRemoteStatus, -1); Gtk.ToolButton btnCreatePatch = new Gtk.ToolButton(new Gtk.Image("vc-diff", Gtk.IconSize.Menu), GettextCatalog.GetString("Create Patch")); btnCreatePatch.IsImportant = true; btnCreatePatch.Clicked += new EventHandler(OnCreatePatch); commandbar.Insert(btnCreatePatch, -1); commandbar.Insert(new Gtk.SeparatorToolItem(), -1); Gtk.ToolButton btnOpen = new Gtk.ToolButton(new Gtk.Image(Gtk.Stock.Open, IconSize.Menu), GettextCatalog.GetString("Open")); btnOpen.IsImportant = true; btnOpen.Clicked += new EventHandler(OnOpen); commandbar.Insert(btnOpen, -1); commandbar.Insert(new Gtk.SeparatorToolItem(), -1); Gtk.ToolButton btnExpand = new Gtk.ToolButton(null, GettextCatalog.GetString("Expand All")); btnExpand.IsImportant = true; btnExpand.Clicked += new EventHandler(OnExpandAll); commandbar.Insert(btnExpand, -1); Gtk.ToolButton btnCollapse = new Gtk.ToolButton(null, GettextCatalog.GetString("Collapse All")); btnCollapse.IsImportant = true; btnCollapse.Clicked += new EventHandler(OnCollapseAll); commandbar.Insert(btnCollapse, -1); commandbar.Insert(new Gtk.SeparatorToolItem(), -1); Gtk.ToolButton btnSelectAll = new Gtk.ToolButton(null, GettextCatalog.GetString("Select All")); btnSelectAll.IsImportant = true; btnSelectAll.Clicked += new EventHandler(OnSelectAll); commandbar.Insert(btnSelectAll, -1); Gtk.ToolButton btnSelectNone = new Gtk.ToolButton(null, GettextCatalog.GetString("Select None")); btnSelectNone.IsImportant = true; btnSelectNone.Clicked += new EventHandler(OnSelectNone); commandbar.Insert(btnSelectNone, -1); status = new Label(""); main.PackStart(status, false, false, 0); scroller = new ScrolledWindow(); scroller.ShadowType = Gtk.ShadowType.In; filelist = new FileTreeView(); filelist.Selection.Mode = SelectionMode.Multiple; scroller.Add(filelist); scroller.HscrollbarPolicy = PolicyType.Automatic; scroller.VscrollbarPolicy = PolicyType.Automatic; filelist.RowActivated += OnRowActivated; filelist.DiffLineActivated += OnDiffLineActivated; CellRendererToggle cellToggle = new CellRendererToggle(); cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); var crc = new CellRendererIcon(); crc.StockId = "vc-comment"; colCommit = new TreeViewColumn(); colCommit.Spacing = 2; colCommit.Widget = new Gtk.Image("vc-commit", Gtk.IconSize.Menu); colCommit.Widget.Show(); colCommit.PackStart(cellToggle, false); colCommit.PackStart(crc, false); colCommit.AddAttribute(cellToggle, "active", ColCommit); colCommit.AddAttribute(cellToggle, "visible", ColShowToggle); colCommit.AddAttribute(crc, "visible", ColShowComment); CellRendererText crt = new CellRendererText(); var crp = new CellRendererPixbuf(); TreeViewColumn colStatus = new TreeViewColumn(); colStatus.Title = GettextCatalog.GetString("Status"); colStatus.PackStart(crp, false); colStatus.PackStart(crt, true); colStatus.AddAttribute(crp, "pixbuf", ColIcon); colStatus.AddAttribute(crp, "visible", ColShowStatus); colStatus.AddAttribute(crt, "text", ColStatus); colStatus.AddAttribute(crt, "foreground", ColStatusColor); TreeViewColumn colFile = new TreeViewColumn(); colFile.Title = GettextCatalog.GetString("File"); colFile.Spacing = 2; crp = new CellRendererPixbuf(); diffRenderer = new CellRendererDiff(); colFile.PackStart(crp, false); colFile.PackStart(diffRenderer, true); colFile.AddAttribute(crp, "pixbuf", ColIconFile); colFile.AddAttribute(crp, "visible", ColShowStatus); colFile.SetCellDataFunc(diffRenderer, new TreeCellDataFunc(SetDiffCellData)); crt = new CellRendererText(); crp = new CellRendererPixbuf(); colRemote = new TreeViewColumn(); colRemote.Title = GettextCatalog.GetString("Remote Status"); colRemote.PackStart(crp, false); colRemote.PackStart(crt, true); colRemote.AddAttribute(crp, "pixbuf", ColRemoteIcon); colRemote.AddAttribute(crt, "text", ColRemoteStatus); colRemote.AddAttribute(crt, "foreground", ColStatusColor); filelist.AppendColumn(colStatus); filelist.AppendColumn(colRemote); filelist.AppendColumn(colCommit); filelist.AppendColumn(colFile); colRemote.Visible = false; filestore = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string[]), typeof(string), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof(bool), typeof(Gdk.Pixbuf), typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(bool)); filelist.Model = filestore; filelist.TestExpandRow += new Gtk.TestExpandRowHandler(OnTestExpandRow); commitBox = new VBox(); HBox labBox = new HBox(); labelCommit = new Gtk.Label(GettextCatalog.GetString("Commit message:")); labelCommit.Xalign = 0; labBox.PackStart(new Gtk.Image("vc-comment", Gtk.IconSize.Menu), false, false, 0); labBox.PackStart(labelCommit, true, true, 3); commitBox.PackStart(labBox, false, false, 0); Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow(); frame.ShadowType = ShadowType.In; commitText = new TextView(); commitText.WrapMode = WrapMode.WordChar; commitText.Buffer.Changed += OnCommitTextChanged; frame.Add(commitText); commitBox.PackStart(frame, true, true, 6); VPaned paned = new VPaned(); paned.Pack1(scroller, true, true); paned.Pack2(commitBox, false, false); main.PackStart(paned, true, true, 0); main.ShowAll(); status.Visible = false; filelist.Selection.Changed += new EventHandler(OnCursorChanged); VersionControlService.FileStatusChanged += OnFileStatusChanged; filelist.HeadersClickable = true; filestore.SetSortFunc(0, CompareNodes); colStatus.SortColumnId = 0; filestore.SetSortFunc(1, CompareNodes); colRemote.SortColumnId = 1; filestore.SetSortFunc(2, CompareNodes); colCommit.SortColumnId = 2; filestore.SetSortFunc(3, CompareNodes); colFile.SortColumnId = 3; filestore.SetSortColumnId(3, Gtk.SortType.Ascending); filelist.ShowContextMenu += OnPopupMenu; StartUpdate(); }
public StatusView (string filepath, Repository vc) : base(Path.GetFileName(filepath) + " Status") { this.vc = vc; this.filepath = filepath; changeSet = vc.CreateChangeSet (filepath); main = new VBox(false, 6); widget = main; commandbar = new Toolbar (); commandbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; commandbar.IconSize = Gtk.IconSize.Menu; main.PackStart (commandbar, false, false, 0); buttonCommit = new Gtk.ToolButton (new Gtk.Image ("vc-commit", Gtk.IconSize.Menu), GettextCatalog.GetString ("Commit...")); buttonCommit.IsImportant = true; buttonCommit.Clicked += new EventHandler (OnCommitClicked); commandbar.Insert (buttonCommit, -1); Gtk.ToolButton btnRefresh = new Gtk.ToolButton (new Gtk.Image (Gtk.Stock.Refresh, IconSize.Menu), GettextCatalog.GetString ("Refresh")); btnRefresh.IsImportant = true; btnRefresh.Clicked += new EventHandler (OnRefresh); commandbar.Insert (btnRefresh, -1); buttonRevert = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert")); buttonRevert.IsImportant = true; buttonRevert.Clicked += new EventHandler (OnRevert); commandbar.Insert (buttonRevert, -1); showRemoteStatus = new Gtk.ToolButton (new Gtk.Image ("vc-remote-status", Gtk.IconSize.Menu), GettextCatalog.GetString ("Show Remote Status")); showRemoteStatus.IsImportant = true; showRemoteStatus.Clicked += new EventHandler(OnShowRemoteStatusClicked); commandbar.Insert (showRemoteStatus, -1); Gtk.ToolButton btnCreatePatch = new Gtk.ToolButton (new Gtk.Image ("vc-diff", Gtk.IconSize.Menu), GettextCatalog.GetString ("Create Patch")); btnCreatePatch.IsImportant = true; btnCreatePatch.Clicked += new EventHandler (OnCreatePatch); commandbar.Insert (btnCreatePatch, -1); commandbar.Insert (new Gtk.SeparatorToolItem (), -1); Gtk.ToolButton btnOpen = new Gtk.ToolButton (new Gtk.Image (Gtk.Stock.Open, IconSize.Menu), GettextCatalog.GetString ("Open")); btnOpen.IsImportant = true; btnOpen.Clicked += new EventHandler (OnOpen); commandbar.Insert (btnOpen, -1); commandbar.Insert (new Gtk.SeparatorToolItem (), -1); Gtk.ToolButton btnExpand = new Gtk.ToolButton (null, GettextCatalog.GetString ("Expand All")); btnExpand.IsImportant = true; btnExpand.Clicked += new EventHandler (OnExpandAll); commandbar.Insert (btnExpand, -1); Gtk.ToolButton btnCollapse = new Gtk.ToolButton (null, GettextCatalog.GetString ("Collapse All")); btnCollapse.IsImportant = true; btnCollapse.Clicked += new EventHandler (OnCollapseAll); commandbar.Insert (btnCollapse, -1); commandbar.Insert (new Gtk.SeparatorToolItem (), -1); Gtk.ToolButton btnSelectAll = new Gtk.ToolButton (null, GettextCatalog.GetString ("Select All")); btnSelectAll.IsImportant = true; btnSelectAll.Clicked += new EventHandler (OnSelectAll); commandbar.Insert (btnSelectAll, -1); Gtk.ToolButton btnSelectNone = new Gtk.ToolButton (null, GettextCatalog.GetString ("Select None")); btnSelectNone.IsImportant = true; btnSelectNone.Clicked += new EventHandler (OnSelectNone); commandbar.Insert (btnSelectNone, -1); status = new Label(""); main.PackStart(status, false, false, 0); scroller = new ScrolledWindow(); scroller.ShadowType = Gtk.ShadowType.In; filelist = new FileTreeView(); filelist.Selection.Mode = Gtk.SelectionMode.Multiple; scroller.Add(filelist); scroller.HscrollbarPolicy = PolicyType.Automatic; scroller.VscrollbarPolicy = PolicyType.Automatic; filelist.RowActivated += OnRowActivated; filelist.DiffLineActivated += OnDiffLineActivated; CellRendererToggle cellToggle = new CellRendererToggle(); cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); var crc = new CellRendererIcon (); crc.StockId = "vc-comment"; colCommit = new TreeViewColumn (); colCommit.Spacing = 2; colCommit.Widget = new Gtk.Image ("vc-commit", Gtk.IconSize.Menu); colCommit.Widget.Show (); colCommit.PackStart (cellToggle, false); colCommit.PackStart (crc, false); colCommit.AddAttribute (cellToggle, "active", ColCommit); colCommit.AddAttribute (cellToggle, "visible", ColShowToggle); colCommit.AddAttribute (crc, "visible", ColShowComment); CellRendererText crt = new CellRendererText(); var crp = new CellRendererPixbuf (); TreeViewColumn colStatus = new TreeViewColumn (); colStatus.Title = GettextCatalog.GetString ("Status"); colStatus.PackStart (crp, false); colStatus.PackStart (crt, true); colStatus.AddAttribute (crp, "pixbuf", ColIcon); colStatus.AddAttribute (crp, "visible", ColShowStatus); colStatus.AddAttribute (crt, "text", ColStatus); colStatus.AddAttribute (crt, "foreground", ColStatusColor); TreeViewColumn colFile = new TreeViewColumn (); colFile.Title = GettextCatalog.GetString ("File"); colFile.Spacing = 2; crp = new CellRendererPixbuf (); diffRenderer = new CellRendererDiff (); colFile.PackStart (crp, false); colFile.PackStart (diffRenderer, true); colFile.AddAttribute (crp, "pixbuf", ColIconFile); colFile.AddAttribute (crp, "visible", ColShowStatus); colFile.SetCellDataFunc (diffRenderer, new TreeCellDataFunc (SetDiffCellData)); crt = new CellRendererText(); crp = new CellRendererPixbuf (); colRemote = new TreeViewColumn (); colRemote.Title = GettextCatalog.GetString ("Remote Status"); colRemote.PackStart (crp, false); colRemote.PackStart (crt, true); colRemote.AddAttribute (crp, "pixbuf", ColRemoteIcon); colRemote.AddAttribute (crt, "text", ColRemoteStatus); colRemote.AddAttribute (crt, "foreground", ColStatusColor); filelist.AppendColumn(colStatus); filelist.AppendColumn(colRemote); filelist.AppendColumn(colCommit); filelist.AppendColumn(colFile); colRemote.Visible = false; filestore = new TreeStore (typeof (Gdk.Pixbuf), typeof (string), typeof (string[]), typeof (string), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof (bool), typeof(Gdk.Pixbuf), typeof(bool), typeof (Gdk.Pixbuf), typeof(string), typeof(bool), typeof(bool)); filelist.Model = filestore; filelist.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow); commitBox = new VBox (); HBox labBox = new HBox (); labelCommit = new Gtk.Label (GettextCatalog.GetString ("Commit message:")); labelCommit.Xalign = 0; labBox.PackStart (new Gtk.Image ("vc-comment", Gtk.IconSize.Menu), false, false, 0); labBox.PackStart (labelCommit, true, true, 3); commitBox.PackStart (labBox, false, false, 0); Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow (); frame.ShadowType = ShadowType.In; commitText = new TextView (); commitText.WrapMode = WrapMode.WordChar; commitText.Buffer.Changed += OnCommitTextChanged; frame.Add (commitText); commitBox.PackStart (frame, true, true, 6); VPaned paned = new VPaned (); paned.Pack1 (scroller, true, true); paned.Pack2 (commitBox, false, false); main.PackStart (paned, true, true, 0); main.ShowAll(); status.Visible = false; filelist.Selection.Changed += new EventHandler(OnCursorChanged); VersionControlService.FileStatusChanged += OnFileStatusChanged; filelist.HeadersClickable = true; filestore.SetSortFunc (0, CompareNodes); colStatus.SortColumnId = 0; filestore.SetSortFunc (1, CompareNodes); colRemote.SortColumnId = 1; filestore.SetSortFunc (2, CompareNodes); colCommit.SortColumnId = 2; filestore.SetSortFunc (3, CompareNodes); colFile.SortColumnId = 3; filestore.SetSortColumnId (3, Gtk.SortType.Ascending); filelist.DoPopupMenu = DoPopupMenu; StartUpdate(); }
public ChangeSetView () { ShadowType = Gtk.ShadowType.In; filelist = new FileTreeView(); filelist.Selection.Mode = SelectionMode.Multiple; Add (filelist); HscrollbarPolicy = PolicyType.Automatic; VscrollbarPolicy = PolicyType.Automatic; filelist.RowActivated += OnRowActivated; filelist.DiffLineActivated += OnDiffLineActivated; CellRendererToggle cellToggle = new CellRendererToggle(); // cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); var crc = new CellRendererIcon (); crc.StockId = "vc-comment"; colCommit = new TreeViewColumn (); colCommit.Spacing = 2; colCommit.Widget = new Gtk.Image ("vc-commit", Gtk.IconSize.Menu); colCommit.Widget.Show (); colCommit.PackStart (cellToggle, false); colCommit.PackStart (crc, false); colCommit.AddAttribute (cellToggle, "active", ColCommit); colCommit.AddAttribute (cellToggle, "visible", ColShowToggle); colCommit.AddAttribute (crc, "visible", ColShowComment); colCommit.Visible = false; CellRendererText crt = new CellRendererText(); var crp = new CellRendererPixbuf (); TreeViewColumn colStatus = new TreeViewColumn (); colStatus.Title = GettextCatalog.GetString ("Status"); colStatus.PackStart (crp, false); colStatus.PackStart (crt, true); colStatus.AddAttribute (crp, "pixbuf", ColIcon); colStatus.AddAttribute (crp, "visible", ColShowStatus); colStatus.AddAttribute (crt, "text", ColStatus); colStatus.AddAttribute (crt, "foreground", ColStatusColor); TreeViewColumn colFile = new TreeViewColumn (); colFile.Title = GettextCatalog.GetString ("File"); colFile.Spacing = 2; crp = new CellRendererPixbuf (); diffRenderer = new CellRendererDiff (); colFile.PackStart (crp, false); colFile.PackStart (diffRenderer, true); colFile.AddAttribute (crp, "pixbuf", ColIconFile); colFile.AddAttribute (crp, "visible", ColShowStatus); colFile.SetCellDataFunc (diffRenderer, new TreeCellDataFunc (SetDiffCellData)); filelist.AppendColumn(colStatus); filelist.AppendColumn(colCommit); filelist.AppendColumn(colFile); filestore = new TreeStore (typeof (Gdk.Pixbuf), typeof (string), typeof (string[]), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof (bool), typeof(Gdk.Pixbuf), typeof(bool), typeof(string)); filelist.Model = filestore; filelist.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow); ShowAll(); filelist.Selection.Changed += new EventHandler(OnCursorChanged); filelist.HeadersClickable = true; filestore.SetSortFunc (0, CompareNodes); colStatus.SortColumnId = 0; filestore.SetSortFunc (1, CompareNodes); colCommit.SortColumnId = 1; filestore.SetSortFunc (2, CompareNodes); colFile.SortColumnId = 2; filestore.SetSortColumnId (2, Gtk.SortType.Ascending); }
protected override void OnDestroyed () { base.OnDestroyed (); disposed = true; if (colCommit != null) { colCommit.Destroy (); colCommit = null; } if (filestore != null) { filestore.Dispose (); filestore = null; } if (this.diffRenderer != null) { this.diffRenderer.Destroy (); this.diffRenderer = null; } }
void Init() { main = new VBox(false, 6); widget = main; buttonCommit = new Gtk.Button() { Image = new Xwt.ImageView(Xwt.Drawing.Image.FromResource("commit-light-16.png")).ToGtkWidget(), Label = GettextCatalog.GetString("Commit...") }; buttonCommit.Image.Show(); buttonRevert = new Gtk.Button() { Image = new Xwt.ImageView(Xwt.Drawing.Image.FromResource("revert-light-16.png")).ToGtkWidget(), Label = GettextCatalog.GetString("Revert") }; buttonRevert.Image.Show(); showRemoteStatus = new Gtk.Button() { Image = new Xwt.ImageView(Xwt.Drawing.Image.FromResource("remote-status-light-16.png")).ToGtkWidget(), Label = GettextCatalog.GetString("Show Remote Status") }; showRemoteStatus.Image.Show(); status = new Label(""); main.PackStart(status, false, false, 0); scroller = new ScrolledWindow(); scroller.ShadowType = Gtk.ShadowType.None; filelist = new FileTreeView(); filelist.Selection.Mode = Gtk.SelectionMode.Multiple; scroller.Add(filelist); scroller.HscrollbarPolicy = PolicyType.Automatic; scroller.VscrollbarPolicy = PolicyType.Automatic; filelist.RowActivated += OnRowActivated; filelist.DiffLineActivated += OnDiffLineActivated; cellToggle = new CellRendererToggle(); cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); var crc = new CellRendererImage(); crc.StockId = "vc-comment"; colCommit = new TreeViewColumn(); colCommit.Spacing = 2; colCommit.Widget = new Xwt.ImageView(Xwt.Drawing.Image.FromResource("commit-light-16.png")).ToGtkWidget(); colCommit.Widget.Show(); colCommit.PackStart(cellToggle, false); colCommit.PackStart(crc, false); colCommit.AddAttribute(cellToggle, "active", ColCommit); colCommit.AddAttribute(cellToggle, "visible", ColShowToggle); colCommit.AddAttribute(crc, "visible", ColShowComment); CellRendererText crt = new CellRendererText(); var crp = new CellRendererImage(); TreeViewColumn colStatus = new TreeViewColumn(); colStatus.Title = GettextCatalog.GetString("Status"); colStatus.PackStart(crp, false); colStatus.PackStart(crt, true); colStatus.AddAttribute(crp, "image", ColIcon); colStatus.AddAttribute(crp, "visible", ColShowStatus); colStatus.AddAttribute(crt, "text", ColStatus); colStatus.AddAttribute(crt, "foreground", ColStatusColor); colFile = new TreeViewColumn(); colFile.Title = GettextCatalog.GetString("File"); colFile.Spacing = 2; crp = new CellRendererImage(); diffRenderer = new CellRendererDiff(); colFile.PackStart(crp, false); colFile.PackStart(diffRenderer, true); colFile.AddAttribute(crp, "image", ColIconFile); colFile.AddAttribute(crp, "visible", ColShowStatus); colFile.SetCellDataFunc(diffRenderer, new TreeCellDataFunc(SetDiffCellData)); crt = new CellRendererText(); crp = new CellRendererImage(); colRemote = new TreeViewColumn(); colRemote.Title = GettextCatalog.GetString("Remote Status"); colRemote.PackStart(crp, false); colRemote.PackStart(crt, true); colRemote.AddAttribute(crp, "image", ColRemoteIcon); colRemote.AddAttribute(crt, "text", ColRemoteStatus); colRemote.AddAttribute(crt, "foreground", ColStatusColor); filelist.AppendColumn(colStatus); filelist.AppendColumn(colRemote); filelist.AppendColumn(colCommit); filelist.AppendColumn(colFile); colRemote.Visible = false; filestore = new TreeStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(string[]), typeof(string), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof(bool), typeof(Xwt.Drawing.Image), typeof(bool), typeof(Xwt.Drawing.Image), typeof(string), typeof(bool), typeof(bool)); filelist.Model = filestore; filelist.TestExpandRow += new Gtk.TestExpandRowHandler(OnTestExpandRow); commitBox = new VBox(); HeaderBox commitMessageLabelBox = new HeaderBox(); commitMessageLabelBox.SetPadding(6, 6, 6, 6); commitMessageLabelBox.SetMargins(1, 1, 0, 0); HBox labBox = new HBox(); labelCommit = new Gtk.Label(GettextCatalog.GetString("Commit message:")); labelCommit.Xalign = 0; labBox.PackStart(new Xwt.ImageView(Xwt.Drawing.Image.FromResource("comment-light-16.png")).ToGtkWidget(), false, false, 0); labBox.PackStart(labelCommit, true, true, 3); commitMessageLabelBox.Add(labBox); commitMessageLabelBox.ShowAll(); //commitBox.PackStart (commitMessageLabelBox, false, false, 0); Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow(); frame.HeightRequest = 75; frame.ShadowType = ShadowType.None; commitText = new TextView(); commitText.WrapMode = WrapMode.WordChar; commitText.Buffer.Changed += OnCommitTextChanged; frame.Add(commitText); commitBox.PackStart(frame, true, true, 0); var paned = new VPanedThin(); paned.HandleWidget = commitMessageLabelBox; paned.Pack1(scroller, true, true); paned.Pack2(commitBox, false, false); main.PackStart(paned, true, true, 0); main.ShowAll(); status.Visible = false; filelist.Selection.Changed += new EventHandler(OnCursorChanged); VersionControlService.FileStatusChanged += OnFileStatusChanged; filelist.HeadersClickable = true; filestore.SetSortFunc(0, CompareNodes); colStatus.SortColumnId = 0; filestore.SetSortFunc(1, CompareNodes); colRemote.SortColumnId = 1; filestore.SetSortFunc(2, CompareNodes); colCommit.SortColumnId = 2; filestore.SetSortFunc(3, CompareNodes); colFile.SortColumnId = 3; filestore.SetSortColumnId(3, Gtk.SortType.Ascending); filelist.DoPopupMenu = DoPopupMenu; StartUpdate(); }