diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs')
-rw-r--r-- | main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs index b9496598a4..95f58746ed 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs @@ -162,9 +162,10 @@ namespace MonoDevelop.VersionControl.Views scroller.VscrollbarPolicy = PolicyType.Automatic; filelist.RowActivated += OnRowActivated; filelist.DiffLineActivated += OnDiffLineActivated; + filelist.CommitSelectionToggled += OnCommitSelectionToggled; cellToggle = new CellRendererToggle(); - cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); + cellToggle.Toggled += new ToggledHandler(OnCommitCellToggled); var crc = new CellRendererImage (); crc.StockId = "vc-comment"; colCommit = new TreeViewColumn (); @@ -409,13 +410,14 @@ namespace MonoDevelop.VersionControl.Views 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 -= OnCommitToggledHandler; + cellToggle.Toggled -= OnCommitCellToggled; cellToggle.Destroy (); cellToggle = null; } @@ -455,7 +457,7 @@ namespace MonoDevelop.VersionControl.Views ThreadPool.QueueUserWorkItem (delegate { if (fileList != null) { - var group = fileList.GroupBy (v => v.IsDirectory || v.WorkspaceObject is SolutionItem); + var group = fileList.GroupBy (v => v.IsDirectory || v.WorkspaceObject is SolutionFolderItem); foreach (var item in group) { // Is directory. if (item.Key) { @@ -710,11 +712,8 @@ namespace MonoDevelop.VersionControl.Views OnOpen (null, null); } - void OnCommitToggledHandler(object o, ToggledArgs args) { - TreeIter pos; - if (!filestore.GetIterFromString (out pos, args.Path)) - return; - + void ToggleCommitStatus(TreeIter pos) + { string localpath = (string) filestore.GetValue (pos, ColFullPath); if (changeSet.ContainsFile (localpath)) { @@ -728,6 +727,20 @@ namespace MonoDevelop.VersionControl.Views UpdateSelectionStatus (); } + void OnCommitSelectionToggled (object sender, EventArgs e) + { + filelist.Selection.SelectedForeach((model, path, iter) => ToggleCommitStatus(iter)); + } + + void OnCommitCellToggled(object o, ToggledArgs args) + { + TreeIter pos; + if (!filestore.GetIterFromString (out pos, args.Path)) + return; + + ToggleCommitStatus (pos); + } + VersionInfo GetVersionInfo (string file) { foreach (VersionInfo vi in statuses) @@ -1134,6 +1147,32 @@ namespace MonoDevelop.VersionControl.Views { const Gdk.ModifierType selectionModifiers = Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask; + protected override bool OnKeyPressEvent (Gdk.EventKey evnt) + { + if (evnt.Key == Gdk.Key.Right || evnt.Key == Gdk.Key.KP_Right) { + Selection.SelectedForeach ((model, path, iter) => ExpandRow (path, true)); + return true; + } + + if (evnt.Key == Gdk.Key.Left || evnt.Key == Gdk.Key.KP_Left) { + Selection.SelectedForeach ((model, path, iter) => CollapseRow (path)); + return true; + } + + if (evnt.Key == Gdk.Key.space && CommitSelectionToggled != null) { + CommitSelectionToggled (this, EventArgs.Empty); + return true; + } + + if (evnt.Key == Gdk.Key.Return || evnt.Key == Gdk.Key.KP_Enter) { + if (DiffLineActivated != null) + DiffLineActivated (this, EventArgs.Empty); + return true; + } + + return base.OnKeyPressEvent (evnt); + } + protected override bool OnButtonPressEvent (Gdk.EventButton evnt) { bool keepPos = false; @@ -1228,5 +1267,6 @@ namespace MonoDevelop.VersionControl.Views public Action<Gdk.EventButton> DoPopupMenu; public event EventHandler DiffLineActivated; + public event EventHandler CommitSelectionToggled; } } |