├── QuickNavigate ├── Settings.cs ├── Bin │ └── Release │ │ └── QuickNavigate.dll ├── packages.config ├── Properties │ └── AssemblyInfo.cs ├── SearchUtil.cs ├── Forms │ ├── Nodes.cs │ ├── QuickOutlineForm.Designer.cs │ ├── ClassHierarchyForm.Designer.cs │ ├── TypeExplorerForm.Designer.cs │ ├── OpenRecentFilesForm.Designer.cs │ ├── OpenRecentProjectsForm.Designer.cs │ ├── OpenRecentFilesForm.cs │ ├── OpenRecentProjectsForm.cs │ ├── ClassHierarchyForm.cs │ ├── QuickOutlineForm.cs │ └── TypeExplorerForm.cs ├── QuickNavigate.csproj ├── ControlClickManager.cs ├── Helpers │ └── FormHelper.cs └── PluginMain.cs ├── QuickNavigate.Tests ├── packages.config ├── PluginMainTests.cs ├── Properties │ └── AssemblyInfo.cs ├── Forms │ └── TypeExplorerTests.cs └── QuickNavigate.Tests.csproj ├── .gitignore ├── appman.template ├── CHANGES.md ├── QuickNavigate.sln ├── README.md └── appveyor.yml /QuickNavigate/Settings.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlavaRa/fdplugin-quicknavigate/HEAD/QuickNavigate/Settings.cs -------------------------------------------------------------------------------- /QuickNavigate/Bin/Release/QuickNavigate.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlavaRa/fdplugin-quicknavigate/HEAD/QuickNavigate/Bin/Release/QuickNavigate.dll -------------------------------------------------------------------------------- /QuickNavigate/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /QuickNavigate.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | obj/ 2 | QuickNavigatePlugin.csproj 3 | Controls/OpenResourceForm.resx 4 | Controls/OpenTypeForm.resx 5 | Controls/QuickOutlineForm.resx 6 | packages/ 7 | .vs/ 8 | .vs/QuickNavigate/v14/.suo 9 | -------------------------------------------------------------------------------- /appman.template: -------------------------------------------------------------------------------- 1 | 2 | _ID_ 3 | _NAME_ 4 | _VERSION_ 5 | _BUILD_ 6 | _CHECKSUM_ 7 | _DESC_ 8 | Plugins 9 | _INFO_ 10 | 11 | _URL_ 12 | 13 | 14 | -------------------------------------------------------------------------------- /QuickNavigate.Tests/PluginMainTests.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace QuickNavigate.Tests 6 | { 7 | [TestClass] 8 | public class PluginMainTests 9 | { 10 | [TestMethod] 11 | public void TestNew() 12 | { 13 | PluginMain plugin = new PluginMain(); 14 | Assert.AreEqual(1, plugin.Api); 15 | Assert.AreEqual("QuickNavigate", plugin.Name); 16 | Assert.AreEqual("5e256956-8f0d-4f2b-9548-08673c0adefd", plugin.Guid); 17 | Assert.AreEqual("Canab, SlavaRa", plugin.Author); 18 | Assert.AreEqual("QuickNavigate plugin", plugin.Description); 19 | Assert.AreEqual("http://www.flashdevelop.org/community/", plugin.Help); 20 | Assert.IsNull(plugin.Settings); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | ## develop 2 | - Fix: [ClassHierarchy] The input field does not lose focus after clicking on the list items 3 | - Fix: [OpenRecentFiles] The input field does not lose focus after clicking on the list items 4 | - Fix: [OpenRecentProjects] The input field does not lose focus after clicking on the list items 5 | - Fix: [QuickOutline] The input field does not lose focus after clicking on the list items 6 | - Fix: [TypeExplorer] The input field does not lose focus after clicking on the list items 7 | - Improvement: [TypeExplorer] Skipping the item separator when navigating 8 | - Improvement: [TypeExplorer] If the words `Main` or `main` starts with the entered text, then the `Document Class` in the list is the first item 9 | - Fix: [QuickOutline] Selection a constructor occurs if the words `constructor`(ActionScript|Haxe) or `new`(Haxe) starts with the text entered 10 | - Fix: [QuickOutline] Select the first node if search text is empty 11 | - Fix: [TypeExplorer] Select the first node when entering text if the list of matches is not empty 12 | - Update to JetBrains.Annotations v11.0.0 13 | - Update to .NET Framework 4.0 14 | -------------------------------------------------------------------------------- /QuickNavigate/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System.Reflection; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | 7 | // Information about this assembly is defined by the following 8 | // attributes. 9 | // 10 | // change them to the information which is associated with the assembly 11 | // you compile. 12 | 13 | [assembly: AssemblyTitle("QuickNavigate")] 14 | [assembly: AssemblyDescription("QuickNavigate Plugin For FlashDevelop")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCompany("Canab, SlavaRa")] 17 | [assembly: AssemblyProduct("QuickNavigate")] 18 | [assembly: AssemblyCopyright("FlashDevelop.org 2005-2016")] 19 | [assembly: AssemblyTrademark("")] 20 | [assembly: AssemblyCulture("")] 21 | 22 | // This sets the default COM visibility of types in the assembly to invisible. 23 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 24 | [assembly: ComVisible(true)] 25 | 26 | // The assembly version has following format : 27 | // 28 | // Major.Minor.Build.Revision 29 | // 30 | // You can specify all values by your own or you can build default build and revision 31 | // numbers with the '*' character (the default): 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | 34 | [assembly: InternalsVisibleTo("QuickNavigate.Tests")] 35 | [assembly: GuidAttribute("5e256956-8f0d-4f2b-9548-08673c0adefd")] 36 | -------------------------------------------------------------------------------- /QuickNavigate.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("QuickNavigate.Tests")] 10 | [assembly: AssemblyDescription("Tests of QuickNavigate Plugin For FlashDevelop")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("SlavaRa")] 13 | [assembly: AssemblyProduct("QuickNavigate.Tests")] 14 | [assembly: AssemblyCopyright("FlashDevelop.org 2014-2016")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(true)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("1b00ebd2-2225-46f5-acee-e266a6651a10")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | [assembly: AssemblyDelaySign(false)] 39 | [assembly: AssemblyKeyFile("")] -------------------------------------------------------------------------------- /QuickNavigate/SearchUtil.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using ASCompletion.Model; 7 | using JetBrains.Annotations; 8 | 9 | namespace QuickNavigate 10 | { 11 | internal static class SearchUtil 12 | { 13 | [NotNull, ItemNotNull] 14 | public static List FindAll([NotNull, ItemNotNull] List items, [NotNull] string search) 15 | { 16 | var length = search.Length; 17 | if (length == 0) return items; 18 | var result = items.FindAll(it => IsMatch(it, search, length)); 19 | return result; 20 | } 21 | 22 | [NotNull, ItemNotNull] 23 | public static List FindAll([NotNull, ItemNotNull] List items, [NotNull] string search) 24 | { 25 | var length = search.Length; 26 | if (length == 0) return items; 27 | var result = items.FindAll(it => IsMatch(it.FullName, search, length)); 28 | return result; 29 | } 30 | 31 | [NotNull, ItemNotNull] 32 | public static List FindAll([NotNull, ItemNotNull] List items, [NotNull] string search, Func match) 33 | { 34 | var length = search.Length; 35 | if (length == 0) return items; 36 | var result = items.FindAll(it => IsMatch(it.FullName, search, length) || match(it)); 37 | return result; 38 | } 39 | 40 | public static bool IsMatch([NotNull] string word, [NotNull] string search, int length) 41 | { 42 | var score = PluginCore.Controls.CompletionList.SmartMatch(word, search, length); 43 | return score > 0 && score < 6; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /QuickNavigate.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickNavigate", "QuickNavigate\QuickNavigate.csproj", "{36B91299-9080-4052-839D-74166B18DD24}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickNavigate.Tests", "QuickNavigate.Tests\QuickNavigate.Tests.csproj", "{7C5E9EAE-6168-473D-8FDE-E1C7C84FE04B}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|x86 = Debug|x86 14 | Release|Any CPU = Release|Any CPU 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {36B91299-9080-4052-839D-74166B18DD24}.Debug|Any CPU.ActiveCfg = Release|Any CPU 19 | {36B91299-9080-4052-839D-74166B18DD24}.Debug|Any CPU.Build.0 = Release|Any CPU 20 | {36B91299-9080-4052-839D-74166B18DD24}.Debug|x86.ActiveCfg = Debug|x86 21 | {36B91299-9080-4052-839D-74166B18DD24}.Debug|x86.Build.0 = Debug|x86 22 | {36B91299-9080-4052-839D-74166B18DD24}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {36B91299-9080-4052-839D-74166B18DD24}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {36B91299-9080-4052-839D-74166B18DD24}.Release|x86.ActiveCfg = Release|x86 25 | {36B91299-9080-4052-839D-74166B18DD24}.Release|x86.Build.0 = Release|x86 26 | {7C5E9EAE-6168-473D-8FDE-E1C7C84FE04B}.Debug|Any CPU.ActiveCfg = Release|Any CPU 27 | {7C5E9EAE-6168-473D-8FDE-E1C7C84FE04B}.Debug|Any CPU.Build.0 = Release|Any CPU 28 | {7C5E9EAE-6168-473D-8FDE-E1C7C84FE04B}.Debug|x86.ActiveCfg = Debug|Any CPU 29 | {7C5E9EAE-6168-473D-8FDE-E1C7C84FE04B}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {7C5E9EAE-6168-473D-8FDE-E1C7C84FE04B}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {7C5E9EAE-6168-473D-8FDE-E1C7C84FE04B}.Release|x86.ActiveCfg = Release|Any CPU 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | QuickNavigate plugin for [FlashDevelop](http://flashdevelop.org)/[HaxeDevelop](https://haxedevelop.org/) 2 | ======================== 3 | [![Build status](https://ci.appveyor.com/api/projects/status/2ilh8bc97hl52hye?svg=true)](https://ci.appveyor.com/project/slavara/fdplugin-quicknavigate) 4 | [![Github Issues](https://img.shields.io/github/issues/SlavaRa/fdplugin-quicknavigate.svg)](https://github.com/SlavaRa/fdplugin-quicknavigate/issues) 5 | 6 | ### Installation 7 | 8 | Download [the latest release](https://github.com/SlavaRa/fdplugin-quicknavigate/releases). Open the .fdz file with FlashDevelop/HaxeDevelop. 9 | 10 | ### Usage 11 | 12 | Open Search in the topmenu. 13 | 14 | ![image](https://cloud.githubusercontent.com/assets/576184/11501695/7f45d91a-9836-11e5-98d1-8eb4c59c29ec.png) 15 | 16 | ### Features 17 | 18 | ##### 1. Type Explorer 19 | Shortcut: QuickNavigate.TypeExplorer
20 | ![image](https://dl.dropboxusercontent.com/u/63456010/GitHub/QuickNavigate/TypeExplorer.gif) 21 | 22 | Synchronize input field with selected type, shortcut: ctrl+right
23 | ![image](https://dl.dropboxusercontent.com/u/63456010/GitHub/QuickNavigate/TypeExplorerSyncWithSelectedType.gif) 24 | 25 | Outline mode
26 | ![image](https://dl.dropboxusercontent.com/u/63456010/GitHub/QuickNavigate/TypeExplorer.Outline.gif) 27 | 28 | ##### 2. Quick Outline 29 | Shortcut: QuickNavigate.Outline
30 | ![image](https://dl.dropboxusercontent.com/u/63456010/GitHub/QuickNavigate/QuickOutlineForm.gif) 31 | 32 | ##### 3. Class Hierarchy 33 | Shortcut: QuickNavigate.ClassHierarchy
34 | ![image](https://dl.dropboxusercontent.com/u/63456010/GitHub/QuickNavigate/ClassHierarchy.gif) 35 | 36 | ##### 4. Recent files 37 | Shortcut: QuickNavigate.RecentFiles
38 | ![Image](https://dl.dropboxusercontent.com/u/63456010/GitHub/QuickNavigate/OpenRecentFiles.gif) 39 | 40 | ##### 5. Recent projects 41 | Shortcut: QuickNavigate.RecentProjects
42 | ![Image](https://dl.dropboxusercontent.com/u/63456010/GitHub/QuickNavigate/OpenRecentProjects.gif) 43 | 44 | ##### 6. Go to previous/next member 45 | Shortcuts: QuickNavigate.GotoPreviousMember, QuickNavigate.GotoNextMember 46 | 47 | ##### 7. Go to previous/next editor tab 48 | Shortcuts: QuickNavigate.GotoPreviousTab, QuickNavigate.GotoNextTab 49 | -------------------------------------------------------------------------------- /QuickNavigate.Tests/Forms/TypeExplorerTests.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using ASCompletion.Model; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | using QuickNavigate.Forms; 6 | 7 | namespace QuickNavigate.Tests.Forms 8 | { 9 | [TestClass] 10 | public class TypeExplorerTests 11 | { 12 | [TestMethod] 13 | public void TestNewTypeNode() 14 | { 15 | var model = new ClassModel 16 | { 17 | InFile = new FileModel 18 | { 19 | FileName = "test/TestClass.as", 20 | Package = "test" 21 | }, 22 | Name = "TestClass" 23 | }; 24 | var node = new ClassNode(model, 0); 25 | Assert.AreEqual(model, node.Model); 26 | Assert.IsFalse(node.IsPrivate); 27 | Assert.IsNull(node.Module); 28 | Assert.AreEqual("TestClass", node.Text); 29 | Assert.AreEqual("test", node.In); 30 | } 31 | 32 | [TestMethod] 33 | public void TestNewTypeNodeWithClassFromSWC() 34 | { 35 | var model = new ClassModel 36 | { 37 | InFile = new FileModel 38 | { 39 | FileName = "../libs/playerglobal.swc/flash/display/DisplayObject", 40 | Package = "flash.display" 41 | }, 42 | Name = "DisplayObject" 43 | }; 44 | var node = new ClassNode(model, 0); 45 | Assert.AreEqual("playerglobal.swc", node.Module); 46 | Assert.AreEqual("DisplayObject", node.Text); 47 | Assert.AreEqual("flash.display", node.In); 48 | } 49 | 50 | [TestMethod] 51 | public void TestNewTypeNodeWithPrivateClass() 52 | { 53 | var model = new ClassModel 54 | { 55 | InFile = new FileModel 56 | 57 | { 58 | FileName = "test/TestClass.as", 59 | Package = "test" 60 | }, 61 | Name = "TestClass2", 62 | Access = Visibility.Private 63 | }; 64 | var node = new ClassNode(model, 0); 65 | Assert.IsTrue(node.IsPrivate); 66 | Assert.AreEqual("TestClass2", node.Text); 67 | Assert.AreEqual("test.TestClass", node.In); 68 | } 69 | 70 | } 71 | } -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | os: Visual Studio 2017 2 | environment: 3 | ID: quicknavigate 4 | PLUGIN_VERSION: 3.0 5 | PLUGIN_NAME: QuickNavigate 6 | PLUGIN_DESC: Quickly navigate through Types, Fields, Projects and more 7 | PLUGIN_PATH: C:\projects\FlashDevelop\External\Plugins\QuickNavigate 8 | PLUGIN_DLL: C:\projects\FlashDevelop\FlashDevelop\Bin\Release\Plugins\QuickNavigate.dll 9 | PLUGIN_INFO: http:\/\/www.flashdevelop.org\/community\/viewtopic.php?f=4&t=5961 10 | PLUGIN_GITHUB_RELEASES: https:\/\/github.com\/SlavaRa\/fdplugin-quicknavigate\/releases 11 | APPMAN_TEMPLATE: C:\projects\FlashDevelop\External\Plugins\QuickNavigate\appman.template 12 | APPMAN_CONFIG_XML: appman.txt 13 | install: 14 | - set PATH=С:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin;%PATH% 15 | version: $(PLUGIN_VERSION).{build} 16 | skip_tags: true 17 | init: 18 | - git clone -q --branch=master https://github.com/fdorg/flashdevelop.git C:\projects\FlashDevelop 19 | matrix: 20 | fast_finish: true 21 | before_build: 22 | build: off 23 | build_script: 24 | - cd c:\ 25 | - mv %APPVEYOR_BUILD_FOLDER% %PLUGIN_PATH% 26 | - nuget restore %PLUGIN_PATH%\%PLUGIN_NAME%.sln 27 | - msbuild /p:Configuration=Release /p:Platform="Any CPU" /v:m %PLUGIN_PATH%\%PLUGIN_NAME%.sln 28 | after_build: 29 | - mkdir %APPVEYOR_BUILD_FOLDER%\$(BaseDir)\Plugins 30 | - mv %PLUGIN_DLL% %APPVEYOR_BUILD_FOLDER%\$(BaseDir)\Plugins\%PLUGIN_NAME%.dll 31 | - cd %APPVEYOR_BUILD_FOLDER% 32 | - 7z a %PLUGIN_NAME%.zip $(BaseDir)\ 33 | - mv %PLUGIN_NAME%.zip %PLUGIN_NAME%.fdz 34 | - rm -rf %APPVEYOR_BUILD_FOLDER%\$(BaseDir) 35 | - md5sum %PLUGIN_NAME%.fdz > checksum.md5 36 | - sed -e "s/.//" checksum.md5 > checksum.tmp.md5 && mv checksum.tmp.md5 checksum.md5 37 | - sed -e "s/ .*//" checksum.md5 > checksum.tmp.md5 && mv checksum.tmp.md5 checksum.md5 38 | - set /p CHECKSUM= 0 ? "new" : it.FullName; 19 | var node = new MemberNode(it.ToString(), icon, icon) 20 | { 21 | InFile = inFile, 22 | Tag = $"{constrDecl}@{it.LineFrom}" 23 | }; 24 | return node; 25 | } 26 | 27 | public static TreeNode CreateTreeNode(ClassModel classModel) => new ClassNode(classModel, PluginUI.GetIcon(classModel.Flags, classModel.Access)); 28 | } 29 | 30 | public class MemberNode : TreeNode 31 | { 32 | public FileModel InFile; 33 | 34 | public MemberNode(string text, int imageIndex, int selectedImageIndex) : base(text, imageIndex, selectedImageIndex) 35 | { 36 | } 37 | } 38 | 39 | public class ClassNode : TreeNode 40 | { 41 | public ClassModel Model; 42 | public FileModel InFile; 43 | public new string Name; 44 | public string In; 45 | public string NameInLowercase; 46 | public string Package; 47 | public string Module; 48 | public bool IsPrivate; 49 | 50 | public ClassNode([NotNull] ClassModel model, int icon) : this(model, icon, icon) 51 | { 52 | } 53 | 54 | public ClassNode([NotNull] ClassModel model, int imageIndex, int selectedImageIndex) 55 | { 56 | Model = model; 57 | Name = model.Name; 58 | InFile = model.InFile ?? FileModel.Ignore; 59 | Package = InFile.Package; 60 | IsPrivate = (model.Access & Visibility.Private) > 0; 61 | Text = Name; 62 | Tag = "class"; 63 | In = Package; 64 | if (IsPrivate) 65 | { 66 | In = Path.GetFileNameWithoutExtension(InFile.FileName); 67 | if (!string.IsNullOrEmpty(Package)) In = $"{Package}.{In}"; 68 | } 69 | else if (InFile.Context.Features.hasModules) 70 | { 71 | var module = InFile.Module; 72 | if (!string.IsNullOrEmpty(module) && module != Name) In = !string.IsNullOrEmpty(In) ? $"{In}.{module}" : module; 73 | } 74 | ImageIndex = imageIndex; 75 | SelectedImageIndex = selectedImageIndex; 76 | if (InFile == FileModel.Ignore) return; 77 | var match = Regex.Match(InFile.FileName, @"\S*.swc", RegexOptions.Compiled); 78 | if (match.Success) Module = Path.GetFileName(match.Value); 79 | } 80 | } 81 | 82 | class ClassHierarchyNode : ClassNode 83 | { 84 | public ClassHierarchyNode([NotNull] ClassModel model, int imageIndex, int selectedImageIndex) 85 | : base(model, imageIndex, selectedImageIndex) 86 | { 87 | Text = model.Type; 88 | } 89 | 90 | public bool Enabled = true; 91 | } 92 | } -------------------------------------------------------------------------------- /QuickNavigate/Forms/QuickOutlineForm.Designer.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | namespace QuickNavigate.Forms 4 | { 5 | sealed partial class QuickOutlineForm 6 | { 7 | /// 8 | /// Required designer variable. 9 | /// 10 | private System.ComponentModel.IContainer components = null; 11 | 12 | /// 13 | /// Disposes of the resources (other than memory) used by the . 14 | /// 15 | /// true to release both managed and unmanaged resources; false to release only unmanaged resources. 16 | protected override void Dispose(bool disposing) 17 | { 18 | if (disposing) 19 | { 20 | components?.Dispose(); 21 | } 22 | base.Dispose(disposing); 23 | } 24 | 25 | #region Windows Form Designer generated code 26 | 27 | /// 28 | /// Required method for Designer support - do not modify 29 | /// the contents of this method with the code editor. 30 | /// 31 | private void InitializeComponent() 32 | { 33 | this.input = new System.Windows.Forms.TextBox(); 34 | this.tree = new System.Windows.Forms.TreeView(); 35 | this.SuspendLayout(); 36 | // 37 | // input 38 | // 39 | this.input.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 40 | | System.Windows.Forms.AnchorStyles.Right))); 41 | this.input.Location = new System.Drawing.Point(12, 12); 42 | this.input.Name = "input"; 43 | this.input.Size = new System.Drawing.Size(305, 21); 44 | this.input.TabIndex = 0; 45 | this.input.TextChanged += new System.EventHandler(this.OnInputTextChanged); 46 | this.input.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.OnInputPreviewKeyDown); 47 | this.input.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnInputKeyDown); 48 | // 49 | // tree 50 | // 51 | this.tree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 52 | | System.Windows.Forms.AnchorStyles.Left) 53 | | System.Windows.Forms.AnchorStyles.Right))); 54 | this.tree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 55 | this.tree.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; 56 | this.tree.HideSelection = false; 57 | this.tree.Location = new System.Drawing.Point(12, 40); 58 | this.tree.Name = "tree"; 59 | this.tree.ShowPlusMinus = false; 60 | this.tree.ShowRootLines = false; 61 | this.tree.Size = new System.Drawing.Size(305, 158); 62 | this.tree.TabIndex = 1; 63 | this.tree.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.OnTreeDrawNode); 64 | this.tree.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.OnTreeNodeMouseClick); 65 | this.tree.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.OnTreeNodeMouseDoubleClick); 66 | // 67 | // QuickOutline 68 | // 69 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 70 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 71 | this.ClientSize = new System.Drawing.Size(330, 230); 72 | this.Controls.Add(this.tree); 73 | this.Controls.Add(this.input); 74 | this.KeyPreview = true; 75 | this.MaximizeBox = false; 76 | this.MinimizeBox = false; 77 | this.MinimumSize = new System.Drawing.Size(320, 200); 78 | this.Name = "QuickOutline"; 79 | this.ShowIcon = false; 80 | this.ShowInTaskbar = false; 81 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 82 | this.Text = "Quick Outline"; 83 | this.ResumeLayout(false); 84 | this.PerformLayout(); 85 | } 86 | 87 | #endregion 88 | 89 | private System.Windows.Forms.TextBox input; 90 | private System.Windows.Forms.TreeView tree; 91 | } 92 | } -------------------------------------------------------------------------------- /QuickNavigate/Forms/ClassHierarchyForm.Designer.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | namespace QuickNavigate.Forms 4 | { 5 | sealed partial class ClassHierarchyForm 6 | { 7 | /// 8 | /// Required designer variable. 9 | /// 10 | private System.ComponentModel.IContainer components = null; 11 | 12 | /// 13 | /// Disposes of the resources (other than memory) used by the . 14 | /// 15 | /// true to release both managed and unmanaged resources; false to release only unmanaged resources. 16 | protected override void Dispose(bool disposing) 17 | { 18 | if (disposing) 19 | { 20 | components?.Dispose(); 21 | } 22 | base.Dispose(disposing); 23 | } 24 | 25 | #region Windows Form Designer generated code 26 | 27 | /// 28 | /// Required method for Designer support - do not modify 29 | /// the contents of this method with the code editor. 30 | /// 31 | private void InitializeComponent() 32 | { 33 | this.input = new System.Windows.Forms.TextBox(); 34 | this.tree = new System.Windows.Forms.TreeView(); 35 | this.infoLabel = new System.Windows.Forms.Label(); 36 | this.SuspendLayout(); 37 | // 38 | // input 39 | // 40 | this.input.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 41 | | System.Windows.Forms.AnchorStyles.Right))); 42 | this.input.Location = new System.Drawing.Point(12, 26); 43 | this.input.Name = "input"; 44 | this.input.Size = new System.Drawing.Size(365, 21); 45 | this.input.TabIndex = 0; 46 | this.input.TextChanged += new System.EventHandler(this.OnInputTextChanged); 47 | this.input.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.OnInputPreviewKeyDown); 48 | this.input.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnInputKeyDown); 49 | // 50 | // tree 51 | // 52 | this.tree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 53 | | System.Windows.Forms.AnchorStyles.Left) 54 | | System.Windows.Forms.AnchorStyles.Right))); 55 | this.tree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 56 | this.tree.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; 57 | this.tree.HideSelection = false; 58 | this.tree.Location = new System.Drawing.Point(12, 52); 59 | this.tree.Name = "tree"; 60 | this.tree.Size = new System.Drawing.Size(365, 200); 61 | this.tree.TabIndex = 1; 62 | this.tree.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.OnTreeDrawNode); 63 | this.tree.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.OnTreeNodeMouseClick); 64 | this.tree.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.OnTreeNodeMouseDoubleClick); 65 | // 66 | // infoLabel 67 | // 68 | this.infoLabel.AutoSize = true; 69 | this.infoLabel.Location = new System.Drawing.Point(12, 9); 70 | this.infoLabel.Name = "infoLabel"; 71 | this.infoLabel.Size = new System.Drawing.Size(271, 13); 72 | this.infoLabel.TabIndex = 2; 73 | this.infoLabel.Text = "Search string: (UPPERCASE for search by abbreviation)"; 74 | // 75 | // ClassHierarchy 76 | // 77 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 78 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 79 | this.ClientSize = new System.Drawing.Size(390, 255); 80 | this.Controls.Add(this.infoLabel); 81 | this.Controls.Add(this.tree); 82 | this.Controls.Add(this.input); 83 | this.KeyPreview = true; 84 | this.MaximizeBox = false; 85 | this.MinimizeBox = false; 86 | this.MinimumSize = new System.Drawing.Size(320, 200); 87 | this.Name = "ClassHierarchy"; 88 | this.ShowIcon = false; 89 | this.ShowInTaskbar = false; 90 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 91 | this.Text = "Class Hierarchy"; 92 | this.ResumeLayout(false); 93 | this.PerformLayout(); 94 | } 95 | 96 | #endregion 97 | 98 | private System.Windows.Forms.TextBox input; 99 | private System.Windows.Forms.TreeView tree; 100 | private System.Windows.Forms.Label infoLabel; 101 | } 102 | } -------------------------------------------------------------------------------- /QuickNavigate/Forms/TypeExplorerForm.Designer.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | namespace QuickNavigate.Forms 4 | { 5 | sealed partial class TypeExplorerForm 6 | { 7 | /// 8 | /// Required designer variable. 9 | /// 10 | private System.ComponentModel.IContainer components = null; 11 | 12 | #region Windows Form Designer generated code 13 | 14 | /// 15 | /// Required method for Designer support - do not modify 16 | /// the contents of this method with the code editor. 17 | /// 18 | private void InitializeComponent() 19 | { 20 | this.infoLabel = new System.Windows.Forms.Label(); 21 | this.input = new System.Windows.Forms.TextBox(); 22 | this.tree = new System.Windows.Forms.TreeView(); 23 | this.searchingInExternalClasspaths = new System.Windows.Forms.CheckBox(); 24 | this.SuspendLayout(); 25 | // 26 | // infoLabel 27 | // 28 | this.infoLabel.AutoSize = true; 29 | this.infoLabel.Location = new System.Drawing.Point(12, 9); 30 | this.infoLabel.Name = "infoLabel"; 31 | this.infoLabel.Size = new System.Drawing.Size(271, 13); 32 | this.infoLabel.TabIndex = 2; 33 | this.infoLabel.Text = "Search string: (UPPERCASE for search by abbreviation)"; 34 | // 35 | // input 36 | // 37 | this.input.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 38 | | System.Windows.Forms.AnchorStyles.Right))); 39 | this.input.Location = new System.Drawing.Point(12, 26); 40 | this.input.Name = "input"; 41 | this.input.Size = new System.Drawing.Size(365, 21); 42 | this.input.TabIndex = 0; 43 | this.input.TextChanged += new System.EventHandler(this.OnInputTextChanged); 44 | this.input.PreviewKeyDown += OnInputPreviewKeyDown; 45 | this.input.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnInputKeyDown); 46 | // 47 | // searchingInExternalClasspaths 48 | // 49 | this.searchingInExternalClasspaths.AutoSize = true; 50 | this.searchingInExternalClasspaths.Checked = true; 51 | this.searchingInExternalClasspaths.CheckState = System.Windows.Forms.CheckState.Checked; 52 | this.searchingInExternalClasspaths.Location = new System.Drawing.Point(12, 54); 53 | this.searchingInExternalClasspaths.Name = "searchingInExternalClasspaths"; 54 | this.searchingInExternalClasspaths.Size = new System.Drawing.Size(246, 17); 55 | this.searchingInExternalClasspaths.TabIndex = 1; 56 | this.searchingInExternalClasspaths.Text = "Searching types in external classpaths(Ctrl+E)"; 57 | this.searchingInExternalClasspaths.UseVisualStyleBackColor = true; 58 | this.searchingInExternalClasspaths.CheckStateChanged += new System.EventHandler(OnSearchingModeCheckStateChanged); 59 | // 60 | // tree 61 | // 62 | this.tree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 63 | | System.Windows.Forms.AnchorStyles.Left) 64 | | System.Windows.Forms.AnchorStyles.Right))); 65 | this.tree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 66 | this.tree.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; 67 | this.tree.HideSelection = false; 68 | this.tree.Location = new System.Drawing.Point(12, 77); 69 | this.tree.Name = "tree"; 70 | this.tree.ShowLines = false; 71 | this.tree.ShowPlusMinus = false; 72 | this.tree.ShowRootLines = false; 73 | this.tree.Size = new System.Drawing.Size(365, 143); 74 | this.tree.TabIndex = 2; 75 | this.tree.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.OnTreeDrawNode); 76 | this.tree.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.OnTreeNodeMouseClick); 77 | this.tree.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.OnTreeNodeMouseDoubleClick); 78 | // 79 | // TypeExplorer 80 | // 81 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 82 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 83 | this.ClientSize = new System.Drawing.Size(390, 255); 84 | this.Controls.Add(this.searchingInExternalClasspaths); 85 | this.Controls.Add(this.tree); 86 | this.Controls.Add(this.input); 87 | this.Controls.Add(this.infoLabel); 88 | this.KeyPreview = true; 89 | this.MaximizeBox = false; 90 | this.MinimizeBox = false; 91 | this.MinimumSize = new System.Drawing.Size(320, 200); 92 | this.Name = "TypeExplorer"; 93 | this.ShowIcon = false; 94 | this.ShowInTaskbar = false; 95 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 96 | this.Text = "Type Explorer"; 97 | this.ResumeLayout(false); 98 | this.PerformLayout(); 99 | } 100 | 101 | #endregion 102 | 103 | private System.Windows.Forms.Label infoLabel; 104 | private System.Windows.Forms.TextBox input; 105 | private System.Windows.Forms.TreeView tree; 106 | private System.Windows.Forms.CheckBox searchingInExternalClasspaths; 107 | } 108 | } -------------------------------------------------------------------------------- /QuickNavigate/Forms/OpenRecentFilesForm.Designer.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System; 4 | using System.Windows.Forms; 5 | 6 | namespace QuickNavigate.Forms 7 | { 8 | sealed partial class OpenRecentFilesForm 9 | { 10 | /// 11 | /// Required designer variable. 12 | /// 13 | private System.ComponentModel.IContainer components = null; 14 | 15 | /// 16 | /// Clean up any resources being used. 17 | /// 18 | /// true if managed resources should be disposed; otherwise, false. 19 | protected override void Dispose(bool disposing) 20 | { 21 | if (disposing && (components != null)) 22 | { 23 | components.Dispose(); 24 | } 25 | base.Dispose(disposing); 26 | } 27 | 28 | #region Windows Form Designer generated code 29 | 30 | /// 31 | /// Required method for Designer support - do not modify 32 | /// the contents of this method with the code editor. 33 | /// 34 | private void InitializeComponent() 35 | { 36 | this.input = new System.Windows.Forms.TextBox(); 37 | this.tree = new System.Windows.Forms.ListBox(); 38 | this.cancel = new System.Windows.Forms.Button(); 39 | this.open = new System.Windows.Forms.Button(); 40 | this.SuspendLayout(); 41 | // 42 | // input 43 | // 44 | this.input.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 45 | | System.Windows.Forms.AnchorStyles.Right))); 46 | this.input.BackColor = System.Drawing.SystemColors.Control; 47 | this.input.Location = new System.Drawing.Point(12, 12); 48 | this.input.Name = "input"; 49 | this.input.Size = new System.Drawing.Size(305, 20); 50 | this.input.TabIndex = 1; 51 | this.input.TextChanged += new System.EventHandler(this.OnInputTextChanged); 52 | this.input.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnInputKeyDown); 53 | // 54 | // tree 55 | // 56 | this.tree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 57 | | System.Windows.Forms.AnchorStyles.Left) 58 | | System.Windows.Forms.AnchorStyles.Right))); 59 | this.tree.BackColor = System.Drawing.SystemColors.Control; 60 | this.tree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 61 | this.tree.Location = new System.Drawing.Point(12, 40); 62 | this.tree.Name = "tree"; 63 | this.tree.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; 64 | this.tree.Size = new System.Drawing.Size(305, 158); 65 | this.tree.TabIndex = 2; 66 | this.tree.SelectedIndexChanged += new System.EventHandler(this.OnTreeSelectedIndexChanged); 67 | this.tree.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.OnTreeMouseDoubleClick); 68 | // 69 | // cancel 70 | // 71 | this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 72 | this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 73 | this.cancel.Location = new System.Drawing.Point(242, 224); 74 | this.cancel.Name = "cancel"; 75 | this.cancel.Size = new System.Drawing.Size(75, 23); 76 | this.cancel.TabIndex = 3; 77 | this.cancel.Text = "Cancel"; 78 | this.cancel.UseVisualStyleBackColor = true; 79 | // 80 | // open 81 | // 82 | this.open.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 83 | this.open.DialogResult = System.Windows.Forms.DialogResult.OK; 84 | this.open.Location = new System.Drawing.Point(161, 224); 85 | this.open.Name = "open"; 86 | this.open.Size = new System.Drawing.Size(75, 23); 87 | this.open.TabIndex = 4; 88 | this.open.Text = "Open"; 89 | this.open.UseVisualStyleBackColor = true; 90 | // 91 | // OpenRecentFilesForm 92 | // 93 | this.AcceptButton = this.open; 94 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 96 | this.CancelButton = this.cancel; 97 | this.ClientSize = new System.Drawing.Size(330, 251); 98 | this.Controls.Add(this.open); 99 | this.Controls.Add(this.cancel); 100 | this.Controls.Add(this.tree); 101 | this.Controls.Add(this.input); 102 | this.KeyPreview = true; 103 | this.MaximizeBox = false; 104 | this.MinimizeBox = false; 105 | this.MinimumSize = new System.Drawing.Size(320, 200); 106 | this.Name = "OpenRecentFilesForm"; 107 | this.ShowIcon = false; 108 | this.ShowInTaskbar = false; 109 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 110 | this.Text = "Recent Files"; 111 | this.ResumeLayout(false); 112 | this.PerformLayout(); 113 | 114 | } 115 | 116 | #endregion 117 | 118 | private System.Windows.Forms.TextBox input; 119 | private System.Windows.Forms.ListBox tree; 120 | private Button cancel; 121 | private Button open; 122 | } 123 | } -------------------------------------------------------------------------------- /QuickNavigate.Tests/QuickNavigate.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {7C5E9EAE-6168-473D-8FDE-E1C7C84FE04B} 7 | Library 8 | Properties 9 | QuickNavigate.Tests 10 | QuickNavigate.Tests 11 | v4.5.2 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | AnyCPU 30 | 31 | 32 | pdbonly 33 | true 34 | bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | false 41 | 42 | 43 | false 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | ..\packages\JetBrains.Annotations.11.1.0\lib\net20\JetBrains.Annotations.dll 52 | True 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | {61885F70-B4DC-4B44-852D-5D6D03F2A734} 77 | PluginCore 78 | 79 | 80 | {4EBF2653-9654-4E40-880E-0046B3D6210E} 81 | ASCompletion 82 | 83 | 84 | {36B91299-9080-4052-839D-74166B18DD24} 85 | QuickNavigate 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | False 99 | 100 | 101 | False 102 | 103 | 104 | False 105 | 106 | 107 | False 108 | 109 | 110 | 111 | 112 | 113 | 114 | 121 | -------------------------------------------------------------------------------- /QuickNavigate/QuickNavigate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.30729 7 | 2.0 8 | {36B91299-9080-4052-839D-74166B18DD24} 9 | Library 10 | Properties 11 | QuickNavigate 12 | QuickNavigate 13 | 14 | 15 | 16 | 17 | 3.5 18 | v4.0 19 | 20 | 21 | 22 | 23 | 24 | true 25 | full 26 | false 27 | ..\..\..\..\FlashDevelop\Bin\Debug\Plugins\ 28 | TRACE 29 | prompt 30 | 4 31 | false 32 | 33 | 34 | pdbonly 35 | true 36 | ..\..\..\..\FlashDevelop\Bin\Release\Plugins\ 37 | TRACE 38 | prompt 39 | 4 40 | 41 | 42 | AnyCPU 43 | ..\..\..\..\FlashDevelop\Bin\Debug\Plugins\ 44 | TRACE 45 | false 46 | 47 | 48 | AnyCPU 49 | ..\..\..\..\FlashDevelop\Bin\Release\Plugins\ 50 | TRACE 51 | true 52 | 53 | 54 | false 55 | 56 | 57 | false 58 | 59 | 60 | 61 | 62 | 63 | 64 | 71 | 72 | 73 | ..\packages\JetBrains.Annotations.11.1.0\lib\net20\JetBrains.Annotations.dll 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Form 83 | 84 | 85 | ClassHierarchyForm.cs 86 | 87 | 88 | 89 | Form 90 | 91 | 92 | OpenRecentProjectsForm.cs 93 | 94 | 95 | Form 96 | 97 | 98 | OpenRecentFilesForm.cs 99 | 100 | 101 | Form 102 | 103 | 104 | TypeExplorerForm.cs 105 | 106 | 107 | Form 108 | 109 | 110 | 111 | 112 | Form 113 | 114 | 115 | QuickOutlineForm.cs 116 | 117 | 118 | 119 | 120 | 121 | 122 | {61885f70-b4dc-4b44-852d-5d6d03f2a734} 123 | PluginCore 124 | 125 | 126 | {A2C159C1-7D21-4483-AEB1-38D9FDC4C7F3} 127 | ASClassWizard 128 | 129 | 130 | {4ebf2653-9654-4e40-880e-0046b3d6210e} 131 | ASCompletion 132 | 133 | 134 | {c1aeddbd-7d3c-4c09-9c88-1644d796fd9a} 135 | FileExplorer 136 | 137 | 138 | {78101C01-E186-4954-B1DD-DEBB7905FAD8} 139 | ProjectManager 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /QuickNavigate/Forms/OpenRecentProjectsForm.Designer.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System.Windows.Forms; 4 | 5 | namespace QuickNavigate.Forms 6 | { 7 | sealed partial class OpenRecentProjectsForm 8 | { 9 | /// 10 | /// Required designer variable. 11 | /// 12 | private System.ComponentModel.IContainer components = null; 13 | 14 | /// 15 | /// Clean up any resources being used. 16 | /// 17 | /// true if managed resources should be disposed; otherwise, false. 18 | protected override void Dispose(bool disposing) 19 | { 20 | if (disposing && (components != null)) 21 | { 22 | components.Dispose(); 23 | } 24 | base.Dispose(disposing); 25 | } 26 | 27 | #region Windows Form Designer generated code 28 | 29 | /// 30 | /// Required method for Designer support - do not modify 31 | /// the contents of this method with the code editor. 32 | /// 33 | private void InitializeComponent() 34 | { 35 | this.input = new System.Windows.Forms.TextBox(); 36 | this.tree = new System.Windows.Forms.TreeView(); 37 | this.open = new System.Windows.Forms.Button(); 38 | this.cancel = new System.Windows.Forms.Button(); 39 | this.openInNewWindow = new System.Windows.Forms.Button(); 40 | this.SuspendLayout(); 41 | // 42 | // input 43 | // 44 | this.input.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 45 | | System.Windows.Forms.AnchorStyles.Right))); 46 | this.input.Location = new System.Drawing.Point(12, 12); 47 | this.input.Name = "input"; 48 | this.input.Size = new System.Drawing.Size(305, 20); 49 | this.input.TabIndex = 0; 50 | this.input.TextChanged += new System.EventHandler(this.OnInputTextChanged); 51 | this.input.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnInputKeyDown); 52 | // 53 | // tree 54 | // 55 | this.tree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 56 | | System.Windows.Forms.AnchorStyles.Left) 57 | | System.Windows.Forms.AnchorStyles.Right))); 58 | this.tree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 59 | this.tree.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; 60 | this.tree.HideSelection = false; 61 | this.tree.Location = new System.Drawing.Point(12, 40); 62 | this.tree.Name = "tree"; 63 | this.tree.ShowLines = false; 64 | this.tree.ShowPlusMinus = false; 65 | this.tree.ShowRootLines = false; 66 | this.tree.Size = new System.Drawing.Size(305, 182); 67 | this.tree.TabIndex = 1; 68 | this.tree.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.OnTreeDrawNode); 69 | this.tree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.OnTreeAfterSelect); 70 | this.tree.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.OnTreeMouseDoubleClick); 71 | // 72 | // open 73 | // 74 | this.open.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 75 | this.open.DialogResult = System.Windows.Forms.DialogResult.OK; 76 | this.open.Location = new System.Drawing.Point(161, 225); 77 | this.open.Name = "open"; 78 | this.open.Size = new System.Drawing.Size(75, 23); 79 | this.open.TabIndex = 3; 80 | this.open.Text = "Open"; 81 | this.open.UseVisualStyleBackColor = true; 82 | // 83 | // cancel 84 | // 85 | this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 86 | this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 87 | this.cancel.Location = new System.Drawing.Point(242, 225); 88 | this.cancel.Name = "cancel"; 89 | this.cancel.Size = new System.Drawing.Size(75, 23); 90 | this.cancel.TabIndex = 4; 91 | this.cancel.Text = "Cancel"; 92 | this.cancel.UseVisualStyleBackColor = true; 93 | // 94 | // openInNewWindow 95 | // 96 | this.openInNewWindow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 97 | this.openInNewWindow.Location = new System.Drawing.Point(12, 225); 98 | this.openInNewWindow.Name = "openInNewWindow"; 99 | this.openInNewWindow.Size = new System.Drawing.Size(143, 23); 100 | this.openInNewWindow.TabIndex = 2; 101 | this.openInNewWindow.Text = "Open in new Window"; 102 | this.openInNewWindow.UseVisualStyleBackColor = true; 103 | this.openInNewWindow.Click += new System.EventHandler(this.OnOpenInNewWindowClick); 104 | // 105 | // OpenRecentProjectsForm 106 | // 107 | this.AcceptButton = this.open; 108 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 109 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 110 | this.CancelButton = this.cancel; 111 | this.ClientSize = new System.Drawing.Size(330, 251); 112 | this.Controls.Add(this.openInNewWindow); 113 | this.Controls.Add(this.open); 114 | this.Controls.Add(this.cancel); 115 | this.Controls.Add(this.tree); 116 | this.Controls.Add(this.input); 117 | this.KeyPreview = true; 118 | this.MaximizeBox = false; 119 | this.MinimizeBox = false; 120 | this.MinimumSize = new System.Drawing.Size(320, 200); 121 | this.Name = "OpenRecentProjectsForm"; 122 | this.ShowIcon = false; 123 | this.ShowInTaskbar = false; 124 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 125 | this.Text = "Recent Projects"; 126 | this.ResumeLayout(false); 127 | this.PerformLayout(); 128 | 129 | } 130 | 131 | #endregion 132 | 133 | private System.Windows.Forms.TextBox input; 134 | private System.Windows.Forms.TreeView tree; 135 | private System.Windows.Forms.Button open; 136 | private System.Windows.Forms.Button cancel; 137 | private Button openInNewWindow; 138 | } 139 | } -------------------------------------------------------------------------------- /QuickNavigate/ControlClickManager.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System; 4 | using System.Drawing; 5 | using System.Runtime.InteropServices; 6 | using System.Windows.Forms; 7 | using ASCompletion.Completion; 8 | using ASCompletion.Context; 9 | using PluginCore; 10 | using ScintillaNet; 11 | using ScintillaNet.Configuration; 12 | using ScintillaNet.Enums; 13 | using Keys = System.Windows.Forms.Keys; 14 | 15 | namespace QuickNavigate 16 | { 17 | class ControlClickManager : IDisposable 18 | { 19 | const int CLICK_AREA = 4; //pixels 20 | ScintillaControl sci; 21 | Word currentWord; 22 | Timer timer; 23 | readonly POINT clickedPoint = new POINT(); 24 | 25 | #region MouseHook definitions 26 | 27 | public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); 28 | int hHook; 29 | const int WH_MOUSE = 7; 30 | 31 | HookProc safeHookProc; 32 | 33 | [StructLayout(LayoutKind.Sequential)] 34 | public class POINT 35 | { 36 | public int x; 37 | public int y; 38 | } 39 | 40 | [StructLayout(LayoutKind.Sequential)] 41 | public class MouseHookStruct 42 | { 43 | public POINT pt; 44 | public int hwnd; 45 | public int wHitTestCode; 46 | public int dwExtraInfo; 47 | } 48 | 49 | [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] 50 | public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId); 51 | 52 | [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] 53 | public static extern bool UnhookWindowsHookEx(int idHook); 54 | 55 | [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] 56 | public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam); 57 | 58 | #endregion 59 | 60 | public ControlClickManager() 61 | { 62 | timer = new Timer {Interval = 10}; 63 | timer.Tick += GoToDeclaration; 64 | } 65 | 66 | public void Dispose() 67 | { 68 | if (timer == null) return; 69 | timer.Dispose(); 70 | timer = null; 71 | } 72 | 73 | void GoToDeclaration(object sender, EventArgs e) 74 | { 75 | timer.Stop(); 76 | SetCurrentWord(null); 77 | ASComplete.DeclarationLookup(sci); 78 | } 79 | 80 | public ScintillaControl Sci 81 | { 82 | set 83 | { 84 | if (hHook == 0) 85 | { 86 | safeHookProc = MouseHookProc; 87 | #pragma warning disable 618,612 88 | hHook = SetWindowsHookEx(WH_MOUSE, safeHookProc, (IntPtr)0, AppDomain.GetCurrentThreadId()); 89 | #pragma warning restore 618,612 90 | } 91 | sci = value; 92 | } 93 | } 94 | 95 | int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam) 96 | { 97 | if (nCode >= 0 && sci != null) 98 | { 99 | MouseHookStruct hookStruct = (MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseHookStruct)); 100 | if (wParam == (IntPtr) 513) //mouseDown 101 | { 102 | clickedPoint.x = hookStruct.pt.x; 103 | clickedPoint.y = hookStruct.pt.y; 104 | } 105 | if (Control.ModifierKeys == Keys.Control) 106 | { 107 | if (wParam == (IntPtr) 514) //mouseUp 108 | { 109 | if (currentWord != null && !timer.Enabled) timer.Start(); 110 | } 111 | else 112 | { 113 | if ((Control.MouseButtons & MouseButtons.Left) > 0) 114 | { 115 | int dx = Math.Abs(clickedPoint.x - hookStruct.pt.x); 116 | int dy = Math.Abs(clickedPoint.y - hookStruct.pt.y); 117 | if (currentWord != null && dx > CLICK_AREA || dy > CLICK_AREA) 118 | SetCurrentWord(null); 119 | } 120 | else 121 | { 122 | Point globalPoint = new Point(hookStruct.pt.x, hookStruct.pt.y); 123 | Point localPoint = sci.PointToClient(globalPoint); 124 | ProcessMouseMove(localPoint); 125 | } 126 | } 127 | } 128 | else if (currentWord != null) SetCurrentWord(null); 129 | } 130 | return CallNextHookEx(hHook, nCode, wParam, lParam); 131 | } 132 | 133 | void ProcessMouseMove(Point point) 134 | { 135 | int position = sci.PositionFromPointClose(point.X, point.Y); 136 | if (position < 0) SetCurrentWord(null); 137 | else if (ASContext.Context.IsFileValid) 138 | { 139 | Word word = new Word 140 | { 141 | StartPos = sci.WordStartPosition(position, true), 142 | EndPos = sci.WordEndPosition(position, true) 143 | }; 144 | ASResult expr = ASComplete.GetExpressionType(sci, word.EndPos); 145 | if (expr.IsNull()) 146 | { 147 | string overrideKey = ASContext.Context.Features.overrideKey; 148 | if (expr.Context == null || !expr.Context.BeforeBody || string.IsNullOrEmpty(overrideKey) || sci.GetWordFromPosition(position) != overrideKey) 149 | word = null; 150 | } 151 | SetCurrentWord(word); 152 | } 153 | } 154 | 155 | void SetCurrentWord(Word word) 156 | { 157 | if (Word.Equals(word, currentWord)) return; 158 | if (currentWord != null) UnHighlight(currentWord); 159 | currentWord = word; 160 | if (currentWord != null) Highlight(currentWord); 161 | } 162 | 163 | void UnHighlight(Word word) 164 | { 165 | sci.CursorType = -1; 166 | int mask = 1 << sci.StyleBits; 167 | sci.StartStyling(word.StartPos, mask); 168 | sci.SetStyling(word.EndPos - word.StartPos, 0); 169 | } 170 | 171 | void Highlight(Word word) 172 | { 173 | sci.CursorType = 8; 174 | int mask = 1 << sci.StyleBits; 175 | Language language = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage); 176 | sci.SetIndicStyle(0, (int)IndicatorStyle.RoundBox); 177 | sci.SetIndicFore(0, language.editorstyle.HighlightBackColor); 178 | sci.StartStyling(word.StartPos, mask); 179 | sci.SetStyling(word.EndPos - word.StartPos, mask); 180 | } 181 | } 182 | 183 | class Word 184 | { 185 | public static bool Equals(Word word1, Word word2) 186 | { 187 | if (word1 == null && word2 == null) return true; 188 | if (word1 == null || word2 == null) return false; 189 | return word1.StartPos == word2.StartPos 190 | && word1.EndPos == word2.EndPos; 191 | } 192 | 193 | public int StartPos; 194 | public int EndPos; 195 | } 196 | } -------------------------------------------------------------------------------- /QuickNavigate/Forms/OpenRecentFilesForm.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Windows.Forms; 9 | using JetBrains.Annotations; 10 | using PluginCore; 11 | using QuickNavigate.Helpers; 12 | 13 | namespace QuickNavigate.Forms 14 | { 15 | public sealed partial class OpenRecentFilesForm : Form 16 | { 17 | [NotNull] readonly Settings settings; 18 | 19 | [NotNull] readonly List recentFiles; 20 | 21 | [NotNull] readonly List openedFiles; 22 | 23 | public OpenRecentFilesForm([NotNull] Settings settings) 24 | { 25 | this.settings = settings; 26 | Font = PluginBase.Settings.DefaultFont; 27 | InitializeComponent(); 28 | if (settings.RecentFilesSize.Width > MinimumSize.Width) Size = settings.RecentFilesSize; 29 | recentFiles = PluginBase.MainForm.Settings.PreviousDocuments.Where(File.Exists).ToList(); 30 | openedFiles = FormHelper.FilterOpenedFiles(recentFiles); 31 | recentFiles.RemoveAll(openedFiles.Contains); 32 | InitializeTree(); 33 | InitializeTheme(); 34 | input.LostFocus += (sender, args) => input.Focus(); 35 | RefreshTree(); 36 | } 37 | 38 | int selectedIndex; 39 | 40 | [NotNull] 41 | public List SelectedItems 42 | { 43 | get 44 | { 45 | var result = (from object item in tree.SelectedItems 46 | where item.ToString() != settings.ItemSpacer 47 | select item.ToString()).ToList(); 48 | return result; 49 | } 50 | } 51 | 52 | void InitializeTree() 53 | { 54 | tree.ItemHeight = tree.Font.Height; 55 | } 56 | 57 | void InitializeTheme() 58 | { 59 | input.BackColor = PluginBase.MainForm.GetThemeColor("TextBox.BackColor", SystemColors.Window); 60 | input.ForeColor = PluginBase.MainForm.GetThemeColor("TextBox.ForeColor", SystemColors.WindowText); 61 | tree.BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 62 | tree.ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 63 | open.BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 64 | open.ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 65 | cancel.BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 66 | cancel.ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 67 | BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 68 | ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 69 | } 70 | 71 | void RefreshTree() 72 | { 73 | tree.BeginUpdate(); 74 | tree.Items.Clear(); 75 | FillTree(); 76 | if (tree.Items.Count > 0) 77 | { 78 | selectedIndex = 0; 79 | tree.SelectedIndex = 0; 80 | } 81 | else open.Enabled = false; 82 | tree.EndUpdate(); 83 | } 84 | 85 | void FillTree() 86 | { 87 | var separator = Path.PathSeparator; 88 | var search = input.Text.Replace('\\', separator).Replace('/', separator); 89 | search = FormHelper.Transcriptor(search); 90 | if (openedFiles.Count > 0) 91 | { 92 | var matches = openedFiles; 93 | if (search.Length > 0) matches = SearchUtil.FindAll(openedFiles, search); 94 | if (matches.Count > 0) 95 | { 96 | tree.Items.AddRange(matches.ToArray()); 97 | if (settings.EnableItemSpacer) tree.Items.Add(settings.ItemSpacer); 98 | } 99 | } 100 | if (recentFiles.Count > 0) 101 | { 102 | var matches = recentFiles; 103 | if (search.Length > 0) matches = SearchUtil.FindAll(matches, search); 104 | if (matches.Count > 0) tree.Items.AddRange(matches.ToArray()); 105 | } 106 | } 107 | 108 | void Navigate() 109 | { 110 | if (SelectedItems.Count == 0) return; 111 | DialogResult = DialogResult.OK; 112 | } 113 | 114 | protected override void OnKeyDown(KeyEventArgs e) 115 | { 116 | switch (e.KeyCode) 117 | { 118 | case Keys.Enter: 119 | e.Handled = true; 120 | Navigate(); 121 | break; 122 | case Keys.L: 123 | if (e.Control) 124 | { 125 | input.Focus(); 126 | input.SelectAll(); 127 | } 128 | break; 129 | } 130 | } 131 | 132 | protected override void OnFormClosing(FormClosingEventArgs e) => settings.RecentFilesSize = Size; 133 | 134 | void OnInputTextChanged(object sender, EventArgs e) => RefreshTree(); 135 | 136 | void OnInputKeyDown(object sender, KeyEventArgs e) 137 | { 138 | var prevSelectedIndex = selectedIndex; 139 | var lastIndex = tree.Items.Count - 1; 140 | switch (e.KeyCode) 141 | { 142 | case Keys.L: 143 | e.Handled = e.Control; 144 | return; 145 | case Keys.Down: 146 | if (selectedIndex < lastIndex) ++selectedIndex; 147 | else if (PluginBase.MainForm.Settings.WrapList) selectedIndex = 0; 148 | else 149 | { 150 | e.Handled = true; 151 | return; 152 | } 153 | break; 154 | case Keys.Up: 155 | if (selectedIndex > 0) --selectedIndex; 156 | else if (PluginBase.MainForm.Settings.WrapList) selectedIndex = lastIndex; 157 | else 158 | { 159 | e.Handled = true; 160 | return; 161 | } 162 | break; 163 | case Keys.Home: 164 | selectedIndex = 0; 165 | break; 166 | case Keys.End: 167 | selectedIndex = lastIndex; 168 | break; 169 | default: return; 170 | } 171 | var selectedIndices = tree.SelectedIndices; 172 | if (e.Shift) 173 | { 174 | if (selectedIndices.Contains(selectedIndex) && selectedIndices.Count > 1) 175 | tree.SetSelected(prevSelectedIndex, false); 176 | else 177 | { 178 | var index = selectedIndex; 179 | var delta = selectedIndex - prevSelectedIndex; 180 | var length = Math.Abs(delta); 181 | for (var i = 0; i < length; i++) 182 | { 183 | tree.SetSelected(index, !selectedIndices.Contains(index)); 184 | if (delta > 0) 185 | { 186 | if (index == lastIndex) index = 0; 187 | else ++index; 188 | } 189 | else 190 | { 191 | if (index == 0) index = lastIndex; 192 | else --index; 193 | } 194 | } 195 | } 196 | } 197 | else 198 | { 199 | selectedIndices.Clear(); 200 | tree.SelectedItems.Clear(); 201 | tree.SetSelected(selectedIndex, true); 202 | } 203 | e.Handled = true; 204 | } 205 | 206 | void OnTreeMouseDoubleClick(object sender, MouseEventArgs e) => Navigate(); 207 | 208 | void OnTreeSelectedIndexChanged(object sender, EventArgs e) => open.Enabled = SelectedItems.Count > 0; 209 | } 210 | } -------------------------------------------------------------------------------- /QuickNavigate/Forms/OpenRecentProjectsForm.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Windows.Forms; 9 | using JetBrains.Annotations; 10 | using PluginCore; 11 | using PluginCore.Helpers; 12 | using ProjectManager.Controls; 13 | using QuickNavigate.Helpers; 14 | 15 | namespace QuickNavigate.Forms 16 | { 17 | public sealed partial class OpenRecentProjectsForm : Form 18 | { 19 | [NotNull] readonly Settings settings; 20 | [NotNull] [ItemNotNull] readonly List recentProjects = ProjectManager.PluginMain.Settings.RecentProjects.Where(File.Exists).ToList(); 21 | 22 | public OpenRecentProjectsForm([NotNull] Settings settings) 23 | { 24 | this.settings = settings; 25 | Font = PluginBase.Settings.DefaultFont; 26 | InitializeComponent(); 27 | if (settings.RecentProjectsSize.Width > MinimumSize.Width) Size = settings.RecentProjectsSize; 28 | InitializeTree(); 29 | InitializeContextMenu(); 30 | InitializeTheme(); 31 | openInNewWindow.Visible = PluginBase.MainForm.MultiInstanceMode; 32 | input.LostFocus += (sender, args) => input.Focus(); 33 | RefrestTree(); 34 | } 35 | 36 | [CanBeNull] ContextMenuStrip contextMenu; 37 | 38 | public bool InNewWindow { get; private set; } 39 | 40 | [CanBeNull] 41 | public string SelectedItem => tree.SelectedNode?.Text; 42 | 43 | void InitializeTree() 44 | { 45 | tree.ImageList = new ImageList 46 | { 47 | ColorDepth = ColorDepth.Depth32Bit, 48 | ImageSize = ScaleHelper.Scale(new Size(16, 16)) 49 | }; 50 | tree.ImageList.Images.Add(Icons.Project.Img); 51 | tree.ItemHeight = tree.ImageList.ImageSize.Height; 52 | } 53 | 54 | void InitializeContextMenu() 55 | { 56 | if (!PluginBase.MainForm.MultiInstanceMode) return; 57 | input.ContextMenu = new ContextMenu(); 58 | contextMenu = new ContextMenuStrip {Renderer = new DockPanelStripRenderer(false)}; 59 | contextMenu.Items.Add("Open in new Window").Click += (s, args) => NavigateInNewWindow(); 60 | contextMenu.Items[0].Select(); 61 | } 62 | 63 | void InitializeTheme() 64 | { 65 | input.BackColor = PluginBase.MainForm.GetThemeColor("TextBox.BackColor", SystemColors.Window); 66 | input.ForeColor = PluginBase.MainForm.GetThemeColor("TextBox.ForeColor", SystemColors.WindowText); 67 | tree.BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 68 | tree.ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 69 | open.BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 70 | open.ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 71 | openInNewWindow.BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 72 | openInNewWindow.ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 73 | cancel.BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 74 | cancel.ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 75 | BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 76 | ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 77 | } 78 | 79 | void RefrestTree() 80 | { 81 | if (recentProjects.Count == 0) return; 82 | tree.BeginUpdate(); 83 | tree.Nodes.Clear(); 84 | FillTree(); 85 | if (tree.Nodes.Count > 0) tree.SelectedNode = tree.Nodes[0]; 86 | else RefreshButtons(); 87 | tree.EndUpdate(); 88 | } 89 | 90 | void RefreshButtons() 91 | { 92 | open.Enabled = false; 93 | openInNewWindow.Enabled = false; 94 | } 95 | 96 | void FillTree() 97 | { 98 | var search = input.Text; 99 | search = FormHelper.Transcriptor(search); 100 | var projects = search.Length > 0 ? SearchUtil.FindAll(recentProjects, search) : recentProjects; 101 | if (projects.Count == 0) return; 102 | foreach (var it in projects) 103 | { 104 | tree.Nodes.Add(it, it, 0); 105 | } 106 | } 107 | 108 | void Navigate() 109 | { 110 | if (SelectedItem == null) return; 111 | DialogResult = DialogResult.OK; 112 | } 113 | 114 | void NavigateInNewWindow() 115 | { 116 | InNewWindow = SelectedItem != null; 117 | Navigate(); 118 | } 119 | 120 | void ShowContextMenu() 121 | { 122 | var selectedNode = tree.SelectedNode; 123 | if (selectedNode == null) return; 124 | ShowContextMenu(new Point(selectedNode.Bounds.X, selectedNode.Bounds.Bottom)); 125 | } 126 | 127 | void ShowContextMenu([NotNull] Point position) => contextMenu?.Show(tree, position); 128 | 129 | protected override void OnKeyDown(KeyEventArgs e) 130 | { 131 | switch (e.KeyCode) 132 | { 133 | case Keys.Enter: 134 | e.Handled = true; 135 | Navigate(); 136 | break; 137 | case Keys.L: 138 | if (e.Control) 139 | { 140 | input.Focus(); 141 | input.SelectAll(); 142 | } 143 | break; 144 | case Keys.Apps: 145 | e.Handled = true; 146 | ShowContextMenu(); 147 | break; 148 | } 149 | } 150 | 151 | protected override void OnFormClosing(FormClosingEventArgs e) 152 | { 153 | settings.RecentProjectsSize = Size; 154 | } 155 | 156 | void OnInputTextChanged(object sender, EventArgs e) => RefrestTree(); 157 | 158 | void OnInputKeyDown(object sender, KeyEventArgs e) 159 | { 160 | if (tree.Nodes.Count < 2) return; 161 | var lastIndex = tree.Nodes.Count - 1; 162 | var index = tree.SelectedNode.Index; 163 | switch (e.KeyCode) 164 | { 165 | case Keys.L: 166 | e.Handled = e.Control; 167 | return; 168 | case Keys.Down: 169 | if (index < lastIndex) tree.SelectedNode = tree.SelectedNode.NextNode; 170 | else if (PluginBase.MainForm.Settings.WrapList) tree.SelectedNode = tree.Nodes[0]; 171 | break; 172 | case Keys.Up: 173 | if (index > 0) tree.SelectedNode = tree.SelectedNode.PrevNode; 174 | else if (PluginBase.MainForm.Settings.WrapList) tree.SelectedNode = tree.Nodes[lastIndex]; 175 | break; 176 | case Keys.Home: 177 | tree.SelectedNode = tree.Nodes[0]; 178 | break; 179 | case Keys.End: 180 | tree.SelectedNode = tree.Nodes[lastIndex]; 181 | break; 182 | default: return; 183 | } 184 | e.Handled = true; 185 | } 186 | 187 | void OnTreeMouseDoubleClick(object sender, MouseEventArgs e) => Navigate(); 188 | 189 | void OnTreeAfterSelect(object sender, TreeViewEventArgs e) => open.Enabled = SelectedItem != null; 190 | 191 | void OnTreeDrawNode(object sender, DrawTreeNodeEventArgs e) 192 | { 193 | var fillBrush = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 194 | var textBrush = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 195 | var moduleBrush = Brushes.DimGray; 196 | if ((e.State & TreeNodeStates.Selected) > 0) 197 | { 198 | fillBrush = PluginBase.MainForm.GetThemeColor("TreeView.Highlight", SystemColors.Highlight); 199 | textBrush = PluginBase.MainForm.GetThemeColor("TreeView.HighlightText", SystemColors.HighlightText); 200 | moduleBrush = Brushes.LightGray; 201 | } 202 | var bounds = e.Bounds; 203 | var text = Path.GetFileNameWithoutExtension(e.Node.Text); 204 | float x = bounds.X; 205 | var itemWidth = tree.Width - x; 206 | var graphics = e.Graphics; 207 | graphics.FillRectangle(new SolidBrush(fillBrush), x, bounds.Y, itemWidth, tree.ItemHeight); 208 | var font = tree.Font; 209 | graphics.DrawString(text, font, new SolidBrush(textBrush), x, bounds.Top, StringFormat.GenericDefault); 210 | var path = Path.GetDirectoryName(e.Node.Text); 211 | if (string.IsNullOrEmpty(path)) return; 212 | x += graphics.MeasureString(text, font).Width; 213 | graphics.DrawString($"({path})", font, moduleBrush, x, bounds.Top, StringFormat.GenericDefault); 214 | } 215 | 216 | void OnOpenInNewWindowClick(object sender, EventArgs e) => NavigateInNewWindow(); 217 | } 218 | } -------------------------------------------------------------------------------- /QuickNavigate/Helpers/FormHelper.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Windows.Forms; 7 | using ASCompletion; 8 | using ASCompletion.Context; 9 | using ASCompletion.Model; 10 | using JetBrains.Annotations; 11 | using PluginCore; 12 | using PluginCore.Localization; 13 | using ProjectManager.Controls; 14 | using QuickNavigate.Forms; 15 | using WeifenLuo.WinFormsUI.Docking; 16 | 17 | namespace QuickNavigate.Helpers 18 | { 19 | public class QuickForm : Form 20 | { 21 | protected QuickForm() { } 22 | 23 | protected QuickForm([NotNull] Settings settings) => Settings = settings; 24 | 25 | [CanBeNull] protected Settings Settings; 26 | 27 | /// 28 | /// The currently selected tree node, or null if nothing is selected. 29 | /// 30 | [CanBeNull] public virtual TreeNode SelectedNode { get; } 31 | 32 | protected virtual void Navigate() 33 | { 34 | } 35 | 36 | /// 37 | /// Displays the shortcut menu. 38 | /// 39 | protected virtual void ShowContextMenu() 40 | { 41 | } 42 | 43 | /// 44 | /// Displays the shortcut menu. 45 | /// 46 | protected virtual void ShowContextMenu(Point position) 47 | { 48 | } 49 | 50 | protected virtual void OnTreeNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) 51 | { 52 | if (e.Button != MouseButtons.Right || !(e.Node is ClassNode node)) return; 53 | ShowContextMenu(new Point(e.Location.X, node.Bounds.Bottom)); 54 | } 55 | } 56 | 57 | class FormHelper 58 | { 59 | [NotNull] 60 | internal static readonly ContextMenu EmptyContextMenu = new ContextMenu(); 61 | 62 | public static bool IsFileOpened([NotNull] string fileName) => PluginBase.MainForm.Documents.Any(it => it.FileName == fileName); 63 | 64 | [NotNull] 65 | public static List FilterOpenedFiles([NotNull] ICollection fileNames) 66 | { 67 | var result = (from doc in PluginBase.MainForm.Documents 68 | let fileName = doc.FileName 69 | where fileNames.Contains(fileName) 70 | select fileName).ToList(); 71 | return result; 72 | } 73 | 74 | public static void Navigate([NotNull] MemberModel member) 75 | { 76 | string tag; 77 | if (member is ClassModel) tag = "class"; 78 | else if ((member.Flags & FlagType.Import) > 0) tag = "import"; 79 | else tag = $"{member.Name}@{member.LineFrom}"; 80 | Navigate(new TreeNode(member.Name) {Tag = tag}); 81 | } 82 | 83 | public static void Navigate([NotNull] TreeNode node) 84 | { 85 | if (node is ClassNode) ModelsExplorer.Instance.OpenFile(((ClassNode) node).InFile.FileName); 86 | else if (node is MemberNode) ModelsExplorer.Instance.OpenFile(((MemberNode) node).InFile.FileName); 87 | ASContext.Context.OnSelectOutlineNode(node); 88 | } 89 | 90 | public const string ProjectManagerGUID = "30018864-fadd-1122-b2a5-779832cbbf23"; 91 | 92 | [CanBeNull] 93 | public static ProjectManager.PluginUI GetProjectManagerPluginUI() => GetPluginUI(ProjectManagerGUID); 94 | 95 | [CanBeNull] 96 | public static FileExplorer.PluginUI GetFileExplorerPluginUI() => GetPluginUI("f534a520-bcc7-4fe4-a4b9-6931948b2686"); 97 | 98 | [CanBeNull] 99 | static T GetPluginUI(string pluginGUID) 100 | { 101 | foreach (var pane in PluginBase.MainForm.DockPanel.Panes) 102 | { 103 | foreach (var dockContent in pane.Contents) 104 | { 105 | var content = (DockContent) dockContent; 106 | if (content?.GetPersistString() != pluginGUID) continue; 107 | foreach (var ui in content.Controls.OfType()) 108 | { 109 | return ui; 110 | } 111 | } 112 | } 113 | return default(T); 114 | } 115 | 116 | static readonly Dictionary RuToEn = new Dictionary 117 | { 118 | {'й', 'q'}, 119 | {'ц', 'w'}, 120 | {'у', 'e'}, 121 | {'к', 'r'}, 122 | {'е', 't'}, 123 | {'н', 'y'}, 124 | {'г', 'u'}, 125 | {'ш', 'i'}, 126 | {'щ', 'o'}, 127 | {'з', 'p'}, 128 | {'ф', 'a'}, 129 | {'ы', 's'}, 130 | {'в', 'd'}, 131 | {'а', 'f'}, 132 | {'п', 'g'}, 133 | {'р', 'h'}, 134 | {'о', 'j'}, 135 | {'л', 'k'}, 136 | {'д', 'l'}, 137 | {'я', 'z'}, 138 | {'ч', 'x'}, 139 | {'с', 'c'}, 140 | {'м', 'v'}, 141 | {'и', 'b'}, 142 | {'т', 'n'}, 143 | {'ь', 'm'}, 144 | {'ю', '.'} 145 | }; 146 | 147 | [NotNull] 148 | public static string Transcriptor([NotNull] string s) 149 | { 150 | if (s.Trim().Length == 0) return s; 151 | var result = new string(s.ToCharArray().Select(c => RuToEn.ContainsKey(c) ? RuToEn[c] : c).ToArray()); 152 | return result; 153 | } 154 | } 155 | 156 | class ShortcutId 157 | { 158 | public const string TypeExplorer = "QuickNavigate.TypeExplorer"; 159 | public const string QuickOutline = "QuickNavigate.Outline"; 160 | public const string ClassHierarchy = "QuickNavigate.ClassHierarchy"; 161 | public const string RecentFiles = "QuickNavigate.RecentFiles"; 162 | public const string RecentProjects = "QuickNavigate.RecentProjects"; 163 | public const string GotoNextMember = "QuickNavigate.GotoNextMember"; 164 | public const string GotoPreviousMember = "QuickNavigate.GotoPreviousMember"; 165 | public const string GotoNextTab = "QuickNavigate.GotoNextTab"; 166 | public const string GotoPreviousTab = "QuickNavigate.GotoPreviousTab"; 167 | } 168 | 169 | class QuickContextMenuItem 170 | { 171 | [NotNull] internal static ToolStripMenuItem GotoPositionOrLineMenuItem = 172 | new ToolStripMenuItem("&Goto Position Or Line", PluginBase.MainForm.FindImage("67")) 173 | { 174 | ShortcutKeyDisplayString = "G" 175 | }; 176 | 177 | [NotNull] internal static ToolStripMenuItem ShowInQuickOutlineMenuItem = 178 | new ToolStripMenuItem("Show in Quick &Outline", PluginBase.MainForm.FindImage("315|16|0|0")) 179 | { 180 | ShortcutKeyDisplayString = "O" 181 | }; 182 | 183 | [NotNull] internal static ToolStripMenuItem ShowInClassHierarchyMenuItem = 184 | new ToolStripMenuItem("Show in &Class Hierarchy", PluginBase.MainForm.FindImage("99|16|0|0")) 185 | { 186 | ShortcutKeyDisplayString = "C" 187 | }; 188 | 189 | [NotNull] internal static ToolStripMenuItem ShowInProjectManagerMenuItem = 190 | new ToolStripMenuItem("Show in &Project Manager", PluginBase.MainForm.FindImage("274")) 191 | { 192 | ShortcutKeyDisplayString = "P" 193 | }; 194 | 195 | [NotNull] internal static ToolStripMenuItem ShowInFileExplorerMenuItem = 196 | new ToolStripMenuItem("Show in &File Explorer", PluginBase.MainForm.FindImage("209")) 197 | { 198 | ShortcutKeyDisplayString = "F" 199 | }; 200 | 201 | [NotNull] internal static ToolStripMenuItem SetDocumentClassMenuItem = 202 | new ToolStripMenuItem(TextHelper.GetString("ProjectManager.Label.SetDocumentClass"), Icons.DocumentClass.Img); 203 | } 204 | 205 | class QuickFilter 206 | { 207 | public int ImageIndex; 208 | public FlagType Flag; 209 | public Keys Shortcut; 210 | public string EnabledTip; 211 | public string DisabledTip; 212 | } 213 | 214 | class QuickFilterMenuItem 215 | { 216 | [NotNull] internal static QuickFilter ShowOnlyClasses = new QuickFilter 217 | { 218 | ImageIndex = PluginUI.ICON_TYPE, 219 | Flag = FlagType.Class, 220 | Shortcut = Keys.C, 221 | EnabledTip = "Show only classes(Alt+C or left click)", 222 | DisabledTip = "Show all(Alt+C or left click)" 223 | }; 224 | 225 | [NotNull] internal static QuickFilter ShowOnlyInterfaces = new QuickFilter 226 | { 227 | ImageIndex = PluginUI.ICON_INTERFACE, 228 | Flag = FlagType.Interface, 229 | Shortcut = Keys.I, 230 | EnabledTip = "Show only interfaces(Alt+I or left click)", 231 | DisabledTip = "Show all(Alt+I or left click)" 232 | }; 233 | 234 | [NotNull] internal static QuickFilter ShowOnlyTypeDefs = new QuickFilter 235 | { 236 | ImageIndex = PluginUI.ICON_TEMPLATE, 237 | Flag = FlagType.TypeDef, 238 | Shortcut = Keys.T, 239 | EnabledTip = "Show only typedefs(Alt+T or left click)", 240 | DisabledTip = "Show all(Alt+T or left click)" 241 | }; 242 | 243 | [NotNull] internal static QuickFilter ShowOnlyEnums = new QuickFilter 244 | { 245 | ImageIndex = PluginUI.ICON_TYPE, 246 | Flag = FlagType.Enum, 247 | Shortcut = Keys.E, 248 | EnabledTip = "Show only enums(Alt+E or left click)", 249 | DisabledTip = "Show all(Alt+E or left click)" 250 | }; 251 | 252 | [NotNull] internal static QuickFilter ShowOnlyFields = new QuickFilter 253 | { 254 | ImageIndex = PluginUI.ICON_VAR, 255 | Flag = FlagType.Variable, 256 | Shortcut = Keys.F, 257 | EnabledTip = "Show only fields(Alt+F or left click)", 258 | DisabledTip = "Show all(Alt+F or left click)" 259 | }; 260 | 261 | [NotNull] internal static QuickFilter ShowOnlyProperties = new QuickFilter 262 | { 263 | ImageIndex = PluginUI.ICON_PROPERTY, 264 | Flag = FlagType.Getter | FlagType.Setter, 265 | Shortcut = Keys.P, 266 | EnabledTip = "Show only properties(Alt+P or left click)", 267 | DisabledTip = "Show all(Alt+P or left click)" 268 | }; 269 | 270 | [NotNull] internal static QuickFilter ShowOnlyMethods = new QuickFilter 271 | { 272 | ImageIndex = PluginUI.ICON_FUNCTION, 273 | Flag = FlagType.Function, 274 | Shortcut = Keys.M, 275 | EnabledTip = "Show only methods(Alt+M or left click)", 276 | DisabledTip = "Show all(Alt+M or left click)" 277 | }; 278 | } 279 | } -------------------------------------------------------------------------------- /QuickNavigate/Forms/ClassHierarchyForm.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Windows.Forms; 9 | using ASCompletion; 10 | using ASCompletion.Context; 11 | using ASCompletion.Model; 12 | using JetBrains.Annotations; 13 | using PluginCore; 14 | using QuickNavigate.Helpers; 15 | 16 | namespace QuickNavigate.Forms 17 | { 18 | public sealed partial class ClassHierarchyForm : QuickForm 19 | { 20 | readonly ClassModel curClass; 21 | readonly Dictionary> extendsToClasses; 22 | readonly Dictionary typeToNode = new Dictionary(); 23 | 24 | [NotNull] 25 | static Dictionary> GetAllProjectExtendsClasses() 26 | { 27 | var result = new Dictionary>(); 28 | foreach (var path in ASContext.Context.Classpath) 29 | { 30 | path.ForeachFile(aFile => 31 | { 32 | foreach (var aClass in aFile.Classes) 33 | { 34 | var extendsType = aClass.ExtendsType; 35 | if (string.IsNullOrEmpty(extendsType)) continue; 36 | if (!result.ContainsKey(extendsType)) result[extendsType] = new List(); 37 | result[extendsType].Add(aClass); 38 | } 39 | return true; 40 | }); 41 | } 42 | return result; 43 | } 44 | 45 | [NotNull] 46 | static IEnumerable GetExtends([NotNull] ClassModel theClass) 47 | { 48 | var result = new List(); 49 | var aClass = theClass.Extends; 50 | while (!aClass.IsVoid()) 51 | { 52 | result.Add(aClass); 53 | aClass = aClass.Extends; 54 | } 55 | result.Reverse(); 56 | return result; 57 | } 58 | 59 | /// 60 | /// Initializes a new instance of the QuickNavigate.Controls.ClassHierarchy 61 | /// 62 | /// 63 | /// 64 | public ClassHierarchyForm([NotNull] ClassModel model, [NotNull] Settings settings) : base(settings) 65 | { 66 | curClass = model; 67 | InitializeComponent(); 68 | extendsToClasses = GetAllProjectExtendsClasses(); 69 | InitializeTree(); 70 | InitializeTheme(); 71 | input.LostFocus += (sender, args) => input.Focus(); 72 | RefreshTree(); 73 | } 74 | 75 | public override TreeNode SelectedNode => tree.SelectedNode; 76 | 77 | void InitializeTree() 78 | { 79 | tree.ImageList = ASContext.Panel.TreeIcons; 80 | tree.ItemHeight = tree.ImageList.ImageSize.Height; 81 | } 82 | 83 | void InitializeTheme() 84 | { 85 | input.BackColor = PluginBase.MainForm.GetThemeColor("TextBox.BackColor", SystemColors.Window); 86 | input.ForeColor = PluginBase.MainForm.GetThemeColor("TextBox.ForeColor", SystemColors.WindowText); 87 | tree.BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 88 | tree.ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 89 | BackColor = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 90 | ForeColor = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 91 | } 92 | 93 | void RefreshTree() 94 | { 95 | tree.BeginUpdate(); 96 | tree.Nodes.Clear(); 97 | FillTree(); 98 | tree.ExpandAll(); 99 | tree.EndUpdate(); 100 | } 101 | 102 | void FillTree() 103 | { 104 | typeToNode.Clear(); 105 | if (curClass.IsVoid()) return; 106 | TreeNode parent = null; 107 | int icon; 108 | foreach (var aClass in GetExtends(curClass)) 109 | { 110 | icon = PluginUI.GetIcon(aClass.Flags, aClass.Access); 111 | TreeNode child = new ClassHierarchyNode(aClass, icon, icon); 112 | if (parent == null) tree.Nodes.Add(child); 113 | else parent.Nodes.Add(child); 114 | typeToNode[aClass.Type] = child; 115 | parent = child; 116 | } 117 | icon = PluginUI.GetIcon(curClass.Flags, curClass.Access); 118 | TreeNode node = new ClassHierarchyNode(curClass, icon, icon); 119 | node.NodeFont = new Font(tree.Font, FontStyle.Underline); 120 | if (parent == null) tree.Nodes.Add(node); 121 | else parent.Nodes.Add(node); 122 | tree.SelectedNode = node; 123 | typeToNode[curClass.Type] = node; 124 | FillNode(node); 125 | } 126 | 127 | void FillNode([NotNull] TreeNode node) 128 | { 129 | if (!extendsToClasses.ContainsKey(node.Name)) return; 130 | foreach (var aClass in extendsToClasses[node.Name]) 131 | { 132 | var extends = aClass.InFile.Context.ResolveType(aClass.ExtendsType, aClass.InFile); 133 | if (extends.Type != node.Text) continue; 134 | var icon = PluginUI.GetIcon(aClass.Flags, aClass.Access); 135 | TreeNode child = new ClassHierarchyNode(aClass, icon, icon); 136 | node.Nodes.Add(child); 137 | typeToNode[aClass.Type] = child; 138 | FillNode(child); 139 | } 140 | } 141 | 142 | [CanBeNull] 143 | TreeNode GetNextEnabledNode() 144 | { 145 | var node = tree.SelectedNode; 146 | while (node.NextVisibleNode != null) 147 | { 148 | node = node.NextVisibleNode; 149 | if (((ClassHierarchyNode) node).Enabled) return node; 150 | } 151 | return null; 152 | } 153 | 154 | [CanBeNull] 155 | TreeNode GetPrevEnabledNode() 156 | { 157 | var node = tree.SelectedNode; 158 | while (node.PrevVisibleNode != null) 159 | { 160 | node = node.PrevVisibleNode; 161 | if (((ClassHierarchyNode) node).Enabled) return node; 162 | } 163 | return null; 164 | } 165 | 166 | [CanBeNull] 167 | TreeNode GetFirstEnabledNode() 168 | { 169 | TreeNode result = null; 170 | var node = tree.SelectedNode; 171 | while (node.PrevVisibleNode != null) 172 | { 173 | node = node.PrevVisibleNode; 174 | if (((ClassHierarchyNode) node).Enabled) result = node; 175 | } 176 | return result; 177 | } 178 | 179 | [CanBeNull] 180 | TreeNode GetLastEnabledNode() 181 | { 182 | TreeNode result = null; 183 | var node = tree.SelectedNode; 184 | while (node.NextVisibleNode != null) 185 | { 186 | node = node.NextVisibleNode; 187 | if (((ClassHierarchyNode) node).Enabled) result = node; 188 | } 189 | return result; 190 | } 191 | 192 | protected override void ShowContextMenu() 193 | { 194 | if (SelectedNode == null) return; 195 | ShowContextMenu(new Point(SelectedNode.Bounds.X, SelectedNode.Bounds.Bottom)); 196 | } 197 | 198 | protected override void ShowContextMenu(Point position) 199 | { 200 | if (SelectedNode == null) return; 201 | var classModel = ((ClassNode) SelectedNode).Model; 202 | ContextMenuStrip.Items.Clear(); 203 | ContextMenuStrip.Items.Add(QuickContextMenuItem.GotoPositionOrLineMenuItem); 204 | ContextMenuStrip.Items.Add(QuickContextMenuItem.ShowInQuickOutlineMenuItem); 205 | if (!curClass.Equals(classModel)) ContextMenuStrip.Items.Add(QuickContextMenuItem.ShowInClassHierarchyMenuItem); 206 | ContextMenuStrip.Items.Add(QuickContextMenuItem.ShowInProjectManagerMenuItem); 207 | if (File.Exists(classModel.InFile.FileName)) ContextMenuStrip.Items.Add(QuickContextMenuItem.ShowInFileExplorerMenuItem); 208 | ContextMenuStrip.Show(tree, position); 209 | } 210 | 211 | protected override void Navigate() 212 | { 213 | if (SelectedNode != null) DialogResult = DialogResult.OK; 214 | } 215 | 216 | #region Event Handlers 217 | 218 | protected override void OnShown(EventArgs e) 219 | { 220 | base.OnShown(e); 221 | if (Settings != null && Settings.HierarchyExplorerSize.Width > MinimumSize.Width) Size = Settings.HierarchyExplorerSize; 222 | CenterToParent(); 223 | } 224 | 225 | protected override void OnFormClosing(FormClosingEventArgs e) 226 | { 227 | if (Settings == null) return; 228 | Settings.HierarchyExplorerSize = Size; 229 | } 230 | 231 | protected override void OnKeyDown(KeyEventArgs e) 232 | { 233 | switch (e.KeyCode) 234 | { 235 | case Keys.L: 236 | if (e.Control) 237 | { 238 | input.Focus(); 239 | input.SelectAll(); 240 | } 241 | break; 242 | case Keys.Escape: 243 | Close(); 244 | break; 245 | case Keys.Enter: 246 | e.Handled = true; 247 | Navigate(); 248 | break; 249 | case Keys.Apps: 250 | e.Handled = true; 251 | ShowContextMenu(); 252 | break; 253 | } 254 | } 255 | 256 | protected override void OnTreeNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) 257 | { 258 | var node = e.Node as ClassNode; 259 | if (node == null) return; 260 | tree.SelectedNode = node; 261 | base.OnTreeNodeMouseClick(sender, e); 262 | } 263 | 264 | void OnTreeNodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) => Navigate(); 265 | 266 | void OnTreeDrawNode(object sender, DrawTreeNodeEventArgs e) 267 | { 268 | var node = (ClassHierarchyNode) e.Node; 269 | var fillBrush = PluginBase.MainForm.GetThemeColor("TreeView.BackColor", SystemColors.Window); 270 | var textBrush = PluginBase.MainForm.GetThemeColor("TreeView.ForeColor", SystemColors.WindowText); 271 | if (node.Enabled) 272 | { 273 | if ((e.State & TreeNodeStates.Selected) > 0) 274 | { 275 | fillBrush = PluginBase.MainForm.GetThemeColor("TreeView.Highlight", SystemColors.Highlight); 276 | textBrush = PluginBase.MainForm.GetThemeColor("TreeView.HighlightText", SystemColors.HighlightText); 277 | } 278 | } 279 | else textBrush = Color.DimGray; 280 | var bounds = e.Bounds; 281 | e.Graphics.FillRectangle(new SolidBrush(fillBrush), bounds.X, bounds.Y, tree.Width - bounds.X, tree.ItemHeight); 282 | e.Graphics.DrawString(e.Node.Text, e.Node.NodeFont ?? tree.Font, new SolidBrush(textBrush), e.Bounds.Left, e.Bounds.Top, StringFormat.GenericDefault); 283 | } 284 | 285 | void OnInputTextChanged(object sender, EventArgs e) 286 | { 287 | if (tree.Nodes.Count == 0) return; 288 | var search = input.Text; 289 | search = FormHelper.Transcriptor(search); 290 | var matches = SearchUtil.FindAll(typeToNode.Keys.ToList(), search); 291 | var mathesIsEmpty = matches.Count == 0; 292 | foreach (var k in typeToNode) 293 | { 294 | ((ClassHierarchyNode) k.Value).Enabled = mathesIsEmpty || matches.Contains(k.Key); 295 | } 296 | tree.Refresh(); 297 | if (mathesIsEmpty) tree.SelectedNode = typeToNode[curClass.Type]; 298 | else 299 | { 300 | matches.Sort(); 301 | tree.SelectedNode = typeToNode[matches[0]]; 302 | } 303 | } 304 | 305 | void OnInputPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) 306 | { 307 | if (e.KeyCode == Keys.Apps) input.ContextMenu = SelectedNode != null ? FormHelper.EmptyContextMenu : null; 308 | } 309 | 310 | void OnInputKeyDown(object sender, KeyEventArgs e) 311 | { 312 | TreeNode node; 313 | TreeNode enabledNode = null; 314 | var lastVisibleIndex = tree.VisibleCount - 1; 315 | switch (e.KeyCode) 316 | { 317 | case Keys.Space: 318 | e.Handled = true; 319 | return; 320 | case Keys.L: 321 | e.Handled = e.Control; 322 | return; 323 | case Keys.Down: 324 | node = GetNextEnabledNode(); 325 | if (node != null) tree.SelectedNode = node; 326 | else if (PluginBase.MainForm.Settings.WrapList) 327 | { 328 | node = GetFirstEnabledNode(); 329 | if (node != null) tree.SelectedNode = node; 330 | } 331 | break; 332 | case Keys.Up: 333 | node = GetPrevEnabledNode(); 334 | if (node != null) tree.SelectedNode = node; 335 | else if (PluginBase.MainForm.Settings.WrapList) 336 | { 337 | node = GetLastEnabledNode(); 338 | if (node != null) tree.SelectedNode = node; 339 | } 340 | break; 341 | case Keys.Home: 342 | node = GetFirstEnabledNode(); 343 | if (node != null) tree.SelectedNode = node; 344 | break; 345 | case Keys.End: 346 | node = GetLastEnabledNode(); 347 | if (node != null) tree.SelectedNode = node; 348 | break; 349 | case Keys.PageUp: 350 | node = tree.SelectedNode; 351 | for (var i = 0; i < lastVisibleIndex; i++) 352 | { 353 | if (node.PrevVisibleNode == null) break; 354 | node = node.PrevVisibleNode; 355 | if (((ClassHierarchyNode) node).Enabled) enabledNode = node; 356 | } 357 | if (enabledNode != null) tree.SelectedNode = enabledNode; 358 | break; 359 | case Keys.PageDown: 360 | node = tree.SelectedNode; 361 | for (var i = 0; i < lastVisibleIndex; i++) 362 | { 363 | if (node.NextVisibleNode == null) break; 364 | node = node.NextVisibleNode; 365 | if (((ClassHierarchyNode) node).Enabled) enabledNode = node; 366 | } 367 | if (enabledNode != null) tree.SelectedNode = enabledNode; 368 | break; 369 | default: return; 370 | } 371 | e.Handled = true; 372 | } 373 | 374 | #endregion 375 | } 376 | } -------------------------------------------------------------------------------- /QuickNavigate/Forms/QuickOutlineForm.cs: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Windows.Forms; 8 | using ASCompletion.Context; 9 | using ASCompletion.Model; 10 | using JetBrains.Annotations; 11 | using PluginCore; 12 | using QuickNavigate.Helpers; 13 | 14 | namespace QuickNavigate.Forms 15 | { 16 | public sealed partial class QuickOutlineForm : QuickForm 17 | { 18 | readonly ContextMenuStrip contextMenu = new ContextMenuStrip { Renderer = new DockPanelStripRenderer(false) }; 19 | readonly ContextMenu inputEmptyContextMenu = new ContextMenu(); 20 | readonly List