Skip to content

Commit 3a69d57

Browse files
author
SlavaRa
committed
closes #139
1 parent 5798719 commit 3a69d57

File tree

6 files changed

+40
-55
lines changed

6 files changed

+40
-55
lines changed

QuickNavigate/Forms/ClassHierarchyForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace QuickNavigate.Forms
1515
{
16-
public sealed partial class ClassHierarchyForm : ClassModelExplorerForm
16+
public sealed partial class ClassHierarchyForm : QuickForm
1717
{
1818
readonly ClassModel curClass;
1919
readonly Dictionary<string, List<ClassModel>> extendsToClasses;

QuickNavigate/Forms/ClassModelExplorerForm.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

QuickNavigate/Forms/QuickOutlineForm.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ protected override void Navigate()
172172
if (SelectedNode != null) DialogResult = DialogResult.OK;
173173
}
174174

175-
void ShowContextMenu()
175+
protected override void ShowContextMenu()
176176
{
177177
if (!(SelectedNode is TypeNode)) return;
178178
ShowContextMenu(new Point(SelectedNode.Bounds.X, SelectedNode.Bounds.Bottom));
179179
}
180180

181-
void ShowContextMenu(Point position)
181+
protected override void ShowContextMenu(Point position)
182182
{
183183
if (!(SelectedNode is TypeNode)) return;
184184
contextMenu.Items.Clear();
@@ -334,7 +334,7 @@ void OnInputKeyDown(object sender, KeyEventArgs e)
334334
e.Handled = true;
335335
}
336336

337-
void OnTreeNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
337+
protected override void OnTreeNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
338338
{
339339
if (e.Button != MouseButtons.Right) return;
340340
TreeNode node = e.Node as TypeNode;

QuickNavigate/Forms/TypeExplorerForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace QuickNavigate.Forms
1717
{
18-
public sealed partial class TypeExplorerForm : ClassModelExplorerForm
18+
public sealed partial class TypeExplorerForm : QuickForm
1919
{
2020
[NotNull] readonly List<string> closedTypes = new List<string>();
2121
[NotNull] readonly List<string> openedTypes = new List<string>();

QuickNavigate/Helpers/FormHelper.cs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Drawing;
23
using System.Linq;
34
using System.Windows.Forms;
45
using ASCompletion;
@@ -8,12 +9,22 @@
89
using PluginCore;
910
using PluginCore.Localization;
1011
using ProjectManager.Controls;
12+
using QuickNavigate.Forms;
1113
using WeifenLuo.WinFormsUI.Docking;
1214

1315
namespace QuickNavigate.Helpers
1416
{
15-
public abstract class QuickForm : Form
17+
public class QuickForm : Form
1618
{
19+
protected QuickForm() { }
20+
21+
protected QuickForm([NotNull] Settings settings)
22+
{
23+
Settings = settings;
24+
}
25+
26+
[CanBeNull] protected Settings Settings;
27+
1728
/// <summary>
1829
/// The currently selected tree node, or null if nothing is selected.
1930
/// </summary>
@@ -22,6 +33,28 @@ public abstract class QuickForm : Form
2233
protected virtual void Navigate()
2334
{
2435
}
36+
37+
/// <summary>
38+
/// Displays the shortcut menu.
39+
/// </summary>
40+
protected virtual void ShowContextMenu()
41+
{
42+
}
43+
44+
/// <summary>
45+
/// Displays the shortcut menu.
46+
/// </summary>
47+
protected virtual void ShowContextMenu(Point position)
48+
{
49+
}
50+
51+
protected virtual void OnTreeNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
52+
{
53+
if (e.Button != MouseButtons.Right) return;
54+
var node = e.Node as TypeNode;
55+
if (node == null) return;
56+
ShowContextMenu(new Point(e.Location.X, node.Bounds.Bottom));
57+
}
2558
}
2659

2760
class FormHelper

QuickNavigate/QuickNavigate.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,11 @@
7979
</ItemGroup>
8080
<ItemGroup>
8181
<Compile Include="ControlClickManager.cs" />
82-
<Compile Include="Forms\ClassHierarchyForm.cs">
83-
<SubType>Form</SubType>
84-
</Compile>
82+
<Compile Include="Forms\ClassHierarchyForm.cs" />
8583
<Compile Include="Forms\ClassHierarchyForm.Designer.cs">
8684
<DependentUpon>ClassHierarchyForm.cs</DependentUpon>
8785
</Compile>
8886
<Compile Include="Collections\Comparers.cs" />
89-
<Compile Include="Forms\ClassModelExplorerForm.cs">
90-
<SubType>Form</SubType>
91-
</Compile>
9287
<Compile Include="Forms\Nodes.cs" />
9388
<Compile Include="Forms\OpenRecentProjectsForm.cs">
9489
<SubType>Form</SubType>

0 commit comments

Comments
 (0)