-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Set UpdateTimer.Interval to 500ms. Properly Stop and Start it on TextChanged. - Refactored NavigationBar - Extracted out TreeNode classes. - Extracted out Item Renderering. - Extracted out Node Searching. - Extracted out Building the DropDowns. - Extracted out navigating to a MemberTreeNode.
- Loading branch information
Showing
15 changed files
with
901 additions
and
885 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using ASCompletion.Model; | ||
|
||
namespace NavigationBar.Controls | ||
{ | ||
internal class ClassTreeNode : MemberTreeNode | ||
{ | ||
public ClassModel ClassModel { get { return (ClassModel)Model; } } | ||
|
||
public ClassTreeNode(ClassModel classModel, int imageIndex, bool showQualifiedClassNames) | ||
: base(classModel, imageIndex, false) | ||
{ | ||
Text = classModel.Name; | ||
Tag = "class"; | ||
Label = showQualifiedClassNames ? classModel.QualifiedName : classModel.Name; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using ASCompletion.Model; | ||
|
||
namespace NavigationBar.Controls | ||
{ | ||
internal class ImportTreeNode : MemberTreeNode | ||
{ | ||
public ImportTreeNode(ClassModel importModel, int imageIndex, bool showQualifiedClassNames) | ||
: base(importModel, imageIndex, false) | ||
{ | ||
Text = importModel.Name; | ||
Tag = "class"; | ||
Label = showQualifiedClassNames ? importModel.QualifiedName : importModel.Name; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using ASCompletion.Model; | ||
|
||
namespace NavigationBar.Controls | ||
{ | ||
internal class InheritedClassTreeNode : InheritedMemberTreeNode | ||
{ | ||
public InheritedClassTreeNode(ClassModel classModel, int imageIndex, bool showQualifiedClassNames) | ||
: base(classModel, classModel, imageIndex, false) | ||
{ | ||
Text = classModel.Name; | ||
Tag = "class"; | ||
Label = showQualifiedClassNames ? classModel.QualifiedName : classModel.Name; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using ASCompletion.Model; | ||
|
||
namespace NavigationBar.Controls | ||
{ | ||
internal class InheritedMemberTreeNode : MemberTreeNode | ||
{ | ||
public InheritedMemberTreeNode(ClassModel classModel, MemberModel memberModel, int imageIndex, bool labelPropertiesLikeFunctions) | ||
: base(memberModel, imageIndex, labelPropertiesLikeFunctions) | ||
{ | ||
Label = Text + " - " + classModel.Name; | ||
ClassModel = classModel; | ||
} | ||
|
||
public ClassModel ClassModel { get; protected set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using ASCompletion.Model; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Windows.Forms; | ||
|
||
namespace NavigationBar.Controls | ||
{ | ||
internal class MemberTreeNode : TreeNode | ||
{ | ||
public MemberModel Model { get; protected set; } | ||
public string Label { get; protected set; } | ||
|
||
public MemberTreeNode(MemberModel memberModel, int imageIndex, bool labelPropertiesLikeFunctions) | ||
: base(memberModel.ToString(), imageIndex, imageIndex) | ||
{ | ||
if (labelPropertiesLikeFunctions && | ||
(memberModel.Flags & (FlagType.Setter | FlagType.Getter)) != 0) | ||
{ | ||
List<string> paramList = new List<string>(); | ||
if (memberModel.Parameters != null) | ||
paramList.AddRange(memberModel.Parameters.Select(param => string.Format("{0}:{1}", param.Name, param.Type))); | ||
|
||
Label = string.Format("{0} ({1}) : {2}", memberModel.Name, string.Join(", ", paramList.ToArray()), memberModel.Type); | ||
} | ||
else | ||
{ | ||
Label = Text; | ||
} | ||
|
||
Model = memberModel; | ||
Tag = memberModel.Name + "@" + memberModel.LineFrom; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using ASCompletion.Model; | ||
using ASCompletion.Settings; | ||
using System.Collections.Generic; | ||
|
||
namespace NavigationBar.Controls | ||
{ | ||
internal class MemberTreeNodeComparer : IComparer<MemberTreeNode> | ||
{ | ||
private static MemberTreeNodeComparer _sortedComparer = new MemberTreeNodeComparer(null); | ||
private static MemberTreeNodeComparer _byKindComparer = new MemberTreeNodeComparer(new ByKindMemberComparer()); | ||
private static MemberTreeNodeComparer _smartSortComparer = new MemberTreeNodeComparer(new SmartMemberComparer()); | ||
|
||
private IComparer<MemberModel> _memberModelComparer; | ||
|
||
public static MemberTreeNodeComparer GetComparer(OutlineSorting outlineSort) | ||
{ | ||
MemberTreeNodeComparer memberSort = null; | ||
|
||
switch (outlineSort) | ||
{ | ||
case OutlineSorting.Sorted: | ||
memberSort = _sortedComparer; | ||
break; | ||
case OutlineSorting.SortedByKind: | ||
case OutlineSorting.SortedGroup: | ||
memberSort = _byKindComparer; | ||
break; | ||
case OutlineSorting.SortedSmart: | ||
memberSort = _smartSortComparer; | ||
break; | ||
} | ||
|
||
return memberSort; | ||
} | ||
|
||
public MemberTreeNodeComparer(IComparer<MemberModel> memberModelComparer) | ||
{ | ||
_memberModelComparer = memberModelComparer; | ||
} | ||
|
||
public int Compare(MemberTreeNode x, MemberTreeNode y) | ||
{ | ||
return _memberModelComparer != null ? _memberModelComparer.Compare(x.Model, y.Model) : | ||
x.Label.CompareTo(y.Label); | ||
} | ||
} | ||
} |
Oops, something went wrong.