diff options
author | Mikayla Hutchinson <m.j.hutchinson@gmail.com> | 2017-01-26 19:35:44 +0300 |
---|---|---|
committer | Mikayla Hutchinson <m.j.hutchinson@gmail.com> | 2017-01-26 20:33:09 +0300 |
commit | 9baeaf6cdcddfc61bd8641c5b85b118a5734fb39 (patch) | |
tree | 51c5f3511df74d1962923ffd448fa342926ca9a6 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components | |
parent | bfe719850a431ab688e674bcaa4379c04f8f9e3f (diff) | |
parent | 239def51e3a1addbad9cffc818e978a8fc6d8afb (diff) |
Merge remote-tracking branch 'xamarin/vNext' into roslyn-ivt
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs | 34 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs | 15 |
2 files changed, 44 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs index 7888a7ad41..f9921fdf37 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs @@ -215,8 +215,7 @@ namespace MonoDevelop.Ide.Gui.Components store.SetSortColumnId (/* GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID */ -1, Gtk.SortType.Ascending); tree.HeadersVisible = false; - tree.SearchColumn = 0; - tree.EnableSearch = true; + tree.EnableSearch = false; complete_column = new Gtk.TreeViewColumn (); complete_column.Title = "column"; @@ -1585,15 +1584,23 @@ namespace MonoDevelop.Ide.Gui.Components NodeBuilder[] chain1 = (NodeBuilder[]) store.GetValue (a, BuilderChainColumn); if (chain1 == null) return -1; + NodeBuilder [] chain2 = (NodeBuilder [])store.GetValue (b, BuilderChainColumn); + if (chain2 == null) return 1; + compareNode1.MoveToIter (a); compareNode2.MoveToIter (b); + var i1 = GetSortIndex (chain1, compareNode1); + var i2 = GetSortIndex (chain2, compareNode2); + + if (i1 < i2) + return -1; + else if (i1 > i2) + return 1; + int sort = CompareObjects (chain1, compareNode1, compareNode2); if (sort != TypeNodeBuilder.DefaultSort) return sort; - NodeBuilder[] chain2 = (NodeBuilder[]) store.GetValue (b, BuilderChainColumn); - if (chain2 == null) return 1; - if (chain1 != chain2) { sort = CompareObjects (chain2, compareNode2, compareNode1); if (sort != TypeNodeBuilder.DefaultSort) return sort * -1; @@ -1622,6 +1629,17 @@ namespace MonoDevelop.Ide.Gui.Components return result; } + int GetSortIndex (NodeBuilder [] chain, ITreeNavigator node) + { + int result = 0; + for (int n = 0; n < chain.Length; n++) { + int sort = chain [n].GetSortIndex (node); + if (sort != NodeBuilder.DefaultSort) + result = sort; + } + return result; + } + internal bool GetFirstNode (object dataObject, out Gtk.TreeIter iter) { object it; @@ -2074,6 +2092,12 @@ namespace MonoDevelop.Ide.Gui.Components } } + [CommandHandler (SearchCommands.Find)] + void HandleSearchCommand () + { + IdeApp.CommandService.DispatchCommand (MonoDevelop.Components.MainToolbar.Commands.NavigateTo); + } + void Expand (Gtk.TreeIter it) { tree.ExpandRow (store.GetPath (it), false); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs index 3f61621ea2..b7a842d75c 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs @@ -135,6 +135,21 @@ namespace MonoDevelop.Ide.Gui.Components return DefaultSort; } + /// <summary> + /// Gets the sort index for this node + /// </summary> + /// <returns>The sort index.</returns> + /// <param name="node">A tree node.</param> + /// <remarks> + /// The sort index is used to determine the relative ordering of nodes. Nodes with a higher sort index are + /// placed after nodes with lower index. When the index of two nodes is the same, the CompareObjects + /// method is used to determine the ordering. The default value is 0. + /// </remarks> + public virtual int GetSortIndex (ITreeNavigator node) + { + return DefaultSort; + } + // Helper methods internal static bool HasAttribute (ITreeNavigator treeNavigator, NodeAttributes attr, NodeBuilder[] chain, object dataObject) |