diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..25c3ede --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,34 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +CSharpRegexTools4Npp is a Notepad++ plugin written in C# that provides regex tools using the .NET regex engine. Features include regex syntax highlighting (via AvalonEdit), match listing with groups/captures, select/extract/replace operations, C# scripting for replacements (via Roslyn/CS-Script), and Excel file support (via ClosedXML). + +## Build + +Open `CSharpRegexTools4Npp.slnx` in Visual Studio 2022+. Select platform (x86 or x64) matching your Notepad++ installation. Build with F5 — post-build targets automatically copy the DLL to the Notepad++ plugins directory and launch Notepad++. + +``` +msbuild CSharpRegexTools4Npp.slnx /p:Configuration=Debug /p:Platform=x64 +``` + +Target framework: .NET Framework 4.8.1, C# 9. `AllowUnsafeBlocks` is enabled in the plugin project. + +There are no automated tests in this project. + +## Architecture + +Two assemblies in the solution: + +- **CSharpRegexTools4Npp** — Plugin entry point and Notepad++ integration layer. `Main.cs` registers menu commands and toolbar buttons. Uses the Plugin Infrastructure (`PluginInfrastructure/`) for IPC with Notepad++ via unmanaged DLL exports and gateway classes (`NotepadPPGateway`, `ScintillaGateway`). `Npp.cs` wraps common Notepad++ operations. + +- **RegexDialog** — Core UI and logic. `RegExToolDialog.xaml/.xaml.cs` is the main WPF dialog (large file, ~116KB code-behind). Contains models (`Model/`), services (`Sevices/` — note the typo), and utilities (`Utils/`). `Config.cs` manages settings via INI files. `RoslynService.cs` handles C# code compilation for script-based replacements. + +## Key Patterns + +- **Fody IL weaving**: `PropertyChanged.Fody` auto-implements `INotifyPropertyChanged` on model/viewmodel classes. `Costura.Fody` merges all dependencies into a single output DLL — this is required for the plugin to load in Notepad++. +- **Dual UI frameworks**: The plugin uses both WPF (main dialog) and Windows Forms (legacy dialogs, Notepad++ interop). +- **Platform-aware builds**: x86 and x64 configurations have separate output directories (`bin\Debug` vs `bin\Debug-x64`) and separate Notepad++ install paths for post-build copy. +- **Keyboard shortcut**: Ctrl+Shift+H invokes the plugin. diff --git a/CSharpRegexTools4Npp.sln b/CSharpRegexTools4Npp.sln deleted file mode 100644 index 485e3e3..0000000 --- a/CSharpRegexTools4Npp.sln +++ /dev/null @@ -1,49 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.421 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpRegexTools4Npp", "CSharpRegexTools4Npp\CSharpRegexTools4Npp.csproj", "{DF71B291-10BE-4C52-973E-C7E209497329}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegexDialog", "RegexDialog\RegexDialog.csproj", "{E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DF71B291-10BE-4C52-973E-C7E209497329}.Debug|Any CPU.ActiveCfg = Debug|x86 - {DF71B291-10BE-4C52-973E-C7E209497329}.Debug|x64.ActiveCfg = Debug|x64 - {DF71B291-10BE-4C52-973E-C7E209497329}.Debug|x64.Build.0 = Debug|x64 - {DF71B291-10BE-4C52-973E-C7E209497329}.Debug|x86.ActiveCfg = Debug|x86 - {DF71B291-10BE-4C52-973E-C7E209497329}.Debug|x86.Build.0 = Debug|x86 - {DF71B291-10BE-4C52-973E-C7E209497329}.Release|Any CPU.ActiveCfg = Release|x86 - {DF71B291-10BE-4C52-973E-C7E209497329}.Release|x64.ActiveCfg = Release|x64 - {DF71B291-10BE-4C52-973E-C7E209497329}.Release|x64.Build.0 = Release|x64 - {DF71B291-10BE-4C52-973E-C7E209497329}.Release|x86.ActiveCfg = Release|x86 - {DF71B291-10BE-4C52-973E-C7E209497329}.Release|x86.Build.0 = Release|x86 - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Debug|x64.ActiveCfg = Debug|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Debug|x64.Build.0 = Debug|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Debug|x86.ActiveCfg = Debug|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Debug|x86.Build.0 = Debug|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Release|Any CPU.Build.0 = Release|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Release|x64.ActiveCfg = Release|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Release|x64.Build.0 = Release|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Release|x86.ActiveCfg = Release|Any CPU - {E9AB46E2-6CCF-4998-9EF4-28F7E8961C31}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {5FD18A7C-CF42-415A-92F5-7B9AD4B6BCD8} - EndGlobalSection -EndGlobal diff --git a/CSharpRegexTools4Npp.slnx b/CSharpRegexTools4Npp.slnx new file mode 100644 index 0000000..77c16a3 --- /dev/null +++ b/CSharpRegexTools4Npp.slnx @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/CSharpRegexTools4Npp/BNpp.cs b/CSharpRegexTools4Npp/BNpp.cs deleted file mode 100644 index 61479ba..0000000 --- a/CSharpRegexTools4Npp/BNpp.cs +++ /dev/null @@ -1,322 +0,0 @@ -using CSharpRegexTools4Npp.PluginInfrastructure; -using System; -using System.Text; - -namespace CSharpRegexTools4Npp -{ - public static class BNpp - { - public static NotepadPPGateway NotepadPP { get; } = new NotepadPPGateway(); - - public static ScintillaGateway Scintilla => new ScintillaGateway(PluginBase.GetCurrentScintilla()); - - /// - /// Récupère les caractères de fin de lignes courant - /// !!! Attention pour le moment bug. !!! Enlève la coloration syntaxique du fichier courant - /// - public static string CurrentEOL - { - get - { - string eol = "\n"; - int value = Scintilla.GetEOLMode(); - - switch ((SciMsg)value) - { - case SciMsg.SC_EOL_CRLF: - eol = "\r\n"; - break; - case SciMsg.SC_EOL_CR: - eol = "\r"; - break; - } - - return eol; - } - } - - /// - /// Récupère ou attribue le texte complet du tab Notepad++ courant - ///
(Gère la conversion d'encodage Npp/C#) - ///
- public static string Text - { - get - { - IScintillaGateway scintilla = new ScintillaGateway(PluginBase.GetCurrentScintilla()); - // Multiply by 2 to managed 2 bytes encoded chars - return BEncoding.GetUtf8TextFromScintillaText(scintilla.GetText(scintilla.GetTextLength() * 2)); - } - - set - { - IScintillaGateway scintilla = new ScintillaGateway(PluginBase.GetCurrentScintilla()); - string text = BEncoding.GetScintillaTextFromUtf8Text(value, out _); - scintilla.SetText(text); - } - } - - /// - /// Récupère ou attribue le début de la sélection de texte - ///
(Gère la conversion d'encodage Npp/C#) - ///
- public static int SelectionStart - { - get - { - return new ScintillaGateway(PluginBase.GetCurrentScintilla()).GetSelectionStart(); - } - - set - { - new ScintillaGateway(PluginBase.GetCurrentScintilla()).SetSelectionStart(new Position(value)); - } - } - - /// - /// Récupère ou attribue la fin de la sélection de texte - ///
si aucun texte n'est sélectionné SelectionEnd = SelectionStart - ///
(Gère la conversion d'encodage Npp/C#) - ///
- public static int SelectionEnd - { - get - { - int curPos = (int)Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_GETSELECTIONEND, 0, 0); - IScintillaGateway scintilla = new ScintillaGateway(PluginBase.GetCurrentScintilla()); - string beginingText = scintilla.GetText(curPos); - BEncoding.GetScintillaTextFromUtf8Text(beginingText, out int length); - return length; - } - - set - { - string allText = Text; - int endToUse = value; - - if (value < 0) - { - endToUse = 0; - } - else if (value > allText.Length) - { - endToUse = allText.Length; - } - - string afterText = allText.Substring(0, endToUse); - BEncoding.GetScintillaTextFromUtf8Text(afterText, out int defaultEnd); - - Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_SETSELECTIONEND, defaultEnd, 0); - } - } - - /// - /// Récupère ou attribue la longueur de la sélection de texte - ///
Si aucun texte n'est sélectionné SelectionEnd = 0 - ///
(Gère la conversion d'encodage Npp/C#) - ///
- public static int SelectionLength - { - get - { - return SelectionEnd - SelectionStart; - } - - set - { - SelectionEnd = SelectionStart + (value < 0 ? 0 : value); - } - } - - /// - /// Récupère ou remplace le texte actuellement sélectionné - ///
(Gère la conversion d'encodage Npp/C#) - ///
- public static string SelectedText - { - get - { - IScintillaGateway scintilla = new ScintillaGateway(PluginBase.GetCurrentScintilla()); - return BEncoding.GetUtf8TextFromScintillaText(scintilla.GetSelText()); - } - - set - { - IScintillaGateway scintilla = new ScintillaGateway(PluginBase.GetCurrentScintilla()); - string defaultNewText = BEncoding.GetScintillaTextFromUtf8Text(value); - scintilla.ReplaceSel(defaultNewText); - } - } - - /// - /// Sélectionne dans le tab Notepad++ courant le texte entre start et end - /// et positionne le scroll pour voir la sélection. - ///
(Gère la conversion d'encodage Npp/C#) - ///
- /// Position du début du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length - /// Position de fin du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length
Si plus petit que start -> forcé à start - public static void SelectTextAndShow(int start, int end) - { - string allText = Text; - int startToUse = start; - int endToUse = end; - - if (start < 0) - { - startToUse = 0; - } - else if (start > allText.Length) - { - startToUse = allText.Length; - } - - if (end < 0) - { - endToUse = 0; - } - else if (end > allText.Length) - { - endToUse = allText.Length; - } - else if (endToUse < startToUse) - { - endToUse = startToUse; - } - - string beforeText = allText.Substring(0, startToUse); - BEncoding.GetScintillaTextFromUtf8Text(beforeText, out int defaultStart); - string endText = allText.Substring(0, endToUse); - BEncoding.GetScintillaTextFromUtf8Text(endText, out int defaultEnd); - - Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_GOTOPOS, defaultStart, 0); - Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_SETSELECTIONEND, defaultEnd, 0); - } - - /// - /// Si la sélection multiple est activée ajoute la sélection spécifié - ///
(Gère la conversion d'encodage Npp/C#) - ///
- /// Position du début du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length - /// Position de fin du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length
Si plus petit que start -> forcé à start - - public static void AddSelection(int start, int end) - { - string allText = Text; - int startToUse = start; - int endToUse = end; - - if (start < 0) - { - startToUse = 0; - } - else if (start > allText.Length) - { - startToUse = allText.Length; - } - - if (end < 0) - { - endToUse = 0; - } - else if (end > allText.Length) - { - endToUse = allText.Length; - } - else if (endToUse < startToUse) - { - endToUse = startToUse; - } - - string beforeText = allText.Substring(0, startToUse); - BEncoding.GetScintillaTextFromUtf8Text(beforeText, out int defaultStart); - string endText = allText.Substring(0, endToUse); - BEncoding.GetScintillaTextFromUtf8Text(endText, out int defaultEnd); - - Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_ADDSELECTION, defaultStart, defaultEnd); - } - - /// - /// Récupère le texte de la ligne spécifiée - /// - /// Numéro de la ligne dont on veut récupérer le texte - /// Le texte de la ligne spécifiée - public static string GetLineText(int lineNb) - { - string result = ""; - - try - { - result = Text.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)[lineNb - 1]; - } - catch { } - - return result; - } - } - - /// - /// Offre des fonctions simples pour convertir l'encodage d'un texte - /// entre l'encodage du document courant dans Notepad++ et l'encodage en C# (UTF8) - /// - internal static class BEncoding - { - private static readonly Encoding utf8 = Encoding.UTF8; - - /// - /// Convertit le texte spécifier de l'encodage du document Notepad++ courant à l'encodage C# (UTF8) - /// - public static string GetUtf8TextFromScintillaText(string scText) - { - switch ((int)Win32.SendMessage(PluginBase.nppData._nppHandle, SciMsg.SCI_GETCODEPAGE, 0, 0)) - { - case 65001: // UTF8 - return utf8.GetString(Encoding.Default.GetBytes(scText)); - default: - Encoding ANSI = Encoding.GetEncoding(1252); - - byte[] ansiBytes = ANSI.GetBytes(scText); - byte[] utf8Bytes = Encoding.Convert(ANSI, Encoding.UTF8, ansiBytes); - - return Encoding.UTF8.GetString(utf8Bytes); - } - } - - /// - /// Convertit le texte spécifier de l'encodage C# (UTF8) à l'encodage document Notepad++ courant - /// - public static string GetScintillaTextFromUtf8Text(string utf8Text) - { - switch ((int)Win32.SendMessage(PluginBase.nppData._nppHandle, SciMsg.SCI_GETCODEPAGE, 0, 0)) - { - case 65001: // UTF8 - return Encoding.Default.GetString(utf8.GetBytes(utf8Text)); - default: - Encoding ANSI = Encoding.GetEncoding(1252); - - byte[] utf8Bytes = utf8.GetBytes(utf8Text); - byte[] ansiBytes = Encoding.Convert(Encoding.UTF8, ANSI, utf8Bytes); - - return ANSI.GetString(ansiBytes); - } - } - - /// - /// Convertit le texte spécifier de l'encodage C# (UTF8) à l'encodage document Notepad++ courant - /// - public static string GetScintillaTextFromUtf8Text(string utf8Text, out int length) - { - byte[] utf8Bytes = utf8.GetBytes(utf8Text); - length = utf8Bytes.Length; - - switch ((int)Win32.SendMessage(PluginBase.nppData._nppHandle, SciMsg.SCI_GETCODEPAGE, 0, 0)) - { - case 65001: // UTF8 - return Encoding.Default.GetString(utf8.GetBytes(utf8Text)); - default: - Encoding ANSI = Encoding.GetEncoding(1252); - byte[] ansiBytes = Encoding.Convert(Encoding.UTF8, ANSI, utf8Bytes); - return ANSI.GetString(ansiBytes); - } - } - } -} diff --git a/CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj b/CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj index 98f4373..fbfa356 100644 --- a/CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj +++ b/CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj @@ -1,159 +1,215 @@  - - + Debug x86 - {DF71B291-10BE-4C52-973E-C7E209497329} + 9.0.21022 + 2.0 + 9.0 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Library Properties CSharpRegexTools4Npp CSharpRegexTools4Npp - bin\Debug\ - v4.6 + v4.8.1 + 3.5 + {EB8FC3A3-93E8-457B-B281-FAFA5119611A} - - true - DEBUG;TRACE full - prompt false bin\Debug + DEBUG;TRACE + prompt + 4 x86 true - false + True - TRACE + none true bin\Release - pdbonly prompt + 4 + 512 x86 + AllRules.ruleset true - false + True true - TRACE;DEBUG;X64 full - prompt false bin\Debug-x64 + DEBUG;TRACE + prompt + 4 x64 true - false + True - TRACE;X64 + none true bin\Release-x64 - pdbonly prompt + 4 + 512 x64 + AllRules.ruleset true - false + True - + $(ProgramW6432)\Notepad++ + $(MSBuildProgramFiles32)\Notepad++ Program - $(ProgramW6432)\Notepad++\notepad++.exe - $(MSBuildProgramFiles32)\Notepad++\notepad++.exe + $(NppPath64)\notepad++.exe + $(NppPath32)\notepad++.exe + + + $(MSBuildProjectDirectory)\packages - - ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll - - - - - - - - - - - - - - - - + + all + - - + + + + - - + + + + - - - - - - - - + + + - + + + + + Resources.resx + + + + + True True Resources.resx + + True + True + Res.resx + + + + + + + + + + + + + + + + + + + + + + + + + - - ResXFileCodeGenerator - Resources.Designer.cs - + + + + + + + + - - + + Designer - - - - Designer - + PublicResXFileCodeGenerator + Resources1.Designer.cs + + + ResXFileCodeGenerator + Res.Designer.cs + - - Designer - - + + + - {e9ab46e2-6ccf-4998-9ef4-28f7e8961c31} + {c2a3f803-5710-d6b9-f97b-4fbfde7e2af4} RegexDialog - - - - Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}. - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CSharpRegexTools4Npp/FodyWeavers.xml b/CSharpRegexTools4Npp/FodyWeavers.xml deleted file mode 100644 index a5dcf04..0000000 --- a/CSharpRegexTools4Npp/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/CSharpRegexTools4Npp/FodyWeavers.xsd b/CSharpRegexTools4Npp/FodyWeavers.xsd deleted file mode 100644 index 44a5374..0000000 --- a/CSharpRegexTools4Npp/FodyWeavers.xsd +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks - - - - - A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. - - - - - A list of unmanaged 32 bit assembly names to include, delimited with line breaks. - - - - - A list of unmanaged 64 bit assembly names to include, delimited with line breaks. - - - - - The order of preloaded assemblies, delimited with line breaks. - - - - - - This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. - - - - - Controls if .pdbs for reference assemblies are also embedded. - - - - - Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. - - - - - As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. - - - - - Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. - - - - - Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. - - - - - A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | - - - - - A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. - - - - - A list of unmanaged 32 bit assembly names to include, delimited with |. - - - - - A list of unmanaged 64 bit assembly names to include, delimited with |. - - - - - The order of preloaded assemblies, delimited with |. - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/CSharpRegexTools4Npp/GlobalSuppressions.cs b/CSharpRegexTools4Npp/GlobalSuppressions.cs new file mode 100644 index 0000000..2aea435 --- /dev/null +++ b/CSharpRegexTools4Npp/GlobalSuppressions.cs @@ -0,0 +1,10 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + + +[assembly: SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "namespaceanddescendants", Target = "~N:CSharpRegexTools4Npp")] +[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "", Scope = "namespaceanddescendants", Target = "~N:CSharpRegexTools4Npp")] diff --git a/CSharpRegexTools4Npp/Main.cs b/CSharpRegexTools4Npp/Main.cs index fbbdea2..f27e563 100644 --- a/CSharpRegexTools4Npp/Main.cs +++ b/CSharpRegexTools4Npp/Main.cs @@ -1,21 +1,50 @@ -using CSharpRegexTools4Npp.PluginInfrastructure; +// NPP plugin platform for .Net v0.91.57 by Kasper B. Graversen etc. +using CSharpRegexTools4Npp.PluginInfrastructure; +using CSharpRegexTools4Npp.Utils; +using Newtonsoft.Json.Linq; using RegexDialog; using System; +using System.Diagnostics; using System.Drawing; +using System.IO; using System.Linq; +using System.Net.Http; +using System.Net; +using System.Reflection; using System.Runtime.InteropServices; using System.Windows; -using System.Windows.Input; using System.Windows.Interop; namespace CSharpRegexTools4Npp { - public class Main + class Main { - internal const string PluginName = "C# Regex Tools 4 Npp"; + internal const int UNDO_BUFFER_SIZE = 64; private static int idMyDlg = 0; - private static readonly Bitmap tbBmp = Resources.icon; - //static RegExToolDialog dialog = null; + internal const string PluginName = "C# Regex Tools 4 Npp"; + public static readonly string PluginConfigDirectory = Path.Combine(Npp.Notepad.GetConfigDirectory(), PluginName); + public const string PluginRepository = "https://github.com/codingseb/CSharpRegexTools4Npp"; + + private static readonly Bitmap tbBmp = Res.Icon;// Resources; + + /// + /// This listens to the message that Notepad++ sends when its UI language is changed. + /// + private static NppListener nppListener = null; + /// + /// If the Notepad++ version is higher than 8.6.9, this boolean does not matter.

+ /// If this is true, and the Notepad++ version is 8.6.9 or lower, will be initialized.

+ /// SETTING THIS TO true COMES AT A REAL PERFORMANCE COST EVEN WHEN YOUR PLUGIN IS NOT IN USE (possibly up to 10% of all CPU usage associated with Notepad++)

+ /// Do NOT set this to true unless it is very important to you that your plugin's UI language can dynamically adjust to the Notepad++ UI language.

+ /// Note that translation will work even if this is false, so the only upside of this is that + /// the user doesn't need to close Notepad++ and restart it to see their new language preferences reflected in this plugin's UI. + ///
+ private const bool FOLLOW_NPP_UI_LANGUAGE = false; + + public const int GWL_EXSTYLE = -20; + public const int WS_EX_LAYERED = 0x80000; + public const int LWA_ALPHA = 0x2; + public const int LWA_COLORKEY = 0x1; //Import the FindWindow API to find our window [DllImport("User32.dll", CharSet = CharSet.Auto)] @@ -25,72 +54,36 @@ public class Main [DllImport("User32.dll", CharSet = CharSet.Auto)] private static extern IntPtr SetForegroundWindow(IntPtr hWnd); - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern IntPtr SetWindowLong(IntPtr hWnd, int windowLongFlags, IntPtr dwNewLong); - - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - private static extern int GetWindowLong(IntPtr hWnd, int nIndex); - [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern long SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); - public const int GWL_EXSTYLE = -20; - public const int WS_EX_LAYERED = 0x80000; - public const int LWA_ALPHA = 0x2; - public const int LWA_COLORKEY = 0x1; - - private enum WindowLongFlags : int - { - GWL_EXSTYLE = -20, - GWLP_HINSTANCE = -6, - GWLP_HWNDPARENT = -8, - GWL_ID = -12, - GWL_STYLE = -16, - GWL_USERDATA = -21, - GWL_WNDPROC = -4, - DWLP_USER = 0x8, - DWLP_MSGRESULT = 0x0, - DWLP_DLGPROC = 0x4, - WS_EX_LAYERED = 0x80000 - } - - private enum LayeredWindowAttributesFlags : byte - { - LWA_COLORKEY = 0x1, - LWA_ALPHA = 0x2 - } - - public static void OnNotification(ScNotification notification) + static internal void CommandMenuInit() { + // first make it so that all references to any third-party dependencies point to the correct location + // see https://github.com/oleg-shilo/cs-script.npp/issues/66#issuecomment-1086657272 for more info + AppDomain.CurrentDomain.AssemblyResolve += LoadDependency; - } - - internal static void CommandMenuInit() - { PluginBase.SetCommand(0, "C# Regex Tools", ShowTheDialog, new ShortcutKey(true, false, true, System.Windows.Forms.Keys.H)); - idMyDlg = 0; - } + PluginBase.SetCommand(1, "&Documentation", Docs); - internal static void SetToolBarIcon() - { - toolbarIcons tbIcons = new toolbarIcons + + if (FOLLOW_NPP_UI_LANGUAGE && (Npp.nppVersion[0] < 8 || (Npp.nppVersion[0] == 8 && (Npp.nppVersion[1] < 6 || (Npp.nppVersion[1] == 6 && Npp.nppVersion[2] <= 9))))) { - hToolbarBmp = tbBmp.GetHbitmap() - }; - - IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIcons)); - Marshal.StructureToPtr(tbIcons, pTbIcons, false); - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON, PluginBase._funcItems.Items[idMyDlg]._cmdID, pTbIcons); - Marshal.FreeHGlobal(pTbIcons); + // start listening to messages that aren't broadcast by the plugin manager (for versions of Notepad++ 8.6.9 or earlier, because later versions have NPPN_NATIVELANGCHANGED) + nppListener = new NppListener(); + nppListener.AssignHandle(PluginBase.nppData._nppHandle); + } } public static void ShowTheDialog() { - try { + string dialogTitle = $"C# Regex Tools - {Assembly.GetExecutingAssembly().GetName().Version}"; - IntPtr hWnd = FindWindow(null, "C# Regex Tools"); + AppDomain.CurrentDomain.SetupInformation.PrivateBinPath = @"plugins\CSharpRegexTools4Npp"; + + IntPtr hWnd = FindWindow(null, dialogTitle); if (hWnd.ToInt64() > 0) { @@ -98,38 +91,41 @@ public static void ShowTheDialog() } else { - var dialog = new RegExToolDialog + RegExToolDialog dialog = null; + + RegExToolDialog.InitIsOK = () => CheckUpdates(dialog); + + dialog = new RegExToolDialog { - GetText = () => BNpp.Text, + GetText = () => Npp.Text, SetText = text => { - if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) - { - BNpp.NotepadPP.FileNew(); - } - - BNpp.Text = text; + Npp.Text = text; }, SetTextInNew = text => { - BNpp.NotepadPP.FileNew(); + Npp.Notepad.FileNew(); - BNpp.Text = text; + Npp.Text = text; }, - GetSelectedText = () => BNpp.SelectedText, + SetSelectedText = text => Npp.SelectedText = text, + + GetSelectedText = () => Npp.SelectedText, + + SetPosition = (index, length) => Npp.SelectTextAndShow(index, index + length), - SetPosition = (index, length) => BNpp.SelectTextAndShow(index, index + length), + SetSelection = (index, length) => Npp.AddSelection(index, index + length), - SetSelection = (index, length) => BNpp.AddSelection(index, index + length), + GetSelectionStartIndex = () => Npp.SelectionStart, - GetSelectionStartIndex = () => BNpp.SelectionStart, + GetSelectionLength = () => Npp.SelectionLength, - GetSelectionLength = () => BNpp.SelectionLength, + SaveCurrentDocument = () => Npp.Notepad.SaveCurrentFile(), - SaveCurrentDocument = () => BNpp.NotepadPP.SaveCurrentFile(), + SetCurrentTabInCSharpHighlighting = () => Npp.Notepad.SetCurrentLanguage(LangType.L_CS), TryOpen = (fileName, onlyIfAlreadyOpen) => { @@ -137,25 +133,25 @@ public static void ShowTheDialog() { bool result = false; - if (BNpp.NotepadPP.CurrentFileName.Equals(fileName, StringComparison.OrdinalIgnoreCase)) + if (Npp.Notepad.CurrentFileName.Equals(fileName, StringComparison.OrdinalIgnoreCase)) { result = true; } - else if (BNpp.NotepadPP.GetAllOpenedDocuments.Any(s => s.Equals(fileName, StringComparison.OrdinalIgnoreCase))) + else if (Npp.Notepad.GetAllOpenedDocuments.Any(s => s.Equals(fileName, StringComparison.OrdinalIgnoreCase))) { - BNpp.NotepadPP.ShowTab(fileName); + Npp.Notepad.ShowTab(fileName); result = true; } else if (!onlyIfAlreadyOpen) { - result = BNpp.NotepadPP.OpenFile(fileName); + result = Npp.Notepad.OpenFile(fileName); } else { result = false; } - hWnd = FindWindow(null, "C# Regex Tool"); + hWnd = FindWindow(null, dialogTitle); if (hWnd.ToInt64() > 0) { SetForegroundWindow(hWnd); @@ -167,25 +163,133 @@ public static void ShowTheDialog() { return false; } - }, - GetCurrentFileName = () => BNpp.NotepadPP.CurrentFileName + GetCurrentFileName = () => Npp.Notepad.CurrentFileName }; - + dialog.Show(); - SetWindowLong(new WindowInteropHelper(dialog).Handle, (int)WindowLongFlags.GWLP_HWNDPARENT, PluginBase.nppData._nppHandle); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.MODELESSDIALOGADD, (int)NppMsg.NPPM_MODELESSDIALOG, new WindowInteropHelper(dialog).Handle); + //SetWindowLong(new WindowInteropHelper(dialog).Handle, (int)WindowLongFlags.GWLP_HWNDPARENT, PluginBase.nppData._nppHandle); SetLayeredWindowAttributes(new WindowInteropHelper(dialog).Handle, 0, 128, LWA_ALPHA); - } } catch (Exception exception) { MessageBox.Show(exception.Message + "\r\n" + exception.StackTrace, "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } + } + private static Assembly LoadDependency(object sender, ResolveEventArgs args) + { + string assemblyFile = Path.Combine(Npp.pluginDllDirectory, new AssemblyName(args.Name).Name) + ".dll"; + if (File.Exists(assemblyFile)) + return Assembly.LoadFrom(assemblyFile); + return null; + } + + public static void OnNotification(ScNotification notification) + { + + } + + static internal void PluginCleanUp() + { + } + + internal static void SetToolBarIcon() + { + if (!string.IsNullOrEmpty(Npp.Notepad.NppBinVersion) + && int.TryParse(Npp.Notepad.NppBinVersion.Split('.')[0], out int majorVersion) + && majorVersion >= 8) + { + ToolbarIcons tbIcons = new() + { + hToolbarBmp = tbBmp.GetHbitmap(), + hToolbarIcon = tbBmp.GetHicon(), + hToolbarIconDarkMode = tbBmp.GetHicon() + }; + + IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIcons)); + Marshal.StructureToPtr(tbIcons, pTbIcons, false); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON_FORDARKMODE, PluginBase._funcItems.Items[idMyDlg]._cmdID, pTbIcons); + Marshal.FreeHGlobal(pTbIcons); + } + } + + private static async void CheckUpdates(RegExToolDialog dialog) + { + double hoursFromLastCheck = Math.Abs((DateTime.Now - Config.Instance.LastUpdateCheck).TotalHours); + + //if (hoursFromLastCheck > 8) + if (true) + { + ServicePointManager.ServerCertificateValidationCallback += (_, __, ___, ____) => true; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; + + try + { + HttpClient client = new(); + client.DefaultRequestHeaders.Add("Accept-Language", "en-US;q=0.5,en;q=0.3"); + client.DefaultRequestHeaders.Add("User-Agent", "C# App"); + + var response = await client.GetAsync("https://api.github.com/repos/codingseb/CSharpRegexTools4Npp/releases/latest").ConfigureAwait(true); + string responseText = await response.Content.ReadAsStringAsync(); + + var jsonResult = JObject.Parse(responseText); + + int[] latestVersion = jsonResult["name"].ToString().Split('.').Select(digit => int.Parse(digit.Trim())).ToArray(); + int[] currentVersion = typeof(RegExToolDialog).Assembly.GetName().Version.ToString().Split('.').Select(digit => int.Parse(digit.Trim())).ToArray(); + + Debug.WriteLine($"{string.Join(".", latestVersion)} - {string.Join(".", currentVersion)}"); + + for (int i = 0; i < latestVersion.Length && i < currentVersion.Length; i++) + { + if (latestVersion[i] > currentVersion[i]) + { + Config.Instance.UpdateAvailable = true; + Config.Instance.UpdateURL = "https://github.com/codingseb/CSharpRegexTools4Npp/releases"; + break; + } + else if (latestVersion[i] < currentVersion[i]) + { + break; + } + } + } + catch + { } + } + } + + /// + /// open GitHub repo with the web browser + /// + private static void Docs() + { + OpenUrlInWebBrowser(PluginRepository); + } + + public static void OpenUrlInWebBrowser(string url) + { + try + { + var ps = new ProcessStartInfo(url) + { + UseShellExecute = true, + Verb = "open" + }; + Process.Start(ps); + } + catch (Exception ex) + { + MessageBox.Show( + $"While attempting to open URL {url} in web browser, got exception\r\n{ex}", + "Could not open url in web browser", + MessageBoxButton.OK, MessageBoxImage.Error); + } } } -} \ No newline at end of file +} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/ClikeStringArray.cs b/CSharpRegexTools4Npp/PluginInfrastructure/ClikeStringArray.cs index 5350a71..b4bb33b 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/ClikeStringArray.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/ClikeStringArray.cs @@ -1,14 +1,15 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -using System; -using System.Collections.Generic; +using System.Collections.Generic; +using System.Reflection; using System.Runtime.InteropServices; +using System.Windows.Forms; +using System; namespace CSharpRegexTools4Npp.PluginInfrastructure { public class ClikeStringArray : IDisposable { - IntPtr _nativeArray; - List _nativeItems; + private readonly IntPtr _nativeArray; + private readonly List _nativeItems; bool _disposed = false; public ClikeStringArray(int num, int stringCapacity) @@ -17,7 +18,7 @@ public ClikeStringArray(int num, int stringCapacity) _nativeItems = new List(); for (int i = 0; i < num; i++) { - IntPtr item = Marshal.AllocHGlobal(stringCapacity); + IntPtr item = Marshal.AllocHGlobal(stringCapacity * 2); // 2 bytes per character, because we're using wchar_t arrays Marshal.WriteIntPtr(_nativeArray + (i * IntPtr.Size), item); _nativeItems.Add(item); } @@ -52,16 +53,19 @@ List _getManagedItems(bool unicode) public void Dispose() { - if (!_disposed) + try { - _disposed = true; - try + if (!_disposed) { for (int i = 0; i < _nativeItems.Count; i++) if (_nativeItems[i] != IntPtr.Zero) Marshal.FreeHGlobal(_nativeItems[i]); if (_nativeArray != IntPtr.Zero) Marshal.FreeHGlobal(_nativeArray); + _disposed = true; } - catch { } + } + catch (Exception e) + { + MessageBox.Show(MethodBase.GetCurrentMethod().ToString() + ": " + e.Message, this.GetType().Name); } } ~ClikeStringArray() diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/DllExportAttribute.cs b/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/DllExportAttribute.cs index 8c45277..926591e 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/DllExportAttribute.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/DllExportAttribute.cs @@ -2,10 +2,17 @@ using System; using System.Runtime.InteropServices; -namespace NppPlugin.DllExport +namespace RGiesecke.DllExport { + /// + /// The fully qualified type name must be RGiesecke.DllExport.DllExportAttribute in order to work with the pre-configured task in UnmanagedExports.Repack.Upgrade.targets. + /// This implementation could be avoided if we referenced the RGiesecke.DllExport.Metadata assembly, but then it will look like a runtime dependency, and be copied to the build output directory. + /// + /// See + /// + /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - public partial class DllExportAttribute : Attribute + partial class DllExportAttribute : Attribute { public DllExportAttribute() { @@ -26,4 +33,4 @@ public DllExportAttribute(string exportName, CallingConvention callingConvention public string ExportName { get; set; } } -} \ No newline at end of file +} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/Mono.Cecil.dll b/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/Mono.Cecil.dll deleted file mode 100644 index ffe9b57..0000000 Binary files a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/Mono.Cecil.dll and /dev/null differ diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.MSBuild.dll b/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.MSBuild.dll deleted file mode 100644 index c3c9de8..0000000 Binary files a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.MSBuild.dll and /dev/null differ diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.dll b/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.dll deleted file mode 100644 index f673ed5..0000000 Binary files a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.dll and /dev/null differ diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.targets b/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.targets deleted file mode 100644 index 4db958e..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.targets +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - $(DevEnvDir)\..\..\VC\bin - - - - - - - - - - - - - - diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/GatewayDomain.cs b/CSharpRegexTools4Npp/PluginInfrastructure/GatewayDomain.cs index dbdead9..580738b 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/GatewayDomain.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/GatewayDomain.cs @@ -1,7 +1,6 @@ // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. using System; using System.Runtime.InteropServices; -using System.Text; namespace CSharpRegexTools4Npp.PluginInfrastructure { @@ -16,25 +15,25 @@ public class Colour public readonly int Red, Green, Blue; public Colour(int rgb) - { - Red = rgb ^ 0xFF; - Green = rgb ^ 0x00FF; - Blue = rgb ^ 0x0000FF; - } + { + Red = rgb & 0xFF; + Green = (rgb >> 8) & 0xFF; + Blue = (rgb >> 16) & 0xFF; + } /// - /// + /// /// /// a number 0-255 /// a number 0-255 /// a number 0-255 public Colour(int red, int green, int blue) { - if (red > 255 || red < 0) + if(red > 255 || red < 0) throw new ArgumentOutOfRangeException("red", "must be 0-255"); - if (green > 255 || green < 0) + if(green > 255 || green < 0) throw new ArgumentOutOfRangeException("green", "must be 0-255"); - if (blue > 255 || blue < 0) + if(blue > 255 || blue < 0) throw new ArgumentOutOfRangeException("blue", "must be 0-255"); Red = red; Green = green; @@ -43,136 +42,7 @@ public Colour(int red, int green, int blue) public int Value { - get { return Red | (Green << 8) | (Blue << 16); } - } - } - - /// - /// Positions within the Scintilla document refer to a character or the gap before that character. - /// The first character in a document is 0, the second 1 and so on. If a document contains nLen characters, the last character is numbered nLen-1. The caret exists between character positions and can be located from before the first character (0) to after the last character (nLen). - /// - /// There are places where the caret can not go where two character bytes make up one character. - /// This occurs when a DBCS character from a language like Japanese is included in the document or when line ends are marked with the CP/M - /// standard of a carriage return followed by a line feed.The INVALID_POSITION constant(-1) represents an invalid position within the document. - /// - /// All lines of text in Scintilla are the same height, and this height is calculated from the largest font in any current style.This restriction - /// is for performance; if lines differed in height then calculations involving positioning of text would require the text to be styled first. - /// - /// If you use messages, there is nothing to stop you setting a position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. - /// However, keyboard commands will not move the caret into such positions. - /// - public class Position : IEquatable - { - private readonly int pos; - - public static Position From(int pos) - { - return new Position(pos); - } - - public Position(int pos) - { - this.pos = pos; - } - - public int Value - { - get { return pos; } - } - - public static implicit operator Position(int pos) - { - return new Position(pos); - } - - public static implicit operator int(Position pos) - { - return pos.Value; - } - - public static Position operator +(Position a, int b) - { - return new Position(a.pos + b); - } - - public static Position operator +(Position a, Position b) - { - return new Position(a.pos + b.pos); - } - - public static Position operator -(Position a, int b) - { - return new Position(a.pos - b); - } - - public static Position operator -(Position a, Position b) - { - return new Position(a.pos - b.pos); - } - - public static bool operator ==(Position a, Position b) - { - if (ReferenceEquals(a, b)) - return true; - if (ReferenceEquals(a, null)) - return false; - if (ReferenceEquals(b, null)) - return false; - return a.pos == b.pos; - } - - public static bool operator !=(Position a, Position b) - { - return !(a == b); - } - - public static bool operator >(Position a, Position b) - { - return a.Value > b.Value; - } - - public static bool operator <(Position a, Position b) - { - return a.Value < b.Value; - } - - public static Position Min(Position a, Position b) - { - if (a < b) - return a; - return b; - } - - public static Position Max(Position a, Position b) - { - if (a > b) - return a; - return b; - } - - public override string ToString() - { - return "Position: " + pos; - } - - public bool Equals(Position other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return pos == other.pos; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; - return Equals((Position)obj); - } - - public override int GetHashCode() - { - return pos; + get { return Red + (Green << 8) + (Blue << 16); } } } @@ -202,7 +72,7 @@ public class KeyModifier /// public KeyModifier(SciMsg SCK_KeyCode, SciMsg SCMOD_modifier) { - value = (int)SCK_KeyCode | ((int)SCMOD_modifier << 16); + value = (int) SCK_KeyCode | ((int) SCMOD_modifier << 16); } public int Value @@ -214,12 +84,9 @@ public int Value [StructLayout(LayoutKind.Sequential)] public struct CharacterRange { - public CharacterRange(int cpmin, int cpmax) - { - cpMin = cpmin; cpMax = cpmax; - } - public int cpMin; - public int cpMax; + public CharacterRange(int cpmin, int cpmax) { cpMin = new IntPtr(cpmin); cpMax = new IntPtr(cpmax); } + public IntPtr cpMin; + public IntPtr cpMax; } public class Cells @@ -230,7 +97,6 @@ public Cells(char[] charactersAndStyles) { this.charactersAndStyles = charactersAndStyles; } - public char[] Value { get { return charactersAndStyles; } } } @@ -247,8 +113,8 @@ public TextRange(CharacterRange chrRange, int stringCapacity) } public TextRange(int cpmin, int cpmax, int stringCapacity) { - _sciTextRange.chrg.cpMin = cpmin; - _sciTextRange.chrg.cpMax = cpmax; + _sciTextRange.chrg.cpMin = new IntPtr(cpmin); + _sciTextRange.chrg.cpMax = new IntPtr(cpmax); _sciTextRange.lpstrText = Marshal.AllocHGlobal(stringCapacity); } @@ -258,11 +124,8 @@ struct Sci_TextRange public CharacterRange chrg; public IntPtr lpstrText; } - public IntPtr NativePointer { get { _initNativeStruct(); return _ptrSciTextRange; } } - public string lpstrText { get { _readNativeStruct(); return Marshal.PtrToStringAnsi(_sciTextRange.lpstrText); } } - public CharacterRange chrg { get { _readNativeStruct(); return _sciTextRange.chrg; } set { _sciTextRange.chrg = value; _initNativeStruct(); } } void _initNativeStruct() @@ -296,6 +159,728 @@ public void Dispose() /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ + /// Is undo history being collected? (Scintilla feature SCWS_) + public enum WhiteSpace + { + INVISIBLE = 0, + VISIBLEALWAYS = 1, + VISIBLEAFTERINDENT = 2, + VISIBLEONLYININDENT = 3 + } + /// Make white space characters invisible, always visible or visible outside indentation. (Scintilla feature SCTD_) + public enum TabDrawMode + { + LONGARROW = 0, + STRIKEOUT = 1 + } + /// Retrieve the position of the last correctly styled character. (Scintilla feature SC_EOL_) + public enum EndOfLine + { + CRLF = 0, + CR = 1, + LF = 2 + } + /// + /// Set the code page used to interpret the bytes of the document as characters. + /// The SC_CP_UTF8 value can be used to enter Unicode mode. + /// (Scintilla feature SC_IME_) + /// + public enum IMEInteraction + { + WINDOWED = 0, + INLINE = 1 + } + /// Choose to display the the IME in a winow or inline. (Scintilla feature SC_MARK_) + public enum MarkerSymbol + { + CIRCLE = 0, + ROUNDRECT = 1, + ARROW = 2, + SMALLRECT = 3, + SHORTARROW = 4, + EMPTY = 5, + ARROWDOWN = 6, + MINUS = 7, + PLUS = 8, + VLINE = 9, + LCORNER = 10, + TCORNER = 11, + BOXPLUS = 12, + BOXPLUSCONNECTED = 13, + BOXMINUS = 14, + BOXMINUSCONNECTED = 15, + LCORNERCURVE = 16, + TCORNERCURVE = 17, + CIRCLEPLUS = 18, + CIRCLEPLUSCONNECTED = 19, + CIRCLEMINUS = 20, + CIRCLEMINUSCONNECTED = 21, + BACKGROUND = 22, + DOTDOTDOT = 23, + ARROWS = 24, + PIXMAP = 25, + FULLRECT = 26, + LEFTRECT = 27, + AVAILABLE = 28, + UNDERLINE = 29, + RGBAIMAGE = 30, + BOOKMARK = 31, + VERTICALBOOKMARK = 32, + CHARACTER = 10000 + } + /// Invisible mark that only sets the line background colour. (Scintilla feature SC_MARKNUM_) + public enum MarkerOutline + { + FOLDEREND = 25, + FOLDEROPENMID = 26, + FOLDERMIDTAIL = 27, + FOLDERTAIL = 28, + FOLDERSUB = 29, + FOLDER = 30, + FOLDEROPEN = 31 + } + /// Set the alpha used for a marker that is drawn in the text area, not the margin. (Scintilla feature SC_MARGIN_) + public enum MarginType + { + SYMBOL = 0, + NUMBER = 1, + BACK = 2, + FORE = 3, + TEXT = 4, + RTEXT = 5, + COLOUR = 6 + } + /// Styles in range 32..39 are predefined for parts of the UI and are not used as normal styles. (Scintilla feature STYLE_) + public enum StylesCommon + { + DEFAULT = 32, + LINENUMBER = 33, + BRACELIGHT = 34, + BRACEBAD = 35, + CONTROLCHAR = 36, + INDENTGUIDE = 37, + CALLTIP = 38, + FOLDDISPLAYTEXT = 39, + LASTPREDEFINED = 39, + MAX = 255 + } + /// + /// Character set identifiers are used in StyleSetCharacterSet. + /// The values are the same as the Windows *_CHARSET values. + /// (Scintilla feature SC_CHARSET_) + /// + public enum CharacterSet + { + ANSI = 0, + DEFAULT = 1, + BALTIC = 186, + CHINESEBIG5 = 136, + EASTEUROPE = 238, + GB2312 = 134, + GREEK = 161, + HANGUL = 129, + MAC = 77, + OEM = 255, + RUSSIAN = 204, + OEM866 = 866, + CYRILLIC = 1251, + SHIFTJIS = 128, + SYMBOL = 2, + TURKISH = 162, + JOHAB = 130, + HEBREW = 177, + ARABIC = 178, + VIETNAMESE = 163, + THAI = 222, + _8859_15 = 1000 + } + /// Set a style to be underlined or not. (Scintilla feature SC_CASE_) + public enum CaseVisible + { + MIXED = 0, + UPPER = 1, + LOWER = 2, + CAMEL = 3 + } + /// Get the size of characters of a style in points multiplied by 100 (Scintilla feature SC_WEIGHT_) + public enum FontWeight + { + NORMAL = 400, + SEMIBOLD = 600, + BOLD = 700 + } + /// Indicator style enumeration and some constants (Scintilla feature INDIC_) + public enum IndicatorStyle + { + PLAIN = 0, + SQUIGGLE = 1, + TT = 2, + DIAGONAL = 3, + STRIKE = 4, + HIDDEN = 5, + BOX = 6, + ROUNDBOX = 7, + STRAIGHTBOX = 8, + DASH = 9, + DOTS = 10, + SQUIGGLELOW = 11, + DOTBOX = 12, + SQUIGGLEPIXMAP = 13, + COMPOSITIONTHICK = 14, + COMPOSITIONTHIN = 15, + FULLBOX = 16, + TEXTFORE = 17, + POINT = 18, + POINTCHARACTER = 19, + GRADIENT = 20, + GRADIENTCENTRE = 21, + CONTAINER = 8, + IME = 32, + IME_MAX = 35, + MAX = 35 + } + /// + /// INDIC_CONTAINER, INDIC_IME, INDIC_IME_MAX, and INDIC_MAX are indicator numbers, + /// not IndicatorStyles so should not really be in the INDIC_ enumeration. + /// They are redeclared in IndicatorNumbers INDICATOR_. + /// (Scintilla feature INDICATOR_) + /// + public enum IndicatorNumbers + { + CONTAINER = 8, + IME = 32, + IME_MAX = 35, + MAX = 35 + } + /// Retrieve the foreground hover colour of an indicator. (Scintilla feature SC_INDICVALUE) + public enum IndicValue + { + BIT = 0x1000000, + MASK = 0xFFFFFF + } + /// Retrieve the foreground hover colour of an indicator. (Scintilla feature SC_INDICFLAG_) + public enum IndicFlag + { + VALUEFORE = 1 + } + /// Is the horizontal scroll bar visible? (Scintilla feature SC_IV_) + public enum IndentView + { + NONE = 0, + REAL = 1, + LOOKFORWARD = 2, + LOOKBOTH = 3 + } + /// Returns the print magnification. (Scintilla feature SC_PRINT_) + public enum PrintOption + { + NORMAL = 0, + INVERTLIGHT = 1, + BLACKONWHITE = 2, + COLOURONWHITE = 3, + COLOURONWHITEDEFAULTBG = 4, + SCREENCOLOURS = 5 + } + /// Returns the print colour mode. (Scintilla feature SCFIND_) + public enum FindOption + { + NONE = 0x0, + WHOLEWORD = 0x2, + MATCHCASE = 0x4, + WORDSTART = 0x00100000, + REGEXP = 0x00200000, + POSIX = 0x00400000, + CXX11REGEX = 0x00800000 + } + /// The number of display lines needed to wrap a document line (Scintilla feature SC_FOLDLEVEL) + public enum FoldLevel + { + BASE = 0x400, + WHITEFLAG = 0x1000, + HEADERFLAG = 0x2000, + NUMBERMASK = 0x0FFF + } + /// Switch a header line between expanded and contracted and show some text after the line. (Scintilla feature SC_FOLDDISPLAYTEXT_) + public enum FoldDisplayTextStyle + { + HIDDEN = 0, + STANDARD = 1, + BOXED = 2 + } + /// Get the default fold display text. (Scintilla feature SC_FOLDACTION_) + public enum FoldAction + { + CONTRACT = 0, + EXPAND = 1, + TOGGLE = 2 + } + /// Ensure a particular line is visible by expanding any header line hiding it. (Scintilla feature SC_AUTOMATICFOLD_) + public enum AutomaticFold + { + SHOW = 0x0001, + CLICK = 0x0002, + CHANGE = 0x0004 + } + /// Get automatic folding behaviours. (Scintilla feature SC_FOLDFLAG_) + public enum FoldFlag + { + LINEBEFORE_EXPANDED = 0x0002, + LINEBEFORE_CONTRACTED = 0x0004, + LINEAFTER_EXPANDED = 0x0008, + LINEAFTER_CONTRACTED = 0x0010, + LEVELNUMBERS = 0x0040, + LINESTATE = 0x0080 + } + /// Is the range start..end considered a word? (Scintilla feature SC_IDLESTYLING_) + public enum IdleStyling + { + NONE = 0, + TOVISIBLE = 1, + AFTERVISIBLE = 2, + ALL = 3 + } + /// Retrieve the limits to idle styling. (Scintilla feature SC_WRAP_) + public enum Wrap + { + NONE = 0, + WORD = 1, + CHAR = 2, + WHITESPACE = 3 + } + /// Retrieve whether text is word wrapped. (Scintilla feature SC_WRAPVISUALFLAG_) + public enum WrapVisualFlag + { + NONE = 0x0000, + END = 0x0001, + START = 0x0002, + MARGIN = 0x0004 + } + /// Retrive the display mode of visual flags for wrapped lines. (Scintilla feature SC_WRAPVISUALFLAGLOC_) + public enum WrapVisualLocation + { + DEFAULT = 0x0000, + END_BY_TEXT = 0x0001, + START_BY_TEXT = 0x0002 + } + /// Retrive the start indent for wrapped lines. (Scintilla feature SC_WRAPINDENT_) + public enum WrapIndentMode + { + FIXED = 0, + SAME = 1, + INDENT = 2, + DEEPINDENT = 3 + } + /// Retrieve how wrapped sublines are placed. Default is fixed. (Scintilla feature SC_CACHE_) + public enum LineCache + { + NONE = 0, + CARET = 1, + PAGE = 2, + DOCUMENT = 3 + } + /// Append a string to the end of the document without changing the selection. (Scintilla feature SC_PHASES_) + public enum PhasesDraw + { + ONE = 0, + TWO = 1, + MULTIPLE = 2 + } + /// Control font anti-aliasing. (Scintilla feature SC_EFF_) + public enum FontQuality + { + QUALITY_MASK = 0xF, + QUALITY_DEFAULT = 0, + QUALITY_NON_ANTIALIASED = 1, + QUALITY_ANTIALIASED = 2, + QUALITY_LCD_OPTIMIZED = 3 + } + /// Scroll so that a display line is at the top of the display. (Scintilla feature SC_MULTIPASTE_) + public enum MultiPaste + { + ONCE = 0, + EACH = 1 + } + /// Set the other colour used as a chequerboard pattern in the fold margin (Scintilla feature SC_ACCESSIBILITY_) + public enum Accessibility + { + DISABLED = 0, + ENABLED = 1 + } + /// Set which document modification events are sent to the container. (Scintilla feature EDGE_) + public enum EdgeVisualStyle + { + NONE = 0, + LINE = 1, + BACKGROUND = 2, + MULTILINE = 3 + } + /// Retrieves the number of lines completely visible. (Scintilla feature SC_POPUP_) + public enum PopUp + { + NEVER = 0, + ALL = 1, + TEXT = 2 + } + /// Retrieve the zoom level. (Scintilla feature SC_DOCUMENTOPTION_) + public enum DocumentOption + { + DEFAULT = 0, + STYLES_NONE = 0x1, + TEXT_LARGE = 0x100 + } + /// Get internal focus flag. (Scintilla feature SC_STATUS_) + public enum Status + { + OK = 0, + FAILURE = 1, + BADALLOC = 2, + WARN_START = 1000, + WARN_REGEX = 1001 + } + /// Get whether mouse wheel can be active outside the window. (Scintilla feature SC_CURSOR) + public enum CursorShape + { + NORMAL = -1, + ARROW = 2, + WAIT = 4, + REVERSEARROW = 7 + } + /// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy. (Scintilla feature VISIBLE_) + public enum VisiblePolicy + { + SLOP = 0x01, + STRICT = 0x04 + } + /// Set the focus to this Scintilla widget. (Scintilla feature CARET_) + public enum CaretPolicy + { + SLOP = 0x01, + STRICT = 0x04, + JUMPS = 0x10, + EVEN = 0x08 + } + /// Copy argument text to the clipboard. (Scintilla feature SC_SEL_) + public enum SelectionMode + { + STREAM = 0, + RECTANGLE = 1, + LINES = 2, + THIN = 3 + } + /// + /// Get currently selected item text in the auto-completion list + /// Returns the length of the item text + /// Result is NUL-terminated. + /// (Scintilla feature SC_CASEINSENSITIVEBEHAVIOUR_) + /// + public enum CaseInsensitiveBehaviour + { + RESPECTCASE = 0, + IGNORECASE = 1 + } + /// Get auto-completion case insensitive behaviour. (Scintilla feature SC_MULTIAUTOC_) + public enum MultiAutoComplete + { + ONCE = 0, + EACH = 1 + } + /// Retrieve the effect of autocompleting when there are multiple selections. (Scintilla feature SC_ORDER_) + public enum Ordering + { + PRESORTED = 0, + PERFORMSORT = 1, + CUSTOM = 2 + } + /// Stop the caret preferred x position changing when the user types. (Scintilla feature SC_CARETSTICKY_) + public enum CaretSticky + { + OFF = 0, + ON = 1, + WHITESPACE = 2 + } + /// Duplicate the selection. If selection empty duplicate the line containing the caret. (Scintilla feature SC_ALPHA_) + public enum Alpha + { + TRANSPARENT = 0, + OPAQUE = 255, + NOALPHA = 256 + } + /// Get the background alpha of the caret line. (Scintilla feature CARETSTYLE_) + public enum CaretStyle + { + INVISIBLE = 0, + LINE = 1, + BLOCK = 2, + OVERSTRIKE_BAR = 0, + OVERSTRIKE_BLOCK = 0x10, + INS_MASK = 0xF, + BLOCK_AFTER = 0x100 + } + /// Get the start of the range of style numbers used for margin text (Scintilla feature SC_MARGINOPTION_) + public enum MarginOption + { + NONE = 0, + SUBLINESELECT = 1 + } + /// Clear the annotations from all lines (Scintilla feature ANNOTATION_) + public enum AnnotationVisible + { + HIDDEN = 0, + STANDARD = 1, + BOXED = 2, + INDENTED = 3 + } + /// Allocate some extended (>255) style numbers and return the start of the range (Scintilla feature UNDO_) + public enum UndoFlags + { + NONE = 0, + MAY_COALESCE = 1 + } + /// Return the virtual space of the anchor of the rectangular selection. (Scintilla feature SCVS_) + public enum VirtualSpace + { + NONE = 0, + RECTANGULARSELECTION = 1, + USERACCESSIBLE = 2, + NOWRAPLINESTART = 4 + } + /// Scroll to end of document. (Scintilla feature SC_TECHNOLOGY_) + public enum Technology + { + DEFAULT = 0, + DIRECTWRITE = 1, + DIRECTWRITERETAIN = 2, + DIRECTWRITEDC = 3 + } + /// + /// Line end types which may be used in addition to LF, CR, and CRLF + /// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, + /// U+2029 Paragraph Separator, and U+0085 Next Line + /// (Scintilla feature SC_LINE_END_TYPE_) + /// + public enum LineEndType + { + DEFAULT = 0, + UNICODE = 1 + } + /// + /// Retrieve a '\n' separated list of properties understood by the current lexer. + /// Result is NUL-terminated. + /// (Scintilla feature SC_TYPE_) + /// + public enum TypeProperty + { + BOOLEAN = 0, + INTEGER = 1, + STRING = 2 + } + /// + /// Notifications + /// Type of modification and the action which caused the modification. + /// These are defined as a bit mask to make it easy to specify which notifications are wanted. + /// One bit is set from each of SC_MOD_* and SC_PERFORMED_*. + /// (Scintilla feature SC_MOD_ SC_PERFORMED_ SC_MULTISTEPUNDOREDO SC_LASTSTEPINUNDOREDO SC_MULTILINEUNDOREDO SC_STARTACTION SC_MODEVENTMASKALL) + /// + public enum ModificationFlags + { + } + /// + /// Notifications + /// Type of modification and the action which caused the modification. + /// These are defined as a bit mask to make it easy to specify which notifications are wanted. + /// One bit is set from each of SC_MOD_* and SC_PERFORMED_*. + /// (Scintilla feature SC_UPDATE_) + /// + public enum Update + { + CONTENT = 0x1, + SELECTION = 0x2, + V_SCROLL = 0x4, + H_SCROLL = 0x8 + } + /// + /// Symbolic key codes and modifier flags. + /// ASCII and other printable characters below 256. + /// Extended keys above 300. + /// (Scintilla feature SCMOD_) + /// + public enum KeyMod + { + NORM = 0, + SHIFT = 1, + CTRL = 2, + ALT = 4, + SUPER = 8, + META = 16 + } + /// + /// Symbolic key codes and modifier flags. + /// ASCII and other printable characters below 256. + /// Extended keys above 300. + /// (Scintilla feature SC_AC_) + /// + public enum CompletionMethods + { + FILLUP = 1, + DOUBLECLICK = 2, + TAB = 3, + NEWLINE = 4, + COMMAND = 5 + } + /// characterSource for SCN_CHARADDED (Scintilla feature SC_CHARACTERSOURCE_) + public enum CharacterSource + { + DIRECT_INPUT = 0, + TENTATIVE_INPUT = 1, + IME_RESULT = 2 + } + /// For SciLexer.h (Scintilla feature SCLEX_) + public enum Lexer + { + CONTAINER = 0, + NULL = 1, + PYTHON = 2, + CPP = 3, + HTML = 4, + XML = 5, + PERL = 6, + SQL = 7, + VB = 8, + PROPERTIES = 9, + ERRORLIST = 10, + MAKEFILE = 11, + BATCH = 12, + XCODE = 13, + LATEX = 14, + LUA = 15, + DIFF = 16, + CONF = 17, + PASCAL = 18, + AVE = 19, + ADA = 20, + LISP = 21, + RUBY = 22, + EIFFEL = 23, + EIFFELKW = 24, + TCL = 25, + NNCRONTAB = 26, + BULLANT = 27, + VBSCRIPT = 28, + BAAN = 31, + MATLAB = 32, + SCRIPTOL = 33, + ASM = 34, + CPPNOCASE = 35, + FORTRAN = 36, + F77 = 37, + CSS = 38, + POV = 39, + LOUT = 40, + ESCRIPT = 41, + PS = 42, + NSIS = 43, + MMIXAL = 44, + CLW = 45, + CLWNOCASE = 46, + LOT = 47, + YAML = 48, + TEX = 49, + METAPOST = 50, + POWERBASIC = 51, + FORTH = 52, + ERLANG = 53, + OCTAVE = 54, + MSSQL = 55, + VERILOG = 56, + KIX = 57, + GUI4CLI = 58, + SPECMAN = 59, + AU3 = 60, + APDL = 61, + BASH = 62, + ASN1 = 63, + VHDL = 64, + CAML = 65, + BLITZBASIC = 66, + PUREBASIC = 67, + HASKELL = 68, + PHPSCRIPT = 69, + TADS3 = 70, + REBOL = 71, + SMALLTALK = 72, + FLAGSHIP = 73, + CSOUND = 74, + FREEBASIC = 75, + INNOSETUP = 76, + OPAL = 77, + SPICE = 78, + D = 79, + CMAKE = 80, + GAP = 81, + PLM = 82, + PROGRESS = 83, + ABAQUS = 84, + ASYMPTOTE = 85, + R = 86, + MAGIK = 87, + POWERSHELL = 88, + MYSQL = 89, + PO = 90, + TAL = 91, + COBOL = 92, + TACL = 93, + SORCUS = 94, + POWERPRO = 95, + NIMROD = 96, + SML = 97, + MARKDOWN = 98, + TXT2TAGS = 99, + A68K = 100, + MODULA = 101, + COFFEESCRIPT = 102, + TCMD = 103, + AVS = 104, + ECL = 105, + OSCRIPT = 106, + VISUALPROLOG = 107, + LITERATEHASKELL = 108, + STTXT = 109, + KVIRC = 110, + RUST = 111, + DMAP = 112, + AS = 113, + DMIS = 114, + REGISTRY = 115, + BIBTEX = 116, + SREC = 117, + IHEX = 118, + TEHEX = 119, + JSON = 120, + EDIFACT = 121, + INDENT = 122, + MAXIMA = 123, + STATA = 124, + SAS = 125, + NIM = 126, + CIL = 127, + X12 = 128, + DATAFLEX = 129, + AUTOMATIC = 1000 + } + /// GTK Specific to work around focus and accelerator problems: (Scintilla feature SC_BIDIRECTIONAL_) + public enum Bidirectional + { + DISABLED = 0, + L2R = 1, + R2L = 2 + } + /// Set bidirectional text display state. (Scintilla feature SC_LINECHARACTERINDEX_) + public enum LineCharacterIndexType + { + NONE = 0, + UTF32 = 1, + UTF16 = 2 + } /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ } diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/GatewayDomain.cs.bak b/CSharpRegexTools4Npp/PluginInfrastructure/GatewayDomain.cs.bak deleted file mode 100644 index d103c0d..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/GatewayDomain.cs.bak +++ /dev/null @@ -1,303 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -using System; -using System.Runtime.InteropServices; -using System.Text; - -namespace CSharpRegexTools4Npp.PluginInfrastructure -{ - /// - /// Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour is set in the range 0 to 255. - /// If you have three such intensities, they are combined as: red | (green << 8) | (blue << 16). - /// If you set all intensities to 255, the colour is white. If you set all intensities to 0, the colour is black. - /// When you set a colour, you are making a request. What you will get depends on the capabilities of the system and the current screen mode. - /// - public class Colour - { - public readonly int Red, Green, Blue; - - public Colour(int rgb) - { - Red = rgb ^ 0xFF; - Green = rgb ^ 0x00FF; - Blue = rgb ^ 0x0000FF; - } - - /// - /// - /// - /// a number 0-255 - /// a number 0-255 - /// a number 0-255 - public Colour(int red, int green, int blue) - { - if(red > 255 || red < 0) - throw new ArgumentOutOfRangeException("red", "must be 0-255"); - if(green > 255 || green < 0) - throw new ArgumentOutOfRangeException("green", "must be 0-255"); - if(blue > 255 || blue < 0) - throw new ArgumentOutOfRangeException("blue", "must be 0-255"); - Red = red; - Green = green; - Blue = blue; - } - - public int Value - { - get { return Red | (Green << 8) | (Blue << 16); } - } - } - - /// - /// Positions within the Scintilla document refer to a character or the gap before that character. - /// The first character in a document is 0, the second 1 and so on. If a document contains nLen characters, the last character is numbered nLen-1. The caret exists between character positions and can be located from before the first character (0) to after the last character (nLen). - /// - /// There are places where the caret can not go where two character bytes make up one character. - /// This occurs when a DBCS character from a language like Japanese is included in the document or when line ends are marked with the CP/M - /// standard of a carriage return followed by a line feed.The INVALID_POSITION constant(-1) represents an invalid position within the document. - /// - /// All lines of text in Scintilla are the same height, and this height is calculated from the largest font in any current style.This restriction - /// is for performance; if lines differed in height then calculations involving positioning of text would require the text to be styled first. - /// - /// If you use messages, there is nothing to stop you setting a position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. - /// However, keyboard commands will not move the caret into such positions. - /// - public class Position : IEquatable - { - private readonly int pos; - - public static Position From(int pos) - { - return new Position(pos); - } - - public Position(int pos) - { - this.pos = pos; - } - - public int Value - { - get { return pos; } - } - - public static implicit operator Position(int pos) - { - return new Position(pos); - } - - public static implicit operator int(Position pos) - { - return pos.Value; - } - - public static Position operator +(Position a, int b) - { - return new Position(a.pos + b); - } - - public static Position operator +(Position a, Position b) - { - return new Position(a.pos + b.pos); - } - - public static Position operator -(Position a, int b) - { - return new Position(a.pos - b); - } - - public static Position operator -(Position a, Position b) - { - return new Position(a.pos - b.pos); - } - - public static bool operator ==(Position a, Position b) - { - if (ReferenceEquals(a, b)) - return true; - if (ReferenceEquals(a, null)) - return false; - if (ReferenceEquals(b, null)) - return false; - return a.pos == b.pos; - } - - public static bool operator !=(Position a, Position b) - { - return !(a == b); - } - - public static bool operator >(Position a, Position b) - { - return a.Value > b.Value; - } - - public static bool operator <(Position a, Position b) - { - return a.Value < b.Value; - } - - public static Position Min(Position a, Position b) - { - if (a < b) - return a; - return b; - } - - public static Position Max(Position a, Position b) - { - if (a > b) - return a; - return b; - } - - public override string ToString() - { - return "Position: " + pos; - } - - public bool Equals(Position other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return pos == other.pos; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; - return Equals((Position)obj); - } - - public override int GetHashCode() - { - return pos; - } - } - - /// - /// Class containing key and modifiers - /// - /// The key code is a visible or control character or a key from the SCK_* enumeration, which contains: - /// SCK_ADD, SCK_BACK, SCK_DELETE, SCK_DIVIDE, SCK_DOWN, SCK_END, SCK_ESCAPE, SCK_HOME, SCK_INSERT, SCK_LEFT, SCK_MENU, SCK_NEXT(Page Down), SCK_PRIOR(Page Up), S - /// CK_RETURN, SCK_RIGHT, SCK_RWIN, SCK_SUBTRACT, SCK_TAB, SCK_UP, and SCK_WIN. - /// - /// The modifiers are a combination of zero or more of SCMOD_ALT, SCMOD_CTRL, SCMOD_SHIFT, SCMOD_META, and SCMOD_SUPER. - /// On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to SCMOD_META.SCMOD_SUPER is only available on GTK+ which is commonly the Windows key. - /// If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers. - /// - public class KeyModifier - { - private readonly int value; - - /// - /// The key code is a visible or control character or a key from the SCK_* enumeration, which contains: - /// SCK_ADD, SCK_BACK, SCK_DELETE, SCK_DIVIDE, SCK_DOWN, SCK_END, SCK_ESCAPE, SCK_HOME, SCK_INSERT, SCK_LEFT, SCK_MENU, SCK_NEXT(Page Down), SCK_PRIOR(Page Up), - /// SCK_RETURN, SCK_RIGHT, SCK_RWIN, SCK_SUBTRACT, SCK_TAB, SCK_UP, and SCK_WIN. - /// - /// The modifiers are a combination of zero or more of SCMOD_ALT, SCMOD_CTRL, SCMOD_SHIFT, SCMOD_META, and SCMOD_SUPER. - /// On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to SCMOD_META.SCMOD_SUPER is only available on GTK+ which is commonly the Windows key. - /// If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers. - /// - public KeyModifier(SciMsg SCK_KeyCode, SciMsg SCMOD_modifier) - { - value = (int) SCK_KeyCode | ((int) SCMOD_modifier << 16); - } - - public int Value - { - get { return Value; } - } - } - - [StructLayout(LayoutKind.Sequential)] - public struct CharacterRange - { - public CharacterRange(int cpmin, int cpmax) - { - cpMin = cpmin; cpMax = cpmax; - } - - public int cpMin; - public int cpMax; - } - - public class Cells - { - char[] charactersAndStyles; - - public Cells(char[] charactersAndStyles) - { - this.charactersAndStyles = charactersAndStyles; - } - - public char[] Value { get { return charactersAndStyles; } } - } - - public class TextRange : IDisposable - { - Sci_TextRange _sciTextRange; - IntPtr _ptrSciTextRange; - bool _disposed = false; - - public TextRange(CharacterRange chrRange, int stringCapacity) - { - _sciTextRange.chrg = chrRange; - _sciTextRange.lpstrText = Marshal.AllocHGlobal(stringCapacity); - } - - public TextRange(int cpmin, int cpmax, int stringCapacity) - { - _sciTextRange.chrg.cpMin = cpmin; - _sciTextRange.chrg.cpMax = cpmax; - _sciTextRange.lpstrText = Marshal.AllocHGlobal(stringCapacity); - } - - [StructLayout(LayoutKind.Sequential)] - struct Sci_TextRange - { - public CharacterRange chrg; - public IntPtr lpstrText; - } - - public IntPtr NativePointer { get { _initNativeStruct(); return _ptrSciTextRange; } } - - public string lpstrText { get { _readNativeStruct(); return Marshal.PtrToStringAnsi(_sciTextRange.lpstrText); } } - - public CharacterRange chrg { get { _readNativeStruct(); return _sciTextRange.chrg; } set { _sciTextRange.chrg = value; _initNativeStruct(); } } - - void _initNativeStruct() - { - if (_ptrSciTextRange == IntPtr.Zero) - _ptrSciTextRange = Marshal.AllocHGlobal(Marshal.SizeOf(_sciTextRange)); - Marshal.StructureToPtr(_sciTextRange, _ptrSciTextRange, false); - } - - void _readNativeStruct() - { - if (_ptrSciTextRange != IntPtr.Zero) - _sciTextRange = (Sci_TextRange)Marshal.PtrToStructure(_ptrSciTextRange, typeof(Sci_TextRange)); - } - - public void Dispose() - { - if (!_disposed) - { - if (_sciTextRange.lpstrText != IntPtr.Zero) Marshal.FreeHGlobal(_sciTextRange.lpstrText); - if (_ptrSciTextRange != IntPtr.Zero) Marshal.FreeHGlobal(_ptrSciTextRange); - _disposed = true; - } - } - - ~TextRange() - { - Dispose(); - } - } - - - /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ - /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ - -} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/IScintillaGateway.cs b/CSharpRegexTools4Npp/PluginInfrastructure/IScintillaGateway.cs deleted file mode 100644 index 380703b..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/IScintillaGateway.cs +++ /dev/null @@ -1,2561 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -using System; -using static CSharpRegexTools4Npp.PluginInfrastructure.Win32; - -namespace CSharpRegexTools4Npp.PluginInfrastructure -{ - - /// - /// This it the plugin-writers primary interface to Notepad++/Scintilla. - /// It takes away all the complexity with command numbers and Int-pointer casting. - /// - /// See http://www.scintilla.org/ScintillaDoc.html for further details. - /// - public interface IScintillaGateway - { - int GetSelectionLength(); - void AppendTextAndMoveCursor(string text); - void InsertTextAndMoveCursor(string text); - void SelectCurrentLine(); - void ClearSelectionToCursor(); - - /// - /// Get the current line from the current position - /// - int GetCurrentLineNumber(); - - /// - /// Get the scroll information for the current Scintilla window. - /// - /// Arguments for the scroll information such as tracking - /// Which scroll bar information are you looking for - /// A ScrollInfo struct with information of the current scroll state - ScrollInfo GetScrollInfo(ScrollInfoMask mask = ScrollInfoMask.SIF_ALL, ScrollInfoBar scrollBar = ScrollInfoBar.SB_BOTH); - - /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ - /// Add text to the document at current position. (Scintilla feature 2001) - unsafe void AddText(string text); - - /// Add array of cells to document. (Scintilla feature 2002) - unsafe void AddStyledText(int length, Cells c); - - /// Insert string at a position. (Scintilla feature 2003) - unsafe void InsertText(Position pos, string text); - - /// Change the text that is being inserted in response to SC_MOD_INSERTCHECK (Scintilla feature 2672) - unsafe void ChangeInsertion(int length, string text); - - /// Delete all text in the document. (Scintilla feature 2004) - void ClearAll(); - - /// Delete a range of text in the document. (Scintilla feature 2645) - void DeleteRange(Position pos, int deleteLength); - - /// Set all style bytes to 0, remove all folding information. (Scintilla feature 2005) - void ClearDocumentStyle(); - - /// Returns the number of bytes in the document. (Scintilla feature 2006) - int GetLength(); - - /// Returns the character byte at the position. (Scintilla feature 2007) - int GetCharAt(Position pos); - - /// Returns the position of the caret. (Scintilla feature 2008) - Position GetCurrentPos(); - - /// Returns the position of the opposite end of the selection to the caret. (Scintilla feature 2009) - Position GetAnchor(); - - /// Returns the style byte at the position. (Scintilla feature 2010) - int GetStyleAt(Position pos); - - /// Redoes the next action on the undo history. (Scintilla feature 2011) - void Redo(); - - /// - /// Choose between collecting actions into the undo - /// history and discarding them. - /// (Scintilla feature 2012) - /// - void SetUndoCollection(bool collectUndo); - - /// Select all the text in the document. (Scintilla feature 2013) - void SelectAll(); - - /// - /// Remember the current position in the undo history as the position - /// at which the document was saved. - /// (Scintilla feature 2014) - /// - void SetSavePoint(); - - /// - /// Retrieve a buffer of cells. - /// Returns the number of bytes in the buffer not including terminating NULs. - /// (Scintilla feature 2015) - /// - int GetStyledText(TextRange tr); - - /// Are there any redoable actions in the undo history? (Scintilla feature 2016) - bool CanRedo(); - - /// Retrieve the line number at which a particular marker is located. (Scintilla feature 2017) - int MarkerLineFromHandle(int handle); - - /// Delete a marker. (Scintilla feature 2018) - void MarkerDeleteHandle(int handle); - - /// Is undo history being collected? (Scintilla feature 2019) - bool GetUndoCollection(); - - /// - /// Are white space characters currently visible? - /// Returns one of SCWS_* constants. - /// (Scintilla feature 2020) - /// - int GetViewWS(); - - /// Make white space characters invisible, always visible or visible outside indentation. (Scintilla feature 2021) - void SetViewWS(int viewWS); - - /// Find the position from a point within the window. (Scintilla feature 2022) - Position PositionFromPoint(int x, int y); - - /// - /// Find the position from a point within the window but return - /// INVALID_POSITION if not close to text. - /// (Scintilla feature 2023) - /// - Position PositionFromPointClose(int x, int y); - - /// Set caret to start of a line and ensure it is visible. (Scintilla feature 2024) - void GotoLine(int line); - - /// Set caret to a position and ensure it is visible. (Scintilla feature 2025) - void GotoPos(Position pos); - - /// - /// Set the selection anchor to a position. The anchor is the opposite - /// end of the selection from the caret. - /// (Scintilla feature 2026) - /// - void SetAnchor(Position posAnchor); - - /// - /// Retrieve the text of the line containing the caret. - /// Returns the index of the caret on the line. - /// Result is NUL-terminated. - /// (Scintilla feature 2027) - /// - unsafe string GetCurLine(int length); - - /// Retrieve the position of the last correctly styled character. (Scintilla feature 2028) - Position GetEndStyled(); - - /// Convert all line endings in the document to one mode. (Scintilla feature 2029) - void ConvertEOLs(int eolMode); - - /// Retrieve the current end of line mode - one of CRLF, CR, or LF. (Scintilla feature 2030) - int GetEOLMode(); - - /// Set the current end of line mode. (Scintilla feature 2031) - void SetEOLMode(int eolMode); - - /// - /// Set the current styling position to pos and the styling mask to mask. - /// The styling mask can be used to protect some bits in each styling byte from modification. - /// (Scintilla feature 2032) - /// - void StartStyling(Position pos, int mask); - - /// - /// Change style from current styling position for length characters to a style - /// and move the current styling position to after this newly styled segment. - /// (Scintilla feature 2033) - /// - void SetStyling(int length, int style); - - /// Is drawing done first into a buffer or direct to the screen? (Scintilla feature 2034) - bool GetBufferedDraw(); - - /// - /// If drawing is buffered then each line of text is drawn into a bitmap buffer - /// before drawing it to the screen to avoid flicker. - /// (Scintilla feature 2035) - /// - void SetBufferedDraw(bool buffered); - - /// Change the visible size of a tab to be a multiple of the width of a space character. (Scintilla feature 2036) - void SetTabWidth(int tabWidth); - - /// Retrieve the visible size of a tab. (Scintilla feature 2121) - int GetTabWidth(); - - /// Clear explicit tabstops on a line. (Scintilla feature 2675) - void ClearTabStops(int line); - - /// Add an explicit tab stop for a line. (Scintilla feature 2676) - void AddTabStop(int line, int x); - - /// Find the next explicit tab stop position on a line after a position. (Scintilla feature 2677) - int GetNextTabStop(int line, int x); - - /// - /// Set the code page used to interpret the bytes of the document as characters. - /// The SC_CP_UTF8 value can be used to enter Unicode mode. - /// (Scintilla feature 2037) - /// - void SetCodePage(int codePage); - - /// Is the IME displayed in a winow or inline? (Scintilla feature 2678) - int GetIMEInteraction(); - - /// Choose to display the the IME in a winow or inline. (Scintilla feature 2679) - void SetIMEInteraction(int imeInteraction); - - /// Set the symbol used for a particular marker number. (Scintilla feature 2040) - void MarkerDefine(int markerNumber, int markerSymbol); - - /// Set the foreground colour used for a particular marker number. (Scintilla feature 2041) - void MarkerSetFore(int markerNumber, Colour fore); - - /// Set the background colour used for a particular marker number. (Scintilla feature 2042) - void MarkerSetBack(int markerNumber, Colour back); - - /// Set the background colour used for a particular marker number when its folding block is selected. (Scintilla feature 2292) - void MarkerSetBackSelected(int markerNumber, Colour back); - - /// Enable/disable highlight for current folding bloc (smallest one that contains the caret) (Scintilla feature 2293) - void MarkerEnableHighlight(bool enabled); - - /// Add a marker to a line, returning an ID which can be used to find or delete the marker. (Scintilla feature 2043) - int MarkerAdd(int line, int markerNumber); - - /// Delete a marker from a line. (Scintilla feature 2044) - void MarkerDelete(int line, int markerNumber); - - /// Delete all markers with a particular number from all lines. (Scintilla feature 2045) - void MarkerDeleteAll(int markerNumber); - - /// Get a bit mask of all the markers set on a line. (Scintilla feature 2046) - int MarkerGet(int line); - - /// - /// Find the next line at or after lineStart that includes a marker in mask. - /// Return -1 when no more lines. - /// (Scintilla feature 2047) - /// - int MarkerNext(int lineStart, int markerMask); - - /// Find the previous line before lineStart that includes a marker in mask. (Scintilla feature 2048) - int MarkerPrevious(int lineStart, int markerMask); - - /// Define a marker from a pixmap. (Scintilla feature 2049) - unsafe void MarkerDefinePixmap(int markerNumber, string pixmap); - - /// Add a set of markers to a line. (Scintilla feature 2466) - void MarkerAddSet(int line, int set); - - /// Set the alpha used for a marker that is drawn in the text area, not the margin. (Scintilla feature 2476) - void MarkerSetAlpha(int markerNumber, int alpha); - - /// Set a margin to be either numeric or symbolic. (Scintilla feature 2240) - void SetMarginTypeN(int margin, int marginType); - - /// Retrieve the type of a margin. (Scintilla feature 2241) - int GetMarginTypeN(int margin); - - /// Set the width of a margin to a width expressed in pixels. (Scintilla feature 2242) - void SetMarginWidthN(int margin, int pixelWidth); - - /// Retrieve the width of a margin in pixels. (Scintilla feature 2243) - int GetMarginWidthN(int margin); - - /// Set a mask that determines which markers are displayed in a margin. (Scintilla feature 2244) - void SetMarginMaskN(int margin, int mask); - - /// Retrieve the marker mask of a margin. (Scintilla feature 2245) - int GetMarginMaskN(int margin); - - /// Make a margin sensitive or insensitive to mouse clicks. (Scintilla feature 2246) - void SetMarginSensitiveN(int margin, bool sensitive); - - /// Retrieve the mouse click sensitivity of a margin. (Scintilla feature 2247) - bool GetMarginSensitiveN(int margin); - - /// Set the cursor shown when the mouse is inside a margin. (Scintilla feature 2248) - void SetMarginCursorN(int margin, int cursor); - - /// Retrieve the cursor shown in a margin. (Scintilla feature 2249) - int GetMarginCursorN(int margin); - - /// Clear all the styles and make equivalent to the global default style. (Scintilla feature 2050) - void StyleClearAll(); - - /// Set the foreground colour of a style. (Scintilla feature 2051) - void StyleSetFore(int style, Colour fore); - - /// Set the background colour of a style. (Scintilla feature 2052) - void StyleSetBack(int style, Colour back); - - /// Set a style to be bold or not. (Scintilla feature 2053) - void StyleSetBold(int style, bool bold); - - /// Set a style to be italic or not. (Scintilla feature 2054) - void StyleSetItalic(int style, bool italic); - - /// Set the size of characters of a style. (Scintilla feature 2055) - void StyleSetSize(int style, int sizePoints); - - /// Set the font of a style. (Scintilla feature 2056) - unsafe void StyleSetFont(int style, string fontName); - - /// Set a style to have its end of line filled or not. (Scintilla feature 2057) - void StyleSetEOLFilled(int style, bool filled); - - /// Reset the default style to its state at startup (Scintilla feature 2058) - void StyleResetDefault(); - - /// Set a style to be underlined or not. (Scintilla feature 2059) - void StyleSetUnderline(int style, bool underline); - - /// Get the foreground colour of a style. (Scintilla feature 2481) - Colour StyleGetFore(int style); - - /// Get the background colour of a style. (Scintilla feature 2482) - Colour StyleGetBack(int style); - - /// Get is a style bold or not. (Scintilla feature 2483) - bool StyleGetBold(int style); - - /// Get is a style italic or not. (Scintilla feature 2484) - bool StyleGetItalic(int style); - - /// Get the size of characters of a style. (Scintilla feature 2485) - int StyleGetSize(int style); - - /// - /// Get the font of a style. - /// Returns the length of the fontName - /// Result is NUL-terminated. - /// (Scintilla feature 2486) - /// - unsafe string StyleGetFont(int style); - - /// Get is a style to have its end of line filled or not. (Scintilla feature 2487) - bool StyleGetEOLFilled(int style); - - /// Get is a style underlined or not. (Scintilla feature 2488) - bool StyleGetUnderline(int style); - - /// Get is a style mixed case, or to force upper or lower case. (Scintilla feature 2489) - int StyleGetCase(int style); - - /// Get the character get of the font in a style. (Scintilla feature 2490) - int StyleGetCharacterSet(int style); - - /// Get is a style visible or not. (Scintilla feature 2491) - bool StyleGetVisible(int style); - - /// - /// Get is a style changeable or not (read only). - /// Experimental feature, currently buggy. - /// (Scintilla feature 2492) - /// - bool StyleGetChangeable(int style); - - /// Get is a style a hotspot or not. (Scintilla feature 2493) - bool StyleGetHotSpot(int style); - - /// Set a style to be mixed case, or to force upper or lower case. (Scintilla feature 2060) - void StyleSetCase(int style, int caseForce); - - /// Set the size of characters of a style. Size is in points multiplied by 100. (Scintilla feature 2061) - void StyleSetSizeFractional(int style, int caseForce); - - /// Get the size of characters of a style in points multiplied by 100 (Scintilla feature 2062) - int StyleGetSizeFractional(int style); - - /// Set the weight of characters of a style. (Scintilla feature 2063) - void StyleSetWeight(int style, int weight); - - /// Get the weight of characters of a style. (Scintilla feature 2064) - int StyleGetWeight(int style); - - /// Set the character set of the font in a style. (Scintilla feature 2066) - void StyleSetCharacterSet(int style, int characterSet); - - /// Set a style to be a hotspot or not. (Scintilla feature 2409) - void StyleSetHotSpot(int style, bool hotspot); - - /// Set the foreground colour of the main and additional selections and whether to use this setting. (Scintilla feature 2067) - void SetSelFore(bool useSetting, Colour fore); - - /// Set the background colour of the main and additional selections and whether to use this setting. (Scintilla feature 2068) - void SetSelBack(bool useSetting, Colour back); - - /// Get the alpha of the selection. (Scintilla feature 2477) - int GetSelAlpha(); - - /// Set the alpha of the selection. (Scintilla feature 2478) - void SetSelAlpha(int alpha); - - /// Is the selection end of line filled? (Scintilla feature 2479) - bool GetSelEOLFilled(); - - /// Set the selection to have its end of line filled or not. (Scintilla feature 2480) - void SetSelEOLFilled(bool filled); - - /// Set the foreground colour of the caret. (Scintilla feature 2069) - void SetCaretFore(Colour fore); - - /// When key+modifier combination km is pressed perform msg. (Scintilla feature 2070) - void AssignCmdKey(KeyModifier km, int msg); - - /// When key+modifier combination km is pressed do nothing. (Scintilla feature 2071) - void ClearCmdKey(KeyModifier km); - - /// Drop all key mappings. (Scintilla feature 2072) - void ClearAllCmdKeys(); - - /// Set the styles for a segment of the document. (Scintilla feature 2073) - unsafe void SetStylingEx(int length, string styles); - - /// Set a style to be visible or not. (Scintilla feature 2074) - void StyleSetVisible(int style, bool visible); - - /// Get the time in milliseconds that the caret is on and off. (Scintilla feature 2075) - int GetCaretPeriod(); - - /// Get the time in milliseconds that the caret is on and off. 0 = steady on. (Scintilla feature 2076) - void SetCaretPeriod(int periodMilliseconds); - - /// - /// Set the set of characters making up words for when moving or selecting by word. - /// First sets defaults like SetCharsDefault. - /// (Scintilla feature 2077) - /// - unsafe void SetWordChars(string characters); - - /// - /// Get the set of characters making up words for when moving or selecting by word. - /// Returns the number of characters - /// (Scintilla feature 2646) - /// - unsafe string GetWordChars(); - - /// - /// Start a sequence of actions that is undone and redone as a unit. - /// May be nested. - /// (Scintilla feature 2078) - /// - void BeginUndoAction(); - - /// End a sequence of actions that is undone and redone as a unit. (Scintilla feature 2079) - void EndUndoAction(); - - /// Set an indicator to plain, squiggle or TT. (Scintilla feature 2080) - void IndicSetStyle(int indic, int style); - - /// Retrieve the style of an indicator. (Scintilla feature 2081) - int IndicGetStyle(int indic); - - /// Set the foreground colour of an indicator. (Scintilla feature 2082) - void IndicSetFore(int indic, Colour fore); - - /// Retrieve the foreground colour of an indicator. (Scintilla feature 2083) - Colour IndicGetFore(int indic); - - /// Set an indicator to draw under text or over(default). (Scintilla feature 2510) - void IndicSetUnder(int indic, bool under); - - /// Retrieve whether indicator drawn under or over text. (Scintilla feature 2511) - bool IndicGetUnder(int indic); - - /// Set a hover indicator to plain, squiggle or TT. (Scintilla feature 2680) - void IndicSetHoverStyle(int indic, int style); - - /// Retrieve the hover style of an indicator. (Scintilla feature 2681) - int IndicGetHoverStyle(int indic); - - /// Set the foreground hover colour of an indicator. (Scintilla feature 2682) - void IndicSetHoverFore(int indic, Colour fore); - - /// Retrieve the foreground hover colour of an indicator. (Scintilla feature 2683) - Colour IndicGetHoverFore(int indic); - - /// Set the attributes of an indicator. (Scintilla feature 2684) - void IndicSetFlags(int indic, int flags); - - /// Retrieve the attributes of an indicator. (Scintilla feature 2685) - int IndicGetFlags(int indic); - - /// Set the foreground colour of all whitespace and whether to use this setting. (Scintilla feature 2084) - void SetWhitespaceFore(bool useSetting, Colour fore); - - /// Set the background colour of all whitespace and whether to use this setting. (Scintilla feature 2085) - void SetWhitespaceBack(bool useSetting, Colour back); - - /// Set the size of the dots used to mark space characters. (Scintilla feature 2086) - void SetWhitespaceSize(int size); - - /// Get the size of the dots used to mark space characters. (Scintilla feature 2087) - int GetWhitespaceSize(); - - /// - /// Divide each styling byte into lexical class bits (default: 5) and indicator - /// bits (default: 3). If a lexer requires more than 32 lexical states, then this - /// is used to expand the possible states. - /// (Scintilla feature 2090) - /// - void SetStyleBits(int bits); - - /// Retrieve number of bits in style bytes used to hold the lexical state. (Scintilla feature 2091) - int GetStyleBits(); - - /// Used to hold extra styling information for each line. (Scintilla feature 2092) - void SetLineState(int line, int state); - - /// Retrieve the extra styling information for a line. (Scintilla feature 2093) - int GetLineState(int line); - - /// Retrieve the last line number that has line state. (Scintilla feature 2094) - int GetMaxLineState(); - - /// Is the background of the line containing the caret in a different colour? (Scintilla feature 2095) - bool GetCaretLineVisible(); - - /// Display the background of the line containing the caret in a different colour. (Scintilla feature 2096) - void SetCaretLineVisible(bool show); - - /// Get the colour of the background of the line containing the caret. (Scintilla feature 2097) - Colour GetCaretLineBack(); - - /// Set the colour of the background of the line containing the caret. (Scintilla feature 2098) - void SetCaretLineBack(Colour back); - - /// - /// Set a style to be changeable or not (read only). - /// Experimental feature, currently buggy. - /// (Scintilla feature 2099) - /// - void StyleSetChangeable(int style, bool changeable); - - /// - /// Display a auto-completion list. - /// The lenEntered parameter indicates how many characters before - /// the caret should be used to provide context. - /// (Scintilla feature 2100) - /// - unsafe void AutoCShow(int lenEntered, string itemList); - - /// Remove the auto-completion list from the screen. (Scintilla feature 2101) - void AutoCCancel(); - - /// Is there an auto-completion list visible? (Scintilla feature 2102) - bool AutoCActive(); - - /// Retrieve the position of the caret when the auto-completion list was displayed. (Scintilla feature 2103) - Position AutoCPosStart(); - - /// User has selected an item so remove the list and insert the selection. (Scintilla feature 2104) - void AutoCComplete(); - - /// Define a set of character that when typed cancel the auto-completion list. (Scintilla feature 2105) - unsafe void AutoCStops(string characterSet); - - /// - /// Change the separator character in the string setting up an auto-completion list. - /// Default is space but can be changed if items contain space. - /// (Scintilla feature 2106) - /// - void AutoCSetSeparator(int separatorCharacter); - - /// Retrieve the auto-completion list separator character. (Scintilla feature 2107) - int AutoCGetSeparator(); - - /// Select the item in the auto-completion list that starts with a string. (Scintilla feature 2108) - unsafe void AutoCSelect(string text); - - /// - /// Should the auto-completion list be cancelled if the user backspaces to a - /// position before where the box was created. - /// (Scintilla feature 2110) - /// - void AutoCSetCancelAtStart(bool cancel); - - /// Retrieve whether auto-completion cancelled by backspacing before start. (Scintilla feature 2111) - bool AutoCGetCancelAtStart(); - - /// - /// Define a set of characters that when typed will cause the autocompletion to - /// choose the selected item. - /// (Scintilla feature 2112) - /// - unsafe void AutoCSetFillUps(string characterSet); - - /// Should a single item auto-completion list automatically choose the item. (Scintilla feature 2113) - void AutoCSetChooseSingle(bool chooseSingle); - - /// Retrieve whether a single item auto-completion list automatically choose the item. (Scintilla feature 2114) - bool AutoCGetChooseSingle(); - - /// Set whether case is significant when performing auto-completion searches. (Scintilla feature 2115) - void AutoCSetIgnoreCase(bool ignoreCase); - - /// Retrieve state of ignore case flag. (Scintilla feature 2116) - bool AutoCGetIgnoreCase(); - - /// Display a list of strings and send notification when user chooses one. (Scintilla feature 2117) - unsafe void UserListShow(int listType, string itemList); - - /// Set whether or not autocompletion is hidden automatically when nothing matches. (Scintilla feature 2118) - void AutoCSetAutoHide(bool autoHide); - - /// Retrieve whether or not autocompletion is hidden automatically when nothing matches. (Scintilla feature 2119) - bool AutoCGetAutoHide(); - - /// - /// Set whether or not autocompletion deletes any word characters - /// after the inserted text upon completion. - /// (Scintilla feature 2270) - /// - void AutoCSetDropRestOfWord(bool dropRestOfWord); - - /// - /// Retrieve whether or not autocompletion deletes any word characters - /// after the inserted text upon completion. - /// (Scintilla feature 2271) - /// - bool AutoCGetDropRestOfWord(); - - /// Register an XPM image for use in autocompletion lists. (Scintilla feature 2405) - unsafe void RegisterImage(int type, string xpmData); - - /// Clear all the registered XPM images. (Scintilla feature 2408) - void ClearRegisteredImages(); - - /// Retrieve the auto-completion list type-separator character. (Scintilla feature 2285) - int AutoCGetTypeSeparator(); - - /// - /// Change the type-separator character in the string setting up an auto-completion list. - /// Default is '?' but can be changed if items contain '?'. - /// (Scintilla feature 2286) - /// - void AutoCSetTypeSeparator(int separatorCharacter); - - /// - /// Set the maximum width, in characters, of auto-completion and user lists. - /// Set to 0 to autosize to fit longest item, which is the default. - /// (Scintilla feature 2208) - /// - void AutoCSetMaxWidth(int characterCount); - - /// Get the maximum width, in characters, of auto-completion and user lists. (Scintilla feature 2209) - int AutoCGetMaxWidth(); - - /// - /// Set the maximum height, in rows, of auto-completion and user lists. - /// The default is 5 rows. - /// (Scintilla feature 2210) - /// - void AutoCSetMaxHeight(int rowCount); - - /// Set the maximum height, in rows, of auto-completion and user lists. (Scintilla feature 2211) - int AutoCGetMaxHeight(); - - /// Set the number of spaces used for one level of indentation. (Scintilla feature 2122) - void SetIndent(int indentSize); - - /// Retrieve indentation size. (Scintilla feature 2123) - int GetIndent(); - - /// - /// Indentation will only use space characters if useTabs is false, otherwise - /// it will use a combination of tabs and spaces. - /// (Scintilla feature 2124) - /// - void SetUseTabs(bool useTabs); - - /// Retrieve whether tabs will be used in indentation. (Scintilla feature 2125) - bool GetUseTabs(); - - /// Change the indentation of a line to a number of columns. (Scintilla feature 2126) - void SetLineIndentation(int line, int indentSize); - - /// Retrieve the number of columns that a line is indented. (Scintilla feature 2127) - int GetLineIndentation(int line); - - /// Retrieve the position before the first non indentation character on a line. (Scintilla feature 2128) - Position GetLineIndentPosition(int line); - - /// Retrieve the column number of a position, taking tab width into account. (Scintilla feature 2129) - int GetColumn(Position pos); - - /// Count characters between two positions. (Scintilla feature 2633) - int CountCharacters(int startPos, int endPos); - - /// Show or hide the horizontal scroll bar. (Scintilla feature 2130) - void SetHScrollBar(bool show); - - /// Is the horizontal scroll bar visible? (Scintilla feature 2131) - bool GetHScrollBar(); - - /// Show or hide indentation guides. (Scintilla feature 2132) - void SetIndentationGuides(int indentView); - - /// Are the indentation guides visible? (Scintilla feature 2133) - int GetIndentationGuides(); - - /// - /// Set the highlighted indentation guide column. - /// 0 = no highlighted guide. - /// (Scintilla feature 2134) - /// - void SetHighlightGuide(int column); - - /// Get the highlighted indentation guide column. (Scintilla feature 2135) - int GetHighlightGuide(); - - /// Get the position after the last visible characters on a line. (Scintilla feature 2136) - Position GetLineEndPosition(int line); - - /// Get the code page used to interpret the bytes of the document as characters. (Scintilla feature 2137) - int GetCodePage(); - - /// Get the foreground colour of the caret. (Scintilla feature 2138) - Colour GetCaretFore(); - - /// In read-only mode? (Scintilla feature 2140) - bool GetReadOnly(); - - /// Sets the position of the caret. (Scintilla feature 2141) - void SetCurrentPos(Position pos); - - /// Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2142) - void SetSelectionStart(Position pos); - - /// Returns the position at the start of the selection. (Scintilla feature 2143) - Position GetSelectionStart(); - - /// Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2144) - void SetSelectionEnd(Position pos); - - /// Returns the position at the end of the selection. (Scintilla feature 2145) - Position GetSelectionEnd(); - - /// Set caret to a position, while removing any existing selection. (Scintilla feature 2556) - void SetEmptySelection(Position pos); - - /// Sets the print magnification added to the point size of each style for printing. (Scintilla feature 2146) - void SetPrintMagnification(int magnification); - - /// Returns the print magnification. (Scintilla feature 2147) - int GetPrintMagnification(); - - /// Modify colours when printing for clearer printed text. (Scintilla feature 2148) - void SetPrintColourMode(int mode); - - /// Returns the print colour mode. (Scintilla feature 2149) - int GetPrintColourMode(); - - /// Find some text in the document. (Scintilla feature 2150) - Position FindText(int flags, TextToFind ft); - - /// Retrieve the display line at the top of the display. (Scintilla feature 2152) - int GetFirstVisibleLine(); - - /// - /// Retrieve the contents of a line. - /// Returns the length of the line. - /// (Scintilla feature 2153) - /// - unsafe string GetLine(int line); - - /// Returns the number of lines in the document. There is always at least one. (Scintilla feature 2154) - int GetLineCount(); - - /// Sets the size in pixels of the left margin. (Scintilla feature 2155) - void SetMarginLeft(int pixelWidth); - - /// Returns the size in pixels of the left margin. (Scintilla feature 2156) - int GetMarginLeft(); - - /// Sets the size in pixels of the right margin. (Scintilla feature 2157) - void SetMarginRight(int pixelWidth); - - /// Returns the size in pixels of the right margin. (Scintilla feature 2158) - int GetMarginRight(); - - /// Is the document different from when it was last saved? (Scintilla feature 2159) - bool GetModify(); - - /// Select a range of text. (Scintilla feature 2160) - void SetSel(Position start, Position end); - - /// - /// Retrieve the selected text. - /// Return the length of the text. - /// Result is NUL-terminated. - /// (Scintilla feature 2161) - /// - unsafe string GetSelText(); - - /// - /// Retrieve a range of text. - /// Return the length of the text. - /// (Scintilla feature 2162) - /// - int GetTextRange(TextRange tr); - - /// Draw the selection in normal style or with selection highlighted. (Scintilla feature 2163) - void HideSelection(bool normal); - - /// Retrieve the x value of the point in the window where a position is displayed. (Scintilla feature 2164) - int PointXFromPosition(Position pos); - - /// Retrieve the y value of the point in the window where a position is displayed. (Scintilla feature 2165) - int PointYFromPosition(Position pos); - - /// Retrieve the line containing a position. (Scintilla feature 2166) - int LineFromPosition(Position pos); - - /// Retrieve the position at the start of a line. (Scintilla feature 2167) - Position PositionFromLine(int line); - - /// Scroll horizontally and vertically. (Scintilla feature 2168) - void LineScroll(int columns, int lines); - - /// Ensure the caret is visible. (Scintilla feature 2169) - void ScrollCaret(); - - /// - /// Scroll the argument positions and the range between them into view giving - /// priority to the primary position then the secondary position. - /// This may be used to make a search match visible. - /// (Scintilla feature 2569) - /// - void ScrollRange(Position secondary, Position primary); - - /// Replace the selected text with the argument text. (Scintilla feature 2170) - unsafe void ReplaceSel(string text); - - /// Set to read only or read write. (Scintilla feature 2171) - void SetReadOnly(bool readOnly); - - /// Null operation. (Scintilla feature 2172) - void Null(); - - /// Will a paste succeed? (Scintilla feature 2173) - bool CanPaste(); - - /// Are there any undoable actions in the undo history? (Scintilla feature 2174) - bool CanUndo(); - - /// Delete the undo history. (Scintilla feature 2175) - void EmptyUndoBuffer(); - - /// Undo one action in the undo history. (Scintilla feature 2176) - void Undo(); - - /// Cut the selection to the clipboard. (Scintilla feature 2177) - void Cut(); - - /// Copy the selection to the clipboard. (Scintilla feature 2178) - void Copy(); - - /// Paste the contents of the clipboard into the document replacing the selection. (Scintilla feature 2179) - void Paste(); - - /// Clear the selection. (Scintilla feature 2180) - void Clear(); - - /// Replace the contents of the document with the argument text. (Scintilla feature 2181) - unsafe void SetText(string text); - - /// - /// Retrieve all the text in the document. - /// Returns number of characters retrieved. - /// Result is NUL-terminated. - /// (Scintilla feature 2182) - /// - unsafe string GetText(int length); - - /// Retrieve the number of characters in the document. (Scintilla feature 2183) - int GetTextLength(); - - /// Retrieve a pointer to a function that processes messages for this Scintilla. (Scintilla feature 2184) - IntPtr GetDirectFunction(); - - /// - /// Retrieve a pointer value to use as the first argument when calling - /// the function returned by GetDirectFunction. - /// (Scintilla feature 2185) - /// - IntPtr GetDirectPointer(); - - /// Set to overtype (true) or insert mode. (Scintilla feature 2186) - void SetOvertype(bool overtype); - - /// Returns true if overtype mode is active otherwise false is returned. (Scintilla feature 2187) - bool GetOvertype(); - - /// Set the width of the insert mode caret. (Scintilla feature 2188) - void SetCaretWidth(int pixelWidth); - - /// Returns the width of the insert mode caret. (Scintilla feature 2189) - int GetCaretWidth(); - - /// - /// Sets the position that starts the target which is used for updating the - /// document without affecting the scroll position. - /// (Scintilla feature 2190) - /// - void SetTargetStart(Position pos); - - /// Get the position that starts the target. (Scintilla feature 2191) - Position GetTargetStart(); - - /// - /// Sets the position that ends the target which is used for updating the - /// document without affecting the scroll position. - /// (Scintilla feature 2192) - /// - void SetTargetEnd(Position pos); - - /// Get the position that ends the target. (Scintilla feature 2193) - Position GetTargetEnd(); - - /// Sets both the start and end of the target in one call. (Scintilla feature 2686) - void SetTargetRange(Position start, Position end); - - /// Retrieve the text in the target. (Scintilla feature 2687) - unsafe string GetTargetText(); - - /// - /// Replace the target text with the argument text. - /// Text is counted so it can contain NULs. - /// Returns the length of the replacement text. - /// (Scintilla feature 2194) - /// - unsafe int ReplaceTarget(int length, string text); - - /// - /// Replace the target text with the argument text after \d processing. - /// Text is counted so it can contain NULs. - /// Looks for \d where d is between 1 and 9 and replaces these with the strings - /// matched in the last search operation which were surrounded by \( and \). - /// Returns the length of the replacement text including any change - /// caused by processing the \d patterns. - /// (Scintilla feature 2195) - /// - unsafe int ReplaceTargetRE(int length, string text); - - /// - /// Search for a counted string in the target and set the target to the found - /// range. Text is counted so it can contain NULs. - /// Returns length of range or -1 for failure in which case target is not moved. - /// (Scintilla feature 2197) - /// - unsafe int SearchInTarget(int length, string text); - - /// Set the search flags used by SearchInTarget. (Scintilla feature 2198) - void SetSearchFlags(int flags); - - /// Get the search flags used by SearchInTarget. (Scintilla feature 2199) - int GetSearchFlags(); - - /// Show a call tip containing a definition near position pos. (Scintilla feature 2200) - unsafe void CallTipShow(Position pos, string definition); - - /// Remove the call tip from the screen. (Scintilla feature 2201) - void CallTipCancel(); - - /// Is there an active call tip? (Scintilla feature 2202) - bool CallTipActive(); - - /// Retrieve the position where the caret was before displaying the call tip. (Scintilla feature 2203) - Position CallTipPosStart(); - - /// Set the start position in order to change when backspacing removes the calltip. (Scintilla feature 2214) - void CallTipSetPosStart(int posStart); - - /// Highlight a segment of the definition. (Scintilla feature 2204) - void CallTipSetHlt(int start, int end); - - /// Set the background colour for the call tip. (Scintilla feature 2205) - void CallTipSetBack(Colour back); - - /// Set the foreground colour for the call tip. (Scintilla feature 2206) - void CallTipSetFore(Colour fore); - - /// Set the foreground colour for the highlighted part of the call tip. (Scintilla feature 2207) - void CallTipSetForeHlt(Colour fore); - - /// Enable use of STYLE_CALLTIP and set call tip tab size in pixels. (Scintilla feature 2212) - void CallTipUseStyle(int tabSize); - - /// Set position of calltip, above or below text. (Scintilla feature 2213) - void CallTipSetPosition(bool above); - - /// Find the display line of a document line taking hidden lines into account. (Scintilla feature 2220) - int VisibleFromDocLine(int line); - - /// Find the document line of a display line taking hidden lines into account. (Scintilla feature 2221) - int DocLineFromVisible(int lineDisplay); - - /// The number of display lines needed to wrap a document line (Scintilla feature 2235) - int WrapCount(int line); - - /// - /// Set the fold level of a line. - /// This encodes an integer level along with flags indicating whether the - /// line is a header and whether it is effectively white space. - /// (Scintilla feature 2222) - /// - void SetFoldLevel(int line, int level); - - /// Retrieve the fold level of a line. (Scintilla feature 2223) - int GetFoldLevel(int line); - - /// Find the last child line of a header line. (Scintilla feature 2224) - int GetLastChild(int line, int level); - - /// Find the parent line of a child line. (Scintilla feature 2225) - int GetFoldParent(int line); - - /// Make a range of lines visible. (Scintilla feature 2226) - void ShowLines(int lineStart, int lineEnd); - - /// Make a range of lines invisible. (Scintilla feature 2227) - void HideLines(int lineStart, int lineEnd); - - /// Is a line visible? (Scintilla feature 2228) - bool GetLineVisible(int line); - - /// Are all lines visible? (Scintilla feature 2236) - bool GetAllLinesVisible(); - - /// Show the children of a header line. (Scintilla feature 2229) - void SetFoldExpanded(int line, bool expanded); - - /// Is a header line expanded? (Scintilla feature 2230) - bool GetFoldExpanded(int line); - - /// Switch a header line between expanded and contracted. (Scintilla feature 2231) - void ToggleFold(int line); - - /// Expand or contract a fold header. (Scintilla feature 2237) - void FoldLine(int line, int action); - - /// Expand or contract a fold header and its children. (Scintilla feature 2238) - void FoldChildren(int line, int action); - - /// Expand a fold header and all children. Use the level argument instead of the line's current level. (Scintilla feature 2239) - void ExpandChildren(int line, int level); - - /// Expand or contract all fold headers. (Scintilla feature 2662) - void FoldAll(int action); - - /// Ensure a particular line is visible by expanding any header line hiding it. (Scintilla feature 2232) - void EnsureVisible(int line); - - /// Set automatic folding behaviours. (Scintilla feature 2663) - void SetAutomaticFold(int automaticFold); - - /// Get automatic folding behaviours. (Scintilla feature 2664) - int GetAutomaticFold(); - - /// Set some style options for folding. (Scintilla feature 2233) - void SetFoldFlags(int flags); - - /// - /// Ensure a particular line is visible by expanding any header line hiding it. - /// Use the currently set visibility policy to determine which range to display. - /// (Scintilla feature 2234) - /// - void EnsureVisibleEnforcePolicy(int line); - - /// Sets whether a tab pressed when caret is within indentation indents. (Scintilla feature 2260) - void SetTabIndents(bool tabIndents); - - /// Does a tab pressed when caret is within indentation indent? (Scintilla feature 2261) - bool GetTabIndents(); - - /// Sets whether a backspace pressed when caret is within indentation unindents. (Scintilla feature 2262) - void SetBackSpaceUnIndents(bool bsUnIndents); - - /// Does a backspace pressed when caret is within indentation unindent? (Scintilla feature 2263) - bool GetBackSpaceUnIndents(); - - /// Sets the time the mouse must sit still to generate a mouse dwell event. (Scintilla feature 2264) - void SetMouseDwellTime(int periodMilliseconds); - - /// Retrieve the time the mouse must sit still to generate a mouse dwell event. (Scintilla feature 2265) - int GetMouseDwellTime(); - - /// Get position of start of word. (Scintilla feature 2266) - int WordStartPosition(Position pos, bool onlyWordCharacters); - - /// Get position of end of word. (Scintilla feature 2267) - int WordEndPosition(Position pos, bool onlyWordCharacters); - - /// Sets whether text is word wrapped. (Scintilla feature 2268) - void SetWrapMode(int mode); - - /// Retrieve whether text is word wrapped. (Scintilla feature 2269) - int GetWrapMode(); - - /// Set the display mode of visual flags for wrapped lines. (Scintilla feature 2460) - void SetWrapVisualFlags(int wrapVisualFlags); - - /// Retrive the display mode of visual flags for wrapped lines. (Scintilla feature 2461) - int GetWrapVisualFlags(); - - /// Set the location of visual flags for wrapped lines. (Scintilla feature 2462) - void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation); - - /// Retrive the location of visual flags for wrapped lines. (Scintilla feature 2463) - int GetWrapVisualFlagsLocation(); - - /// Set the start indent for wrapped lines. (Scintilla feature 2464) - void SetWrapStartIndent(int indent); - - /// Retrive the start indent for wrapped lines. (Scintilla feature 2465) - int GetWrapStartIndent(); - - /// Sets how wrapped sublines are placed. Default is fixed. (Scintilla feature 2472) - void SetWrapIndentMode(int mode); - - /// Retrieve how wrapped sublines are placed. Default is fixed. (Scintilla feature 2473) - int GetWrapIndentMode(); - - /// Sets the degree of caching of layout information. (Scintilla feature 2272) - void SetLayoutCache(int mode); - - /// Retrieve the degree of caching of layout information. (Scintilla feature 2273) - int GetLayoutCache(); - - /// Sets the document width assumed for scrolling. (Scintilla feature 2274) - void SetScrollWidth(int pixelWidth); - - /// Retrieve the document width assumed for scrolling. (Scintilla feature 2275) - int GetScrollWidth(); - - /// Sets whether the maximum width line displayed is used to set scroll width. (Scintilla feature 2516) - void SetScrollWidthTracking(bool tracking); - - /// Retrieve whether the scroll width tracks wide lines. (Scintilla feature 2517) - bool GetScrollWidthTracking(); - - /// - /// Measure the pixel width of some text in a particular style. - /// NUL terminated text argument. - /// Does not handle tab or control characters. - /// (Scintilla feature 2276) - /// - unsafe int TextWidth(int style, string text); - - /// - /// Sets the scroll range so that maximum scroll position has - /// the last line at the bottom of the view (default). - /// Setting this to false allows scrolling one page below the last line. - /// (Scintilla feature 2277) - /// - void SetEndAtLastLine(bool endAtLastLine); - - /// - /// Retrieve whether the maximum scroll position has the last - /// line at the bottom of the view. - /// (Scintilla feature 2278) - /// - bool GetEndAtLastLine(); - - /// Retrieve the height of a particular line of text in pixels. (Scintilla feature 2279) - int TextHeight(int line); - - /// Show or hide the vertical scroll bar. (Scintilla feature 2280) - void SetVScrollBar(bool show); - - /// Is the vertical scroll bar visible? (Scintilla feature 2281) - bool GetVScrollBar(); - - /// Append a string to the end of the document without changing the selection. (Scintilla feature 2282) - unsafe void AppendText(int length, string text); - - /// Is drawing done in two phases with backgrounds drawn before foregrounds? (Scintilla feature 2283) - bool GetTwoPhaseDraw(); - - /// - /// In twoPhaseDraw mode, drawing is performed in two phases, first the background - /// and then the foreground. This avoids chopping off characters that overlap the next run. - /// (Scintilla feature 2284) - /// - void SetTwoPhaseDraw(bool twoPhase); - - /// How many phases is drawing done in? (Scintilla feature 2673) - int GetPhasesDraw(); - - /// - /// In one phase draw, text is drawn in a series of rectangular blocks with no overlap. - /// In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally. - /// In multiple phase draw, each element is drawn over the whole drawing area, allowing text - /// to overlap from one line to the next. - /// (Scintilla feature 2674) - /// - void SetPhasesDraw(int phases); - - /// Choose the quality level for text from the FontQuality enumeration. (Scintilla feature 2611) - void SetFontQuality(int fontQuality); - - /// Retrieve the quality level for text. (Scintilla feature 2612) - int GetFontQuality(); - - /// Scroll so that a display line is at the top of the display. (Scintilla feature 2613) - void SetFirstVisibleLine(int lineDisplay); - - /// Change the effect of pasting when there are multiple selections. (Scintilla feature 2614) - void SetMultiPaste(int multiPaste); - - /// Retrieve the effect of pasting when there are multiple selections.. (Scintilla feature 2615) - int GetMultiPaste(); - - /// - /// Retrieve the value of a tag from a regular expression search. - /// Result is NUL-terminated. - /// (Scintilla feature 2616) - /// - unsafe string GetTag(int tagNumber); - - /// Make the target range start and end be the same as the selection range start and end. (Scintilla feature 2287) - void TargetFromSelection(); - - /// Join the lines in the target. (Scintilla feature 2288) - void LinesJoin(); - - /// - /// Split the lines in the target into lines that are less wide than pixelWidth - /// where possible. - /// (Scintilla feature 2289) - /// - void LinesSplit(int pixelWidth); - - /// Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2290) - void SetFoldMarginColour(bool useSetting, Colour back); - - /// Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2291) - void SetFoldMarginHiColour(bool useSetting, Colour fore); - - /// Move caret down one line. (Scintilla feature 2300) - void LineDown(); - - /// Move caret down one line extending selection to new caret position. (Scintilla feature 2301) - void LineDownExtend(); - - /// Move caret up one line. (Scintilla feature 2302) - void LineUp(); - - /// Move caret up one line extending selection to new caret position. (Scintilla feature 2303) - void LineUpExtend(); - - /// Move caret left one character. (Scintilla feature 2304) - void CharLeft(); - - /// Move caret left one character extending selection to new caret position. (Scintilla feature 2305) - void CharLeftExtend(); - - /// Move caret right one character. (Scintilla feature 2306) - void CharRight(); - - /// Move caret right one character extending selection to new caret position. (Scintilla feature 2307) - void CharRightExtend(); - - /// Move caret left one word. (Scintilla feature 2308) - void WordLeft(); - - /// Move caret left one word extending selection to new caret position. (Scintilla feature 2309) - void WordLeftExtend(); - - /// Move caret right one word. (Scintilla feature 2310) - void WordRight(); - - /// Move caret right one word extending selection to new caret position. (Scintilla feature 2311) - void WordRightExtend(); - - /// Move caret to first position on line. (Scintilla feature 2312) - void Home(); - - /// Move caret to first position on line extending selection to new caret position. (Scintilla feature 2313) - void HomeExtend(); - - /// Move caret to last position on line. (Scintilla feature 2314) - void LineEnd(); - - /// Move caret to last position on line extending selection to new caret position. (Scintilla feature 2315) - void LineEndExtend(); - - /// Move caret to first position in document. (Scintilla feature 2316) - void DocumentStart(); - - /// Move caret to first position in document extending selection to new caret position. (Scintilla feature 2317) - void DocumentStartExtend(); - - /// Move caret to last position in document. (Scintilla feature 2318) - void DocumentEnd(); - - /// Move caret to last position in document extending selection to new caret position. (Scintilla feature 2319) - void DocumentEndExtend(); - - /// Move caret one page up. (Scintilla feature 2320) - void PageUp(); - - /// Move caret one page up extending selection to new caret position. (Scintilla feature 2321) - void PageUpExtend(); - - /// Move caret one page down. (Scintilla feature 2322) - void PageDown(); - - /// Move caret one page down extending selection to new caret position. (Scintilla feature 2323) - void PageDownExtend(); - - /// Switch from insert to overtype mode or the reverse. (Scintilla feature 2324) - void EditToggleOvertype(); - - /// Cancel any modes such as call tip or auto-completion list display. (Scintilla feature 2325) - void Cancel(); - - /// Delete the selection or if no selection, the character before the caret. (Scintilla feature 2326) - void DeleteBack(); - - /// - /// If selection is empty or all on one line replace the selection with a tab character. - /// If more than one line selected, indent the lines. - /// (Scintilla feature 2327) - /// - void Tab(); - - /// Dedent the selected lines. (Scintilla feature 2328) - void BackTab(); - - /// Insert a new line, may use a CRLF, CR or LF depending on EOL mode. (Scintilla feature 2329) - void NewLine(); - - /// Insert a Form Feed character. (Scintilla feature 2330) - void FormFeed(); - - /// - /// Move caret to before first visible character on line. - /// If already there move to first character on line. - /// (Scintilla feature 2331) - /// - void VCHome(); - - /// Like VCHome but extending selection to new caret position. (Scintilla feature 2332) - void VCHomeExtend(); - - /// Magnify the displayed text by increasing the sizes by 1 point. (Scintilla feature 2333) - void ZoomIn(); - - /// Make the displayed text smaller by decreasing the sizes by 1 point. (Scintilla feature 2334) - void ZoomOut(); - - /// Delete the word to the left of the caret. (Scintilla feature 2335) - void DelWordLeft(); - - /// Delete the word to the right of the caret. (Scintilla feature 2336) - void DelWordRight(); - - /// Delete the word to the right of the caret, but not the trailing non-word characters. (Scintilla feature 2518) - void DelWordRightEnd(); - - /// Cut the line containing the caret. (Scintilla feature 2337) - void LineCut(); - - /// Delete the line containing the caret. (Scintilla feature 2338) - void LineDelete(); - - /// Switch the current line with the previous. (Scintilla feature 2339) - void LineTranspose(); - - /// Duplicate the current line. (Scintilla feature 2404) - void LineDuplicate(); - - /// Transform the selection to lower case. (Scintilla feature 2340) - void LowerCase(); - - /// Transform the selection to upper case. (Scintilla feature 2341) - void UpperCase(); - - /// Scroll the document down, keeping the caret visible. (Scintilla feature 2342) - void LineScrollDown(); - - /// Scroll the document up, keeping the caret visible. (Scintilla feature 2343) - void LineScrollUp(); - - /// - /// Delete the selection or if no selection, the character before the caret. - /// Will not delete the character before at the start of a line. - /// (Scintilla feature 2344) - /// - void DeleteBackNotLine(); - - /// Move caret to first position on display line. (Scintilla feature 2345) - void HomeDisplay(); - - /// - /// Move caret to first position on display line extending selection to - /// new caret position. - /// (Scintilla feature 2346) - /// - void HomeDisplayExtend(); - - /// Move caret to last position on display line. (Scintilla feature 2347) - void LineEndDisplay(); - - /// - /// Move caret to last position on display line extending selection to new - /// caret position. - /// (Scintilla feature 2348) - /// - void LineEndDisplayExtend(); - - /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - /// (Scintilla feature 2349) - /// - void HomeWrap(); - - /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - /// (Scintilla feature 2450) - /// - void HomeWrapExtend(); - - /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - /// (Scintilla feature 2451) - /// - void LineEndWrap(); - - /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - /// (Scintilla feature 2452) - /// - void LineEndWrapExtend(); - - /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - /// (Scintilla feature 2453) - /// - void VCHomeWrap(); - - /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - /// (Scintilla feature 2454) - /// - void VCHomeWrapExtend(); - - /// Copy the line containing the caret. (Scintilla feature 2455) - void LineCopy(); - - /// Move the caret inside current view if it's not there already. (Scintilla feature 2401) - void MoveCaretInsideView(); - - /// How many characters are on a line, including end of line characters? (Scintilla feature 2350) - int LineLength(int line); - - /// Highlight the characters at two positions. (Scintilla feature 2351) - void BraceHighlight(Position pos1, Position pos2); - - /// Use specified indicator to highlight matching braces instead of changing their style. (Scintilla feature 2498) - void BraceHighlightIndicator(bool useBraceHighlightIndicator, int indicator); - - /// Highlight the character at a position indicating there is no matching brace. (Scintilla feature 2352) - void BraceBadLight(Position pos); - - /// Use specified indicator to highlight non matching brace instead of changing its style. (Scintilla feature 2499) - void BraceBadLightIndicator(bool useBraceBadLightIndicator, int indicator); - - /// Find the position of a matching brace or INVALID_POSITION if no match. (Scintilla feature 2353) - Position BraceMatch(Position pos); - - /// Are the end of line characters visible? (Scintilla feature 2355) - bool GetViewEOL(); - - /// Make the end of line characters visible or invisible. (Scintilla feature 2356) - void SetViewEOL(bool visible); - - /// Retrieve a pointer to the document object. (Scintilla feature 2357) - IntPtr GetDocPointer(); - - /// Change the document object used. (Scintilla feature 2358) - void SetDocPointer(IntPtr pointer); - - /// Set which document modification events are sent to the container. (Scintilla feature 2359) - void SetModEventMask(int mask); - - /// Retrieve the column number which text should be kept within. (Scintilla feature 2360) - int GetEdgeColumn(); - - /// - /// Set the column number of the edge. - /// If text goes past the edge then it is highlighted. - /// (Scintilla feature 2361) - /// - void SetEdgeColumn(int column); - - /// Retrieve the edge highlight mode. (Scintilla feature 2362) - int GetEdgeMode(); - - /// - /// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that - /// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). - /// (Scintilla feature 2363) - /// - void SetEdgeMode(int mode); - - /// Retrieve the colour used in edge indication. (Scintilla feature 2364) - Colour GetEdgeColour(); - - /// Change the colour used in edge indication. (Scintilla feature 2365) - void SetEdgeColour(Colour edgeColour); - - /// Sets the current caret position to be the search anchor. (Scintilla feature 2366) - void SearchAnchor(); - - /// - /// Find some text starting at the search anchor. - /// Does not ensure the selection is visible. - /// (Scintilla feature 2367) - /// - unsafe int SearchNext(int flags, string text); - - /// - /// Find some text starting at the search anchor and moving backwards. - /// Does not ensure the selection is visible. - /// (Scintilla feature 2368) - /// - unsafe int SearchPrev(int flags, string text); - - /// Retrieves the number of lines completely visible. (Scintilla feature 2370) - int LinesOnScreen(); - - /// - /// Set whether a pop up menu is displayed automatically when the user presses - /// the wrong mouse button. - /// (Scintilla feature 2371) - /// - void UsePopUp(bool allowPopUp); - - /// Is the selection rectangular? The alternative is the more common stream selection. (Scintilla feature 2372) - bool SelectionIsRectangle(); - - /// - /// Set the zoom level. This number of points is added to the size of all fonts. - /// It may be positive to magnify or negative to reduce. - /// (Scintilla feature 2373) - /// - void SetZoom(int zoom); - - /// Retrieve the zoom level. (Scintilla feature 2374) - int GetZoom(); - - /// - /// Create a new document object. - /// Starts with reference count of 1 and not selected into editor. - /// (Scintilla feature 2375) - /// - int CreateDocument(); - - /// Extend life of document. (Scintilla feature 2376) - void AddRefDocument(int doc); - - /// Release a reference to the document, deleting document if it fades to black. (Scintilla feature 2377) - void ReleaseDocument(int doc); - - /// Get which document modification events are sent to the container. (Scintilla feature 2378) - int GetModEventMask(); - - /// Change internal focus flag. (Scintilla feature 2380) - void SetFocus(bool focus); - - /// Get internal focus flag. (Scintilla feature 2381) - bool GetFocus(); - - /// Change error status - 0 = OK. (Scintilla feature 2382) - void SetStatus(int statusCode); - - /// Get error status. (Scintilla feature 2383) - int GetStatus(); - - /// Set whether the mouse is captured when its button is pressed. (Scintilla feature 2384) - void SetMouseDownCaptures(bool captures); - - /// Get whether mouse gets captured. (Scintilla feature 2385) - bool GetMouseDownCaptures(); - - /// Sets the cursor to one of the SC_CURSOR* values. (Scintilla feature 2386) - void SetCursor(int cursorType); - - /// Get cursor type. (Scintilla feature 2387) - int GetCursor(); - - /// - /// Change the way control characters are displayed: - /// If symbol is < 32, keep the drawn way, else, use the given character. - /// (Scintilla feature 2388) - /// - void SetControlCharSymbol(int symbol); - - /// Get the way control characters are displayed. (Scintilla feature 2389) - int GetControlCharSymbol(); - - /// Move to the previous change in capitalisation. (Scintilla feature 2390) - void WordPartLeft(); - - /// - /// Move to the previous change in capitalisation extending selection - /// to new caret position. - /// (Scintilla feature 2391) - /// - void WordPartLeftExtend(); - - /// Move to the change next in capitalisation. (Scintilla feature 2392) - void WordPartRight(); - - /// - /// Move to the next change in capitalisation extending selection - /// to new caret position. - /// (Scintilla feature 2393) - /// - void WordPartRightExtend(); - - /// - /// Set the way the display area is determined when a particular line - /// is to be moved to by Find, FindNext, GotoLine, etc. - /// (Scintilla feature 2394) - /// - void SetVisiblePolicy(int visiblePolicy, int visibleSlop); - - /// Delete back from the current position to the start of the line. (Scintilla feature 2395) - void DelLineLeft(); - - /// Delete forwards from the current position to the end of the line. (Scintilla feature 2396) - void DelLineRight(); - - /// Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2397) - void SetXOffset(int newOffset); - - /// Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2398) - int GetXOffset(); - - /// Set the last x chosen value to be the caret x position. (Scintilla feature 2399) - void ChooseCaretX(); - - /// Set the focus to this Scintilla widget. (Scintilla feature 2400) - void GrabFocus(); - - /// - /// Set the way the caret is kept visible when going sideways. - /// The exclusion zone is given in pixels. - /// (Scintilla feature 2402) - /// - void SetXCaretPolicy(int caretPolicy, int caretSlop); - - /// - /// Set the way the line the caret is on is kept visible. - /// The exclusion zone is given in lines. - /// (Scintilla feature 2403) - /// - void SetYCaretPolicy(int caretPolicy, int caretSlop); - - /// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). (Scintilla feature 2406) - void SetPrintWrapMode(int mode); - - /// Is printing line wrapped? (Scintilla feature 2407) - int GetPrintWrapMode(); - - /// Set a fore colour for active hotspots. (Scintilla feature 2410) - void SetHotspotActiveFore(bool useSetting, Colour fore); - - /// Get the fore colour for active hotspots. (Scintilla feature 2494) - Colour GetHotspotActiveFore(); - - /// Set a back colour for active hotspots. (Scintilla feature 2411) - void SetHotspotActiveBack(bool useSetting, Colour back); - - /// Get the back colour for active hotspots. (Scintilla feature 2495) - Colour GetHotspotActiveBack(); - - /// Enable / Disable underlining active hotspots. (Scintilla feature 2412) - void SetHotspotActiveUnderline(bool underline); - - /// Get whether underlining for active hotspots. (Scintilla feature 2496) - bool GetHotspotActiveUnderline(); - - /// Limit hotspots to single line so hotspots on two lines don't merge. (Scintilla feature 2421) - void SetHotspotSingleLine(bool singleLine); - - /// Get the HotspotSingleLine property (Scintilla feature 2497) - bool GetHotspotSingleLine(); - - /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2413) - void ParaDown(); - - /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2414) - void ParaDownExtend(); - - /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2415) - void ParaUp(); - - /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2416) - void ParaUpExtend(); - - /// - /// Given a valid document position, return the previous position taking code - /// page into account. Returns 0 if passed 0. - /// (Scintilla feature 2417) - /// - Position PositionBefore(Position pos); - - /// - /// Given a valid document position, return the next position taking code - /// page into account. Maximum value returned is the last position in the document. - /// (Scintilla feature 2418) - /// - Position PositionAfter(Position pos); - - /// - /// Given a valid document position, return a position that differs in a number - /// of characters. Returned value is always between 0 and last position in document. - /// (Scintilla feature 2670) - /// - Position PositionRelative(Position pos, int relative); - - /// Copy a range of text to the clipboard. Positions are clipped into the document. (Scintilla feature 2419) - void CopyRange(Position start, Position end); - - /// Copy argument text to the clipboard. (Scintilla feature 2420) - unsafe void CopyText(int length, string text); - - /// - /// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or - /// by lines (SC_SEL_LINES). - /// (Scintilla feature 2422) - /// - void SetSelectionMode(int mode); - - /// Get the mode of the current selection. (Scintilla feature 2423) - int GetSelectionMode(); - - /// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2424) - Position GetLineSelStartPosition(int line); - - /// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2425) - Position GetLineSelEndPosition(int line); - - /// Move caret down one line, extending rectangular selection to new caret position. (Scintilla feature 2426) - void LineDownRectExtend(); - - /// Move caret up one line, extending rectangular selection to new caret position. (Scintilla feature 2427) - void LineUpRectExtend(); - - /// Move caret left one character, extending rectangular selection to new caret position. (Scintilla feature 2428) - void CharLeftRectExtend(); - - /// Move caret right one character, extending rectangular selection to new caret position. (Scintilla feature 2429) - void CharRightRectExtend(); - - /// Move caret to first position on line, extending rectangular selection to new caret position. (Scintilla feature 2430) - void HomeRectExtend(); - - /// - /// Move caret to before first visible character on line. - /// If already there move to first character on line. - /// In either case, extend rectangular selection to new caret position. - /// (Scintilla feature 2431) - /// - void VCHomeRectExtend(); - - /// Move caret to last position on line, extending rectangular selection to new caret position. (Scintilla feature 2432) - void LineEndRectExtend(); - - /// Move caret one page up, extending rectangular selection to new caret position. (Scintilla feature 2433) - void PageUpRectExtend(); - - /// Move caret one page down, extending rectangular selection to new caret position. (Scintilla feature 2434) - void PageDownRectExtend(); - - /// Move caret to top of page, or one page up if already at top of page. (Scintilla feature 2435) - void StutteredPageUp(); - - /// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. (Scintilla feature 2436) - void StutteredPageUpExtend(); - - /// Move caret to bottom of page, or one page down if already at bottom of page. (Scintilla feature 2437) - void StutteredPageDown(); - - /// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. (Scintilla feature 2438) - void StutteredPageDownExtend(); - - /// Move caret left one word, position cursor at end of word. (Scintilla feature 2439) - void WordLeftEnd(); - - /// Move caret left one word, position cursor at end of word, extending selection to new caret position. (Scintilla feature 2440) - void WordLeftEndExtend(); - - /// Move caret right one word, position cursor at end of word. (Scintilla feature 2441) - void WordRightEnd(); - - /// Move caret right one word, position cursor at end of word, extending selection to new caret position. (Scintilla feature 2442) - void WordRightEndExtend(); - - /// - /// Set the set of characters making up whitespace for when moving or selecting by word. - /// Should be called after SetWordChars. - /// (Scintilla feature 2443) - /// - unsafe void SetWhitespaceChars(string characters); - - /// Get the set of characters making up whitespace for when moving or selecting by word. (Scintilla feature 2647) - unsafe string GetWhitespaceChars(); - - /// - /// Set the set of characters making up punctuation characters - /// Should be called after SetWordChars. - /// (Scintilla feature 2648) - /// - unsafe void SetPunctuationChars(string characters); - - /// Get the set of characters making up punctuation characters (Scintilla feature 2649) - unsafe string GetPunctuationChars(); - - /// Reset the set of characters for whitespace and word characters to the defaults. (Scintilla feature 2444) - void SetCharsDefault(); - - /// Get currently selected item position in the auto-completion list (Scintilla feature 2445) - int AutoCGetCurrent(); - - /// - /// Get currently selected item text in the auto-completion list - /// Returns the length of the item text - /// Result is NUL-terminated. - /// (Scintilla feature 2610) - /// - unsafe string AutoCGetCurrentText(); - - /// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. (Scintilla feature 2634) - void AutoCSetCaseInsensitiveBehaviour(int behaviour); - - /// Get auto-completion case insensitive behaviour. (Scintilla feature 2635) - int AutoCGetCaseInsensitiveBehaviour(); - - /// Change the effect of autocompleting when there are multiple selections. (Scintilla feature 2636) - void AutoCSetMulti(int multi); - - /// Retrieve the effect of autocompleting when there are multiple selections.. (Scintilla feature 2637) - int AutoCGetMulti(); - - /// Set the way autocompletion lists are ordered. (Scintilla feature 2660) - void AutoCSetOrder(int order); - - /// Get the way autocompletion lists are ordered. (Scintilla feature 2661) - int AutoCGetOrder(); - - /// Enlarge the document to a particular size of text bytes. (Scintilla feature 2446) - void Allocate(int bytes); - - /// - /// Returns the target converted to UTF8. - /// Return the length in bytes. - /// (Scintilla feature 2447) - /// - unsafe string TargetAsUTF8(); - - /// - /// Set the length of the utf8 argument for calling EncodedFromUTF8. - /// Set to -1 and the string will be measured to the first nul. - /// (Scintilla feature 2448) - /// - void SetLengthForEncode(int bytes); - - /// - /// Translates a UTF8 string into the document encoding. - /// Return the length of the result in bytes. - /// On error return 0. - /// (Scintilla feature 2449) - /// - unsafe string EncodedFromUTF8(string utf8); - - /// - /// Find the position of a column on a line taking into account tabs and - /// multi-byte characters. If beyond end of line, return line end position. - /// (Scintilla feature 2456) - /// - int FindColumn(int line, int column); - - /// Can the caret preferred x position only be changed by explicit movement commands? (Scintilla feature 2457) - int GetCaretSticky(); - - /// Stop the caret preferred x position changing when the user types. (Scintilla feature 2458) - void SetCaretSticky(int useCaretStickyBehaviour); - - /// Switch between sticky and non-sticky: meant to be bound to a key. (Scintilla feature 2459) - void ToggleCaretSticky(); - - /// Enable/Disable convert-on-paste for line endings (Scintilla feature 2467) - void SetPasteConvertEndings(bool convert); - - /// Get convert-on-paste setting (Scintilla feature 2468) - bool GetPasteConvertEndings(); - - /// Duplicate the selection. If selection empty duplicate the line containing the caret. (Scintilla feature 2469) - void SelectionDuplicate(); - - /// Set background alpha of the caret line. (Scintilla feature 2470) - void SetCaretLineBackAlpha(int alpha); - - /// Get the background alpha of the caret line. (Scintilla feature 2471) - int GetCaretLineBackAlpha(); - - /// Set the style of the caret to be drawn. (Scintilla feature 2512) - void SetCaretStyle(int caretStyle); - - /// Returns the current style of the caret. (Scintilla feature 2513) - int GetCaretStyle(); - - /// Set the indicator used for IndicatorFillRange and IndicatorClearRange (Scintilla feature 2500) - void SetIndicatorCurrent(int indicator); - - /// Get the current indicator (Scintilla feature 2501) - int GetIndicatorCurrent(); - - /// Set the value used for IndicatorFillRange (Scintilla feature 2502) - void SetIndicatorValue(int value); - - /// Get the current indicator value (Scintilla feature 2503) - int GetIndicatorValue(); - - /// Turn a indicator on over a range. (Scintilla feature 2504) - void IndicatorFillRange(int position, int fillLength); - - /// Turn a indicator off over a range. (Scintilla feature 2505) - void IndicatorClearRange(int position, int clearLength); - - /// Are any indicators present at position? (Scintilla feature 2506) - int IndicatorAllOnFor(int position); - - /// What value does a particular indicator have at at a position? (Scintilla feature 2507) - int IndicatorValueAt(int indicator, int position); - - /// Where does a particular indicator start? (Scintilla feature 2508) - int IndicatorStart(int indicator, int position); - - /// Where does a particular indicator end? (Scintilla feature 2509) - int IndicatorEnd(int indicator, int position); - - /// Set number of entries in position cache (Scintilla feature 2514) - void SetPositionCache(int size); - - /// How many entries are allocated to the position cache? (Scintilla feature 2515) - int GetPositionCache(); - - /// Copy the selection, if selection empty copy the line with the caret (Scintilla feature 2519) - void CopyAllowLine(); - - /// - /// Compact the document buffer and return a read-only pointer to the - /// characters in the document. - /// (Scintilla feature 2520) - /// - IntPtr GetCharacterPointer(); - - /// - /// Return a read-only pointer to a range of characters in the document. - /// May move the gap so that the range is contiguous, but will only move up - /// to rangeLength bytes. - /// (Scintilla feature 2643) - /// - IntPtr GetRangePointer(int position, int rangeLength); - - /// - /// Return a position which, to avoid performance costs, should not be within - /// the range of a call to GetRangePointer. - /// (Scintilla feature 2644) - /// - Position GetGapPosition(); - - /// Set the alpha fill colour of the given indicator. (Scintilla feature 2523) - void IndicSetAlpha(int indicator, int alpha); - - /// Get the alpha fill colour of the given indicator. (Scintilla feature 2524) - int IndicGetAlpha(int indicator); - - /// Set the alpha outline colour of the given indicator. (Scintilla feature 2558) - void IndicSetOutlineAlpha(int indicator, int alpha); - - /// Get the alpha outline colour of the given indicator. (Scintilla feature 2559) - int IndicGetOutlineAlpha(int indicator); - - /// Set extra ascent for each line (Scintilla feature 2525) - void SetExtraAscent(int extraAscent); - - /// Get extra ascent for each line (Scintilla feature 2526) - int GetExtraAscent(); - - /// Set extra descent for each line (Scintilla feature 2527) - void SetExtraDescent(int extraDescent); - - /// Get extra descent for each line (Scintilla feature 2528) - int GetExtraDescent(); - - /// Which symbol was defined for markerNumber with MarkerDefine (Scintilla feature 2529) - int MarkerSymbolDefined(int markerNumber); - - /// Set the text in the text margin for a line (Scintilla feature 2530) - unsafe void MarginSetText(int line, string text); - - /// Get the text in the text margin for a line (Scintilla feature 2531) - unsafe string MarginGetText(int line); - - /// Set the style number for the text margin for a line (Scintilla feature 2532) - void MarginSetStyle(int line, int style); - - /// Get the style number for the text margin for a line (Scintilla feature 2533) - int MarginGetStyle(int line); - - /// Set the style in the text margin for a line (Scintilla feature 2534) - unsafe void MarginSetStyles(int line, string styles); - - /// Get the styles in the text margin for a line (Scintilla feature 2535) - unsafe string MarginGetStyles(int line); - - /// Clear the margin text on all lines (Scintilla feature 2536) - void MarginTextClearAll(); - - /// Get the start of the range of style numbers used for margin text (Scintilla feature 2537) - void MarginSetStyleOffset(int style); - - /// Get the start of the range of style numbers used for margin text (Scintilla feature 2538) - int MarginGetStyleOffset(); - - /// Set the margin options. (Scintilla feature 2539) - void SetMarginOptions(int marginOptions); - - /// Get the margin options. (Scintilla feature 2557) - int GetMarginOptions(); - - /// Set the annotation text for a line (Scintilla feature 2540) - unsafe void AnnotationSetText(int line, string text); - - /// Get the annotation text for a line (Scintilla feature 2541) - unsafe string AnnotationGetText(int line); - - /// Set the style number for the annotations for a line (Scintilla feature 2542) - void AnnotationSetStyle(int line, int style); - - /// Get the style number for the annotations for a line (Scintilla feature 2543) - int AnnotationGetStyle(int line); - - /// Set the annotation styles for a line (Scintilla feature 2544) - unsafe void AnnotationSetStyles(int line, string styles); - - /// Get the annotation styles for a line (Scintilla feature 2545) - unsafe string AnnotationGetStyles(int line); - - /// Get the number of annotation lines for a line (Scintilla feature 2546) - int AnnotationGetLines(int line); - - /// Clear the annotations from all lines (Scintilla feature 2547) - void AnnotationClearAll(); - - /// Set the visibility for the annotations for a view (Scintilla feature 2548) - void AnnotationSetVisible(int visible); - - /// Get the visibility for the annotations for a view (Scintilla feature 2549) - int AnnotationGetVisible(); - - /// Get the start of the range of style numbers used for annotations (Scintilla feature 2550) - void AnnotationSetStyleOffset(int style); - - /// Get the start of the range of style numbers used for annotations (Scintilla feature 2551) - int AnnotationGetStyleOffset(); - - /// Release all extended (>255) style numbers (Scintilla feature 2552) - void ReleaseAllExtendedStyles(); - - /// Allocate some extended (>255) style numbers and return the start of the range (Scintilla feature 2553) - int AllocateExtendedStyles(int numberStyles); - - /// Add a container action to the undo stack (Scintilla feature 2560) - void AddUndoAction(int token, int flags); - - /// Find the position of a character from a point within the window. (Scintilla feature 2561) - Position CharPositionFromPoint(int x, int y); - - /// - /// Find the position of a character from a point within the window. - /// Return INVALID_POSITION if not close to text. - /// (Scintilla feature 2562) - /// - Position CharPositionFromPointClose(int x, int y); - - /// Set whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2668) - void SetMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch); - - /// Whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2669) - bool GetMouseSelectionRectangularSwitch(); - - /// Set whether multiple selections can be made (Scintilla feature 2563) - void SetMultipleSelection(bool multipleSelection); - - /// Whether multiple selections can be made (Scintilla feature 2564) - bool GetMultipleSelection(); - - /// Set whether typing can be performed into multiple selections (Scintilla feature 2565) - void SetAdditionalSelectionTyping(bool additionalSelectionTyping); - - /// Whether typing can be performed into multiple selections (Scintilla feature 2566) - bool GetAdditionalSelectionTyping(); - - /// Set whether additional carets will blink (Scintilla feature 2567) - void SetAdditionalCaretsBlink(bool additionalCaretsBlink); - - /// Whether additional carets will blink (Scintilla feature 2568) - bool GetAdditionalCaretsBlink(); - - /// Set whether additional carets are visible (Scintilla feature 2608) - void SetAdditionalCaretsVisible(bool additionalCaretsBlink); - - /// Whether additional carets are visible (Scintilla feature 2609) - bool GetAdditionalCaretsVisible(); - - /// How many selections are there? (Scintilla feature 2570) - int GetSelections(); - - /// Is every selected range empty? (Scintilla feature 2650) - bool GetSelectionEmpty(); - - /// Clear selections to a single empty stream selection (Scintilla feature 2571) - void ClearSelections(); - - /// Set a simple selection (Scintilla feature 2572) - int SetSelection(int caret, int anchor); - - /// Add a selection (Scintilla feature 2573) - int AddSelection(int caret, int anchor); - - /// Drop one selection (Scintilla feature 2671) - void DropSelectionN(int selection); - - /// Set the main selection (Scintilla feature 2574) - void SetMainSelection(int selection); - - /// Which selection is the main selection (Scintilla feature 2575) - int GetMainSelection(); - - /// Which selection is the main selection (Scintilla feature 2576) - void SetSelectionNCaret(int selection, Position pos); - - /// Which selection is the main selection (Scintilla feature 2577) - Position GetSelectionNCaret(int selection); - - /// Which selection is the main selection (Scintilla feature 2578) - void SetSelectionNAnchor(int selection, Position posAnchor); - - /// Which selection is the main selection (Scintilla feature 2579) - Position GetSelectionNAnchor(int selection); - - /// Which selection is the main selection (Scintilla feature 2580) - void SetSelectionNCaretVirtualSpace(int selection, int space); - - /// Which selection is the main selection (Scintilla feature 2581) - int GetSelectionNCaretVirtualSpace(int selection); - - /// Which selection is the main selection (Scintilla feature 2582) - void SetSelectionNAnchorVirtualSpace(int selection, int space); - - /// Which selection is the main selection (Scintilla feature 2583) - int GetSelectionNAnchorVirtualSpace(int selection); - - /// Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2584) - void SetSelectionNStart(int selection, Position pos); - - /// Returns the position at the start of the selection. (Scintilla feature 2585) - Position GetSelectionNStart(int selection); - - /// Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2586) - void SetSelectionNEnd(int selection, Position pos); - - /// Returns the position at the end of the selection. (Scintilla feature 2587) - Position GetSelectionNEnd(int selection); - - /// Returns the position at the end of the selection. (Scintilla feature 2588) - void SetRectangularSelectionCaret(Position pos); - - /// Returns the position at the end of the selection. (Scintilla feature 2589) - Position GetRectangularSelectionCaret(); - - /// Returns the position at the end of the selection. (Scintilla feature 2590) - void SetRectangularSelectionAnchor(Position posAnchor); - - /// Returns the position at the end of the selection. (Scintilla feature 2591) - Position GetRectangularSelectionAnchor(); - - /// Returns the position at the end of the selection. (Scintilla feature 2592) - void SetRectangularSelectionCaretVirtualSpace(int space); - - /// Returns the position at the end of the selection. (Scintilla feature 2593) - int GetRectangularSelectionCaretVirtualSpace(); - - /// Returns the position at the end of the selection. (Scintilla feature 2594) - void SetRectangularSelectionAnchorVirtualSpace(int space); - - /// Returns the position at the end of the selection. (Scintilla feature 2595) - int GetRectangularSelectionAnchorVirtualSpace(); - - /// Returns the position at the end of the selection. (Scintilla feature 2596) - void SetVirtualSpaceOptions(int virtualSpaceOptions); - - /// Returns the position at the end of the selection. (Scintilla feature 2597) - int GetVirtualSpaceOptions(); - - /// - /// On GTK+, allow selecting the modifier key to use for mouse-based - /// rectangular selection. Often the window manager requires Alt+Mouse Drag - /// for moving windows. - /// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. - /// (Scintilla feature 2598) - /// - void SetRectangularSelectionModifier(int modifier); - - /// Get the modifier key used for rectangular selection. (Scintilla feature 2599) - int GetRectangularSelectionModifier(); - - /// - /// Set the foreground colour of additional selections. - /// Must have previously called SetSelFore with non-zero first argument for this to have an effect. - /// (Scintilla feature 2600) - /// - void SetAdditionalSelFore(Colour fore); - - /// - /// Set the background colour of additional selections. - /// Must have previously called SetSelBack with non-zero first argument for this to have an effect. - /// (Scintilla feature 2601) - /// - void SetAdditionalSelBack(Colour back); - - /// Set the alpha of the selection. (Scintilla feature 2602) - void SetAdditionalSelAlpha(int alpha); - - /// Get the alpha of the selection. (Scintilla feature 2603) - int GetAdditionalSelAlpha(); - - /// Set the foreground colour of additional carets. (Scintilla feature 2604) - void SetAdditionalCaretFore(Colour fore); - - /// Get the foreground colour of additional carets. (Scintilla feature 2605) - Colour GetAdditionalCaretFore(); - - /// Set the main selection to the next selection. (Scintilla feature 2606) - void RotateSelection(); - - /// Swap that caret and anchor of the main selection. (Scintilla feature 2607) - void SwapMainAnchorCaret(); - - /// - /// Indicate that the internal state of a lexer has changed over a range and therefore - /// there may be a need to redraw. - /// (Scintilla feature 2617) - /// - int ChangeLexerState(Position start, Position end); - - /// - /// Find the next line at or after lineStart that is a contracted fold header line. - /// Return -1 when no more lines. - /// (Scintilla feature 2618) - /// - int ContractedFoldNext(int lineStart); - - /// Centre current line in window. (Scintilla feature 2619) - void VerticalCentreCaret(); - - /// Move the selected lines up one line, shifting the line above after the selection (Scintilla feature 2620) - void MoveSelectedLinesUp(); - - /// Move the selected lines down one line, shifting the line below before the selection (Scintilla feature 2621) - void MoveSelectedLinesDown(); - - /// Set the identifier reported as IdFrom in notification messages. (Scintilla feature 2622) - void SetIdentifier(int identifier); - - /// Get the identifier. (Scintilla feature 2623) - int GetIdentifier(); - - /// Set the width for future RGBA image data. (Scintilla feature 2624) - void RGBAImageSetWidth(int width); - - /// Set the height for future RGBA image data. (Scintilla feature 2625) - void RGBAImageSetHeight(int height); - - /// Set the scale factor in percent for future RGBA image data. (Scintilla feature 2651) - void RGBAImageSetScale(int scalePercent); - - /// - /// Define a marker from RGBA data. - /// It has the width and height from RGBAImageSetWidth/Height - /// (Scintilla feature 2626) - /// - unsafe void MarkerDefineRGBAImage(int markerNumber, string pixels); - - /// - /// Register an RGBA image for use in autocompletion lists. - /// It has the width and height from RGBAImageSetWidth/Height - /// (Scintilla feature 2627) - /// - unsafe void RegisterRGBAImage(int type, string pixels); - - /// Scroll to start of document. (Scintilla feature 2628) - void ScrollToStart(); - - /// Scroll to end of document. (Scintilla feature 2629) - void ScrollToEnd(); - - /// Set the technology used. (Scintilla feature 2630) - void SetTechnology(int technology); - - /// Get the tech. (Scintilla feature 2631) - int GetTechnology(); - - /// Create an ILoader*. (Scintilla feature 2632) - int CreateLoader(int bytes); - - /// On OS X, show a find indicator. (Scintilla feature 2640) - void FindIndicatorShow(Position start, Position end); - - /// On OS X, flash a find indicator, then fade out. (Scintilla feature 2641) - void FindIndicatorFlash(Position start, Position end); - - /// On OS X, hide the find indicator. (Scintilla feature 2642) - void FindIndicatorHide(); - - /// - /// Move caret to before first visible character on display line. - /// If already there move to first character on display line. - /// (Scintilla feature 2652) - /// - void VCHomeDisplay(); - - /// Like VCHomeDisplay but extending selection to new caret position. (Scintilla feature 2653) - void VCHomeDisplayExtend(); - - /// Is the caret line always visible? (Scintilla feature 2654) - bool GetCaretLineVisibleAlways(); - - /// Sets the caret line to always visible. (Scintilla feature 2655) - void SetCaretLineVisibleAlways(bool alwaysVisible); - - /// Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. (Scintilla feature 2656) - void SetLineEndTypesAllowed(int lineEndBitSet); - - /// Get the line end types currently allowed. (Scintilla feature 2657) - int GetLineEndTypesAllowed(); - - /// Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. (Scintilla feature 2658) - int GetLineEndTypesActive(); - - /// Set the way a character is drawn. (Scintilla feature 2665) - unsafe void SetRepresentation(string encodedCharacter, string representation); - - /// - /// Set the way a character is drawn. - /// Result is NUL-terminated. - /// (Scintilla feature 2666) - /// - unsafe string GetRepresentation(string encodedCharacter); - - /// Remove a character representation. (Scintilla feature 2667) - unsafe void ClearRepresentation(string encodedCharacter); - - /// Start notifying the container of all key presses and commands. (Scintilla feature 3001) - void StartRecord(); - - /// Stop notifying the container of all key presses and commands. (Scintilla feature 3002) - void StopRecord(); - - /// Set the lexing language of the document. (Scintilla feature 4001) - void SetLexer(int lexer); - - /// Retrieve the lexing language of the document. (Scintilla feature 4002) - int GetLexer(); - - /// Colourise a segment of the document using the current lexing language. (Scintilla feature 4003) - void Colourise(Position start, Position end); - - /// Set up a value that may be used by a lexer for some optional feature. (Scintilla feature 4004) - unsafe void SetProperty(string key, string value); - - /// Set up the key words used by the lexer. (Scintilla feature 4005) - unsafe void SetKeyWords(int keywordSet, string keyWords); - - /// Set the lexing language of the document based on string name. (Scintilla feature 4006) - unsafe void SetLexerLanguage(string language); - - /// Load a lexer library (dll / so). (Scintilla feature 4007) - unsafe void LoadLexerLibrary(string path); - - /// - /// Retrieve a "property" value previously set with SetProperty. - /// Result is NUL-terminated. - /// (Scintilla feature 4008) - /// - unsafe string GetProperty(string key); - - /// - /// Retrieve a "property" value previously set with SetProperty, - /// with "$()" variable replacement on returned buffer. - /// Result is NUL-terminated. - /// (Scintilla feature 4009) - /// - unsafe string GetPropertyExpanded(string key); - - /// - /// Retrieve a "property" value previously set with SetProperty, - /// interpreted as an int AFTER any "$()" variable replacement. - /// (Scintilla feature 4010) - /// - unsafe int GetPropertyInt(string key); - - /// Retrieve the number of bits the current lexer needs for styling. (Scintilla feature 4011) - int GetStyleBitsNeeded(); - - /// - /// Retrieve the name of the lexer. - /// Return the length of the text. - /// Result is NUL-terminated. - /// (Scintilla feature 4012) - /// - unsafe string GetLexerLanguage(); - - /// For private communication between an application and a known lexer. (Scintilla feature 4013) - int PrivateLexerCall(int operation, int pointer); - - /// - /// Retrieve a '\n' separated list of properties understood by the current lexer. - /// Result is NUL-terminated. - /// (Scintilla feature 4014) - /// - unsafe string PropertyNames(); - - /// Retrieve the type of a property. (Scintilla feature 4015) - unsafe int PropertyType(string name); - - /// - /// Describe a property. - /// Result is NUL-terminated. - /// (Scintilla feature 4016) - /// - unsafe string DescribeProperty(string name); - - /// - /// Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. - /// Result is NUL-terminated. - /// (Scintilla feature 4017) - /// - unsafe string DescribeKeyWordSets(); - - /// - /// Bit set of LineEndType enumertion for which line ends beyond the standard - /// LF, CR, and CRLF are supported by the lexer. - /// (Scintilla feature 4018) - /// - int GetLineEndTypesSupported(); - - /// Allocate a set of sub styles for a particular base style, returning start of range (Scintilla feature 4020) - int AllocateSubStyles(int styleBase, int numberStyles); - - /// The starting style number for the sub styles associated with a base style (Scintilla feature 4021) - int GetSubStylesStart(int styleBase); - - /// The number of sub styles associated with a base style (Scintilla feature 4022) - int GetSubStylesLength(int styleBase); - - /// For a sub style, return the base style, else return the argument. (Scintilla feature 4027) - int GetStyleFromSubStyle(int subStyle); - - /// For a secondary style, return the primary style, else return the argument. (Scintilla feature 4028) - int GetPrimaryStyleFromStyle(int style); - - /// Free allocated sub styles (Scintilla feature 4023) - void FreeSubStyles(); - - /// Set the identifiers that are shown in a particular style (Scintilla feature 4024) - unsafe void SetIdentifiers(int style, string identifiers); - - /// - /// Where styles are duplicated by a feature such as active/inactive code - /// return the distance between the two types. - /// (Scintilla feature 4025) - /// - int DistanceToSecondaryStyles(); - - /// - /// Get the set of base styles that can be extended with sub styles - /// Result is NUL-terminated. - /// (Scintilla feature 4026) - /// - unsafe string GetSubStyleBases(); - - /// - /// Deprecated in 2.30 - /// In palette mode? - /// (Scintilla feature 2139) - /// - bool GetUsePalette(); - - /// - /// In palette mode, Scintilla uses the environment's palette calls to display - /// more colours. This may lead to ugly displays. - /// (Scintilla feature 2039) - /// - void SetUsePalette(bool usePalette); - - /// - /// Deprecated in 3.5.5 - /// Always interpret keyboard input as Unicode - /// (Scintilla feature 2521) - /// - void SetKeysUnicode(bool keysUnicode); - - /// Are keys always interpreted as Unicode? (Scintilla feature 2522) - bool GetKeysUnicode(); - - /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ - } -} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/MenuCmdID_h.cs b/CSharpRegexTools4Npp/PluginInfrastructure/MenuCmdID_h.cs index 9e1681c..b5758e9 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/MenuCmdID_h.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/MenuCmdID_h.cs @@ -20,7 +20,7 @@ public enum NppMenuCmd : uint IDM_FILE_SAVE = (IDM_FILE + 6), IDM_FILE_SAVEALL = (IDM_FILE + 7), IDM_FILE_SAVEAS = (IDM_FILE + 8), - //IDM_FILE_ASIAN_LANG = (IDM_FILE + 9), + //IDM_FILE_ASIAN_LANG = (IDM_FILE + 9), IDM_FILE_PRINT = (IDM_FILE + 10), IDM_FILE_PRINTNOW = 1001, IDM_FILE_EXIT = (IDM_FILE + 11), @@ -31,7 +31,7 @@ public enum NppMenuCmd : uint IDM_FILE_DELETE = (IDM_FILE + 16), IDM_FILE_RENAME = (IDM_FILE + 17), - // A mettre à jour si on ajoute nouveau menu item dans le menu "File" + // A mettre � jour si on ajoute nouveau menu item dans le menu "File" IDM_FILEMENU_LASTONE = IDM_FILE_RENAME, IDM_EDIT = (IDM + 2000), diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/MenuCmdID_h.cs.bak b/CSharpRegexTools4Npp/PluginInfrastructure/MenuCmdID_h.cs.bak deleted file mode 100644 index 9a8ecf2..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/MenuCmdID_h.cs.bak +++ /dev/null @@ -1,398 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -// -// This file should stay in sync with the CPP project file -// "notepad-plus-plus/PowerEditor/src/menuCmdID.h" -// found at -// https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/menuCmdID.h - -namespace CSharpRegexTools4Npp.PluginInfrastructure -{ - public enum NppMenuCmd : uint - { - IDM = 40000, - - IDM_FILE = (IDM + 1000), - IDM_FILE_NEW = (IDM_FILE + 1), - IDM_FILE_OPEN = (IDM_FILE + 2), - IDM_FILE_CLOSE = (IDM_FILE + 3), - IDM_FILE_CLOSEALL = (IDM_FILE + 4), - IDM_FILE_CLOSEALL_BUT_CURRENT = (IDM_FILE + 5), - IDM_FILE_SAVE = (IDM_FILE + 6), - IDM_FILE_SAVEALL = (IDM_FILE + 7), - IDM_FILE_SAVEAS = (IDM_FILE + 8), - //IDM_FILE_ASIAN_LANG = (IDM_FILE + 9), - IDM_FILE_PRINT = (IDM_FILE + 10), - IDM_FILE_PRINTNOW = 1001, - IDM_FILE_EXIT = (IDM_FILE + 11), - IDM_FILE_LOADSESSION = (IDM_FILE + 12), - IDM_FILE_SAVESESSION = (IDM_FILE + 13), - IDM_FILE_RELOAD = (IDM_FILE + 14), - IDM_FILE_SAVECOPYAS = (IDM_FILE + 15), - IDM_FILE_DELETE = (IDM_FILE + 16), - IDM_FILE_RENAME = (IDM_FILE + 17), - - // A mettre � jour si on ajoute nouveau menu item dans le menu "File" - IDM_FILEMENU_LASTONE = IDM_FILE_RENAME, - - IDM_EDIT = (IDM + 2000), - IDM_EDIT_CUT = (IDM_EDIT + 1), - IDM_EDIT_COPY = (IDM_EDIT + 2), - IDM_EDIT_UNDO = (IDM_EDIT + 3), - IDM_EDIT_REDO = (IDM_EDIT + 4), - IDM_EDIT_PASTE = (IDM_EDIT + 5), - IDM_EDIT_DELETE = (IDM_EDIT + 6), - IDM_EDIT_SELECTALL = (IDM_EDIT + 7), - - IDM_EDIT_INS_TAB = (IDM_EDIT + 8), - IDM_EDIT_RMV_TAB = (IDM_EDIT + 9), - IDM_EDIT_DUP_LINE = (IDM_EDIT + 10), - IDM_EDIT_TRANSPOSE_LINE = (IDM_EDIT + 11), - IDM_EDIT_SPLIT_LINES = (IDM_EDIT + 12), - IDM_EDIT_JOIN_LINES = (IDM_EDIT + 13), - IDM_EDIT_LINE_UP = (IDM_EDIT + 14), - IDM_EDIT_LINE_DOWN = (IDM_EDIT + 15), - IDM_EDIT_UPPERCASE = (IDM_EDIT + 16), - IDM_EDIT_LOWERCASE = (IDM_EDIT + 17), - - // Menu macro - IDM_MACRO_STARTRECORDINGMACRO = (IDM_EDIT + 18), - IDM_MACRO_STOPRECORDINGMACRO = (IDM_EDIT + 19), - IDM_MACRO_PLAYBACKRECORDEDMACRO = (IDM_EDIT + 21), - //----------- - - IDM_EDIT_BLOCK_COMMENT = (IDM_EDIT + 22), - IDM_EDIT_STREAM_COMMENT = (IDM_EDIT + 23), - IDM_EDIT_TRIMTRAILING = (IDM_EDIT + 24), - IDM_EDIT_TRIMLINEHEAD = (IDM_EDIT + 42), - IDM_EDIT_TRIM_BOTH = (IDM_EDIT + 43), - IDM_EDIT_EOL2WS = (IDM_EDIT + 44), - IDM_EDIT_TRIMALL = (IDM_EDIT + 45), - IDM_EDIT_TAB2SW = (IDM_EDIT + 46), - IDM_EDIT_SW2TAB = (IDM_EDIT + 47), - - // Menu macro - IDM_MACRO_SAVECURRENTMACRO = (IDM_EDIT + 25), - //----------- - - IDM_EDIT_RTL = (IDM_EDIT + 26), - IDM_EDIT_LTR = (IDM_EDIT + 27), - IDM_EDIT_SETREADONLY = (IDM_EDIT + 28), - IDM_EDIT_FULLPATHTOCLIP = (IDM_EDIT + 29), - IDM_EDIT_FILENAMETOCLIP = (IDM_EDIT + 30), - IDM_EDIT_CURRENTDIRTOCLIP = (IDM_EDIT + 31), - - // Menu macro - IDM_MACRO_RUNMULTIMACRODLG = (IDM_EDIT + 32), - //----------- - - IDM_EDIT_CLEARREADONLY = (IDM_EDIT + 33), - IDM_EDIT_COLUMNMODE = (IDM_EDIT + 34), - IDM_EDIT_BLOCK_COMMENT_SET = (IDM_EDIT + 35), - IDM_EDIT_BLOCK_UNCOMMENT = (IDM_EDIT + 36), - - IDM_EDIT_AUTOCOMPLETE = (50000 + 0), - IDM_EDIT_AUTOCOMPLETE_CURRENTFILE = (50000 + 1), - IDM_EDIT_FUNCCALLTIP = (50000 + 2), - - //Belong to MENU FILE - IDM_OPEN_ALL_RECENT_FILE = (IDM_EDIT + 40), - IDM_CLEAN_RECENT_FILE_LIST = (IDM_EDIT + 41), - - IDM_SEARCH = (IDM + 3000), - - IDM_SEARCH_FIND = (IDM_SEARCH + 1), - IDM_SEARCH_FINDNEXT = (IDM_SEARCH + 2), - IDM_SEARCH_REPLACE = (IDM_SEARCH + 3), - IDM_SEARCH_GOTOLINE = (IDM_SEARCH + 4), - IDM_SEARCH_TOGGLE_BOOKMARK = (IDM_SEARCH + 5), - IDM_SEARCH_NEXT_BOOKMARK = (IDM_SEARCH + 6), - IDM_SEARCH_PREV_BOOKMARK = (IDM_SEARCH + 7), - IDM_SEARCH_CLEAR_BOOKMARKS = (IDM_SEARCH + 8), - IDM_SEARCH_GOTOMATCHINGBRACE = (IDM_SEARCH + 9), - IDM_SEARCH_FINDPREV = (IDM_SEARCH + 10), - IDM_SEARCH_FINDINCREMENT = (IDM_SEARCH + 11), - IDM_SEARCH_FINDINFILES = (IDM_SEARCH + 13), - IDM_SEARCH_VOLATILE_FINDNEXT = (IDM_SEARCH + 14), - IDM_SEARCH_VOLATILE_FINDPREV = (IDM_SEARCH + 15), - IDM_SEARCH_CUTMARKEDLINES = (IDM_SEARCH + 18), - IDM_SEARCH_COPYMARKEDLINES = (IDM_SEARCH + 19), - IDM_SEARCH_PASTEMARKEDLINES = (IDM_SEARCH + 20), - IDM_SEARCH_DELETEMARKEDLINES = (IDM_SEARCH + 21), - IDM_SEARCH_MARKALLEXT1 = (IDM_SEARCH + 22), - IDM_SEARCH_UNMARKALLEXT1 = (IDM_SEARCH + 23), - IDM_SEARCH_MARKALLEXT2 = (IDM_SEARCH + 24), - IDM_SEARCH_UNMARKALLEXT2 = (IDM_SEARCH + 25), - IDM_SEARCH_MARKALLEXT3 = (IDM_SEARCH + 26), - IDM_SEARCH_UNMARKALLEXT3 = (IDM_SEARCH + 27), - IDM_SEARCH_MARKALLEXT4 = (IDM_SEARCH + 28), - IDM_SEARCH_UNMARKALLEXT4 = (IDM_SEARCH + 29), - IDM_SEARCH_MARKALLEXT5 = (IDM_SEARCH + 30), - IDM_SEARCH_UNMARKALLEXT5 = (IDM_SEARCH + 31), - IDM_SEARCH_CLEARALLMARKS = (IDM_SEARCH + 32), - - IDM_SEARCH_GOPREVMARKER1 = (IDM_SEARCH + 33), - IDM_SEARCH_GOPREVMARKER2 = (IDM_SEARCH + 34), - IDM_SEARCH_GOPREVMARKER3 = (IDM_SEARCH + 35), - IDM_SEARCH_GOPREVMARKER4 = (IDM_SEARCH + 36), - IDM_SEARCH_GOPREVMARKER5 = (IDM_SEARCH + 37), - IDM_SEARCH_GOPREVMARKER_DEF = (IDM_SEARCH + 38), - - IDM_SEARCH_GONEXTMARKER1 = (IDM_SEARCH + 39), - IDM_SEARCH_GONEXTMARKER2 = (IDM_SEARCH + 40), - IDM_SEARCH_GONEXTMARKER3 = (IDM_SEARCH + 41), - IDM_SEARCH_GONEXTMARKER4 = (IDM_SEARCH + 42), - IDM_SEARCH_GONEXTMARKER5 = (IDM_SEARCH + 43), - IDM_SEARCH_GONEXTMARKER_DEF = (IDM_SEARCH + 44), - - IDM_FOCUS_ON_FOUND_RESULTS = (IDM_SEARCH + 45), - IDM_SEARCH_GOTONEXTFOUND = (IDM_SEARCH + 46), - IDM_SEARCH_GOTOPREVFOUND = (IDM_SEARCH + 47), - - IDM_SEARCH_SETANDFINDNEXT = (IDM_SEARCH + 48), - IDM_SEARCH_SETANDFINDPREV = (IDM_SEARCH + 49), - IDM_SEARCH_INVERSEMARKS = (IDM_SEARCH + 50), - - IDM_VIEW = (IDM + 4000), - //IDM_VIEW_TOOLBAR_HIDE = (IDM_VIEW + 1), - IDM_VIEW_TOOLBAR_REDUCE = (IDM_VIEW + 2), - IDM_VIEW_TOOLBAR_ENLARGE = (IDM_VIEW + 3), - IDM_VIEW_TOOLBAR_STANDARD = (IDM_VIEW + 4), - IDM_VIEW_REDUCETABBAR = (IDM_VIEW + 5), - IDM_VIEW_LOCKTABBAR = (IDM_VIEW + 6), - IDM_VIEW_DRAWTABBAR_TOPBAR = (IDM_VIEW + 7), - IDM_VIEW_DRAWTABBAR_INACIVETAB = (IDM_VIEW + 8), - IDM_VIEW_POSTIT = (IDM_VIEW + 9), - IDM_VIEW_TOGGLE_FOLDALL = (IDM_VIEW + 10), - IDM_VIEW_USER_DLG = (IDM_VIEW + 11), - IDM_VIEW_LINENUMBER = (IDM_VIEW + 12), - IDM_VIEW_SYMBOLMARGIN = (IDM_VIEW + 13), - IDM_VIEW_FOLDERMAGIN = (IDM_VIEW + 14), - IDM_VIEW_FOLDERMAGIN_SIMPLE = (IDM_VIEW + 15), - IDM_VIEW_FOLDERMAGIN_ARROW = (IDM_VIEW + 16), - IDM_VIEW_FOLDERMAGIN_CIRCLE = (IDM_VIEW + 17), - IDM_VIEW_FOLDERMAGIN_BOX = (IDM_VIEW + 18), - IDM_VIEW_ALL_CHARACTERS = (IDM_VIEW + 19), - IDM_VIEW_INDENT_GUIDE = (IDM_VIEW + 20), - IDM_VIEW_CURLINE_HILITING = (IDM_VIEW + 21), - IDM_VIEW_WRAP = (IDM_VIEW + 22), - IDM_VIEW_ZOOMIN = (IDM_VIEW + 23), - IDM_VIEW_ZOOMOUT = (IDM_VIEW + 24), - IDM_VIEW_TAB_SPACE = (IDM_VIEW + 25), - IDM_VIEW_EOL = (IDM_VIEW + 26), - IDM_VIEW_EDGELINE = (IDM_VIEW + 27), - IDM_VIEW_EDGEBACKGROUND = (IDM_VIEW + 28), - IDM_VIEW_TOGGLE_UNFOLDALL = (IDM_VIEW + 29), - IDM_VIEW_FOLD_CURRENT = (IDM_VIEW + 30), - IDM_VIEW_UNFOLD_CURRENT = (IDM_VIEW + 31), - IDM_VIEW_FULLSCREENTOGGLE = (IDM_VIEW + 32), - IDM_VIEW_ZOOMRESTORE = (IDM_VIEW + 33), - IDM_VIEW_ALWAYSONTOP = (IDM_VIEW + 34), - IDM_VIEW_SYNSCROLLV = (IDM_VIEW + 35), - IDM_VIEW_SYNSCROLLH = (IDM_VIEW + 36), - IDM_VIEW_EDGENONE = (IDM_VIEW + 37), - IDM_VIEW_DRAWTABBAR_CLOSEBOTTUN = (IDM_VIEW + 38), - IDM_VIEW_DRAWTABBAR_DBCLK2CLOSE = (IDM_VIEW + 39), - IDM_VIEW_REFRESHTABAR = (IDM_VIEW + 40), - IDM_VIEW_WRAP_SYMBOL = (IDM_VIEW + 41), - IDM_VIEW_HIDELINES = (IDM_VIEW + 42), - IDM_VIEW_DRAWTABBAR_VERTICAL = (IDM_VIEW + 43), - IDM_VIEW_DRAWTABBAR_MULTILINE = (IDM_VIEW + 44), - IDM_VIEW_DOCCHANGEMARGIN = (IDM_VIEW + 45), - IDM_VIEW_LWDEF = (IDM_VIEW + 46), - IDM_VIEW_LWALIGN = (IDM_VIEW + 47), - IDM_VIEW_LWINDENT = (IDM_VIEW + 48), - IDM_VIEW_SUMMARY = (IDM_VIEW + 49), - - IDM_VIEW_FOLD = (IDM_VIEW + 50), - IDM_VIEW_FOLD_1 = (IDM_VIEW_FOLD + 1), - IDM_VIEW_FOLD_2 = (IDM_VIEW_FOLD + 2), - IDM_VIEW_FOLD_3 = (IDM_VIEW_FOLD + 3), - IDM_VIEW_FOLD_4 = (IDM_VIEW_FOLD + 4), - IDM_VIEW_FOLD_5 = (IDM_VIEW_FOLD + 5), - IDM_VIEW_FOLD_6 = (IDM_VIEW_FOLD + 6), - IDM_VIEW_FOLD_7 = (IDM_VIEW_FOLD + 7), - IDM_VIEW_FOLD_8 = (IDM_VIEW_FOLD + 8), - - IDM_VIEW_UNFOLD = (IDM_VIEW + 60), - IDM_VIEW_UNFOLD_1 = (IDM_VIEW_UNFOLD + 1), - IDM_VIEW_UNFOLD_2 = (IDM_VIEW_UNFOLD + 2), - IDM_VIEW_UNFOLD_3 = (IDM_VIEW_UNFOLD + 3), - IDM_VIEW_UNFOLD_4 = (IDM_VIEW_UNFOLD + 4), - IDM_VIEW_UNFOLD_5 = (IDM_VIEW_UNFOLD + 5), - IDM_VIEW_UNFOLD_6 = (IDM_VIEW_UNFOLD + 6), - IDM_VIEW_UNFOLD_7 = (IDM_VIEW_UNFOLD + 7), - IDM_VIEW_UNFOLD_8 = (IDM_VIEW_UNFOLD + 8), - - IDM_VIEW_GOTO_ANOTHER_VIEW = 10001, - IDM_VIEW_CLONE_TO_ANOTHER_VIEW = 10002, - IDM_VIEW_GOTO_NEW_INSTANCE = 10003, - IDM_VIEW_LOAD_IN_NEW_INSTANCE = 10004, - - IDM_VIEW_SWITCHTO_OTHER_VIEW = (IDM_VIEW + 72), - - IDM_FORMAT = (IDM + 5000), - IDM_FORMAT_TODOS = (IDM_FORMAT + 1), - IDM_FORMAT_TOUNIX = (IDM_FORMAT + 2), - IDM_FORMAT_TOMAC = (IDM_FORMAT + 3), - IDM_FORMAT_ANSI = (IDM_FORMAT + 4), - IDM_FORMAT_UTF_8 = (IDM_FORMAT + 5), - IDM_FORMAT_UCS_2BE = (IDM_FORMAT + 6), - IDM_FORMAT_UCS_2LE = (IDM_FORMAT + 7), - IDM_FORMAT_AS_UTF_8 = (IDM_FORMAT + 8), - IDM_FORMAT_CONV2_ANSI = (IDM_FORMAT + 9), - IDM_FORMAT_CONV2_AS_UTF_8 = (IDM_FORMAT + 10), - IDM_FORMAT_CONV2_UTF_8 = (IDM_FORMAT + 11), - IDM_FORMAT_CONV2_UCS_2BE = (IDM_FORMAT + 12), - IDM_FORMAT_CONV2_UCS_2LE = (IDM_FORMAT + 13), - - IDM_FORMAT_ENCODE = (IDM_FORMAT + 20), - IDM_FORMAT_WIN_1250 = (IDM_FORMAT_ENCODE + 0), - IDM_FORMAT_WIN_1251 = (IDM_FORMAT_ENCODE + 1), - IDM_FORMAT_WIN_1252 = (IDM_FORMAT_ENCODE + 2), - IDM_FORMAT_WIN_1253 = (IDM_FORMAT_ENCODE + 3), - IDM_FORMAT_WIN_1254 = (IDM_FORMAT_ENCODE + 4), - IDM_FORMAT_WIN_1255 = (IDM_FORMAT_ENCODE + 5), - IDM_FORMAT_WIN_1256 = (IDM_FORMAT_ENCODE + 6), - IDM_FORMAT_WIN_1257 = (IDM_FORMAT_ENCODE + 7), - IDM_FORMAT_WIN_1258 = (IDM_FORMAT_ENCODE + 8), - IDM_FORMAT_ISO_8859_1 = (IDM_FORMAT_ENCODE + 9), - IDM_FORMAT_ISO_8859_2 = (IDM_FORMAT_ENCODE + 10), - IDM_FORMAT_ISO_8859_3 = (IDM_FORMAT_ENCODE + 11), - IDM_FORMAT_ISO_8859_4 = (IDM_FORMAT_ENCODE + 12), - IDM_FORMAT_ISO_8859_5 = (IDM_FORMAT_ENCODE + 13), - IDM_FORMAT_ISO_8859_6 = (IDM_FORMAT_ENCODE + 14), - IDM_FORMAT_ISO_8859_7 = (IDM_FORMAT_ENCODE + 15), - IDM_FORMAT_ISO_8859_8 = (IDM_FORMAT_ENCODE + 16), - IDM_FORMAT_ISO_8859_9 = (IDM_FORMAT_ENCODE + 17), - IDM_FORMAT_ISO_8859_10 = (IDM_FORMAT_ENCODE + 18), - IDM_FORMAT_ISO_8859_11 = (IDM_FORMAT_ENCODE + 19), - IDM_FORMAT_ISO_8859_13 = (IDM_FORMAT_ENCODE + 20), - IDM_FORMAT_ISO_8859_14 = (IDM_FORMAT_ENCODE + 21), - IDM_FORMAT_ISO_8859_15 = (IDM_FORMAT_ENCODE + 22), - IDM_FORMAT_ISO_8859_16 = (IDM_FORMAT_ENCODE + 23), - IDM_FORMAT_DOS_437 = (IDM_FORMAT_ENCODE + 24), - IDM_FORMAT_DOS_720 = (IDM_FORMAT_ENCODE + 25), - IDM_FORMAT_DOS_737 = (IDM_FORMAT_ENCODE + 26), - IDM_FORMAT_DOS_775 = (IDM_FORMAT_ENCODE + 27), - IDM_FORMAT_DOS_850 = (IDM_FORMAT_ENCODE + 28), - IDM_FORMAT_DOS_852 = (IDM_FORMAT_ENCODE + 29), - IDM_FORMAT_DOS_855 = (IDM_FORMAT_ENCODE + 30), - IDM_FORMAT_DOS_857 = (IDM_FORMAT_ENCODE + 31), - IDM_FORMAT_DOS_858 = (IDM_FORMAT_ENCODE + 32), - IDM_FORMAT_DOS_860 = (IDM_FORMAT_ENCODE + 33), - IDM_FORMAT_DOS_861 = (IDM_FORMAT_ENCODE + 34), - IDM_FORMAT_DOS_862 = (IDM_FORMAT_ENCODE + 35), - IDM_FORMAT_DOS_863 = (IDM_FORMAT_ENCODE + 36), - IDM_FORMAT_DOS_865 = (IDM_FORMAT_ENCODE + 37), - IDM_FORMAT_DOS_866 = (IDM_FORMAT_ENCODE + 38), - IDM_FORMAT_DOS_869 = (IDM_FORMAT_ENCODE + 39), - IDM_FORMAT_BIG5 = (IDM_FORMAT_ENCODE + 40), - IDM_FORMAT_GB2312 = (IDM_FORMAT_ENCODE + 41), - IDM_FORMAT_SHIFT_JIS = (IDM_FORMAT_ENCODE + 42), - IDM_FORMAT_KOREAN_WIN = (IDM_FORMAT_ENCODE + 43), - IDM_FORMAT_EUC_KR = (IDM_FORMAT_ENCODE + 44), - IDM_FORMAT_TIS_620 = (IDM_FORMAT_ENCODE + 45), - IDM_FORMAT_MAC_CYRILLIC = (IDM_FORMAT_ENCODE + 46), - IDM_FORMAT_KOI8U_CYRILLIC = (IDM_FORMAT_ENCODE + 47), - IDM_FORMAT_KOI8R_CYRILLIC = (IDM_FORMAT_ENCODE + 48), - IDM_FORMAT_ENCODE_END = IDM_FORMAT_KOI8R_CYRILLIC, - - //#define IDM_FORMAT_CONVERT 200 - - IDM_LANG = (IDM + 6000), - IDM_LANGSTYLE_CONFIG_DLG = (IDM_LANG + 1), - IDM_LANG_C = (IDM_LANG + 2), - IDM_LANG_CPP = (IDM_LANG + 3), - IDM_LANG_JAVA = (IDM_LANG + 4), - IDM_LANG_HTML = (IDM_LANG + 5), - IDM_LANG_XML = (IDM_LANG + 6), - IDM_LANG_JS = (IDM_LANG + 7), - IDM_LANG_PHP = (IDM_LANG + 8), - IDM_LANG_ASP = (IDM_LANG + 9), - IDM_LANG_CSS = (IDM_LANG + 10), - IDM_LANG_PASCAL = (IDM_LANG + 11), - IDM_LANG_PYTHON = (IDM_LANG + 12), - IDM_LANG_PERL = (IDM_LANG + 13), - IDM_LANG_OBJC = (IDM_LANG + 14), - IDM_LANG_ASCII = (IDM_LANG + 15), - IDM_LANG_TEXT = (IDM_LANG + 16), - IDM_LANG_RC = (IDM_LANG + 17), - IDM_LANG_MAKEFILE = (IDM_LANG + 18), - IDM_LANG_INI = (IDM_LANG + 19), - IDM_LANG_SQL = (IDM_LANG + 20), - IDM_LANG_VB = (IDM_LANG + 21), - IDM_LANG_BATCH = (IDM_LANG + 22), - IDM_LANG_CS = (IDM_LANG + 23), - IDM_LANG_LUA = (IDM_LANG + 24), - IDM_LANG_TEX = (IDM_LANG + 25), - IDM_LANG_FORTRAN = (IDM_LANG + 26), - IDM_LANG_BASH = (IDM_LANG + 27), - IDM_LANG_FLASH = (IDM_LANG + 28), - IDM_LANG_NSIS = (IDM_LANG + 29), - IDM_LANG_TCL = (IDM_LANG + 30), - IDM_LANG_LISP = (IDM_LANG + 31), - IDM_LANG_SCHEME = (IDM_LANG + 32), - IDM_LANG_ASM = (IDM_LANG + 33), - IDM_LANG_DIFF = (IDM_LANG + 34), - IDM_LANG_PROPS = (IDM_LANG + 35), - IDM_LANG_PS = (IDM_LANG + 36), - IDM_LANG_RUBY = (IDM_LANG + 37), - IDM_LANG_SMALLTALK = (IDM_LANG + 38), - IDM_LANG_VHDL = (IDM_LANG + 39), - IDM_LANG_CAML = (IDM_LANG + 40), - IDM_LANG_KIX = (IDM_LANG + 41), - IDM_LANG_ADA = (IDM_LANG + 42), - IDM_LANG_VERILOG = (IDM_LANG + 43), - IDM_LANG_AU3 = (IDM_LANG + 44), - IDM_LANG_MATLAB = (IDM_LANG + 45), - IDM_LANG_HASKELL = (IDM_LANG + 46), - IDM_LANG_INNO = (IDM_LANG + 47), - IDM_LANG_CMAKE = (IDM_LANG + 48), - IDM_LANG_YAML = (IDM_LANG + 49), - IDM_LANG_COBOL = (IDM_LANG + 50), - IDM_LANG_D = (IDM_LANG + 51), - IDM_LANG_GUI4CLI = (IDM_LANG + 52), - IDM_LANG_POWERSHELL = (IDM_LANG + 53), - IDM_LANG_R = (IDM_LANG + 54), - IDM_LANG_JSP = (IDM_LANG + 55), - IDM_LANG_EXTERNAL = (IDM_LANG + 65), - IDM_LANG_EXTERNAL_LIMIT = (IDM_LANG + 79), - IDM_LANG_USER = (IDM_LANG + 80), //46080 - IDM_LANG_USER_LIMIT = (IDM_LANG + 110), //46110 - - IDM_ABOUT = (IDM + 7000), - IDM_HOMESWEETHOME = (IDM_ABOUT + 1), - IDM_PROJECTPAGE = (IDM_ABOUT + 2), - IDM_ONLINEHELP = (IDM_ABOUT + 3), - IDM_FORUM = (IDM_ABOUT + 4), - IDM_PLUGINSHOME = (IDM_ABOUT + 5), - IDM_UPDATE_NPP = (IDM_ABOUT + 6), - IDM_WIKIFAQ = (IDM_ABOUT + 7), - IDM_HELP = (IDM_ABOUT + 8), - - IDM_SETTING = (IDM + 8000), - IDM_SETTING_TAB_SIZE = (IDM_SETTING + 1), - IDM_SETTING_TAB_REPLCESPACE = (IDM_SETTING + 2), - IDM_SETTING_HISTORY_SIZE = (IDM_SETTING + 3), - IDM_SETTING_EDGE_SIZE = (IDM_SETTING + 4), - IDM_SETTING_IMPORTPLUGIN = (IDM_SETTING + 5), - IDM_SETTING_IMPORTSTYLETHEMS = (IDM_SETTING + 6), - IDM_SETTING_TRAYICON = (IDM_SETTING + 8), - IDM_SETTING_SHORTCUT_MAPPER = (IDM_SETTING + 9), - IDM_SETTING_REMEMBER_LAST_SESSION = (IDM_SETTING + 10), - IDM_SETTING_PREFERECE = (IDM_SETTING + 11), - IDM_SETTING_AUTOCNBCHAR = (IDM_SETTING + 15), - IDM_SETTING_SHORTCUT_MAPPER_MACRO = (IDM_SETTING + 16), - IDM_SETTING_SHORTCUT_MAPPER_RUN = (IDM_SETTING + 17), - IDM_SETTING_EDITCONTEXTMENU = (IDM_SETTING + 18), - - IDM_EXECUTE = (IDM + 9000), - - IDM_SYSTRAYPOPUP = (IDM + 3100), - IDM_SYSTRAYPOPUP_ACTIVATE = (IDM_SYSTRAYPOPUP + 1), - IDM_SYSTRAYPOPUP_NEWDOC = (IDM_SYSTRAYPOPUP + 2), - IDM_SYSTRAYPOPUP_NEW_AND_PASTE = (IDM_SYSTRAYPOPUP + 3), - IDM_SYSTRAYPOPUP_OPENFILE = (IDM_SYSTRAYPOPUP + 4), - IDM_SYSTRAYPOPUP_CLOSE = (IDM_SYSTRAYPOPUP + 5) - } -} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/Msgs_h.cs b/CSharpRegexTools4Npp/PluginInfrastructure/Msgs_h.cs index 97ffea4..3b77d71 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/Msgs_h.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/Msgs_h.cs @@ -9,7 +9,7 @@ namespace CSharpRegexTools4Npp.PluginInfrastructure { - public class Constants + class Constants { public const int WM_USER = 0x400; public const int NPPMSG = WM_USER + 1000; @@ -24,14 +24,16 @@ public enum LangType L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3, L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT, L_CMAKE, L_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R, L_JSP, - L_COFFEESCRIPT, L_JSON, L_JAVASCRIPT, L_FORTRAN_77, + L_COFFEESCRIPT, L_JSON, L_JAVASCRIPT, L_FORTRAN_77, L_BAANC, L_SREC, + L_IHEX, L_TEHEX, L_SWIFT, + L_ASN1, L_AVS, L_BLITZBASIC, L_PUREBASIC, L_FREEBASIC, + L_CSOUND, L_ERLANG, L_ESCRIPT, L_FORTH, L_LATEX, + L_MMIXAL, L_NIM, L_NNCRONTAB, L_OSCRIPT, L_REBOL, + L_REGISTRY, L_RUST, L_SPICE, L_TXT2TAGS, L_VISUALPROLOG, + L_TYPESCRIPT, L_JSON5, L_MSSQL, L_GDSCRIPT, L_HOLLYWOOD, // Don't use L_JS, use L_JAVASCRIPT instead // The end of enumated language type, so it should be always at the end - L_EXTERNAL, - L_SRECORD, L_INTELHEX, L_TEKTRONIXEXTENDEDHEX, L_SWIFT, L_ASN1, L_AVISYNTH, - L_BLITZBASIC, L_PUREBASIC, L_FREEBASIC, L_CSOUND, L_ERLANG, L_ESCRIPT, - L_FORTH, L_LATEX, L_MMIXAL, L_NIMROD, L_NNCRONTAB, L_OSCRIPT, L_REBOL, - L_REGISTRY, L_RUST, L_SPICE, L_TXT2TAGS, L_VPROLOG, + L_EXTERNAL } [Flags] @@ -49,7 +51,6 @@ public enum NppMsg : uint ALL_OPEN_FILES = 0, PRIMARY_VIEW = 1, SECOND_VIEW = 2, - NPPM_GETOPENFILENAMES = Constants.NPPMSG + 8, NPPM_MODELESSDIALOG = Constants.NPPMSG + 12, @@ -80,12 +81,12 @@ public enum NppMsg : uint STATUSBAR_UNICODE_TYPE = 4, STATUSBAR_TYPING_MODE = 5, - NPPM_GETMENUHANDLE = Constants.NPPMSG + 25, - NPPPLUGINMENU = 0, /// - /// INT NPPM_GETMENUHANDLE(INT menuChoice, 0) - /// Return: menu handle (HMENU) of choice (plugin menu handle or Notepad++ main menu handle) + /// INT NPPM_GETMENUHANDLE(INT menuChoice, 0)

+ /// Return: menu handle (HMENU) of choice (plugin menu handle () or Notepad++ main menu handle ()) ///
+ NPPM_GETMENUHANDLE = Constants.NPPMSG + 25, + NPPPLUGINMENU = 0, NPPMAINMENU = 1, /// @@ -195,7 +196,11 @@ public enum NppMsg : uint NPPM_GETENABLETHEMETEXTUREFUNC = Constants.NPPMSG + 45, /// - ///void NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str) + ///INT NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str) + /// Get user's plugin config directory path. It's useful if plugins want to save/load parameters for the current user + /// Returns the number of TCHAR copied/to copy. + /// Users should call it with "str" be NULL to get the required number of TCHAR (not including the terminating nul character), + /// allocate "str" buffer with the return value + 1, then call it again to get the path. /// NPPM_GETPLUGINSCONFIGDIR = Constants.NPPMSG + 46, @@ -243,7 +248,7 @@ public enum NppMsg : uint NPPM_ISTABBARHIDDEN = Constants.NPPMSG + 52, /// - /// INT NPPM_GETPOSFROMBUFFERID(INT bufferID, INT priorityView) + /// INT NPPM_GETPOSFROMBUFFERID(UINT_PTR bufferID, INT priorityView) /// Return VIEW|INDEX from a buffer ID. -1 if the bufferID non existing /// if priorityView set to SUB_VIEW, then SUB_VIEW will be search firstly /// @@ -255,11 +260,11 @@ public enum NppMsg : uint NPPM_GETPOSFROMBUFFERID = Constants.NPPMSG + 57, /// - /// INT NPPM_GETFULLPATHFROMBUFFERID(INT bufferID, TCHAR *fullFilePath) + /// INT NPPM_GETFULLPATHFROMBUFFERID(UINT_PTR bufferID, TCHAR *fullFilePath) /// Get full path file name from a bufferID. /// Return -1 if the bufferID non existing, otherwise the number of TCHAR copied/to copy /// User should call it with fullFilePath be NULL to get the number of TCHAR (not including the nul character), - /// allocate fullFilePath with the return values + 1, then call it again to get full path file name + /// allocate fullFilePath with the return values + 1, then call it again to get full path file name /// NPPM_GETFULLPATHFROMBUFFERID = Constants.NPPMSG + 58, @@ -278,7 +283,7 @@ public enum NppMsg : uint NPPM_GETCURRENTBUFFERID = Constants.NPPMSG + 60, /// - /// VOID NPPM_RELOADBUFFERID(0, 0) + /// VOID NPPM_RELOADBUFFERID(UINT_PTR bufferID, BOOL alert) /// Reloads Buffer /// wParam: Buffer to reload /// lParam: 0 if no alert, else alert @@ -286,7 +291,7 @@ public enum NppMsg : uint NPPM_RELOADBUFFERID = Constants.NPPMSG + 61, /// - /// INT NPPM_GETBUFFERLANGTYPE(INT bufferID, 0) + /// INT NPPM_GETBUFFERLANGTYPE(UINT_PTR bufferID, 0) /// wParam: BufferID to get LangType from /// lParam: 0 /// Returns as int, see LangType. -1 on error @@ -294,7 +299,7 @@ public enum NppMsg : uint NPPM_GETBUFFERLANGTYPE = Constants.NPPMSG + 64, /// - /// BOOL NPPM_SETBUFFERLANGTYPE(INT bufferID, INT langType) + /// BOOL NPPM_SETBUFFERLANGTYPE(UINT_PTR bufferID, INT langType) /// wParam: BufferID to set LangType of /// lParam: LangType /// Returns TRUE on success, FALSE otherwise @@ -304,7 +309,7 @@ public enum NppMsg : uint NPPM_SETBUFFERLANGTYPE = Constants.NPPMSG + 65, /// - /// INT NPPM_GETBUFFERENCODING(INT bufferID, 0) + /// INT NPPM_GETBUFFERENCODING(UINT_PTR bufferID, 0) /// wParam: BufferID to get encoding from /// lParam: 0 /// returns as int, see UniMode. -1 on error @@ -312,7 +317,7 @@ public enum NppMsg : uint NPPM_GETBUFFERENCODING = Constants.NPPMSG + 66, /// - /// BOOL NPPM_SETBUFFERENCODING(INT bufferID, INT encoding) + /// BOOL NPPM_SETBUFFERENCODING(UINT_PTR bufferID, INT encoding) /// wParam: BufferID to set encoding of /// lParam: encoding /// Returns TRUE on success, FALSE otherwise @@ -322,40 +327,22 @@ public enum NppMsg : uint NPPM_SETBUFFERENCODING = Constants.NPPMSG + 67, /// - /// INT NPPM_GETBUFFERFORMAT(INT bufferID, 0) - /// wParam: BufferID to get format from + /// INT NPPM_GETBUFFERFORMAT(UINT_PTR bufferID, 0) + /// wParam: BufferID to get EolType format from /// lParam: 0 - /// returns as int, see formatType. -1 on error + /// returns as int, see EolType format. -1 on error /// NPPM_GETBUFFERFORMAT = Constants.NPPMSG + 68, /// - /// BOOL NPPM_SETBUFFERFORMAT(INT bufferID, INT format) - /// wParam: BufferID to set format of + /// BOOL NPPM_SETBUFFERFORMAT(UINT_PTR bufferID, INT format) + /// wParam: BufferID to set EolType format of /// lParam: format /// Returns TRUE on success, FALSE otherwise - /// use int, see formatType + /// use int, see EolType format /// NPPM_SETBUFFERFORMAT = Constants.NPPMSG + 69, - /// - /// BOOL NPPM_ADDREBAR(0, REBARBANDINFO *) - /// Returns assigned ID in wID value of struct pointer - /// - NPPM_ADDREBAR = Constants.NPPMSG + 57, - - /// - /// BOOL NPPM_ADDREBAR(INT ID, REBARBANDINFO *) - ///Use ID assigned with NPPM_ADDREBAR - /// - NPPM_UPDATEREBAR = Constants.NPPMSG + 58, - - /// - /// BOOL NPPM_ADDREBAR(INT ID, 0) - ///Use ID assigned with NPPM_ADDREBAR - /// - NPPM_REMOVEREBAR = Constants.NPPMSG + 59, - /// /// BOOL NPPM_HIDETOOLBAR(0, BOOL hideOrNot) /// if hideOrNot is set as TRUE then tool bar will be hidden @@ -402,7 +389,7 @@ public enum NppMsg : uint /// BOOL NPPM_GETSHORTCUTBYCMDID(int cmdID, ShortcutKey *sk) /// get your plugin command current mapped shortcut into sk via cmdID /// You may need it after getting NPPN_READY notification - /// returned value : TRUE if this function call is successful and shorcut is enable, otherwise FALSE + /// returned value : TRUE if this function call is successful and shortcut is enable, otherwise FALSE /// NPPM_GETSHORTCUTBYCMDID = Constants.NPPMSG + 76, @@ -420,7 +407,7 @@ public enum NppMsg : uint /// /// INT NPPM_GETCURRENTNATIVELANGENCODING(0, 0) - /// returned value : the current native language enconding + /// returned value : the current native language encoding /// NPPM_GETCURRENTNATIVELANGENCODING = Constants.NPPMSG + 79, @@ -447,7 +434,7 @@ public enum NppMsg : uint /// /// INT NPPM_GETLANGUAGENAME(int langType, TCHAR *langName) - /// Get programing language name from the given language type (LangType) + /// Get programming language name from the given language type (LangType) /// Return value is the number of copied character / number of character to copy (\0 is not included) /// You should call this function 2 times - the first time you pass langName as NULL to get the number of characters to copy. /// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGENAME function the 2nd time @@ -457,7 +444,7 @@ public enum NppMsg : uint /// /// INT NPPM_GETLANGUAGEDESC(int langType, TCHAR *langDesc) - /// Get programing language short description from the given language type (LangType) + /// Get programming language short description from the given language type (LangType) /// Return value is the number of copied character / number of character to copy (\0 is not included) /// You should call this function 2 times - the first time you pass langDesc as NULL to get the number of characters to copy. /// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGEDESC function the 2nd time @@ -466,7 +453,7 @@ public enum NppMsg : uint NPPM_GETLANGUAGEDESC = Constants.NPPMSG + 84, /// - /// VOID NPPM_ISDOCSWITCHERSHOWN(0, BOOL toShowOrNot) + /// VOID NPPM_SHOWDOCSWITCHER(0, BOOL toShowOrNot) /// Send this message to show or hide doc switcher. /// if toShowOrNot is TRUE then show doc switcher, otherwise hide it. /// @@ -480,7 +467,7 @@ public enum NppMsg : uint /// /// BOOL NPPM_GETAPPDATAPLUGINSALLOWED(0, 0) - /// Check to see if loading plugins from "%APPDATA%\Notepad++\plugins" is allowed. + /// Check to see if loading plugins from "%APPDATA%\..\Local\Notepad++\plugins" is allowed. /// NPPM_GETAPPDATAPLUGINSALLOWED = Constants.NPPMSG + 87, @@ -523,6 +510,88 @@ public enum NppMsg : uint /// NPPM_SAVEFILE = Constants.NPPMSG + 94, + /// + /// VOID NPPM_DISABLEAUTOUPDATE(0, 0) + /// + NPPM_DISABLEAUTOUPDATE = Constants.NPPMSG + 95, + + /// + /// BOOL NPPM_REMOVESHORTCUTASSIGNMENT(int cmdID) + /// removes the assigned shortcut mapped to cmdID + /// returned value : TRUE if function call is successful, otherwise FALSE + /// + NPPM_REMOVESHORTCUTBYCMDID = Constants.NPPMSG + 96, + + /// + /// INT NPPM_GETPLUGINHOMEPATH(size_t strLen, TCHAR *pluginRootPath) + /// Get plugin home root path. It's useful if plugins want to get its own path + /// by appending which is the name of plugin without extension part. + /// Returns the number of TCHAR copied/to copy. + /// Users should call it with pluginRootPath be NULL to get the required number of TCHAR (not including the terminating nul character), + /// allocate pluginRootPath buffer with the return value + 1, then call it again to get the path. + /// + NPPM_GETPLUGINHOMEPATH = Constants.NPPMSG + 97, + + /// + /// INT NPPM_GETSETTINGSCLOUDPATH(size_t strLen, TCHAR *settingsOnCloudPath) + /// Get settings on cloud path. It's useful if plugins want to store its settings on Cloud, if this path is set. + /// Returns the number of TCHAR copied/to copy. If the return value is 0, then this path is not set, or the "strLen" is not enough to copy the path. + /// Users should call it with settingsCloudPath be NULL to get the required number of TCHAR (not including the terminating nul character), + /// allocate settingsCloudPath buffer with the return value + 1, then call it again to get the path. + /// + NPPM_GETSETTINGSONCLOUDPATH = Constants.NPPMSG + 98, + + /// + /// BOOL NPPM_SETLINENUMBERWIDTHMODE(0, INT widthMode) + /// Set line number margin width in dynamic width mode (LINENUMWIDTH_DYNAMIC) or constant width mode (LINENUMWIDTH_CONSTANT) + /// It may help some plugins to disable non-dynamic line number margins width to have a smoothly visual effect while vertical scrolling the content in Notepad++ + /// If calling is successful return TRUE, otherwise return FALSE. + /// + NPPM_SETLINENUMBERWIDTHMODE = Constants.NPPMSG + 99, + LINENUMWIDTH_DYNAMIC = 0, + LINENUMWIDTH_CONSTANT = 1, + + /// + /// INT NPPM_GETLINENUMBERWIDTHMODE(0, 0) + /// Get line number margin width in dynamic width mode (LINENUMWIDTH_DYNAMIC) or constant width mode (LINENUMWIDTH_CONSTANT) + /// + NPPM_GETLINENUMBERWIDTHMODE = Constants.NPPMSG + 100, + + /// + /// VOID NPPM_ADDTOOLBARICON_FORDARKMODE(UINT funcItem[X]._cmdID, toolbarIconsWithDarkMode iconHandles) + /// Use NPPM_ADDTOOLBARICON_FORDARKMODE instead obsolete NPPM_ADDTOOLBARICON which doesn't support the dark mode + /// 2 formats / 3 icons are needed: 1 * BMP + 2 * ICO + /// All 3 handles below should be set so the icon will be displayed correctly if toolbar icon sets are changed by users, also in dark mode + /// + NPPM_ADDTOOLBARICON_FORDARKMODE = Constants.NPPMSG + 101, + + // BOOL NPPM_ALLOCATEINDICATOR(int numberRequested, int* startNumber) + // Allocates an indicator number to a plugin: if a plugin needs to add an indicator, + // it has to use this message to get the indicator number, in order to prevent a conflict with the other plugins. + // wParam[in]: numberRequested is the number of ID you request for the reservation + // lParam[out]: startNumber will be set to the initial command ID if successful + // Return TRUE if successful, FALSE otherwise. startNumber will also be set to 0 if unsuccessful + // + // Example: If a plugin needs 1 indicator ID, the following code can be used : + // + // int idBegin; + // BOOL isAllocatedSuccessful = ::SendMessage(nppData._nppHandle, NPPM_ALLOCATEINDICATOR, 1, &idBegin); + // + // if isAllocatedSuccessful is TRUE, and value of idBegin is 7 + // then indicator ID 7 is preserved by Notepad++, and it is safe to be used by the plugin. + NPPM_ALLOCATEINDICATOR = Constants.NPPMSG + 113, + + /// + /// int NPPM_GETNATIVELANGFILENAME(size_t strLen, char* nativeLangFileName)

+ /// Get the Current native language file name string.

+ /// Users should call it with nativeLangFileName as NULL to get the required number of char (not including the terminating nul character),

+ /// allocate commandLineStr buffer with the return value + 1, then call it again to get the current native language file name string.

+ /// wParam[in]: strLen is "commandLineStr" buffer length

+ /// lParam[out]: commandLineStr recieves all copied native language file name string

+ /// Return the number of char copied/to copy + ///
+ NPPM_GETNATIVELANGFILENAME = Constants.NPPMSG + 116, + RUNCOMMAND_USER = Constants.WM_USER + 3000, NPPM_GETFULLCURRENTPATH = RUNCOMMAND_USER + FULL_CURRENT_PATH, NPPM_GETCURRENTDIRECTORY = RUNCOMMAND_USER + CURRENT_DIRECTORY, @@ -530,6 +599,7 @@ public enum NppMsg : uint NPPM_GETNAMEPART = RUNCOMMAND_USER + NAME_PART, NPPM_GETEXTPART = RUNCOMMAND_USER + EXT_PART, NPPM_GETCURRENTWORD = RUNCOMMAND_USER + CURRENT_WORD, + NPPM_GETNPPDIRECTORY = RUNCOMMAND_USER + NPP_DIRECTORY, /// /// BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str) /// where str is the allocated TCHAR array, @@ -537,7 +607,7 @@ public enum NppMsg : uint /// The return value is TRUE when get generic_string operation success /// Otherwise (allocated array size is too small) FALSE /// - NPPM_GETNPPDIRECTORY = RUNCOMMAND_USER + NPP_DIRECTORY, + NPPM_GETFILENAMEATCURSOR = RUNCOMMAND_USER + GETFILENAMEATCURSOR, /// /// INT NPPM_GETCURRENTLINE(0, 0) @@ -551,6 +621,8 @@ public enum NppMsg : uint /// NPPM_GETCURRENTCOLUMN = RUNCOMMAND_USER + CURRENT_COLUMN, + NPPM_GETNPPFULLFILEPATH = RUNCOMMAND_USER + NPP_FULL_FILE_PATH, + VAR_NOT_RECOGNIZED = 0, FULL_CURRENT_PATH = 1, CURRENT_DIRECTORY = 2, @@ -561,6 +633,8 @@ public enum NppMsg : uint NPP_DIRECTORY = 7, CURRENT_LINE = 8, CURRENT_COLUMN = 9, + NPP_FULL_FILE_PATH = 10, + GETFILENAMEATCURSOR = 11, /// /// To notify plugins that all the procedures of launchment of notepad++ are done. @@ -686,12 +760,12 @@ public enum NppMsg : uint ///scnNotification->nmhdr.hwndFrom = bufferID; ///scnNotification->nmhdr.idFrom = docStatus; /// where bufferID is BufferID - /// docStatus can be combined by DOCSTAUS_READONLY and DOCSTAUS_BUFFERDIRTY + /// docStatus can be combined by DOCSTATUS_READONLY and DOCSTATUS_BUFFERDIRTY /// NPPN_READONLYCHANGED = NPPN_FIRST + 16, - DOCSTAUS_READONLY = 1, - DOCSTAUS_BUFFERDIRTY = 2, + DOCSTATUS_READONLY = 1, + DOCSTATUS_BUFFERDIRTY = 2, /// ///scnNotification->nmhdr.code = NPPN_DOCORDERCHANGED; @@ -763,6 +837,62 @@ public enum NppMsg : uint /// NPPN_FILEDELETED = NPPN_FIRST + 26, + /// + /// To notify plugins that Dark Mode was enabled/disabled + /// scnNotification->nmhdr.code = NPPN_DARKMODECHANGED; + /// scnNotification->nmhdr.hwndFrom = hwndNpp; + /// scnNotification->nmhdr.idFrom = 0; + /// + NPPN_DARKMODECHANGED = NPPN_FIRST + 27, + + /// + /// To notify plugins that the new argument for plugins (via '-pluginMessage="YOUR_PLUGIN_ARGUMENT"' in command line) is available + /// scnNotification->nmhdr.code = NPPN_CMDLINEPLUGINMSG; + /// scnNotification->nmhdr.hwndFrom = hwndNpp; + /// scnNotification->nmhdr.idFrom = pluginMessage; //where pluginMessage is pointer of type wchar_t + /// + NPPN_CMDLINEPLUGINMSG = NPPN_FIRST + 28, + + /// + /// To notify lexer plugins that the buffer (in idFrom) is just applied to a external lexer + /// scnNotification->nmhdr.code = NPPN_EXTERNALLEXERBUFFER; + /// scnNotification->nmhdr.hwndFrom = hwndNpp; + /// scnNotification->nmhdr.idFrom = BufferID; //where pluginMessage is pointer of type wchar_t + /// + NPPN_EXTERNALLEXERBUFFER = NPPN_FIRST + 29, + + /// + /// To notify plugins that the current document is just modified by Replace All action.

+ /// For solving the performance issue (from v8.6.4), Notepad++ doesn't trigger SCN_MODIFIED during Replace All action anymore.

+ /// As a result, the plugins which monitor SCN_MODIFIED should also monitor NPPN_GLOBALMODIFIED.

+ /// This notification is implemented in Notepad++ v8.6.5.

+ /// scnNotification->nmhdr.code = NPPN_GLOBALMODIFIED;

+ /// scnNotification->nmhdr.hwndFrom = BufferID;

+ /// scnNotifiNATIVELANGCHANGEDcation->nmhdr.idFrom = 0; // preserved for the future use, must be zero + ///
+ NPPN_GLOBALMODIFIED = NPPN_FIRST + 30, + + + /// + /// To notify plugins that the current native language is just changed to another one.

+ /// Use NPPM_GETNATIVELANGFILENAME to get current native language file name.

+ /// Use NPPM_GETMENUHANDLE(NPPPLUGINMENU, 0) to get submenu "Plugins" handle (HMENU)

+ /// scnNotification->nmhdr.code = NPPN_NATIVELANGCHANGED;

+ /// scnNotification->nmhdr.hwndFrom = hwndNpp

+ /// scnNotification->nmhdr.idFrom = 0; // preserved for the future use, must be zero + ///
+ NPPN_NATIVELANGCHANGED = NPPN_FIRST + 31, + /* --Autogenerated -- end of section automatically generated from notepad-plus-plus\PowerEditor\src\MISC\PluginsManager\Notepad_plus_msgs.h * */ } + + public enum StatusBarSection + { + DocType, + DocSize, + CurPos, + EofFormat, + UnicodeType, + TypingMode, + } } diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/Msgs_h.cs.bak b/CSharpRegexTools4Npp/PluginInfrastructure/Msgs_h.cs.bak deleted file mode 100644 index 0f310de..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/Msgs_h.cs.bak +++ /dev/null @@ -1,764 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -// -// This file should stay in sync with the CPP project file -// "notepad-plus-plus/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h" -// found at -// https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h - -using System; - -namespace CSharpRegexTools4Npp.PluginInfrastructure -{ - public class Constants - { - public const int WM_USER = 0x400; - public const int NPPMSG = WM_USER + 1000; - } - - public enum LangType - { - L_TEXT, L_PHP, L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC, - L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_ASCII, L_USER, - L_ASP, L_SQL, L_VB, L_JS, L_CSS, L_PERL, L_PYTHON, L_LUA, - L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME, - L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3, - L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT, - L_CMAKE, L_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R, L_JSP, - L_COFFEESCRIPT, L_JSON, L_JAVASCRIPT, L_FORTRAN_77, - // Don't use L_JS, use L_JAVASCRIPT instead - // The end of enumated language type, so it should be always at the end - L_EXTERNAL - } - - [Flags] - public enum NppMsg : uint - { - /* ++Autogenerated -- start of section automatically generated from notepad-plus-plus\PowerEditor\src\MISC\PluginsManager\Notepad_plus_msgs.h */ - - NPPMSG = Constants.WM_USER + 1000, - - NPPM_GETCURRENTSCINTILLA = Constants.NPPMSG + 4, - NPPM_GETCURRENTLANGTYPE = Constants.NPPMSG + 5, - NPPM_SETCURRENTLANGTYPE = Constants.NPPMSG + 6, - - NPPM_GETNBOPENFILES = Constants.NPPMSG + 7, - ALL_OPEN_FILES = 0, - PRIMARY_VIEW = 1, - SECOND_VIEW = 2, - - NPPM_GETOPENFILENAMES = Constants.NPPMSG + 8, - - NPPM_MODELESSDIALOG = Constants.NPPMSG + 12, - MODELESSDIALOGADD = 0, - MODELESSDIALOGREMOVE = 1, - - NPPM_GETNBSESSIONFILES = Constants.NPPMSG + 13, - NPPM_GETSESSIONFILES = Constants.NPPMSG + 14, - NPPM_SAVESESSION = Constants.NPPMSG + 15, - NPPM_SAVECURRENTSESSION = Constants.NPPMSG + 16, - - NPPM_GETOPENFILENAMESPRIMARY = Constants.NPPMSG + 17, - NPPM_GETOPENFILENAMESSECOND = Constants.NPPMSG + 18, - - NPPM_CREATESCINTILLAHANDLE = Constants.NPPMSG + 20, - NPPM_DESTROYSCINTILLAHANDLE = Constants.NPPMSG + 21, - NPPM_GETNBUSERLANG = Constants.NPPMSG + 22, - - NPPM_GETCURRENTDOCINDEX = Constants.NPPMSG + 23, - MAIN_VIEW = 0, - SUB_VIEW = 1, - - NPPM_SETSTATUSBAR = Constants.NPPMSG + 24, - STATUSBAR_DOC_TYPE = 0, - STATUSBAR_DOC_SIZE = 1, - STATUSBAR_CUR_POS = 2, - STATUSBAR_EOF_FORMAT = 3, - STATUSBAR_UNICODE_TYPE = 4, - STATUSBAR_TYPING_MODE = 5, - - NPPM_GETMENUHANDLE = Constants.NPPMSG + 25, - NPPPLUGINMENU = 0, - /// - /// INT NPPM_GETMENUHANDLE(INT menuChoice, 0) - /// Return: menu handle (HMENU) of choice (plugin menu handle or Notepad++ main menu handle) - /// - NPPMAINMENU = 1, - - /// - ///ascii file to unicode - ///int NPPM_ENCODESCI(MAIN_VIEW/SUB_VIEW, 0) - ///return new unicodeMode - /// - NPPM_ENCODESCI = Constants.NPPMSG + 26, - - /// - ///unicode file to ascii - ///int NPPM_DECODESCI(MAIN_VIEW/SUB_VIEW, 0) - ///return old unicodeMode - /// - NPPM_DECODESCI = Constants.NPPMSG + 27, - - /// - ///void NPPM_ACTIVATEDOC(int view, int index2Activate) - /// - NPPM_ACTIVATEDOC = Constants.NPPMSG + 28, - - /// - ///void NPPM_LAUNCHFINDINFILESDLG(TCHAR * dir2Search, TCHAR * filtre) - /// - NPPM_LAUNCHFINDINFILESDLG = Constants.NPPMSG + 29, - - /// - ///void NPPM_DMMSHOW(0, tTbData->hClient) - /// - NPPM_DMMSHOW = Constants.NPPMSG + 30, - - /// - ///void NPPM_DMMHIDE(0, tTbData->hClient) - /// - NPPM_DMMHIDE = Constants.NPPMSG + 31, - - /// - ///void NPPM_DMMUPDATEDISPINFO(0, tTbData->hClient) - /// - NPPM_DMMUPDATEDISPINFO = Constants.NPPMSG + 32, - - /// - ///void NPPM_DMMREGASDCKDLG(0, &tTbData) - /// - NPPM_DMMREGASDCKDLG = Constants.NPPMSG + 33, - - /// - ///void NPPM_LOADSESSION(0, const TCHAR* file name) - /// - NPPM_LOADSESSION = Constants.NPPMSG + 34, - - /// - ///void WM_DMM_VIEWOTHERTAB(0, tTbData->pszName) - /// - NPPM_DMMVIEWOTHERTAB = Constants.NPPMSG + 35, - - /// - ///BOOL NPPM_RELOADFILE(BOOL withAlert, TCHAR *filePathName2Reload) - /// - NPPM_RELOADFILE = Constants.NPPMSG + 36, - - /// - ///BOOL NPPM_SWITCHTOFILE(0, TCHAR *filePathName2switch) - /// - NPPM_SWITCHTOFILE = Constants.NPPMSG + 37, - - /// - ///BOOL NPPM_SAVECURRENTFILE(0, 0) - /// - NPPM_SAVECURRENTFILE = Constants.NPPMSG + 38, - - /// - ///BOOL NPPM_SAVEALLFILES(0, 0) - /// - NPPM_SAVEALLFILES = Constants.NPPMSG + 39, - - /// - ///void WM_PIMENU_CHECK(UINT funcItem[X]._cmdID, TRUE/FALSE) - /// - NPPM_SETMENUITEMCHECK = Constants.NPPMSG + 40, - - /// - ///void WM_ADDTOOLBARICON(UINT funcItem[X]._cmdID, toolbarIcons icon) - /// - NPPM_ADDTOOLBARICON = Constants.NPPMSG + 41, - - /// - ///winVer NPPM_GETWINDOWSVERSION(0, 0) - /// - NPPM_GETWINDOWSVERSION = Constants.NPPMSG + 42, - - /// - ///HWND WM_DMM_GETPLUGINHWNDBYNAME(const TCHAR *windowName, const TCHAR *moduleName) - /// if moduleName is NULL, then return value is NULL - /// if windowName is NULL, then the first found window handle which matches with the moduleName will be returned - /// - NPPM_DMMGETPLUGINHWNDBYNAME = Constants.NPPMSG + 43, - - /// - ///BOOL NPPM_MAKECURRENTBUFFERDIRTY(0, 0) - /// - NPPM_MAKECURRENTBUFFERDIRTY = Constants.NPPMSG + 44, - - /// - ///BOOL NPPM_GETENABLETHEMETEXTUREFUNC(0, 0) - /// - NPPM_GETENABLETHEMETEXTUREFUNC = Constants.NPPMSG + 45, - - /// - ///void NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str) - /// - NPPM_GETPLUGINSCONFIGDIR = Constants.NPPMSG + 46, - - /// - ///BOOL NPPM_MSGTOPLUGIN(TCHAR *destModuleName, CommunicationInfo *info) - /// return value is TRUE when the message arrive to the destination plugins. - /// if destModule or info is NULL, then return value is FALSE - /// - NPPM_MSGTOPLUGIN = Constants.NPPMSG + 47, - - /// - ///void NPPM_MENUCOMMAND(0, int cmdID) - /// uncomment //#include "menuCmdID.h" - /// in the beginning of this file then use the command symbols defined in "menuCmdID.h" file - /// to access all the Notepad++ menu command items - /// - NPPM_MENUCOMMAND = Constants.NPPMSG + 48, - - /// - ///void NPPM_TRIGGERTABBARCONTEXTMENU(int view, int index2Activate) - /// - NPPM_TRIGGERTABBARCONTEXTMENU = Constants.NPPMSG + 49, - - /// - /// int NPPM_GETNPPVERSION(0, 0) - /// return version - /// ex : v4.6 - /// HIWORD(version) == 4 - /// LOWORD(version) == 6 - /// - NPPM_GETNPPVERSION = Constants.NPPMSG + 50, - - /// - /// BOOL NPPM_HIDETABBAR(0, BOOL hideOrNot) - /// if hideOrNot is set as TRUE then tab bar will be hidden - /// otherwise it'll be shown. - /// return value : the old status value - /// - NPPM_HIDETABBAR = Constants.NPPMSG + 51, - - /// - /// BOOL NPPM_ISTABBARHIDDEN(0, 0) - /// returned value : TRUE if tab bar is hidden, otherwise FALSE - /// - NPPM_ISTABBARHIDDEN = Constants.NPPMSG + 52, - - /// - /// INT NPPM_GETPOSFROMBUFFERID(INT bufferID, INT priorityView) - /// Return VIEW|INDEX from a buffer ID. -1 if the bufferID non existing - /// if priorityView set to SUB_VIEW, then SUB_VIEW will be search firstly - /// - /// VIEW takes 2 highest bits and INDEX (0 based) takes the rest (30 bits) - /// Here's the values for the view : - /// MAIN_VIEW 0 - /// SUB_VIEW 1 - /// - NPPM_GETPOSFROMBUFFERID = Constants.NPPMSG + 57, - - /// - /// INT NPPM_GETFULLPATHFROMBUFFERID(INT bufferID, TCHAR *fullFilePath) - /// Get full path file name from a bufferID. - /// Return -1 if the bufferID non existing, otherwise the number of TCHAR copied/to copy - /// User should call it with fullFilePath be NULL to get the number of TCHAR (not including the nul character), - /// allocate fullFilePath with the return values + 1, then call it again to get full path file name - /// - NPPM_GETFULLPATHFROMBUFFERID = Constants.NPPMSG + 58, - - /// - /// LRESULT NPPM_GETBUFFERIDFROMPOS(INT index, INT iView) - /// wParam: Position of document - /// lParam: View to use, 0 = Main, 1 = Secondary - /// Returns 0 if invalid - /// - NPPM_GETBUFFERIDFROMPOS = Constants.NPPMSG + 59, - - /// - /// LRESULT NPPM_GETCURRENTBUFFERID(0, 0) - /// Returns active Buffer - /// - NPPM_GETCURRENTBUFFERID = Constants.NPPMSG + 60, - - /// - /// VOID NPPM_RELOADBUFFERID(0, 0) - /// Reloads Buffer - /// wParam: Buffer to reload - /// lParam: 0 if no alert, else alert - /// - NPPM_RELOADBUFFERID = Constants.NPPMSG + 61, - - /// - /// INT NPPM_GETBUFFERLANGTYPE(INT bufferID, 0) - /// wParam: BufferID to get LangType from - /// lParam: 0 - /// Returns as int, see LangType. -1 on error - /// - NPPM_GETBUFFERLANGTYPE = Constants.NPPMSG + 64, - - /// - /// BOOL NPPM_SETBUFFERLANGTYPE(INT bufferID, INT langType) - /// wParam: BufferID to set LangType of - /// lParam: LangType - /// Returns TRUE on success, FALSE otherwise - /// use int, see LangType for possible values - /// L_USER and L_EXTERNAL are not supported - /// - NPPM_SETBUFFERLANGTYPE = Constants.NPPMSG + 65, - - /// - /// INT NPPM_GETBUFFERENCODING(INT bufferID, 0) - /// wParam: BufferID to get encoding from - /// lParam: 0 - /// returns as int, see UniMode. -1 on error - /// - NPPM_GETBUFFERENCODING = Constants.NPPMSG + 66, - - /// - /// BOOL NPPM_SETBUFFERENCODING(INT bufferID, INT encoding) - /// wParam: BufferID to set encoding of - /// lParam: encoding - /// Returns TRUE on success, FALSE otherwise - /// use int, see UniMode - /// Can only be done on new, unedited files - /// - NPPM_SETBUFFERENCODING = Constants.NPPMSG + 67, - - /// - /// INT NPPM_GETBUFFERFORMAT(INT bufferID, 0) - /// wParam: BufferID to get format from - /// lParam: 0 - /// returns as int, see formatType. -1 on error - /// - NPPM_GETBUFFERFORMAT = Constants.NPPMSG + 68, - - /// - /// BOOL NPPM_SETBUFFERFORMAT(INT bufferID, INT format) - /// wParam: BufferID to set format of - /// lParam: format - /// Returns TRUE on success, FALSE otherwise - /// use int, see formatType - /// - NPPM_SETBUFFERFORMAT = Constants.NPPMSG + 69, - - /// - /// BOOL NPPM_ADDREBAR(0, REBARBANDINFO *) - /// Returns assigned ID in wID value of struct pointer - /// - NPPM_ADDREBAR = Constants.NPPMSG + 57, - - /// - /// BOOL NPPM_ADDREBAR(INT ID, REBARBANDINFO *) - ///Use ID assigned with NPPM_ADDREBAR - /// - NPPM_UPDATEREBAR = Constants.NPPMSG + 58, - - /// - /// BOOL NPPM_ADDREBAR(INT ID, 0) - ///Use ID assigned with NPPM_ADDREBAR - /// - NPPM_REMOVEREBAR = Constants.NPPMSG + 59, - - /// - /// BOOL NPPM_HIDETOOLBAR(0, BOOL hideOrNot) - /// if hideOrNot is set as TRUE then tool bar will be hidden - /// otherwise it'll be shown. - /// return value : the old status value - /// - NPPM_HIDETOOLBAR = Constants.NPPMSG + 70, - - /// - /// BOOL NPPM_ISTOOLBARHIDDEN(0, 0) - /// returned value : TRUE if tool bar is hidden, otherwise FALSE - /// - NPPM_ISTOOLBARHIDDEN = Constants.NPPMSG + 71, - - /// - /// BOOL NPPM_HIDEMENU(0, BOOL hideOrNot) - /// if hideOrNot is set as TRUE then menu will be hidden - /// otherwise it'll be shown. - /// return value : the old status value - /// - NPPM_HIDEMENU = Constants.NPPMSG + 72, - - /// - /// BOOL NPPM_ISMENUHIDDEN(0, 0) - /// returned value : TRUE if menu is hidden, otherwise FALSE - /// - NPPM_ISMENUHIDDEN = Constants.NPPMSG + 73, - - /// - /// BOOL NPPM_HIDESTATUSBAR(0, BOOL hideOrNot) - /// if hideOrNot is set as TRUE then STATUSBAR will be hidden - /// otherwise it'll be shown. - /// return value : the old status value - /// - NPPM_HIDESTATUSBAR = Constants.NPPMSG + 74, - - /// - /// BOOL NPPM_ISSTATUSBARHIDDEN(0, 0) - /// returned value : TRUE if STATUSBAR is hidden, otherwise FALSE - /// - NPPM_ISSTATUSBARHIDDEN = Constants.NPPMSG + 75, - - /// - /// BOOL NPPM_GETSHORTCUTBYCMDID(int cmdID, ShortcutKey *sk) - /// get your plugin command current mapped shortcut into sk via cmdID - /// You may need it after getting NPPN_READY notification - /// returned value : TRUE if this function call is successful and shorcut is enable, otherwise FALSE - /// - NPPM_GETSHORTCUTBYCMDID = Constants.NPPMSG + 76, - - /// - /// BOOL NPPM_DOOPEN(0, const TCHAR *fullPathName2Open) - /// fullPathName2Open indicates the full file path name to be opened. - /// The return value is TRUE (1) if the operation is successful, otherwise FALSE (0). - /// - NPPM_DOOPEN = Constants.NPPMSG + 77, - - /// - /// BOOL NPPM_SAVECURRENTFILEAS (BOOL asCopy, const TCHAR* filename) - /// - NPPM_SAVECURRENTFILEAS = Constants.NPPMSG + 78, - - /// - /// INT NPPM_GETCURRENTNATIVELANGENCODING(0, 0) - /// returned value : the current native language enconding - /// - NPPM_GETCURRENTNATIVELANGENCODING = Constants.NPPMSG + 79, - - /// - /// returns TRUE if NPPM_ALLOCATECMDID is supported - /// Use to identify if subclassing is necessary - /// - NPPM_ALLOCATESUPPORTED = Constants.NPPMSG + 80, - - /// - /// BOOL NPPM_ALLOCATECMDID(int numberRequested, int* startNumber) - /// sets startNumber to the initial command ID if successful - /// Returns: TRUE if successful, FALSE otherwise. startNumber will also be set to 0 if unsuccessful - /// - NPPM_ALLOCATECMDID = Constants.NPPMSG + 81, - - /// - /// BOOL NPPM_ALLOCATEMARKER(int numberRequested, int* startNumber) - /// sets startNumber to the initial command ID if successful - /// Allocates a marker number to a plugin - /// Returns: TRUE if successful, FALSE otherwise. startNumber will also be set to 0 if unsuccessful - /// - NPPM_ALLOCATEMARKER = Constants.NPPMSG + 82, - - /// - /// INT NPPM_GETLANGUAGENAME(int langType, TCHAR *langName) - /// Get programing language name from the given language type (LangType) - /// Return value is the number of copied character / number of character to copy (\0 is not included) - /// You should call this function 2 times - the first time you pass langName as NULL to get the number of characters to copy. - /// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGENAME function the 2nd time - /// by passing allocated buffer as argument langName - /// - NPPM_GETLANGUAGENAME = Constants.NPPMSG + 83, - - /// - /// INT NPPM_GETLANGUAGEDESC(int langType, TCHAR *langDesc) - /// Get programing language short description from the given language type (LangType) - /// Return value is the number of copied character / number of character to copy (\0 is not included) - /// You should call this function 2 times - the first time you pass langDesc as NULL to get the number of characters to copy. - /// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGEDESC function the 2nd time - /// by passing allocated buffer as argument langDesc - /// - NPPM_GETLANGUAGEDESC = Constants.NPPMSG + 84, - - /// - /// VOID NPPM_ISDOCSWITCHERSHOWN(0, BOOL toShowOrNot) - /// Send this message to show or hide doc switcher. - /// if toShowOrNot is TRUE then show doc switcher, otherwise hide it. - /// - NPPM_SHOWDOCSWITCHER = Constants.NPPMSG + 85, - - /// - /// BOOL NPPM_ISDOCSWITCHERSHOWN(0, 0) - /// Check to see if doc switcher is shown. - /// - NPPM_ISDOCSWITCHERSHOWN = Constants.NPPMSG + 86, - - /// - /// BOOL NPPM_GETAPPDATAPLUGINSALLOWED(0, 0) - /// Check to see if loading plugins from "%APPDATA%\Notepad++\plugins" is allowed. - /// - NPPM_GETAPPDATAPLUGINSALLOWED = Constants.NPPMSG + 87, - - /// - /// INT NPPM_GETCURRENTVIEW(0, 0) - /// Return: current edit view of Notepad++. Only 2 possible values: 0 = Main, 1 = Secondary - /// - NPPM_GETCURRENTVIEW = Constants.NPPMSG + 88, - - /// - /// VOID NPPM_DOCSWITCHERDISABLECOLUMN(0, BOOL disableOrNot) - /// Disable or enable extension column of doc switcher - /// - NPPM_DOCSWITCHERDISABLECOLUMN = Constants.NPPMSG + 89, - - /// - /// INT NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR(0, 0) - /// Return: current editor default foreground color. You should convert the returned value in COLORREF - /// - NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR = Constants.NPPMSG + 90, - - /// - /// INT NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR(0, 0) - /// Return: current editor default background color. You should convert the returned value in COLORREF - /// - NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR = Constants.NPPMSG + 91, - - /// - /// VOID NPPM_SETSMOOTHFONT(0, BOOL setSmoothFontOrNot) - /// - NPPM_SETSMOOTHFONT = Constants.NPPMSG + 92, - - /// - /// VOID NPPM_SETEDITORBORDEREDGE(0, BOOL withEditorBorderEdgeOrNot) - /// - NPPM_SETEDITORBORDEREDGE = Constants.NPPMSG + 93, - - /// - /// VOID NPPM_SAVEFILE(0, const TCHAR *fileNameToSave) - /// - NPPM_SAVEFILE = Constants.NPPMSG + 94, - - RUNCOMMAND_USER = Constants.WM_USER + 3000, - NPPM_GETFULLCURRENTPATH = RUNCOMMAND_USER + FULL_CURRENT_PATH, - NPPM_GETCURRENTDIRECTORY = RUNCOMMAND_USER + CURRENT_DIRECTORY, - NPPM_GETFILENAME = RUNCOMMAND_USER + FILE_NAME, - NPPM_GETNAMEPART = RUNCOMMAND_USER + NAME_PART, - NPPM_GETEXTPART = RUNCOMMAND_USER + EXT_PART, - NPPM_GETCURRENTWORD = RUNCOMMAND_USER + CURRENT_WORD, - /// - /// BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str) - /// where str is the allocated TCHAR array, - /// strLen is the allocated array size - /// The return value is TRUE when get generic_string operation success - /// Otherwise (allocated array size is too small) FALSE - /// - NPPM_GETNPPDIRECTORY = RUNCOMMAND_USER + NPP_DIRECTORY, - - /// - /// INT NPPM_GETCURRENTLINE(0, 0) - /// return the caret current position line - /// - NPPM_GETCURRENTLINE = RUNCOMMAND_USER + CURRENT_LINE, - - /// - /// INT NPPM_GETCURRENTCOLUMN(0, 0) - /// return the caret current position column - /// - NPPM_GETCURRENTCOLUMN = RUNCOMMAND_USER + CURRENT_COLUMN, - - VAR_NOT_RECOGNIZED = 0, - FULL_CURRENT_PATH = 1, - CURRENT_DIRECTORY = 2, - FILE_NAME = 3, - NAME_PART = 4, - EXT_PART = 5, - CURRENT_WORD = 6, - NPP_DIRECTORY = 7, - CURRENT_LINE = 8, - CURRENT_COLUMN = 9, - - /// - /// To notify plugins that all the procedures of launchment of notepad++ are done. - ///scnNotification->nmhdr.code = NPPN_READY; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = 0; - /// - NPPN_FIRST = 1000, - /// - ///scnNotification->nmhdr.code = NPPN_READY; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = 0; - /// - NPPN_READY = NPPN_FIRST + 1, - - /// - ///scnNotification->nmhdr.code = NPPN_TB_MODIFICATION; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = 0; - /// - NPPN_TBMODIFICATION = NPPN_FIRST + 2, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEBEFORECLOSE; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILEBEFORECLOSE = NPPN_FIRST + 3, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEOPENED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILEOPENED = NPPN_FIRST + 4, - - /// - ///scnNotification->nmhdr.code = NPPN_FILECLOSED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILECLOSED = NPPN_FIRST + 5, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILEBEFOREOPEN = NPPN_FIRST + 6, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILEBEFORESAVE = NPPN_FIRST + 7, - - /// - ///scnNotification->nmhdr.code = NPPN_FILESAVED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILESAVED = NPPN_FIRST + 8, - - /// - ///scnNotification->nmhdr.code = NPPN_SHUTDOWN; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = 0; - /// - NPPN_SHUTDOWN = NPPN_FIRST + 9, - - /// - ///scnNotification->nmhdr.code = NPPN_BUFFERACTIVATED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = activatedBufferID; - /// - NPPN_BUFFERACTIVATED = NPPN_FIRST + 10, - - /// - ///scnNotification->nmhdr.code = NPPN_LANGCHANGED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = currentBufferID; - /// - NPPN_LANGCHANGED = NPPN_FIRST + 11, - - /// - ///scnNotification->nmhdr.code = NPPN_WORDSTYLESUPDATED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = currentBufferID; - /// - NPPN_WORDSTYLESUPDATED = NPPN_FIRST + 12, - - /// - ///scnNotification->nmhdr.code = NPPN_SHORTCUTSREMAPPED; - ///scnNotification->nmhdr.hwndFrom = ShortcutKeyStructurePointer; - ///scnNotification->nmhdr.idFrom = cmdID; - ///where ShortcutKeyStructurePointer is pointer of struct ShortcutKey: - ///struct ShortcutKey { - /// bool _isCtrl; - /// bool _isAlt; - /// bool _isShift; - /// UCHAR _key; - ///}; - /// - NPPN_SHORTCUTREMAPPED = NPPN_FIRST + 13, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = NULL; - /// - NPPN_FILEBEFORELOAD = NPPN_FIRST + 14, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEOPENFAILED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILELOADFAILED = NPPN_FIRST + 15, - - /// - ///scnNotification->nmhdr.code = NPPN_READONLYCHANGED; - ///scnNotification->nmhdr.hwndFrom = bufferID; - ///scnNotification->nmhdr.idFrom = docStatus; - /// where bufferID is BufferID - /// docStatus can be combined by DOCSTAUS_READONLY and DOCSTAUS_BUFFERDIRTY - /// - NPPN_READONLYCHANGED = NPPN_FIRST + 16, - - DOCSTAUS_READONLY = 1, - DOCSTAUS_BUFFERDIRTY = 2, - - /// - ///scnNotification->nmhdr.code = NPPN_DOCORDERCHANGED; - ///scnNotification->nmhdr.hwndFrom = newIndex; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_DOCORDERCHANGED = NPPN_FIRST + 17, - - /// - ///scnNotification->nmhdr.code = NPPN_SNAPSHOTDIRTYFILELOADED; - ///scnNotification->nmhdr.hwndFrom = NULL; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_SNAPSHOTDIRTYFILELOADED = NPPN_FIRST + 18, - - /// - ///scnNotification->nmhdr.code = NPPN_BEFORESHUTDOWN; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = 0; - /// - NPPN_BEFORESHUTDOWN = NPPN_FIRST + 19, - - /// - ///scnNotification->nmhdr.code = NPPN_CANCELSHUTDOWN; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = 0; - /// - NPPN_CANCELSHUTDOWN = NPPN_FIRST + 20, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEBEFORERENAME; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILEBEFORERENAME = NPPN_FIRST + 21, - - /// - ///scnNotification->nmhdr.code = NPPN_FILERENAMECANCEL; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILERENAMECANCEL = NPPN_FIRST + 22, - - /// - ///scnNotification->nmhdr.code = NPPN_FILERENAMED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILERENAMED = NPPN_FIRST + 23, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEBEFOREDELETE; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILEBEFOREDELETE = NPPN_FIRST + 24, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEDELETEFAILED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILEDELETEFAILED = NPPN_FIRST + 25, - - /// - ///scnNotification->nmhdr.code = NPPN_FILEDELETED; - ///scnNotification->nmhdr.hwndFrom = hwndNpp; - ///scnNotification->nmhdr.idFrom = BufferID; - /// - NPPN_FILEDELETED = NPPN_FIRST + 26, - - /* --Autogenerated -- end of section automatically generated from notepad-plus-plus\PowerEditor\src\MISC\PluginsManager\Notepad_plus_msgs.h * */ - } -} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/NotepadPPGateway.cs b/CSharpRegexTools4Npp/PluginInfrastructure/NotepadPPGateway.cs index 262ac9c..db6aca8 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/NotepadPPGateway.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/NotepadPPGateway.cs @@ -1,29 +1,23 @@ // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; using System.IO; using System.Runtime.InteropServices; using System.Text; +using System.Windows.Interop; +using CSharpRegexTools4Npp.PluginInfrastructure; +using CSharpRegexTools4Npp.Utils; namespace CSharpRegexTools4Npp.PluginInfrastructure { - public interface INotepadPPGateway - { - NotepadPPGateway FileNew(); - - string CurrentFileName { get; } - - unsafe string GetFilePath(int bufferId); - - NotepadPPGateway SetCurrentLanguage(LangType language); - } - /// /// This class holds helpers for sending messages defined in the Msgs_h.cs file. It is at the moment /// incomplete. Please help fill in the blanks. /// - public class NotepadPPGateway : INotepadPPGateway - { + public class NotepadPPGateway + { public IntPtr Handle { get { return PluginBase.nppData._nppHandle; } } private const int Unused = 0; @@ -33,12 +27,12 @@ IntPtr Send(NppMsg command, int wParam, NppMenuCmd lParam) return Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)command, wParam, lParam); } - IntPtr Send(NppMsg command, int wParam, int lParam) + private IntPtr Send(NppMsg command, int wParam, int lParam) { return Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)command, wParam, lParam); } - IntPtr Send(NppMsg command, IntPtr wParam, IntPtr lParam) + private IntPtr Send(NppMsg command, IntPtr wParam, IntPtr lParam) { return Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)command, wParam, lParam); } @@ -78,7 +72,6 @@ public NotepadPPGateway FileExit() Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_EXIT); return this; } - public bool OpenFile(string fileName) { bool result = false; @@ -108,53 +101,6 @@ public int GetTabIndex(string tabPath, bool smart = false) return index; } - public int GetTabIndex(string tabPath) - { - return GetTabIndex(tabPath, false); - } - - public NotepadPPGateway ShowTab(string tabPath, bool smart) - { - try - { - ShowTab(GetTabIndex(tabPath, smart)); - } - catch { } - - return this; - } - - - public NotepadPPGateway ShowTab(string tabPath) - { - try - { - ShowTab(GetTabIndex(tabPath)); - } - catch { } - - return this; - } - - public NotepadPPGateway ShowTab(int index) - { - try - { - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ACTIVATEDOC, 0, index); - } - catch { } - - return this; - } - - public int TabCount - { - get - { - return Send(NppMsg.NPPM_GETNBOPENFILES, Unused, Unused).ToInt32(); - } - } - public IntPtr GetBufferIdFromTab(int tabIndex) { return Send(NppMsg.NPPM_GETBUFFERIDFROMPOS, tabIndex, 0); @@ -217,6 +163,21 @@ public string NppBinDirectoryPath } } + public string NppBinVersion + { + get + { + try + { + return FileVersionInfo.GetVersionInfo(Path.Combine(NppBinDirectoryPath, "notepad++.exe")).FileVersion; + } + catch + { + return null; + } + } + } + /// /// Gets the path of the current document. /// @@ -271,5 +232,287 @@ public void SetPluginMenuChecked(int id, bool check) { Send(NppMsg.NPPM_SETMENUITEMCHECK, PluginBase._funcItems.Items[id]._cmdID, check ? 1 : 0); } + + public int GetTabIndex(string tabPath) + { + return GetTabIndex(tabPath, false); + } + + public NotepadPPGateway ShowTab(string tabPath, bool smart) + { + try + { + ShowTab(GetTabIndex(tabPath, smart)); + } + catch { } + + return this; + } + + + public NotepadPPGateway ShowTab(string tabPath) + { + try + { + ShowTab(GetTabIndex(tabPath)); + } + catch { } + + return this; + } + + public NotepadPPGateway ShowTab(int index) + { + try + { + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ACTIVATEDOC, 0, index); + } + catch { } + + return this; + } + + public int TabCount + { + get + { + return Send(NppMsg.NPPM_GETNBOPENFILES, Unused, Unused).ToInt32(); + } + } + + + public void AddToolbarIcon(int funcItemsIndex, ToolbarIcons icon) + { + IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(icon)); + try { + Marshal.StructureToPtr(icon, pTbIcons, false); + _ = Win32.SendMessage( + PluginBase.nppData._nppHandle, + (uint) NppMsg.NPPM_ADDTOOLBARICON, + PluginBase._funcItems.Items[funcItemsIndex]._cmdID, + pTbIcons); + } finally { + Marshal.FreeHGlobal(pTbIcons); + } + } + + public void AddToolbarIcon(int funcItemsIndex, Bitmap icon) + { + ToolbarIcons tbi = new ToolbarIcons + { + hToolbarBmp = icon.GetHbitmap() + }; + AddToolbarIcon(funcItemsIndex, tbi); + } + + /// + /// Gets the path of the current document. + /// + public string GetCurrentFilePath() + { + var path = new StringBuilder(2000); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETFULLCURRENTPATH, 0, path); + return path.ToString(); + } + + /// + /// This method incapsulates a common pattern in the Notepad++ API: when + /// you need to retrieve a string, you can first query the buffer size. + /// This method queries the necessary buffer size, allocates the temporary + /// memory, then returns the string retrieved through that buffer. + /// + /// Message ID of the data string to query. + /// String returned by Notepad++. + public string GetString(NppMsg message) + { + int len = Win32.SendMessage( + PluginBase.nppData._nppHandle, + (uint) message, Unused, Unused).ToInt32() + + 1; + var res = new StringBuilder(len); + _ = Win32.SendMessage( + PluginBase.nppData._nppHandle, (uint) message, len, res); + return res.ToString(); + } + + /// The path to the Notepad++ executable. + public string GetNppPath() + => GetString(NppMsg.NPPM_GETNPPDIRECTORY); + + /// The path to the Config folder for plugins. + public string GetPluginConfigPath() + => GetString(NppMsg.NPPM_GETPLUGINSCONFIGDIR); + + /// + /// Gets the path of the current document. + /// + public unsafe string GetFilePath(IntPtr bufferId) + { + var path = new StringBuilder(2000); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_GETFULLPATHFROMBUFFERID, bufferId, path); + return path.ToString(); + } + + public void HideDockingForm(System.Windows.Forms.Form form) + { + Win32.SendMessage(PluginBase.nppData._nppHandle, + (uint)(NppMsg.NPPM_DMMHIDE), + 0, form.Handle); + } + + public void ShowDockingForm(System.Windows.Forms.Form form) + { + Win32.SendMessage(PluginBase.nppData._nppHandle, + (uint)(NppMsg.NPPM_DMMSHOW), + 0, form.Handle); + } + + public void ShowDockingForm(System.Windows.Window window) + { + Win32.SendMessage(PluginBase.nppData._nppHandle, + (uint)(NppMsg.NPPM_DMMSHOW), + 0, new WindowInteropHelper(window).Handle); + } + + public Color GetDefaultForegroundColor() + { + var rawColor = (int)Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR, 0, 0); + return Color.FromArgb(rawColor & 0xff, (rawColor >> 8) & 0xff, (rawColor >> 16) & 0xff); + } + + public Color GetDefaultBackgroundColor() + { + var rawColor = (int)Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR, 0, 0); + return Color.FromArgb(rawColor & 0xff, (rawColor >> 8) & 0xff, (rawColor >> 16) & 0xff); + } + + /// + /// Figure out default N++ config file path

+ /// Path is usually -> .\Users\\AppData\Roaming\Notepad++\plugins\config\ + ///
+ public string GetConfigDirectory() + { + var sbIniFilePath = new StringBuilder(Win32.MAX_PATH); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath); + return sbIniFilePath.ToString(); + } + + /// + /// 3-int array: {major, minor, bugfix}

+ /// Thus GetNppVersion() would return {8, 5, 0} for version 8.5.0 + /// and {7, 7, 1} for version 7.7.1 + ///
+ /// + public int[] GetNppVersion() + { + int version = Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETNPPVERSION, 0, 0).ToInt32(); + int major = version >> 16; + int minor = Math.DivRem(version & 0xffff, 10, out int bugfix); + if (minor == 0) + (bugfix, minor) = (minor, bugfix); + return new int[] { major, minor, bugfix }; + } + + /// + /// Get all open filenames in both views (all in first view, then all in second view) + /// + /// + public string[] GetOpenFileNames() + { + var bufs = new List(); + foreach (int view in GetVisibleViews()) + { + int nbOpenFiles = (int)Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETNBOPENFILES, 0, view + 1); + for (int ii = 0; ii < nbOpenFiles; ii++) + { + IntPtr bufId = Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETBUFFERIDFROMPOS, ii, view); + bufs.Add(Npp.Notepad.GetFilePath(bufId)); + } + } + return bufs.ToArray(); + } + + public void AddModelessDialog(IntPtr formHandle) + { + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_MODELESSDIALOG, IntPtr.Zero, formHandle); + } + + public void RemoveModelessDialog(IntPtr formHandle) + { + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_MODELESSDIALOG, new IntPtr(1), formHandle); + } + + /// + /// the status bar is the bar at the bottom with the document type, EOL type, current position, line, etc.

+ /// Set the message for one of the sections of that bar. + ///
+ /// + /// + public void SetStatusBarSection(string message, StatusBarSection section) + { + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_SETSTATUSBAR, (int)section, message); + } + + public unsafe bool AllocateIndicators(int numberOfIndicators, out int[] indicators) + { + indicators = null; + if (numberOfIndicators < 1) + return false; + indicators = new int[numberOfIndicators]; + fixed (int * indicatorsPtr = indicators) + { + IntPtr success = Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ALLOCATEINDICATOR, (IntPtr)numberOfIndicators, (IntPtr)indicatorsPtr); + for (int ii = 1; ii < numberOfIndicators; ii++) + indicators[ii] = indicators[ii - 1] + 1; + return success != IntPtr.Zero; + } + } + + public unsafe bool TryGetNativeLangName(out string langName) + { + langName = ""; + int fnameLen = Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETNATIVELANGFILENAME, IntPtr.Zero, IntPtr.Zero).ToInt32() + 1; + if (fnameLen == 1) + return false; + var fnameArr = new byte[fnameLen]; + fixed (byte * fnameBuf = fnameArr) + { + IntPtr fnamePtr = (IntPtr)fnameBuf; + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETNATIVELANGFILENAME, (IntPtr)fnameLen, fnamePtr); + langName = Marshal.PtrToStringAnsi(fnamePtr); + } + if (!string.IsNullOrEmpty(langName) && langName.EndsWith(".xml")) + { + langName = langName.Substring(0, langName.Length - 4); + return true; + } + return false; + } + + public List GetVisibleViews() + { + var openViews = new List(); + for (int view = 0; view < 2; view++) + { + // NPPM_GETCURRENTDOCINDEX(0, view) returns -1 if that view is invisible + if ((int)Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETCURRENTDOCINDEX, 0, view) >= 0) + openViews.Add(view); + } + return openViews; + } } + + /// + /// This class holds helpers for sending messages defined in the Resource_h.cs file. It is at the moment + /// incomplete. Please help fill in the blanks. + /// + class NppResource + { + private const int Unused = 0; + + public void ClearIndicator() + { + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) Resource.NPPM_INTERNAL_CLEARINDICATOR, Unused, Unused); + } + } } diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/NotepadPPGateway.cs.bak b/CSharpRegexTools4Npp/PluginInfrastructure/NotepadPPGateway.cs.bak deleted file mode 100644 index 0223af9..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/NotepadPPGateway.cs.bak +++ /dev/null @@ -1,196 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -namespace CSharpRegexTools4Npp.PluginInfrastructure -{ - public interface INotepadPPGateway - { - NotepadPPGateway FileNew(); - - string CurrentFileName { get; } - - unsafe string GetFilePath(int bufferId); - - NotepadPPGateway SetCurrentLanguage(LangType language); - } - - /// - /// This class holds helpers for sending messages defined in the Msgs_h.cs file. It is at the moment - /// incomplete. Please help fill in the blanks. - /// - public class NotepadPPGateway : INotepadPPGateway - { - public IntPtr Handle { get { return PluginBase.nppData._nppHandle; } } - - private const int Unused = 0; - - IntPtr Send(NppMsg command, int wParam, NppMenuCmd lParam) - { - return Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)command, wParam, lParam); - } - - IntPtr Send(NppMsg command, IntPtr wParam, IntPtr lParam) - { - return Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)command, wParam, lParam); - } - - public NotepadPPGateway FileNew() - { - Send(NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_NEW); - return this; - } - - public NotepadPPGateway ReloadFile(string file, bool showAlert) - { - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_RELOADFILE, showAlert ? 1 : 0, file); - return this; - } - - public NotepadPPGateway SaveCurrentFile() - { - Send(NppMsg.NPPM_SAVECURRENTFILE, Unused, Unused); - return this; - } - - public NotepadPPGateway SaveAllOpenedDocuments() - { - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_SAVEALLFILES, Unused, Unused); - return this; - } - - public NotepadPPGateway FileExit() - { - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_EXIT); - return this; - } - - public bool OpenFile(string fileName) - { - bool result = false; - - try - { - if (File.Exists(fileName)) - { - result = Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_DOOPEN, 0, fileName).ToInt64() == 1; - } - } - catch { } - - return result; - } - - public NotepadPPGateway ShowOpenedDocument(string tabPath) - { - try - { - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_SWITCHTOFILE, 0, tabPath); - } - catch { } - - return this; - } - - public int TabCount - { - get - { - return Send(NppMsg.NPPM_GETNBOPENFILES, Unused, Unused).ToInt32(); - } - } - - public IntPtr GetBufferIdFromTab(int tabIndex) - { - return Send(NppMsg.NPPM_GETBUFFERIDFROMPOS, tabIndex, 0); - } - - public string GetTabFileFromPosition(int tabIndex) - { - var id = this.GetBufferIdFromTab(tabIndex); - return this.GetTabFile(id); - } - - public List GetAllOpenedDocuments - { - get - { - var count = this.TabCount; - - var files = new List(); - for (int i = 0; i < count; i++) - { - var file = this.GetTabFileFromPosition(i); - - if (!string.IsNullOrEmpty(file)) - files.Add(file); - } - return files; - } - } - - public string GetTabFile(IntPtr index) - { - var path = new StringBuilder(2000); - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETFULLPATHFROMBUFFERID, index, path); - return path.ToString(); - } - - /// - /// Gets the path of plugins directory - /// - public string PluginsConfigDirectory - { - get - { - var path = new StringBuilder(2000); - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINSCONFIGDIR, path.Capacity, path); - return path.ToString(); - } - } - - /// - /// Get the path of the directory where to find the executable of the current Notepad++ instance. - /// - public string NppBinDirectoryPath - { - get - { - var path = new StringBuilder(2000); - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETNPPDIRECTORY, path.Capacity, path); - return path.ToString(); - } - } - - /// - /// Gets the path of the current document. - /// - public string CurrentFileName - { - get - { - var path = new StringBuilder(2000); - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETFULLCURRENTPATH, path.Capacity, path); - return path.ToString(); - } - } - - /// - /// Gets the path of the current document. - /// - public unsafe string GetFilePath(int bufferId) - { - var path = new StringBuilder(2000); - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETFULLPATHFROMBUFFERID, bufferId, path); - return path.ToString(); - } - - public NotepadPPGateway SetCurrentLanguage(LangType language) - { - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int)language); - return this; - } - } -} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETBase.cs b/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETBase.cs index 3b0aaec..9138062 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETBase.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETBase.cs @@ -1,54 +1,213 @@ // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using CSharpRegexTools4Npp.Utils; namespace CSharpRegexTools4Npp.PluginInfrastructure { - public class PluginBase + class PluginBase { - public static NppData nppData; - public static FuncItems _funcItems = new FuncItems(); + internal static NppData nppData; + internal static FuncItems _funcItems = new FuncItems(); + private static List _untranslatedFuncItemNames = new List(); + public static List GetUntranslatedFuncItemNames() => _untranslatedFuncItemNames.ToList(); - public static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer) + internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer) { SetCommand(index, commandName, functionPointer, new ShortcutKey(), false); } - public static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut) + internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut) { SetCommand(index, commandName, functionPointer, shortcut, false); } - public static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, bool checkOnInit) + internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, bool checkOnInit) { SetCommand(index, commandName, functionPointer, new ShortcutKey(), checkOnInit); } - public static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut, bool checkOnInit) + internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut, bool checkOnInit) { - FuncItem funcItem = new FuncItem - { - _cmdID = index, - _itemName = commandName - }; - + FuncItem funcItem = new FuncItem(); + funcItem._cmdID = index; + funcItem._itemName = commandName; if (functionPointer != null) funcItem._pFunc = new NppFuncItemDelegate(functionPointer); if (shortcut._key != 0) funcItem._pShKey = shortcut; funcItem._init2Check = checkOnInit; + _untranslatedFuncItemNames.Add(commandName); _funcItems.Add(funcItem); } - public static IntPtr GetCurrentScintilla() + /// + /// if a menu item (for your plugin's drop-down menu) has a checkmark, check/uncheck it, and call its associated funcId. + /// + /// the index of the menu item of interest + /// whether the menu item should be checked + public static void CheckMenuItem(int funcId, bool isChecked) + { + Win32.CheckMenuItem( + Win32.GetMenu(nppData._nppHandle), + PluginBase._funcItems.Items[funcId]._cmdID, + Win32.MF_BYCOMMAND | (isChecked ? Win32.MF_CHECKED : Win32.MF_UNCHECKED)); + } + + //private static IntPtr GetThisPluginMenuHandle() + //{ + // IntPtr mainMenuHandle = Win32.GetMenu(nppData._nppHandle); + // int pluginMenuIndex = 10; + // IntPtr allPluginsMenuHandle = Win32.GetSubMenu(mainMenuHandle, pluginMenuIndex); + // int itemCount = Win32.GetMenuItemCount(allPluginsMenuHandle); + // if (itemCount < 0) + // return IntPtr.Zero; + // for (int ii = 0; ii < itemCount; ii++) + // { + // var mii = new Win32.MenuItemInfo(Win32.MenuItemMask.MIIM_STRING | Win32.MenuItemMask.MIIM_SUBMENU); + // mii.cch = + // } + //} + + private static IntPtr MenuItemInfoToHGlobal(Win32.MenuItemInfo mii) + { + IntPtr miiPtr = Marshal.AllocHGlobal((int)mii.cbSize); + Marshal.StructureToPtr(mii, miiPtr, false); + return miiPtr; + } + + private static bool SetMenuItemText(IntPtr hMenu, int index, string newText) + { + if (index >= _funcItems.Items.Count || index < 0 || newText is null) + return false; + var mii = new Win32.MenuItemInfo(Win32.MenuItemMask.MIIM_STRING | Win32.MenuItemMask.MIIM_FTYPE); + IntPtr newTextPtr = Marshal.StringToHGlobalAnsi(newText); + mii.dwTypeData = newTextPtr; + IntPtr miiPtr = MenuItemInfoToHGlobal(mii); + bool res = Win32.SetMenuItemInfo(hMenu, (uint)index, true, miiPtr); + Marshal.FreeHGlobal(miiPtr); + Marshal.FreeHGlobal(newTextPtr); + return res; + } + + private static unsafe bool TryGetMenuItemText(IntPtr hMenu, int index, out string str) + { + str = null; + if (index < 0) // we assume the user has already checked the menu item count using Win32.GetMenuItemCount(hMenu) + return false; + var mii = new Win32.MenuItemInfo(Win32.MenuItemMask.MIIM_STRING | Win32.MenuItemMask.MIIM_STATE); + IntPtr miiPtr = MenuItemInfoToHGlobal(mii); + if (Win32.GetMenuItemInfo(hMenu, (uint)index, true, miiPtr)) + { + mii = (Win32.MenuItemInfo)Marshal.PtrToStructure(miiPtr, typeof(Win32.MenuItemInfo)); + mii.cch++; + byte[] textBuffer = new byte[mii.cch]; + fixed (byte * textPtr = textBuffer) + { + IntPtr textPtrSafe = (IntPtr)textPtr; + mii.dwTypeData = textPtrSafe; + Marshal.StructureToPtr(mii, miiPtr, true); + Win32.GetMenuItemInfo(hMenu, (uint)index, true, miiPtr); + str = Marshal.PtrToStringAnsi(textPtrSafe); + } + } + Marshal.FreeHGlobal(miiPtr); + return !(str is null); + } + + private static unsafe bool TryGetSubMenuWithName(IntPtr hMenu, string subMenuName, out IntPtr hSubMenu, out int idSubMenu) + { + idSubMenu = -1; + hSubMenu = IntPtr.Zero; + int itemCount = Win32.GetMenuItemCount(hMenu); + if (itemCount < 0) + return false; + for (int ii = 0; ii < itemCount; ii++) + { + if (!TryGetMenuItemText(hMenu, ii, out string menuItemName)) + return false; + if (menuItemName == subMenuName) + { + idSubMenu = ii; + hSubMenu = Win32.GetSubMenu(hMenu, ii); + return true; + } + } + return false; + } + + private static IntPtr _allPluginsMenuHandle = IntPtr.Zero; + private static int _thisPluginIdxInAllPluginsMenu = -1; + private static IntPtr _thisPluginMenuHandle = IntPtr.Zero; + + /// + /// If allPluginsMenuHandle is a valid menu handle, and this plugin's name is the name of one of the submenus of allPluginsMenuHandle,

+ /// set _allPluginsMenuHandle to allPluginsMenuHandle, and set _thisPluginMenuHandle to the handle of the submenu with the same name as this plugin. + ///
+ /// the menu handle to the Plugins submenu of the Notepad++ main menu + /// + private static unsafe bool TrySetPluginsMenuHandle(IntPtr allPluginsMenuHandle) + { + if (_thisPluginMenuHandle != IntPtr.Zero && _allPluginsMenuHandle != IntPtr.Zero && _thisPluginIdxInAllPluginsMenu >= 0 + && TryGetMenuItemText(_allPluginsMenuHandle, _thisPluginIdxInAllPluginsMenu, out string pluginName) + && pluginName == Main.PluginName) + { + return true; + } + if (!TryGetSubMenuWithName(allPluginsMenuHandle, Main.PluginName, out _thisPluginMenuHandle, out _thisPluginIdxInAllPluginsMenu)) + return false; + _allPluginsMenuHandle = allPluginsMenuHandle; + return true; + } + + /// + /// attempt to change the names of this plugin's menu items to newNames, assuming that allPluginsMenuHandle is the handle of the Plugins submenu of the Notepad++ main menu.

+ /// Returns true if and only if all the menu items could be renamed. + ///
+ /// + /// + /// + public static bool ChangePluginMenuItemNames(IntPtr allPluginsMenuHandle, List newNames) + { + if (newNames.Count != _funcItems.Items.Count || !TrySetPluginsMenuHandle(allPluginsMenuHandle)) + return false; + for (int ii = 0; ii < newNames.Count; ii++) + { + string newName = newNames[ii]; + if (newName != "---" && !SetMenuItemText(_thisPluginMenuHandle, ii, newName)) + return false; + } + return true; + } + + /// + /// if a menu item (for your plugin's drop-down menu) has a checkmark:

+ /// - if it's checked, uncheck it

+ /// - if it's unchecked, check it. + /// Either way, call its associated funcId. + ///
+ /// the index of the menu item of interest + /// whether the menu item is currently checked + internal static void CheckMenuItemToggle(int funcId, ref bool isCurrentlyChecked) + { + // toggle value + isCurrentlyChecked = !isCurrentlyChecked; + CheckMenuItem(funcId, isCurrentlyChecked); + } + + internal static IntPtr GetCurrentScintilla() { - Win32.SendMessage(nppData._nppHandle, (uint)NppMsg.NPPM_GETCURRENTSCINTILLA, 0, out int curScintilla); + int curScintilla; + Win32.SendMessage(nppData._nppHandle, (uint) NppMsg.NPPM_GETCURRENTSCINTILLA, 0, out curScintilla); return (curScintilla == 0) ? nppData._scintillaMainHandle : nppData._scintillaSecondHandle; } - public static readonly Func gatewayFactory = () => new ScintillaGateway(GetCurrentScintilla()); + static readonly Func gatewayFactory = () => new ScintillaGateway(GetCurrentScintilla()); - public static Func GetGatewayFactory() + public static Func GetGatewayFactory() { return gatewayFactory; } diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETHelper.cs b/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETHelper.cs index 5d159b4..640b6b6 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETHelper.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETHelper.cs @@ -4,7 +4,6 @@ using System.Windows.Forms; using System.Collections.Generic; using System.Runtime.InteropServices; -using System.Linq; namespace CSharpRegexTools4Npp.PluginInfrastructure { @@ -21,17 +20,6 @@ public struct NppData [StructLayout(LayoutKind.Sequential)] public struct ShortcutKey { - public ShortcutKey(string data) - { - //Ctrl+Shift+Alt+Key - var parts = data.Split('+'); - _key = Convert.ToByte(Enum.Parse(typeof(Keys), parts.Last())); - parts = parts.Take(parts.Length - 1).ToArray(); - _isCtrl = Convert.ToByte(parts.Contains("Ctrl")); - _isShift = Convert.ToByte(parts.Contains("Shift")); - _isAlt = Convert.ToByte(parts.Contains("Alt")); - } - public ShortcutKey(bool isCtrl, bool isAlt, bool isShift, Keys key) { // the types 'bool' and 'char' have a size of 1 byte only! @@ -40,18 +28,6 @@ public ShortcutKey(bool isCtrl, bool isAlt, bool isShift, Keys key) _isShift = Convert.ToByte(isShift); _key = Convert.ToByte(key); } - - public bool IsCtrl { get { return _isCtrl != 0; } } - public bool IsShift { get { return _isShift != 0; } } - public bool IsAlt { get { return _isAlt != 0; } } - public Keys Key { get { return (Keys)_key; } } - public string AsText { get => Key == Keys.None ? null : (IsCtrl ? "Ctrl+" : string.Empty) + (IsAlt ? "Alt+" : string.Empty) + (IsShift ? "Shift+" : string.Empty) + Key.ToString(); } - - public override string ToString() - { - return AsText; - } - public byte _isCtrl; public byte _isAlt; public byte _isShift; @@ -61,7 +37,13 @@ public override string ToString() [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct FuncItem { - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + /// + /// The maximum number of UTF-16 characters in a FuncItem name.

+ /// This is one less than the number listed the relevant code, because that is the length of a C string + ///
+ public const int MAX_FUNC_ITEM_NAME_LENGTH = 63; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_FUNC_ITEM_NAME_LENGTH + 1)] // +1 for terminating nul char public string _itemName; public NppFuncItemDelegate _pFunc; public int _cmdID; @@ -148,13 +130,9 @@ public void Dispose() { if (!_disposed) { + foreach (IntPtr ptr in _shortCutKeys) Marshal.FreeHGlobal(ptr); + if (_nativePointer != IntPtr.Zero) Marshal.FreeHGlobal(_nativePointer); _disposed = true; - try - { - foreach (IntPtr ptr in _shortCutKeys) Marshal.FreeHGlobal(ptr); - if (_nativePointer != IntPtr.Zero) Marshal.FreeHGlobal(_nativePointer); - } - catch { } } } ~FuncItems() @@ -175,45 +153,49 @@ public enum winVer public enum DockMgrMsg : uint { IDB_CLOSE_DOWN = 137, - IDB_CLOSE_UP = 138, - IDD_CONTAINER_DLG = 139, - - IDC_TAB_CONT = 1027, - IDC_CLIENT_TAB = 1028, - IDC_BTN_CAPTION = 1050, - - DMM_MSG = 0x5000, - DMM_CLOSE = (DMM_MSG + 1), - DMM_DOCK = (DMM_MSG + 2), - DMM_FLOAT = (DMM_MSG + 3), - DMM_DOCKALL = (DMM_MSG + 4), - DMM_FLOATALL = (DMM_MSG + 5), - DMM_MOVE = (DMM_MSG + 6), - DMM_UPDATEDISPINFO = (DMM_MSG + 7), - DMM_GETIMAGELIST = (DMM_MSG + 8), - DMM_GETICONPOS = (DMM_MSG + 9), - DMM_DROPDATA = (DMM_MSG + 10), - DMM_MOVE_SPLITTER = (DMM_MSG + 11), - DMM_CANCEL_MOVE = (DMM_MSG + 12), - DMM_LBUTTONUP = (DMM_MSG + 13), + IDB_CLOSE_UP = 138, + IDD_CONTAINER_DLG = 139, + + IDC_TAB_CONT = 1027, + IDC_CLIENT_TAB = 1028, + IDC_BTN_CAPTION = 1050, + + DMM_MSG = 0x5000, + DMM_CLOSE = (DMM_MSG + 1), + DMM_DOCK = (DMM_MSG + 2), + DMM_FLOAT = (DMM_MSG + 3), + DMM_DOCKALL = (DMM_MSG + 4), + DMM_FLOATALL = (DMM_MSG + 5), + DMM_MOVE = (DMM_MSG + 6), + DMM_UPDATEDISPINFO = (DMM_MSG + 7), + DMM_GETIMAGELIST = (DMM_MSG + 8), + DMM_GETICONPOS = (DMM_MSG + 9), + DMM_DROPDATA = (DMM_MSG + 10), + DMM_MOVE_SPLITTER = (DMM_MSG + 11), + DMM_CANCEL_MOVE = (DMM_MSG + 12), + DMM_LBUTTONUP = (DMM_MSG + 13), DMN_FIRST = 1050, - DMN_CLOSE = (DMN_FIRST + 1), - //nmhdr.Code = DWORD(DMN_CLOSE, 0)); - //nmhdr.hwndFrom = hwndNpp; - //nmhdr.IdFrom = ctrlIdNpp; - - DMN_DOCK = (DMN_FIRST + 2), - DMN_FLOAT = (DMN_FIRST + 3) + DMN_CLOSE = (DMN_FIRST + 1), + //nmhdr.Code = DWORD(DMN_CLOSE, 0)); + //nmhdr.hwndFrom = hwndNpp; + //nmhdr.IdFrom = ctrlIdNpp; + + DMN_DOCK = (DMN_FIRST + 2), + DMN_FLOAT = (DMN_FIRST + 3), + DMN_SWITCHIN = (DMN_FIRST + 4), + DMN_SWITCHOFF = (DMN_FIRST + 5), + DMN_FLOATDROPPED = (DMN_FIRST + 6), //nmhdr.Code = DWORD(DMN_XXX, int newContainer); //nmhdr.hwndFrom = hwndNpp; //nmhdr.IdFrom = ctrlIdNpp; } [StructLayout(LayoutKind.Sequential)] - public struct toolbarIcons + public struct ToolbarIcons { - public IntPtr hToolbarBmp; - public IntPtr hToolbarIcon; + public IntPtr hToolbarBmp; // standard icon (color) + public IntPtr hToolbarIcon; // Fluent UI icon (black) + public IntPtr hToolbarIconDarkMode; // Fluent UI icon (white) } } diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETHelper.cs.bak b/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETHelper.cs.bak deleted file mode 100644 index 3e40499..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETHelper.cs.bak +++ /dev/null @@ -1,213 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -using System; -using System.Text; -using System.Windows.Forms; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Linq; - -namespace CSharpRegexTools4Npp.PluginInfrastructure -{ - [StructLayout(LayoutKind.Sequential)] - public struct NppData - { - public IntPtr _nppHandle; - public IntPtr _scintillaMainHandle; - public IntPtr _scintillaSecondHandle; - } - - public delegate void NppFuncItemDelegate(); - - [StructLayout(LayoutKind.Sequential)] - public struct ShortcutKey - { - public ShortcutKey(string data) - { - //Ctrl+Shift+Alt+Key - var parts = data.Split('+'); - _key = Convert.ToByte(Enum.Parse(typeof(Keys), parts.Last())); - parts = parts.Take(parts.Length - 1).ToArray(); - _isCtrl = Convert.ToByte(parts.Contains("Ctrl")); - _isShift = Convert.ToByte(parts.Contains("Shift")); - _isAlt = Convert.ToByte(parts.Contains("Alt")); - } - - public ShortcutKey(bool isCtrl, bool isAlt, bool isShift, Keys key) - { - // the types 'bool' and 'char' have a size of 1 byte only! - _isCtrl = Convert.ToByte(isCtrl); - _isAlt = Convert.ToByte(isAlt); - _isShift = Convert.ToByte(isShift); - _key = Convert.ToByte(key); - } - - public bool IsCtrl { get { return _isCtrl != 0; } } - public bool IsShift { get { return _isShift != 0; } } - public bool IsAlt { get { return _isAlt != 0; } } - public Keys Key { get { return (Keys)_key; } } - - public byte _isCtrl; - public byte _isAlt; - public byte _isShift; - public byte _key; - } - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct FuncItem - { - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string _itemName; - public NppFuncItemDelegate _pFunc; - public int _cmdID; - public bool _init2Check; - public ShortcutKey _pShKey; - } - - public class FuncItems : IDisposable - { - List _funcItems; - int _sizeFuncItem; - List _shortCutKeys; - IntPtr _nativePointer; - bool _disposed = false; - - public FuncItems() - { - _funcItems = new List(); - _sizeFuncItem = Marshal.SizeOf(typeof(FuncItem)); - _shortCutKeys = new List(); - } - - [DllImport("kernel32")] - static extern void RtlMoveMemory(IntPtr Destination, IntPtr Source, int Length); - public void Add(FuncItem funcItem) - { - int oldSize = _funcItems.Count * _sizeFuncItem; - _funcItems.Add(funcItem); - int newSize = _funcItems.Count * _sizeFuncItem; - IntPtr newPointer = Marshal.AllocHGlobal(newSize); - - if (_nativePointer != IntPtr.Zero) - { - RtlMoveMemory(newPointer, _nativePointer, oldSize); - Marshal.FreeHGlobal(_nativePointer); - } - IntPtr ptrPosNewItem = (IntPtr)(newPointer.ToInt64() + oldSize); - byte[] aB = Encoding.Unicode.GetBytes(funcItem._itemName + "\0"); - Marshal.Copy(aB, 0, ptrPosNewItem, aB.Length); - ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 128); - IntPtr p = (funcItem._pFunc != null) ? Marshal.GetFunctionPointerForDelegate(funcItem._pFunc) : IntPtr.Zero; - Marshal.WriteIntPtr(ptrPosNewItem, p); - ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + IntPtr.Size); - Marshal.WriteInt32(ptrPosNewItem, funcItem._cmdID); - ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 4); - Marshal.WriteInt32(ptrPosNewItem, Convert.ToInt32(funcItem._init2Check)); - ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 4); - if (funcItem._pShKey._key != 0) - { - IntPtr newShortCutKey = Marshal.AllocHGlobal(4); - Marshal.StructureToPtr(funcItem._pShKey, newShortCutKey, false); - Marshal.WriteIntPtr(ptrPosNewItem, newShortCutKey); - } - else Marshal.WriteIntPtr(ptrPosNewItem, IntPtr.Zero); - - _nativePointer = newPointer; - } - - public void RefreshItems() - { - IntPtr ptrPosItem = _nativePointer; - for (int i = 0; i < _funcItems.Count; i++) - { - FuncItem updatedItem = new FuncItem(); - updatedItem._itemName = _funcItems[i]._itemName; - ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 128); - updatedItem._pFunc = _funcItems[i]._pFunc; - ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + IntPtr.Size); - updatedItem._cmdID = Marshal.ReadInt32(ptrPosItem); - ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 4); - updatedItem._init2Check = _funcItems[i]._init2Check; - ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 4); - updatedItem._pShKey = _funcItems[i]._pShKey; - ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + IntPtr.Size); - - _funcItems[i] = updatedItem; - } - } - - public IntPtr NativePointer { get { return _nativePointer; } } - public List Items { get { return _funcItems; } } - - public void Dispose() - { - if (!_disposed) - { - _disposed = true; - try - { - foreach (IntPtr ptr in _shortCutKeys) Marshal.FreeHGlobal(ptr); - if (_nativePointer != IntPtr.Zero) Marshal.FreeHGlobal(_nativePointer); - } - catch { } - } - } - ~FuncItems() - { - Dispose(); - } - } - - - public enum winVer - { - WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, - WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10 - } - - - [Flags] - public enum DockMgrMsg : uint - { - IDB_CLOSE_DOWN = 137, - IDB_CLOSE_UP = 138, - IDD_CONTAINER_DLG = 139, - - IDC_TAB_CONT = 1027, - IDC_CLIENT_TAB = 1028, - IDC_BTN_CAPTION = 1050, - - DMM_MSG = 0x5000, - DMM_CLOSE = (DMM_MSG + 1), - DMM_DOCK = (DMM_MSG + 2), - DMM_FLOAT = (DMM_MSG + 3), - DMM_DOCKALL = (DMM_MSG + 4), - DMM_FLOATALL = (DMM_MSG + 5), - DMM_MOVE = (DMM_MSG + 6), - DMM_UPDATEDISPINFO = (DMM_MSG + 7), - DMM_GETIMAGELIST = (DMM_MSG + 8), - DMM_GETICONPOS = (DMM_MSG + 9), - DMM_DROPDATA = (DMM_MSG + 10), - DMM_MOVE_SPLITTER = (DMM_MSG + 11), - DMM_CANCEL_MOVE = (DMM_MSG + 12), - DMM_LBUTTONUP = (DMM_MSG + 13), - - DMN_FIRST = 1050, - DMN_CLOSE = (DMN_FIRST + 1), - //nmhdr.Code = DWORD(DMN_CLOSE, 0)); - //nmhdr.hwndFrom = hwndNpp; - //nmhdr.IdFrom = ctrlIdNpp; - - DMN_DOCK = (DMN_FIRST + 2), - DMN_FLOAT = (DMN_FIRST + 3) - //nmhdr.Code = DWORD(DMN_XXX, int newContainer); - //nmhdr.hwndFrom = hwndNpp; - //nmhdr.IdFrom = ctrlIdNpp; - } - - [StructLayout(LayoutKind.Sequential)] - public struct toolbarIcons - { - public IntPtr hToolbarBmp; - public IntPtr hToolbarIcon; - } -} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/Preference_h.cs b/CSharpRegexTools4Npp/PluginInfrastructure/Preference_h.cs index 5282016..3010618 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/Preference_h.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/Preference_h.cs @@ -4,16 +4,12 @@ // "notepad-plus-plus/scintilla/include/Scintilla.iface" // found at // https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.iface -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -namespace NppPluginNET.PluginInfrastructure +namespace CSharpRegexTools4Npp.PluginInfrastructure { - public enum Preference - { - /* ++Autogenerated -- start of section automatically generated from preference_rc.h */ + public enum Preference + { + /* ++Autogenerated -- start of section automatically generated from preference_rc.h */ IDD_PREFERENCE_BOX = 6000, IDC_BUTTON_CLOSE = IDD_PREFERENCE_BOX + 1, @@ -41,7 +37,7 @@ public enum Preference IDC_CHECK_TAB_HIDE = IDD_PREFERENCE_BAR_BOX + 18, IDC_CHECK_TAB_MULTILINE = IDD_PREFERENCE_BAR_BOX + 19, IDC_CHECK_TAB_VERTICAL = IDD_PREFERENCE_BAR_BOX + 20, - + IDC_CHECK_TAB_LAST_EXIT = IDD_PREFERENCE_BAR_BOX + 21, IDC_CHECK_HIDEMENUBAR = IDD_PREFERENCE_BAR_BOX + 22, IDC_LOCALIZATION_GB_STATIC = IDD_PREFERENCE_BAR_BOX + 23, IDC_COMBO_LOCALIZATION = IDD_PREFERENCE_BAR_BOX + 24, @@ -56,6 +52,14 @@ public enum Preference IDC_MONOINST_RADIO = IDD_PREFERENCE_MULTIINSTANCE_BOX + 4, IDD_STATIC_RESTARTNOTE = IDD_PREFERENCE_MULTIINSTANCE_BOX + 5, + IDD_PREFERENCE_WORDCHARLIST_BOX = 6160, + IDC_WORDCHARLIST_GB_STATIC = IDD_PREFERENCE_WORDCHARLIST_BOX + 1, + IDC_RADIO_WORDCHAR_DEFAULT = IDD_PREFERENCE_WORDCHARLIST_BOX + 2, + IDC_RADIO_WORDCHAR_CUSTOM = IDD_PREFERENCE_WORDCHARLIST_BOX + 3, + IDC_WORDCHAR_CUSTOM_EDIT = IDD_PREFERENCE_WORDCHARLIST_BOX + 4, + IDD_WORDCHAR_QUESTION_BUTTON = IDD_PREFERENCE_WORDCHARLIST_BOX + 5, + IDD_STATIC_WORDCHAR_WARNING = IDD_PREFERENCE_WORDCHARLIST_BOX + 6, + IDD_PREFERENCE_MARGEIN_BOX = 6200, IDC_FMS_GB_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 1, IDC_RADIO_SIMPLE = IDD_PREFERENCE_MARGEIN_BOX + 2, @@ -66,13 +70,9 @@ public enum Preference IDC_CHECK_LINENUMBERMARGE = IDD_PREFERENCE_MARGEIN_BOX + 6, IDC_CHECK_BOOKMARKMARGE = IDD_PREFERENCE_MARGEIN_BOX + 7, - IDC_CHECK_SHOWVERTICALEDGE = IDD_PREFERENCE_MARGEIN_BOX + 8, - IDC_NBCOLONE_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 9, - IDC_COLONENUMBER_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 10, - IDC_VES_GB_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 11, - IDC_RADIO_LNMODE = IDD_PREFERENCE_MARGEIN_BOX + 12, - IDC_RADIO_BGMODE = IDD_PREFERENCE_MARGEIN_BOX + 13, + + IDC_CHECK_EDGEBGMODE = IDD_PREFERENCE_MARGEIN_BOX + 13, IDC_CHECK_CURRENTLINEHILITE = IDD_PREFERENCE_MARGEIN_BOX + 14, IDC_CHECK_SMOOTHFONT = IDD_PREFERENCE_MARGEIN_BOX + 15, @@ -99,6 +99,11 @@ public enum Preference IDC_BORDERWIDTH_SLIDER = IDD_PREFERENCE_MARGEIN_BOX + 33, IDC_CHECK_DISABLEADVANCEDSCROLL = IDD_PREFERENCE_MARGEIN_BOX + 34, IDC_CHECK_NOEDGE = IDD_PREFERENCE_MARGEIN_BOX + 35, + IDC_CHECK_SCROLLBEYONDLASTLINE = IDD_PREFERENCE_MARGEIN_BOX + 36, + + IDC_STATIC_MULTILNMODE_TIP = IDD_PREFERENCE_MARGEIN_BOX + 37, + IDC_COLUMNPOS_EDIT = IDD_PREFERENCE_MARGEIN_BOX + 38, + IDC_CHECK_RIGHTCLICKKEEPSSELECTION = IDD_PREFERENCE_MARGEIN_BOX + 39, IDD_PREFERENCE_DELIMITERSETTINGS_BOX = 6250, IDC_DELIMITERSETTINGS_GB_STATIC = IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 1, @@ -119,6 +124,17 @@ public enum Preference IDC_CLOUDPATH_EDIT = IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 8, IDD_CLOUDPATH_BROWSE_BUTTON = IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 9, + IDD_PREFERENCE_SEARCHENGINE_BOX = 6270, + IDC_SEARCHENGINES_GB_STATIC = IDD_PREFERENCE_SEARCHENGINE_BOX + 1, + IDC_SEARCHENGINE_DUCKDUCKGO_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 2, + IDC_SEARCHENGINE_GOOGLE_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 3, + IDC_SEARCHENGINE_BING_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 4, + IDC_SEARCHENGINE_YAHOO_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 5, + IDC_SEARCHENGINE_CUSTOM_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 6, + IDC_SEARCHENGINE_EDIT = IDD_PREFERENCE_SEARCHENGINE_BOX + 7, + IDD_SEARCHENGINE_NOTE_STATIC = IDD_PREFERENCE_SEARCHENGINE_BOX + 8, + IDC_SEARCHENGINE_STACKOVERFLOW_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 9, + IDD_PREFERENCE_SETTING_BOX = 6300, IDC_TABSETTING_GB_STATIC = IDD_PREFERENCE_SETTING_BOX + 1, IDC_CHECK_REPLACEBYSPACE = IDD_PREFERENCE_SETTING_BOX + 2, @@ -126,14 +142,12 @@ public enum Preference IDC_HISTORY_GB_STATIC = IDD_PREFERENCE_SETTING_BOX + 4, IDC_CHECK_DONTCHECKHISTORY = IDD_PREFERENCE_SETTING_BOX + 5, IDC_MAXNBFILE_STATIC = IDD_PREFERENCE_SETTING_BOX + 6, - IDC_CHECK_FILEAUTODETECTION = IDD_PREFERENCE_SETTING_BOX + 7, IDC_CHECK_MIN2SYSTRAY = IDD_PREFERENCE_SETTING_BOX + 8, IDC_CHECK_REMEMBERSESSION = IDD_PREFERENCE_SETTING_BOX + 9, IDC_TABSIZEVAL_STATIC = IDD_PREFERENCE_SETTING_BOX + 10, IDC_MAXNBFILEVAL_STATIC = IDD_PREFERENCE_SETTING_BOX + 11, IDC_FILEAUTODETECTION_STATIC = IDD_PREFERENCE_SETTING_BOX + 12, IDC_CHECK_UPDATESILENTLY = IDD_PREFERENCE_SETTING_BOX + 13, - IDC_RADIO_BKNONE = IDD_PREFERENCE_SETTING_BOX + 15, IDC_RADIO_BKSIMPLE = IDD_PREFERENCE_SETTING_BOX + 16, IDC_RADIO_BKVERBOSE = IDD_PREFERENCE_SETTING_BOX + 17, @@ -157,11 +171,19 @@ public enum Preference IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL = IDD_PREFERENCE_SETTING_BOX + 35, IDC_EDIT_WORKSPACEFILEEXT = IDD_PREFERENCE_SETTING_BOX + 36, IDC_WORKSPACEFILEEXT_STATIC = IDD_PREFERENCE_SETTING_BOX + 37, + IDC_CHECK_SMARTHILITEWHOLEWORDONLY = IDD_PREFERENCE_SETTING_BOX + 38, + IDC_CHECK_SMARTHILITEUSEFINDSETTINGS = IDD_PREFERENCE_SETTING_BOX + 39, + IDC_CHECK_SMARTHILITEANOTHERRVIEW = IDD_PREFERENCE_SETTING_BOX + 40, - IDC_PREFERENCE_OFFSET_FLS = 40, - IDC_CHECK_REMEMBEREDITVIEWPERFILE = IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 1, - IDC_REMEMBEREDITVIEWPERFILE_STATIC = IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 2, - IDC_EDIT_REMEMBEREDITVIEWPERFILE = IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 3, + IDC_CHECK_REMEMBEREDITVIEWPERFILE = IDD_PREFERENCE_SETTING_BOX + 41, + IDC_REMEMBEREDITVIEWPERFILE_STATIC = IDD_PREFERENCE_SETTING_BOX + 42, + IDC_EDIT_REMEMBEREDITVIEWPERFILE = IDD_PREFERENCE_SETTING_BOX + 43, + + IDC_DOCUMENTPEEK_STATIC = IDD_PREFERENCE_SETTING_BOX + 44, + IDC_CHECK_ENABLEDOCPEEKER = IDD_PREFERENCE_SETTING_BOX + 45, + IDC_CHECK_ENABLEDOCPEEKONMAP = IDD_PREFERENCE_SETTING_BOX + 46, + IDC_COMBO_FILEUPDATECHOICE = IDD_PREFERENCE_SETTING_BOX + 47, + IDC_CHECK_DIRECTWRITE_ENABLE = IDD_PREFERENCE_SETTING_BOX + 49, IDD_PREFERENCE_NEWDOCSETTING_BOX = 6400, IDC_FORMAT_GB_STATIC = IDD_PREFERENCE_NEWDOCSETTING_BOX + 1, @@ -194,6 +216,7 @@ public enum Preference IDC_CUSTOMIZELENGTHVAL_STATIC = IDD_PREFERENCE_NEWDOCSETTING_BOX + 28, IDC_DISPLAY_STATIC = IDD_PREFERENCE_NEWDOCSETTING_BOX + 29, IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG = IDD_PREFERENCE_NEWDOCSETTING_BOX + 30, + IDC_OPENSAVEDIR_CHECK_DRROPFOLDEROPENFILES = IDD_PREFERENCE_NEWDOCSETTING_BOX + 31, IDD_PREFERENCE_DEFAULTDIRECTORY_BOX = 6450, IDD_PREFERENCE_RECENTFILESHISTORY_BOX = 6460, @@ -211,7 +234,7 @@ public enum Preference IDC_CHECK_DEFAULTTABVALUE = IDD_PREFERENCE_LANG_BOX + 10, IDC_GR_TABVALUE_STATIC = IDD_PREFERENCE_LANG_BOX + 11, IDC_TABSIZEVAL_DISABLE_STATIC = IDD_PREFERENCE_LANG_BOX + 12, - IDD_PREFERENCE_TABSETTINGS_BOX = 6550, + IDD_PREFERENCE_HILITE_BOX = 6550, IDD_PREFERENCE_PRINT_BOX = 6600, IDC_CHECK_PRINTLINENUM = IDD_PREFERENCE_PRINT_BOX + 1, @@ -284,6 +307,7 @@ public enum Preference IDD_BACKUPDIR_RESTORESESSION_STATIC2 = IDD_PREFERENCE_BACKUP_BOX + 21, IDD_BACKUPDIR_RESTORESESSION_PATHLABEL_STATIC = IDD_PREFERENCE_BACKUP_BOX + 22, IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT = IDD_PREFERENCE_BACKUP_BOX + 23, + IDD_AUTOC_IGNORENUMBERS = IDD_PREFERENCE_BACKUP_BOX + 24, IDD_PREFERENCE_AUTOCOMPLETION_BOX = 6850, IDD_AUTOCINSERT_GRPSTATIC = IDD_PREFERENCE_AUTOCOMPLETION_BOX + 1, @@ -305,6 +329,10 @@ public enum Preference IDC_MACHEDPAIROPEN_EDIT3 = IDD_PREFERENCE_AUTOCOMPLETION_BOX + 17, IDC_MACHEDPAIRCLOSE_EDIT3 = IDD_PREFERENCE_AUTOCOMPLETION_BOX + 18, - /* --Autogenerated -- end of section automatically generated from preference_rc.h */ - } + IDD_PREFERENCE_SEARCHINGSETTINGS_BOX = 6900, + IDC_CHECK_STOPFILLINGFINDFIELD = IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 1, + IDC_CHECK_MONOSPACEDFONT_FINDDLG = IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 2, + + /* --Autogenerated -- end of section automatically generated from preference_rc.h */ + } } diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/Resource_h.cs b/CSharpRegexTools4Npp/PluginInfrastructure/Resource_h.cs index 3d59cdf..6edbc92 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/Resource_h.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/Resource_h.cs @@ -4,12 +4,13 @@ // "notepad-plus-plus/scintilla/include/Scintilla.iface" // found at // https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.iface +using CSharpRegexTools4Npp.PluginInfrastructure; namespace CSharpRegexTools4Npp.PluginInfrastructure { - public enum Resource - { - /* ++Autogenerated -- start of section automatically generated from resource.h */ + public enum Resource + { + /* ++Autogenerated -- start of section automatically generated from resource.h */ IDC_STATIC = -1, @@ -99,6 +100,7 @@ public enum Resource IDI_UNSAVED_ICON = 502, IDI_READONLY_ICON = 503, IDI_FIND_RESULT_ICON = 504, + IDI_MONITORING_ICON = 505, IDI_PROJECT_WORKSPACE = 601, IDI_PROJECT_WORKSPACEDIRTY = 602, @@ -109,6 +111,9 @@ public enum Resource IDI_PROJECT_FILEINVALID = 607, IDI_FB_ROOTOPEN = 608, IDI_FB_ROOTCLOSE = 609, + IDI_FB_SELECTCURRENTFILE = 610, + IDI_FB_FOLDALL = 611, + IDI_FB_EXPANDALL = 612, IDI_FUNCLIST_ROOT = 620, IDI_FUNCLIST_NODE = 621, @@ -117,6 +122,15 @@ public enum Resource IDI_FUNCLIST_SORTBUTTON = 631, IDI_FUNCLIST_RELOADBUTTON = 632, + IDI_VIEW_DOC_MAP_ON_ICON = 633, + IDI_VIEW_DOC_MAP_OFF_ICON = 634, + IDI_VIEW_FILEBROWSER_ON_ICON = 635, + IDI_VIEW_FILEBROWSER_OFF_ICON = 636, + IDI_VIEW_FUNCLIST_ON_ICON = 637, + IDI_VIEW_FUNCLIST_OFF_ICON = 638, + IDI_VIEW_MONITORING_ON_ICON = 639, + IDI_VIEW_MONITORING_OFF_ICON = 640, + IDC_MY_CUR = 1402, IDC_UP_ARROW = 1403, IDC_DRAG_TAB = 1404, @@ -160,7 +174,6 @@ public enum Resource IDR_CLOSETAB_INACT = 1531, IDR_CLOSETAB_HOVER = 1532, IDR_CLOSETAB_PUSH = 1533, - IDR_FUNC_LIST_ICO = 1534, IDR_DOCMAP_ICO = 1535, IDR_PROJECTPANEL_ICO = 1536, @@ -168,6 +181,8 @@ public enum Resource IDR_ASCIIPANEL_ICO = 1538, IDR_DOCSWITCHER_ICO = 1539, IDR_FILEBROWSER_ICO = 1540, + IDR_FILEMONITORING = 1541, + ID_MACRO = 20000, ID_MACRO_LIMIT = 20200, @@ -188,31 +203,31 @@ public enum Resource IDCMD = 50000, - IDC_PREV_DOC = IDCMD + 3, - IDC_NEXT_DOC = IDCMD + 4, - IDC_EDIT_TOGGLEMACRORECORDING = IDCMD + 5, + IDC_PREV_DOC = IDCMD+3, + IDC_NEXT_DOC = IDCMD+4, + IDC_EDIT_TOGGLEMACRORECORDING = IDCMD+5, - IDCMD_LIMIT = IDCMD + 20, + IDCMD_LIMIT = IDCMD+20, IDSCINTILLA = 60000, - IDSCINTILLA_KEY_HOME = IDSCINTILLA + 0, - IDSCINTILLA_KEY_HOME_WRAP = IDSCINTILLA + 1, - IDSCINTILLA_KEY_END = IDSCINTILLA + 2, - IDSCINTILLA_KEY_END_WRAP = IDSCINTILLA + 3, - IDSCINTILLA_KEY_LINE_DUP = IDSCINTILLA + 4, - IDSCINTILLA_KEY_LINE_CUT = IDSCINTILLA + 5, - IDSCINTILLA_KEY_LINE_DEL = IDSCINTILLA + 6, - IDSCINTILLA_KEY_LINE_TRANS = IDSCINTILLA + 7, - IDSCINTILLA_KEY_LINE_COPY = IDSCINTILLA + 8, - IDSCINTILLA_KEY_CUT = IDSCINTILLA + 9, - IDSCINTILLA_KEY_COPY = IDSCINTILLA + 10, - IDSCINTILLA_KEY_PASTE = IDSCINTILLA + 11, - IDSCINTILLA_KEY_DEL = IDSCINTILLA + 12, - IDSCINTILLA_KEY_SELECTALL = IDSCINTILLA + 13, - IDSCINTILLA_KEY_OUTDENT = IDSCINTILLA + 14, - IDSCINTILLA_KEY_UNDO = IDSCINTILLA + 15, - IDSCINTILLA_KEY_REDO = IDSCINTILLA + 16, - IDSCINTILLA_LIMIT = IDSCINTILLA + 30, + IDSCINTILLA_KEY_HOME = IDSCINTILLA+0, + IDSCINTILLA_KEY_HOME_WRAP = IDSCINTILLA+1, + IDSCINTILLA_KEY_END = IDSCINTILLA+2, + IDSCINTILLA_KEY_END_WRAP = IDSCINTILLA+3, + IDSCINTILLA_KEY_LINE_DUP = IDSCINTILLA+4, + IDSCINTILLA_KEY_LINE_CUT = IDSCINTILLA+5, + IDSCINTILLA_KEY_LINE_DEL = IDSCINTILLA+6, + IDSCINTILLA_KEY_LINE_TRANS = IDSCINTILLA+7, + IDSCINTILLA_KEY_LINE_COPY = IDSCINTILLA+8, + IDSCINTILLA_KEY_CUT = IDSCINTILLA+9, + IDSCINTILLA_KEY_COPY = IDSCINTILLA+10, + IDSCINTILLA_KEY_PASTE = IDSCINTILLA+11, + IDSCINTILLA_KEY_DEL = IDSCINTILLA+12, + IDSCINTILLA_KEY_SELECTALL = IDSCINTILLA+13, + IDSCINTILLA_KEY_OUTDENT = IDSCINTILLA+14, + IDSCINTILLA_KEY_UNDO = IDSCINTILLA+15, + IDSCINTILLA_KEY_REDO = IDSCINTILLA+16, + IDSCINTILLA_LIMIT = IDSCINTILLA+30, IDD_FILEVIEW_DIALOG = 1000, @@ -238,11 +253,15 @@ public enum Resource IDC_ONLINEHELP_ADDR = 1704, IDC_AUTHOR_NAME = 1705, IDC_BUILD_DATETIME = 1706, + IDC_VERSION_BIT = 1707, IDD_DEBUGINFOBOX = 1750, IDC_DEBUGINFO_EDIT = 1751, IDC_DEBUGINFO_COPYLINK = 1752, + IDD_DOSAVEORNOTBOX = 1760, + IDC_DOSAVEORNOTTEX = 1761, + IDD_GOLINE = 2000, ID_GOLINE_EDIT = IDD_GOLINE + 1, ID_CURRLINE = IDD_GOLINE + 2, @@ -290,7 +309,7 @@ public enum Resource NPPM_INTERNAL_RELOADNATIVELANG = NOTEPADPLUS_USER_INTERNAL + 25, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED = NOTEPADPLUS_USER_INTERNAL + 26, NPPM_INTERNAL_SCINTILLAFINFERCLEARALL = NOTEPADPLUS_USER_INTERNAL + 27, - NPPM_INTERNAL_SETTING_EDGE_SIZE = NOTEPADPLUS_USER_INTERNAL + 28, + NPPM_INTERNAL_SETTING_TAB_REPLCESPACE = NOTEPADPLUS_USER_INTERNAL + 29, NPPM_INTERNAL_SETTING_TAB_SIZE = NOTEPADPLUS_USER_INTERNAL + 30, NPPM_INTERNAL_RELOADSTYLERS = NOTEPADPLUS_USER_INTERNAL + 31, @@ -304,6 +323,17 @@ public enum Resource NPPM_INTERNAL_SAVECURRENTSESSION = NOTEPADPLUS_USER_INTERNAL + 39, NPPM_INTERNAL_FINDINFINDERDLG = NOTEPADPLUS_USER_INTERNAL + 40, NPPM_INTERNAL_REMOVEFINDER = NOTEPADPLUS_USER_INTERNAL + 41, + NPPM_INTERNAL_RELOADSCROLLTOEND = NOTEPADPLUS_USER_INTERNAL + 42, + NPPM_INTERNAL_FINDKEYCONFLICTS = NOTEPADPLUS_USER_INTERNAL + 43, + NPPM_INTERNAL_SCROLLBEYONDLASTLINE = NOTEPADPLUS_USER_INTERNAL + 44, + NPPM_INTERNAL_SETWORDCHARS = NOTEPADPLUS_USER_INTERNAL + 45, + NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT = NOTEPADPLUS_USER_INTERNAL + 46, + NPPM_INTERNAL_PRNTANDQUIT = NOTEPADPLUS_USER_INTERNAL + 47, + NPPM_INTERNAL_SAVEBACKUP = NOTEPADPLUS_USER_INTERNAL + 48, + NPPM_INTERNAL_STOPMONITORING = NOTEPADPLUS_USER_INTERNAL + 49, + NPPM_INTERNAL_EDGEBACKGROUND = NOTEPADPLUS_USER_INTERNAL + 50, + NPPM_INTERNAL_EDGEMULTISETSIZE = NOTEPADPLUS_USER_INTERNAL + 51, + NPPM_INTERNAL_UPDATECLICKABLELINKS = NOTEPADPLUS_USER_INTERNAL + 52, NPPM_INTERNAL_CHECKDOCSTATUS = Constants.NPPMSG + 53, @@ -313,10 +343,6 @@ public enum Resource CHECKDOCOPT_UPDATESILENTLY = 1, CHECKDOCOPT_UPDATEGO2END = 2, - NPPM_INTERNAL_GETCHECKDOCOPT = Constants.NPPMSG + 55, - - NPPM_INTERNAL_SETCHECKDOCOPT = Constants.NPPMSG + 56, - NPPM_INTERNAL_SETFILENAME = Constants.NPPMSG + 63, SCINTILLA_USER = Constants.WM_USER + 2000, @@ -337,9 +363,10 @@ public enum Resource MENUINDEX_FORMAT = 4, MENUINDEX_LANGUAGE = 5, MENUINDEX_SETTINGS = 6, - MENUINDEX_MACRO = 7, - MENUINDEX_RUN = 8, - MENUINDEX_PLUGINS = 9, - /* --Autogenerated -- end of section automatically generated from resource.h */ - } + MENUINDEX_TOOLS = 7, + MENUINDEX_MACRO = 8, + MENUINDEX_RUN = 9, + MENUINDEX_PLUGINS = 10, + /* --Autogenerated -- end of section automatically generated from resource.h */ + } } diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/ScintillaGateway.cs b/CSharpRegexTools4Npp/PluginInfrastructure/ScintillaGateway.cs index 1e4298f..680e2f2 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/ScintillaGateway.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/ScintillaGateway.cs @@ -12,7 +12,7 @@ namespace CSharpRegexTools4Npp.PluginInfrastructure /// /// See http://www.scintilla.org/ScintillaDoc.html for further details. ///
- public class ScintillaGateway : IScintillaGateway + public class ScintillaGateway { private const int Unused = 0; @@ -20,6 +20,45 @@ public class ScintillaGateway : IScintillaGateway public static readonly int LengthZeroTerminator = "\0".Length; + /// + /// if bytes is null, returns null.

+ /// Else, returns bytes decoded from UTF-8 as a string, with all trailing NULL bytes stripped off. + ///
+ public static string Utf8BytesToNullStrippedString(byte[] bytes) + { + if (bytes is null) + return null; + int lastNullCharPos = bytes.Length - 1; + // this only bypasses NULL chars because no char + // other than NULL can have any 0-valued bytes in UTF-8. + // See https://en.wikipedia.org/wiki/UTF-8#Encoding + for (; lastNullCharPos >= 0 && bytes[lastNullCharPos] == '\x00'; lastNullCharPos--) { } + return Encoding.UTF8.GetString(bytes, 0, lastNullCharPos + 1); + } + + /// + /// Recall that all Scintilla methods have the signature + /// (scintilla* scin, SciMsg msg, void* wParam, void* lParam) -> void*

+ /// Many of these scintilla methods are bimodal in the following way

+ /// * if lParam is 0, return the length of the buffer to be filled and have no side effects. The wParam may be involved in telling Scintilla how big the buffer needs to be.

+ /// * if lParam is greater than 0, it is assumed to be a pointer to a buffer. Now the wParam indicates what the text will need to be.



+ /// This sets lParam to 0 to get the length, allocates a buffer of that length,

+ /// uses the second mode to fill a buffer,

+ /// and returns a string of the UTF8-decoded buffer with all trailing '\x00' chars stripped off. + ///
+ /// message to send + /// another parameter for defining what the buffer should contain + /// + private unsafe string GetNullStrippedStringFromMessageThatReturnsLength(SciMsg msg, IntPtr wParam=default) + { + int length = Win32.SendMessage(scintilla, msg, wParam, (IntPtr)Unused).ToInt32(); + byte[] textBuffer = new byte[length]; + fixed (byte* textPtr = textBuffer) + { + Win32.SendMessage(scintilla, msg, wParam, (IntPtr)textPtr); + return Utf8BytesToNullStrippedString(textBuffer); + } + } public ScintillaGateway(IntPtr scintilla) { @@ -28,27 +67,27 @@ public ScintillaGateway(IntPtr scintilla) public int GetSelectionLength() { - var selectionLength = (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELTEXT, Unused, Unused) - LengthZeroTerminator; + var selectionLength = (int) Win32.SendMessage(scintilla, SciMsg.SCI_GETSELTEXT, Unused, Unused) - LengthZeroTerminator; return selectionLength; } public void AppendTextAndMoveCursor(string text) { AppendText(text.Length, text); - GotoPos(new Position(GetCurrentPos().Value + text.Length)); + GotoPos(GetCurrentPos() + text.Length); } public void InsertTextAndMoveCursor(string text) { var currentPos = GetCurrentPos(); InsertText(currentPos, text); - GotoPos(new Position(currentPos.Value + text.Length)); + GotoPos(currentPos + text.Length); } public void SelectCurrentLine() { int line = GetCurrentLineNumber(); - SetSelection(PositionFromLine(line).Value, PositionFromLine(line + 1).Value); + SetSelection(PositionFromLine(line), PositionFromLine(line + 1)); } /// @@ -56,7 +95,7 @@ public void SelectCurrentLine() /// public void ClearSelectionToCursor() { - var pos = GetCurrentPos().Value; + var pos = GetCurrentPos(); SetSelection(pos, pos); } @@ -85,12 +124,11 @@ public ScrollInfo GetScrollInfo(ScrollInfoMask mask = ScrollInfoMask.SIF_ALL, Sc /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ /// Add text to the document at current position. (Scintilla feature 2001) - public unsafe void AddText(string text) + public unsafe void AddText(int length, string text) { - var array = Encoding.UTF8.GetBytes(text); fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDTEXT, array.Length, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_ADDTEXT, (IntPtr) length, (IntPtr) textPtr); } } @@ -99,16 +137,16 @@ public unsafe void AddStyledText(int length, Cells c) { fixed (char* cPtr = c.Value) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDSTYLEDTEXT, length, (IntPtr)cPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_ADDSTYLEDTEXT, (IntPtr) length, (IntPtr) cPtr); } } /// Insert string at a position. (Scintilla feature 2003) - public unsafe void InsertText(Position pos, string text) + public unsafe void InsertText(int pos, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INSERTTEXT, pos.Value, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_INSERTTEXT, (IntPtr) pos, (IntPtr) textPtr); } } @@ -117,67 +155,74 @@ public unsafe void ChangeInsertion(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHANGEINSERTION, length, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_CHANGEINSERTION, (IntPtr) length, (IntPtr) textPtr); } } /// Delete all text in the document. (Scintilla feature 2004) public void ClearAll() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALL, (IntPtr) Unused, (IntPtr) Unused); } /// Delete a range of text in the document. (Scintilla feature 2645) - public void DeleteRange(Position pos, int deleteLength) + public void DeleteRange(int start, int lengthDelete) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETERANGE, pos.Value, deleteLength); + Win32.SendMessage(scintilla, SciMsg.SCI_DELETERANGE, (IntPtr) start, (IntPtr) lengthDelete); } /// Set all style bytes to 0, remove all folding information. (Scintilla feature 2005) public void ClearDocumentStyle() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARDOCUMENTSTYLE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEARDOCUMENTSTYLE, (IntPtr) Unused, (IntPtr) Unused); } /// Returns the number of bytes in the document. (Scintilla feature 2006) - public int GetLength() + public long GetLength() + { + return (long)Win32.SendMessage(scintilla, SciMsg.SCI_GETLENGTH, (IntPtr) Unused, (IntPtr) Unused); + } + + public bool TryGetLengthAsInt(out int result) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLENGTH, Unused, Unused); - return (int)res; + long longRes = GetLength(); + if (longRes > int.MaxValue) + { + result = -1; + return false; + } + result = (int)longRes; + return true; } /// Returns the character byte at the position. (Scintilla feature 2007) - public int GetCharAt(Position pos) + public int GetCharAt(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARAT, pos.Value, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARAT, (IntPtr) pos, (IntPtr) Unused); } /// Returns the position of the caret. (Scintilla feature 2008) - public Position GetCurrentPos() + public int GetCurrentPos() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURRENTPOS, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCURRENTPOS, (IntPtr) Unused, (IntPtr) Unused); } /// Returns the position of the opposite end of the selection to the caret. (Scintilla feature 2009) - public Position GetAnchor() + public int GetAnchor() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETANCHOR, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETANCHOR, (IntPtr) Unused, (IntPtr) Unused); } /// Returns the style byte at the position. (Scintilla feature 2010) - public int GetStyleAt(Position pos) + public int GetStyleAt(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEAT, pos.Value, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEAT, (IntPtr) pos, (IntPtr) Unused); } /// Redoes the next action on the undo history. (Scintilla feature 2011) public void Redo() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REDO, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_REDO, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -187,13 +232,13 @@ public void Redo() /// public void SetUndoCollection(bool collectUndo) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUNDOCOLLECTION, collectUndo ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETUNDOCOLLECTION, new IntPtr(collectUndo ? 1 : 0), (IntPtr) Unused); } /// Select all the text in the document. (Scintilla feature 2013) public void SelectAll() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTALL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SELECTALL, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -203,7 +248,7 @@ public void SelectAll() /// public void SetSavePoint() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSAVEPOINT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSAVEPOINT, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -213,35 +258,31 @@ public void SetSavePoint() /// public int GetStyledText(TextRange tr) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEDTEXT, Unused, tr.NativePointer); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEDTEXT, (IntPtr) Unused, tr.NativePointer); } /// Are there any redoable actions in the undo history? (Scintilla feature 2016) public bool CanRedo() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANREDO, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_CANREDO, (IntPtr) Unused, (IntPtr) Unused); } /// Retrieve the line number at which a particular marker is located. (Scintilla feature 2017) - public int MarkerLineFromHandle(int handle) + public int MarkerLineFromHandle(int markerHandle) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERLINEFROMHANDLE, handle, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERLINEFROMHANDLE, (IntPtr) markerHandle, (IntPtr) Unused); } /// Delete a marker. (Scintilla feature 2018) - public void MarkerDeleteHandle(int handle) + public void MarkerDeleteHandle(int markerHandle) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEHANDLE, handle, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEHANDLE, (IntPtr) markerHandle, (IntPtr) Unused); } /// Is undo history being collected? (Scintilla feature 2019) public bool GetUndoCollection() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUNDOCOLLECTION, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETUNDOCOLLECTION, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -249,23 +290,37 @@ public bool GetUndoCollection() /// Returns one of SCWS_* constants. /// (Scintilla feature 2020) /// - public int GetViewWS() + public WhiteSpace GetViewWS() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWWS, Unused, Unused); - return (int)res; + return (WhiteSpace)Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWWS, (IntPtr) Unused, (IntPtr) Unused); } /// Make white space characters invisible, always visible or visible outside indentation. (Scintilla feature 2021) - public void SetViewWS(int viewWS) + public void SetViewWS(WhiteSpace viewWS) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWWS, viewWS, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWWS, (IntPtr) viewWS, (IntPtr) Unused); + } + + /// + /// Retrieve the current tab draw mode. + /// Returns one of SCTD_* constants. + /// (Scintilla feature 2698) + /// + public TabDrawMode GetTabDrawMode() + { + return (TabDrawMode)Win32.SendMessage(scintilla, SciMsg.SCI_GETTABDRAWMODE, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Set how tabs are drawn when visible. (Scintilla feature 2699) + public void SetTabDrawMode(TabDrawMode tabDrawMode) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETTABDRAWMODE, (IntPtr) tabDrawMode, (IntPtr) Unused); } /// Find the position from a point within the window. (Scintilla feature 2022) - public Position PositionFromPoint(int x, int y) + public int PositionFromPoint(int x, int y) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINT, x, y); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINT, (IntPtr) x, (IntPtr) y); } /// @@ -273,22 +328,21 @@ public Position PositionFromPoint(int x, int y) /// INVALID_POSITION if not close to text. /// (Scintilla feature 2023) /// - public Position PositionFromPointClose(int x, int y) + public int PositionFromPointClose(int x, int y) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINTCLOSE, x, y); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINTCLOSE, (IntPtr) x, (IntPtr) y); } /// Set caret to start of a line and ensure it is visible. (Scintilla feature 2024) public void GotoLine(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GOTOLINE, line, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_GOTOLINE, (IntPtr) line, (IntPtr) Unused); } /// Set caret to a position and ensure it is visible. (Scintilla feature 2025) - public void GotoPos(Position pos) + public void GotoPos(int caret) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GOTOPOS, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_GOTOPOS, (IntPtr) caret, (IntPtr) Unused); } /// @@ -296,9 +350,9 @@ public void GotoPos(Position pos) /// end of the selection from the caret. /// (Scintilla feature 2026) /// - public void SetAnchor(Position posAnchor) + public void SetAnchor(int anchor) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETANCHOR, posAnchor.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETANCHOR, (IntPtr) anchor, (IntPtr) Unused); } /// @@ -307,50 +361,43 @@ public void SetAnchor(Position posAnchor) /// Result is NUL-terminated. /// (Scintilla feature 2027) /// - public unsafe string GetCurLine(int length) + public unsafe string GetCurLine() { - byte[] textBuffer = new byte[10000]; - fixed (byte* textPtr = textBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURLINE, length, (IntPtr)textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETCURLINE); } /// Retrieve the position of the last correctly styled character. (Scintilla feature 2028) - public Position GetEndStyled() + public int GetEndStyled() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETENDSTYLED, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETENDSTYLED, (IntPtr) Unused, (IntPtr) Unused); } /// Convert all line endings in the document to one mode. (Scintilla feature 2029) - public void ConvertEOLs(int eolMode) + public void ConvertEOLs(EndOfLine eolMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CONVERTEOLS, eolMode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CONVERTEOLS, (IntPtr) eolMode, (IntPtr) Unused); } /// Retrieve the current end of line mode - one of CRLF, CR, or LF. (Scintilla feature 2030) - public int GetEOLMode() + public EndOfLine GetEOLMode() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEOLMODE, Unused, Unused); - return (int)res; + return (EndOfLine)Win32.SendMessage(scintilla, SciMsg.SCI_GETEOLMODE, (IntPtr) Unused, (IntPtr) Unused); } /// Set the current end of line mode. (Scintilla feature 2031) - public void SetEOLMode(int eolMode) + public void SetEOLMode(EndOfLine eolMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEOLMODE, eolMode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETEOLMODE, (IntPtr) eolMode, (IntPtr) Unused); } /// - /// Set the current styling position to pos and the styling mask to mask. - /// The styling mask can be used to protect some bits in each styling byte from modification. + /// Set the current styling position to start. + /// The unused parameter is no longer used and should be set to 0. /// (Scintilla feature 2032) /// - public void StartStyling(Position pos, int mask) + public void StartStyling(int start, int unused) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STARTSTYLING, pos.Value, mask); + Win32.SendMessage(scintilla, SciMsg.SCI_STARTSTYLING, (IntPtr) start, (IntPtr) unused); } /// @@ -360,14 +407,13 @@ public void StartStyling(Position pos, int mask) /// public void SetStyling(int length, int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLING, length, style); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLING, (IntPtr) length, (IntPtr) style); } /// Is drawing done first into a buffer or direct to the screen? (Scintilla feature 2034) public bool GetBufferedDraw() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETBUFFEREDDRAW, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETBUFFEREDDRAW, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -377,39 +423,37 @@ public bool GetBufferedDraw() /// public void SetBufferedDraw(bool buffered) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETBUFFEREDDRAW, buffered ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETBUFFEREDDRAW, new IntPtr(buffered ? 1 : 0), (IntPtr) Unused); } /// Change the visible size of a tab to be a multiple of the width of a space character. (Scintilla feature 2036) public void SetTabWidth(int tabWidth) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTABWIDTH, tabWidth, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETTABWIDTH, (IntPtr) tabWidth, (IntPtr) Unused); } /// Retrieve the visible size of a tab. (Scintilla feature 2121) public int GetTabWidth() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTABWIDTH, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTABWIDTH, (IntPtr) Unused, (IntPtr) Unused); } /// Clear explicit tabstops on a line. (Scintilla feature 2675) public void ClearTabStops(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARTABSTOPS, line, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEARTABSTOPS, (IntPtr) line, (IntPtr) Unused); } /// Add an explicit tab stop for a line. (Scintilla feature 2676) public void AddTabStop(int line, int x) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDTABSTOP, line, x); + Win32.SendMessage(scintilla, SciMsg.SCI_ADDTABSTOP, (IntPtr) line, (IntPtr) x); } /// Find the next explicit tab stop position on a line after a position. (Scintilla feature 2677) public int GetNextTabStop(int line, int x) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETNEXTTABSTOP, line, x); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETNEXTTABSTOP, (IntPtr) line, (IntPtr) x); } /// @@ -419,76 +463,73 @@ public int GetNextTabStop(int line, int x) /// public void SetCodePage(int codePage) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCODEPAGE, codePage, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCODEPAGE, (IntPtr) codePage, (IntPtr) Unused); } - /// Is the IME displayed in a winow or inline? (Scintilla feature 2678) - public int GetIMEInteraction() + /// Is the IME displayed in a window or inline? (Scintilla feature 2678) + public IMEInteraction GetIMEInteraction() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETIMEINTERACTION, Unused, Unused); - return (int)res; + return (IMEInteraction)Win32.SendMessage(scintilla, SciMsg.SCI_GETIMEINTERACTION, (IntPtr) Unused, (IntPtr) Unused); } /// Choose to display the the IME in a winow or inline. (Scintilla feature 2679) - public void SetIMEInteraction(int imeInteraction) + public void SetIMEInteraction(IMEInteraction imeInteraction) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIMEINTERACTION, imeInteraction, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETIMEINTERACTION, (IntPtr) imeInteraction, (IntPtr) Unused); } /// Set the symbol used for a particular marker number. (Scintilla feature 2040) - public void MarkerDefine(int markerNumber, int markerSymbol) + public void MarkerDefine(int markerNumber, MarkerSymbol markerSymbol) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINE, markerNumber, markerSymbol); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINE, (IntPtr) markerNumber, (IntPtr) markerSymbol); } /// Set the foreground colour used for a particular marker number. (Scintilla feature 2041) public void MarkerSetFore(int markerNumber, Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETFORE, markerNumber, fore.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETFORE, (IntPtr) markerNumber, fore.Value); } /// Set the background colour used for a particular marker number. (Scintilla feature 2042) public void MarkerSetBack(int markerNumber, Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACK, markerNumber, back.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACK, (IntPtr) markerNumber, back.Value); } /// Set the background colour used for a particular marker number when its folding block is selected. (Scintilla feature 2292) public void MarkerSetBackSelected(int markerNumber, Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACKSELECTED, markerNumber, back.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACKSELECTED, (IntPtr) markerNumber, back.Value); } /// Enable/disable highlight for current folding bloc (smallest one that contains the caret) (Scintilla feature 2293) public void MarkerEnableHighlight(bool enabled) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERENABLEHIGHLIGHT, enabled ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERENABLEHIGHLIGHT, new IntPtr(enabled ? 1 : 0), (IntPtr) Unused); } /// Add a marker to a line, returning an ID which can be used to find or delete the marker. (Scintilla feature 2043) public int MarkerAdd(int line, int markerNumber) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADD, line, markerNumber); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADD, (IntPtr) line, (IntPtr) markerNumber); } /// Delete a marker from a line. (Scintilla feature 2044) public void MarkerDelete(int line, int markerNumber) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETE, line, markerNumber); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETE, (IntPtr) line, (IntPtr) markerNumber); } /// Delete all markers with a particular number from all lines. (Scintilla feature 2045) public void MarkerDeleteAll(int markerNumber) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEALL, markerNumber, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEALL, (IntPtr) markerNumber, (IntPtr) Unused); } /// Get a bit mask of all the markers set on a line. (Scintilla feature 2046) public int MarkerGet(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERGET, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERGET, (IntPtr) line, (IntPtr) Unused); } /// @@ -498,15 +539,13 @@ public int MarkerGet(int line) /// public int MarkerNext(int lineStart, int markerMask) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERNEXT, lineStart, markerMask); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERNEXT, (IntPtr) lineStart, (IntPtr) markerMask); } /// Find the previous line before lineStart that includes a marker in mask. (Scintilla feature 2048) public int MarkerPrevious(int lineStart, int markerMask) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERPREVIOUS, lineStart, markerMask); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERPREVIOUS, (IntPtr) lineStart, (IntPtr) markerMask); } /// Define a marker from a pixmap. (Scintilla feature 2049) @@ -514,121 +553,140 @@ public unsafe void MarkerDefinePixmap(int markerNumber, string pixmap) { fixed (byte* pixmapPtr = Encoding.UTF8.GetBytes(pixmap)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINEPIXMAP, markerNumber, (IntPtr)pixmapPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINEPIXMAP, (IntPtr) markerNumber, (IntPtr) pixmapPtr); } } /// Add a set of markers to a line. (Scintilla feature 2466) - public void MarkerAddSet(int line, int set) + public void MarkerAddSet(int line, int markerSet) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADDSET, line, set); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADDSET, (IntPtr) line, (IntPtr) markerSet); } /// Set the alpha used for a marker that is drawn in the text area, not the margin. (Scintilla feature 2476) - public void MarkerSetAlpha(int markerNumber, int alpha) + public void MarkerSetAlpha(int markerNumber, Alpha alpha) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETALPHA, markerNumber, alpha); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETALPHA, (IntPtr) markerNumber, (IntPtr) alpha); } /// Set a margin to be either numeric or symbolic. (Scintilla feature 2240) - public void SetMarginTypeN(int margin, int marginType) + public void SetMarginTypeN(int margin, MarginType marginType) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINTYPEN, margin, marginType); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINTYPEN, (IntPtr) margin, (IntPtr) marginType); } /// Retrieve the type of a margin. (Scintilla feature 2241) - public int GetMarginTypeN(int margin) + public MarginType GetMarginTypeN(int margin) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINTYPEN, margin, Unused); - return (int)res; + return (MarginType)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINTYPEN, (IntPtr) margin, (IntPtr) Unused); } /// Set the width of a margin to a width expressed in pixels. (Scintilla feature 2242) public void SetMarginWidthN(int margin, int pixelWidth) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINWIDTHN, margin, pixelWidth); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINWIDTHN, (IntPtr) margin, (IntPtr) pixelWidth); } /// Retrieve the width of a margin in pixels. (Scintilla feature 2243) public int GetMarginWidthN(int margin) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINWIDTHN, margin, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINWIDTHN, (IntPtr) margin, (IntPtr) Unused); } /// Set a mask that determines which markers are displayed in a margin. (Scintilla feature 2244) public void SetMarginMaskN(int margin, int mask) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINMASKN, margin, mask); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINMASKN, (IntPtr) margin, (IntPtr) mask); } /// Retrieve the marker mask of a margin. (Scintilla feature 2245) public int GetMarginMaskN(int margin) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINMASKN, margin, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINMASKN, (IntPtr) margin, (IntPtr) Unused); } /// Make a margin sensitive or insensitive to mouse clicks. (Scintilla feature 2246) public void SetMarginSensitiveN(int margin, bool sensitive) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINSENSITIVEN, margin, sensitive ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINSENSITIVEN, (IntPtr) margin, new IntPtr(sensitive ? 1 : 0)); } /// Retrieve the mouse click sensitivity of a margin. (Scintilla feature 2247) public bool GetMarginSensitiveN(int margin) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINSENSITIVEN, margin, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINSENSITIVEN, (IntPtr) margin, (IntPtr) Unused); } /// Set the cursor shown when the mouse is inside a margin. (Scintilla feature 2248) - public void SetMarginCursorN(int margin, int cursor) + public void SetMarginCursorN(int margin, CursorShape cursor) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINCURSORN, margin, cursor); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINCURSORN, (IntPtr) margin, (IntPtr) cursor); } /// Retrieve the cursor shown in a margin. (Scintilla feature 2249) - public int GetMarginCursorN(int margin) + public CursorShape GetMarginCursorN(int margin) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINCURSORN, margin, Unused); - return (int)res; + return (CursorShape)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINCURSORN, (IntPtr) margin, (IntPtr) Unused); + } + + /// Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. (Scintilla feature 2250) + public void SetMarginBackN(int margin, Colour back) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINBACKN, (IntPtr) margin, back.Value); + } + + /// Retrieve the background colour of a margin (Scintilla feature 2251) + public Colour GetMarginBackN(int margin) + { + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINBACKN, (IntPtr) margin, (IntPtr) Unused)); + } + + /// Allocate a non-standard number of margins. (Scintilla feature 2252) + public void SetMargins(int margins) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINS, (IntPtr) margins, (IntPtr) Unused); + } + + /// How many margins are there?. (Scintilla feature 2253) + public int GetMargins() + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINS, (IntPtr) Unused, (IntPtr) Unused); } /// Clear all the styles and make equivalent to the global default style. (Scintilla feature 2050) public void StyleClearAll() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLECLEARALL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLECLEARALL, (IntPtr) Unused, (IntPtr) Unused); } /// Set the foreground colour of a style. (Scintilla feature 2051) public void StyleSetFore(int style, Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFORE, style, fore.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFORE, (IntPtr) style, fore.Value); } /// Set the background colour of a style. (Scintilla feature 2052) public void StyleSetBack(int style, Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBACK, style, back.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBACK, (IntPtr) style, back.Value); } /// Set a style to be bold or not. (Scintilla feature 2053) public void StyleSetBold(int style, bool bold) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBOLD, style, bold ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBOLD, (IntPtr) style, new IntPtr(bold ? 1 : 0)); } /// Set a style to be italic or not. (Scintilla feature 2054) public void StyleSetItalic(int style, bool italic) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETITALIC, style, italic ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETITALIC, (IntPtr) style, new IntPtr(italic ? 1 : 0)); } /// Set the size of characters of a style. (Scintilla feature 2055) public void StyleSetSize(int style, int sizePoints) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZE, style, sizePoints); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZE, (IntPtr) style, (IntPtr) sizePoints); } /// Set the font of a style. (Scintilla feature 2056) @@ -636,61 +694,56 @@ public unsafe void StyleSetFont(int style, string fontName) { fixed (byte* fontNamePtr = Encoding.UTF8.GetBytes(fontName)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFONT, style, (IntPtr)fontNamePtr); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFONT, (IntPtr) style, (IntPtr) fontNamePtr); } } /// Set a style to have its end of line filled or not. (Scintilla feature 2057) - public void StyleSetEOLFilled(int style, bool filled) + public void StyleSetEOLFilled(int style, bool eolFilled) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETEOLFILLED, style, filled ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETEOLFILLED, (IntPtr) style, new IntPtr(eolFilled ? 1 : 0)); } /// Reset the default style to its state at startup (Scintilla feature 2058) public void StyleResetDefault() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLERESETDEFAULT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLERESETDEFAULT, (IntPtr) Unused, (IntPtr) Unused); } /// Set a style to be underlined or not. (Scintilla feature 2059) public void StyleSetUnderline(int style, bool underline) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETUNDERLINE, style, underline ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETUNDERLINE, (IntPtr) style, new IntPtr(underline ? 1 : 0)); } /// Get the foreground colour of a style. (Scintilla feature 2481) public Colour StyleGetFore(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFORE, style, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFORE, (IntPtr) style, (IntPtr) Unused)); } /// Get the background colour of a style. (Scintilla feature 2482) public Colour StyleGetBack(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBACK, style, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBACK, (IntPtr) style, (IntPtr) Unused)); } /// Get is a style bold or not. (Scintilla feature 2483) public bool StyleGetBold(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBOLD, style, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBOLD, (IntPtr) style, (IntPtr) Unused); } /// Get is a style italic or not. (Scintilla feature 2484) public bool StyleGetItalic(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETITALIC, style, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETITALIC, (IntPtr) style, (IntPtr) Unused); } /// Get the size of characters of a style. (Scintilla feature 2485) public int StyleGetSize(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZE, style, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZE, (IntPtr) style, (IntPtr) Unused); } /// @@ -701,47 +754,37 @@ public int StyleGetSize(int style) /// public unsafe string StyleGetFont(int style) { - byte[] fontNameBuffer = new byte[10000]; - fixed (byte* fontNamePtr = fontNameBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFONT, style, (IntPtr)fontNamePtr); - return Encoding.UTF8.GetString(fontNameBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_STYLEGETFONT, (IntPtr)style); } /// Get is a style to have its end of line filled or not. (Scintilla feature 2487) public bool StyleGetEOLFilled(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETEOLFILLED, style, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETEOLFILLED, (IntPtr) style, (IntPtr) Unused); } /// Get is a style underlined or not. (Scintilla feature 2488) public bool StyleGetUnderline(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETUNDERLINE, style, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETUNDERLINE, (IntPtr) style, (IntPtr) Unused); } /// Get is a style mixed case, or to force upper or lower case. (Scintilla feature 2489) - public int StyleGetCase(int style) + public CaseVisible StyleGetCase(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCASE, style, Unused); - return (int)res; + return (CaseVisible)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCASE, (IntPtr) style, (IntPtr) Unused); } /// Get the character get of the font in a style. (Scintilla feature 2490) - public int StyleGetCharacterSet(int style) + public CharacterSet StyleGetCharacterSet(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHARACTERSET, style, Unused); - return (int)res; + return (CharacterSet)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHARACTERSET, (IntPtr) style, (IntPtr) Unused); } /// Get is a style visible or not. (Scintilla feature 2491) public bool StyleGetVisible(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETVISIBLE, style, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETVISIBLE, (IntPtr) style, (IntPtr) Unused); } /// @@ -751,121 +794,115 @@ public bool StyleGetVisible(int style) /// public bool StyleGetChangeable(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHANGEABLE, style, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHANGEABLE, (IntPtr) style, (IntPtr) Unused); } /// Get is a style a hotspot or not. (Scintilla feature 2493) public bool StyleGetHotSpot(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETHOTSPOT, style, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETHOTSPOT, (IntPtr) style, (IntPtr) Unused); } /// Set a style to be mixed case, or to force upper or lower case. (Scintilla feature 2060) - public void StyleSetCase(int style, int caseForce) + public void StyleSetCase(int style, CaseVisible caseVisible) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCASE, style, caseForce); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCASE, (IntPtr) style, (IntPtr) caseVisible); } /// Set the size of characters of a style. Size is in points multiplied by 100. (Scintilla feature 2061) - public void StyleSetSizeFractional(int style, int caseForce) + public void StyleSetSizeFractional(int style, int sizeHundredthPoints) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZEFRACTIONAL, style, caseForce); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZEFRACTIONAL, (IntPtr) style, (IntPtr) sizeHundredthPoints); } /// Get the size of characters of a style in points multiplied by 100 (Scintilla feature 2062) public int StyleGetSizeFractional(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZEFRACTIONAL, style, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZEFRACTIONAL, (IntPtr) style, (IntPtr) Unused); } /// Set the weight of characters of a style. (Scintilla feature 2063) - public void StyleSetWeight(int style, int weight) + public void StyleSetWeight(int style, FontWeight weight) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETWEIGHT, style, weight); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETWEIGHT, (IntPtr) style, (IntPtr) weight); } /// Get the weight of characters of a style. (Scintilla feature 2064) - public int StyleGetWeight(int style) + public FontWeight StyleGetWeight(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETWEIGHT, style, Unused); - return (int)res; + return (FontWeight)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETWEIGHT, (IntPtr) style, (IntPtr) Unused); } /// Set the character set of the font in a style. (Scintilla feature 2066) - public void StyleSetCharacterSet(int style, int characterSet) + public void StyleSetCharacterSet(int style, CharacterSet characterSet) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHARACTERSET, style, characterSet); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHARACTERSET, (IntPtr) style, (IntPtr) characterSet); } /// Set a style to be a hotspot or not. (Scintilla feature 2409) public void StyleSetHotSpot(int style, bool hotspot) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETHOTSPOT, style, hotspot ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETHOTSPOT, (IntPtr) style, new IntPtr(hotspot ? 1 : 0)); } /// Set the foreground colour of the main and additional selections and whether to use this setting. (Scintilla feature 2067) public void SetSelFore(bool useSetting, Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELFORE, useSetting ? 1 : 0, fore.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELFORE, new IntPtr(useSetting ? 1 : 0), fore.Value); } /// Set the background colour of the main and additional selections and whether to use this setting. (Scintilla feature 2068) public void SetSelBack(bool useSetting, Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELBACK, useSetting ? 1 : 0, back.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELBACK, new IntPtr(useSetting ? 1 : 0), back.Value); } /// Get the alpha of the selection. (Scintilla feature 2477) - public int GetSelAlpha() + public Alpha GetSelAlpha() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELALPHA, Unused, Unused); - return (int)res; + return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELALPHA, (IntPtr) Unused, (IntPtr) Unused); } /// Set the alpha of the selection. (Scintilla feature 2478) - public void SetSelAlpha(int alpha) + public void SetSelAlpha(Alpha alpha) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELALPHA, alpha, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELALPHA, (IntPtr) alpha, (IntPtr) Unused); } /// Is the selection end of line filled? (Scintilla feature 2479) public bool GetSelEOLFilled() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELEOLFILLED, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELEOLFILLED, (IntPtr) Unused, (IntPtr) Unused); } /// Set the selection to have its end of line filled or not. (Scintilla feature 2480) public void SetSelEOLFilled(bool filled) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELEOLFILLED, filled ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELEOLFILLED, new IntPtr(filled ? 1 : 0), (IntPtr) Unused); } /// Set the foreground colour of the caret. (Scintilla feature 2069) public void SetCaretFore(Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETFORE, fore.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETFORE, fore.Value, (IntPtr) Unused); } - /// When key+modifier combination km is pressed perform msg. (Scintilla feature 2070) - public void AssignCmdKey(KeyModifier km, int msg) + /// When key+modifier combination keyDefinition is pressed perform sciCommand. (Scintilla feature 2070) + public void AssignCmdKey(KeyModifier keyDefinition, int sciCommand) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ASSIGNCMDKEY, km.Value, msg); + Win32.SendMessage(scintilla, SciMsg.SCI_ASSIGNCMDKEY, keyDefinition.Value, (IntPtr) sciCommand); } - /// When key+modifier combination km is pressed do nothing. (Scintilla feature 2071) - public void ClearCmdKey(KeyModifier km) + /// When key+modifier combination keyDefinition is pressed do nothing. (Scintilla feature 2071) + public void ClearCmdKey(KeyModifier keyDefinition) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARCMDKEY, km.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEARCMDKEY, keyDefinition.Value, (IntPtr) Unused); } /// Drop all key mappings. (Scintilla feature 2072) public void ClearAllCmdKeys() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALLCMDKEYS, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALLCMDKEYS, (IntPtr) Unused, (IntPtr) Unused); } /// Set the styles for a segment of the document. (Scintilla feature 2073) @@ -873,27 +910,26 @@ public unsafe void SetStylingEx(int length, string styles) { fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLINGEX, length, (IntPtr)stylesPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLINGEX, (IntPtr) length, (IntPtr) stylesPtr); } } /// Set a style to be visible or not. (Scintilla feature 2074) public void StyleSetVisible(int style, bool visible) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETVISIBLE, style, visible ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETVISIBLE, (IntPtr) style, new IntPtr(visible ? 1 : 0)); } /// Get the time in milliseconds that the caret is on and off. (Scintilla feature 2075) public int GetCaretPeriod() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETPERIOD, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETPERIOD, (IntPtr) Unused, (IntPtr) Unused); } /// Get the time in milliseconds that the caret is on and off. 0 = steady on. (Scintilla feature 2076) public void SetCaretPeriod(int periodMilliseconds) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETPERIOD, periodMilliseconds, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETPERIOD, (IntPtr) periodMilliseconds, (IntPtr) Unused); } /// @@ -905,7 +941,7 @@ public unsafe void SetWordChars(string characters) { fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWORDCHARS, Unused, (IntPtr)charactersPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWORDCHARS, (IntPtr) Unused, (IntPtr) charactersPtr); } } @@ -916,12 +952,19 @@ public unsafe void SetWordChars(string characters) /// public unsafe string GetWordChars() { - byte[] charactersBuffer = new byte[10000]; - fixed (byte* charactersPtr = charactersBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWORDCHARS, Unused, (IntPtr)charactersPtr); - return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETWORDCHARS); + } + + /// Set the number of characters to have directly indexed categories (Scintilla feature 2720) + public void SetCharacterCategoryOptimization(int countCharacters) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETCHARACTERCATEGORYOPTIMIZATION, (IntPtr) countCharacters, (IntPtr) Unused); + } + + /// Get the number of characters to have directly indexed categories (Scintilla feature 2721) + public int GetCharacterCategoryOptimization() + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERCATEGORYOPTIMIZATION, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -931,180 +974,171 @@ public unsafe string GetWordChars() /// public void BeginUndoAction() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BEGINUNDOACTION, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_BEGINUNDOACTION, (IntPtr) Unused, (IntPtr) Unused); } /// End a sequence of actions that is undone and redone as a unit. (Scintilla feature 2079) public void EndUndoAction() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENDUNDOACTION, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ENDUNDOACTION, (IntPtr) Unused, (IntPtr) Unused); } /// Set an indicator to plain, squiggle or TT. (Scintilla feature 2080) - public void IndicSetStyle(int indic, int style) + public void IndicSetStyle(int indicator, IndicatorStyle indicatorStyle) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETSTYLE, indic, style); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETSTYLE, (IntPtr) indicator, (IntPtr) indicatorStyle); } /// Retrieve the style of an indicator. (Scintilla feature 2081) - public int IndicGetStyle(int indic) + public IndicatorStyle IndicGetStyle(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETSTYLE, indic, Unused); - return (int)res; + return (IndicatorStyle)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETSTYLE, (IntPtr) indicator, (IntPtr) Unused); } /// Set the foreground colour of an indicator. (Scintilla feature 2082) - public void IndicSetFore(int indic, Colour fore) + public void IndicSetFore(int indicator, Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFORE, indic, fore.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFORE, (IntPtr) indicator, fore.Value); } /// Retrieve the foreground colour of an indicator. (Scintilla feature 2083) - public Colour IndicGetFore(int indic) + public Colour IndicGetFore(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFORE, indic, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFORE, (IntPtr) indicator, (IntPtr) Unused)); } /// Set an indicator to draw under text or over(default). (Scintilla feature 2510) - public void IndicSetUnder(int indic, bool under) + public void IndicSetUnder(int indicator, bool under) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETUNDER, indic, under ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETUNDER, (IntPtr) indicator, new IntPtr(under ? 1 : 0)); } /// Retrieve whether indicator drawn under or over text. (Scintilla feature 2511) - public bool IndicGetUnder(int indic) + public bool IndicGetUnder(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETUNDER, indic, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETUNDER, (IntPtr) indicator, (IntPtr) Unused); } /// Set a hover indicator to plain, squiggle or TT. (Scintilla feature 2680) - public void IndicSetHoverStyle(int indic, int style) + public void IndicSetHoverStyle(int indicator, IndicatorStyle indicatorStyle) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERSTYLE, indic, style); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERSTYLE, (IntPtr) indicator, (IntPtr) indicatorStyle); } /// Retrieve the hover style of an indicator. (Scintilla feature 2681) - public int IndicGetHoverStyle(int indic) + public IndicatorStyle IndicGetHoverStyle(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERSTYLE, indic, Unused); - return (int)res; + return (IndicatorStyle)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERSTYLE, (IntPtr) indicator, (IntPtr) Unused); } /// Set the foreground hover colour of an indicator. (Scintilla feature 2682) - public void IndicSetHoverFore(int indic, Colour fore) + public void IndicSetHoverFore(int indicator, Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERFORE, indic, fore.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERFORE, (IntPtr) indicator, fore.Value); } /// Retrieve the foreground hover colour of an indicator. (Scintilla feature 2683) - public Colour IndicGetHoverFore(int indic) + public Colour IndicGetHoverFore(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERFORE, indic, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERFORE, (IntPtr) indicator, (IntPtr) Unused)); } /// Set the attributes of an indicator. (Scintilla feature 2684) - public void IndicSetFlags(int indic, int flags) + public void IndicSetFlags(int indicator, IndicFlag flags) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFLAGS, indic, flags); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFLAGS, (IntPtr) indicator, (IntPtr) flags); } /// Retrieve the attributes of an indicator. (Scintilla feature 2685) - public int IndicGetFlags(int indic) + public IndicFlag IndicGetFlags(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFLAGS, indic, Unused); - return (int)res; + return (IndicFlag)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFLAGS, (IntPtr) indicator, (IntPtr) Unused); } /// Set the foreground colour of all whitespace and whether to use this setting. (Scintilla feature 2084) public void SetWhitespaceFore(bool useSetting, Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEFORE, useSetting ? 1 : 0, fore.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEFORE, new IntPtr(useSetting ? 1 : 0), fore.Value); } /// Set the background colour of all whitespace and whether to use this setting. (Scintilla feature 2085) public void SetWhitespaceBack(bool useSetting, Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEBACK, useSetting ? 1 : 0, back.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEBACK, new IntPtr(useSetting ? 1 : 0), back.Value); } /// Set the size of the dots used to mark space characters. (Scintilla feature 2086) public void SetWhitespaceSize(int size) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACESIZE, size, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACESIZE, (IntPtr) size, (IntPtr) Unused); } /// Get the size of the dots used to mark space characters. (Scintilla feature 2087) public int GetWhitespaceSize() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACESIZE, Unused, Unused); - return (int)res; - } - - /// - /// Divide each styling byte into lexical class bits (default: 5) and indicator - /// bits (default: 3). If a lexer requires more than 32 lexical states, then this - /// is used to expand the possible states. - /// (Scintilla feature 2090) - /// - public void SetStyleBits(int bits) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLEBITS, bits, Unused); - } - - /// Retrieve number of bits in style bytes used to hold the lexical state. (Scintilla feature 2091) - public int GetStyleBits() - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITS, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACESIZE, (IntPtr) Unused, (IntPtr) Unused); } /// Used to hold extra styling information for each line. (Scintilla feature 2092) public void SetLineState(int line, int state) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINESTATE, line, state); + Win32.SendMessage(scintilla, SciMsg.SCI_SETLINESTATE, (IntPtr) line, (IntPtr) state); } /// Retrieve the extra styling information for a line. (Scintilla feature 2093) public int GetLineState(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESTATE, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESTATE, (IntPtr) line, (IntPtr) Unused); } /// Retrieve the last line number that has line state. (Scintilla feature 2094) public int GetMaxLineState() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMAXLINESTATE, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMAXLINESTATE, (IntPtr) Unused, (IntPtr) Unused); } /// Is the background of the line containing the caret in a different colour? (Scintilla feature 2095) public bool GetCaretLineVisible() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLE, (IntPtr) Unused, (IntPtr) Unused); } /// Display the background of the line containing the caret in a different colour. (Scintilla feature 2096) public void SetCaretLineVisible(bool show) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLE, show ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLE, new IntPtr(show ? 1 : 0), (IntPtr) Unused); } /// Get the colour of the background of the line containing the caret. (Scintilla feature 2097) public Colour GetCaretLineBack() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACK, Unused, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACK, (IntPtr) Unused, (IntPtr) Unused)); } /// Set the colour of the background of the line containing the caret. (Scintilla feature 2098) public void SetCaretLineBack(Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACK, back.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACK, back.Value, (IntPtr) Unused); + } + + /// + /// Retrieve the caret line frame width. + /// Width = 0 means this option is disabled. + /// (Scintilla feature 2704) + /// + public int GetCaretLineFrame() + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEFRAME, (IntPtr) Unused, (IntPtr) Unused); + } + + /// + /// Display the caret line framed. + /// Set width != 0 to enable this option and width = 0 to disable it. + /// (Scintilla feature 2705) + /// + public void SetCaretLineFrame(int width) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEFRAME, (IntPtr) width, (IntPtr) Unused); } /// @@ -1114,47 +1148,45 @@ public void SetCaretLineBack(Colour back) /// public void StyleSetChangeable(int style, bool changeable) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHANGEABLE, style, changeable ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHANGEABLE, (IntPtr) style, new IntPtr(changeable ? 1 : 0)); } /// /// Display a auto-completion list. - /// The lenEntered parameter indicates how many characters before + /// The lengthEntered parameter indicates how many characters before /// the caret should be used to provide context. /// (Scintilla feature 2100) /// - public unsafe void AutoCShow(int lenEntered, string itemList) + public unsafe void AutoCShow(int lengthEntered, string itemList) { fixed (byte* itemListPtr = Encoding.UTF8.GetBytes(itemList)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSHOW, lenEntered, (IntPtr)itemListPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSHOW, (IntPtr) lengthEntered, (IntPtr) itemListPtr); } } /// Remove the auto-completion list from the screen. (Scintilla feature 2101) public void AutoCCancel() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCANCEL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCANCEL, (IntPtr) Unused, (IntPtr) Unused); } /// Is there an auto-completion list visible? (Scintilla feature 2102) public bool AutoCActive() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCACTIVE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCACTIVE, (IntPtr) Unused, (IntPtr) Unused); } /// Retrieve the position of the caret when the auto-completion list was displayed. (Scintilla feature 2103) - public Position AutoCPosStart() + public int AutoCPosStart() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCPOSSTART, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCPOSSTART, (IntPtr) Unused, (IntPtr) Unused); } /// User has selected an item so remove the list and insert the selection. (Scintilla feature 2104) public void AutoCComplete() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCOMPLETE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCOMPLETE, (IntPtr) Unused, (IntPtr) Unused); } /// Define a set of character that when typed cancel the auto-completion list. (Scintilla feature 2105) @@ -1162,7 +1194,7 @@ public unsafe void AutoCStops(string characterSet) { fixed (byte* characterSetPtr = Encoding.UTF8.GetBytes(characterSet)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSTOPS, Unused, (IntPtr)characterSetPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSTOPS, (IntPtr) Unused, (IntPtr) characterSetPtr); } } @@ -1173,22 +1205,21 @@ public unsafe void AutoCStops(string characterSet) ///
public void AutoCSetSeparator(int separatorCharacter) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETSEPARATOR, separatorCharacter, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETSEPARATOR, (IntPtr) separatorCharacter, (IntPtr) Unused); } /// Retrieve the auto-completion list separator character. (Scintilla feature 2107) public int AutoCGetSeparator() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETSEPARATOR, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETSEPARATOR, (IntPtr) Unused, (IntPtr) Unused); } /// Select the item in the auto-completion list that starts with a string. (Scintilla feature 2108) - public unsafe void AutoCSelect(string text) + public unsafe void AutoCSelect(string select) { - fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) + fixed (byte* selectPtr = Encoding.UTF8.GetBytes(select)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSELECT, Unused, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSELECT, (IntPtr) Unused, (IntPtr) selectPtr); } } @@ -1199,14 +1230,13 @@ public unsafe void AutoCSelect(string text) ///
public void AutoCSetCancelAtStart(bool cancel) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCANCELATSTART, cancel ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCANCELATSTART, new IntPtr(cancel ? 1 : 0), (IntPtr) Unused); } /// Retrieve whether auto-completion cancelled by backspacing before start. (Scintilla feature 2111) public bool AutoCGetCancelAtStart() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCANCELATSTART, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCANCELATSTART, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1218,34 +1248,32 @@ public unsafe void AutoCSetFillUps(string characterSet) { fixed (byte* characterSetPtr = Encoding.UTF8.GetBytes(characterSet)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETFILLUPS, Unused, (IntPtr)characterSetPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETFILLUPS, (IntPtr) Unused, (IntPtr) characterSetPtr); } } /// Should a single item auto-completion list automatically choose the item. (Scintilla feature 2113) public void AutoCSetChooseSingle(bool chooseSingle) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCHOOSESINGLE, chooseSingle ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCHOOSESINGLE, new IntPtr(chooseSingle ? 1 : 0), (IntPtr) Unused); } /// Retrieve whether a single item auto-completion list automatically choose the item. (Scintilla feature 2114) public bool AutoCGetChooseSingle() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCHOOSESINGLE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCHOOSESINGLE, (IntPtr) Unused, (IntPtr) Unused); } /// Set whether case is significant when performing auto-completion searches. (Scintilla feature 2115) public void AutoCSetIgnoreCase(bool ignoreCase) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETIGNORECASE, ignoreCase ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETIGNORECASE, new IntPtr(ignoreCase ? 1 : 0), (IntPtr) Unused); } /// Retrieve state of ignore case flag. (Scintilla feature 2116) public bool AutoCGetIgnoreCase() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETIGNORECASE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETIGNORECASE, (IntPtr) Unused, (IntPtr) Unused); } /// Display a list of strings and send notification when user chooses one. (Scintilla feature 2117) @@ -1253,21 +1281,20 @@ public unsafe void UserListShow(int listType, string itemList) { fixed (byte* itemListPtr = Encoding.UTF8.GetBytes(itemList)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_USERLISTSHOW, listType, (IntPtr)itemListPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_USERLISTSHOW, (IntPtr) listType, (IntPtr) itemListPtr); } } /// Set whether or not autocompletion is hidden automatically when nothing matches. (Scintilla feature 2118) public void AutoCSetAutoHide(bool autoHide) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETAUTOHIDE, autoHide ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETAUTOHIDE, new IntPtr(autoHide ? 1 : 0), (IntPtr) Unused); } /// Retrieve whether or not autocompletion is hidden automatically when nothing matches. (Scintilla feature 2119) public bool AutoCGetAutoHide() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETAUTOHIDE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETAUTOHIDE, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1277,7 +1304,7 @@ public bool AutoCGetAutoHide() /// public void AutoCSetDropRestOfWord(bool dropRestOfWord) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETDROPRESTOFWORD, dropRestOfWord ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETDROPRESTOFWORD, new IntPtr(dropRestOfWord ? 1 : 0), (IntPtr) Unused); } /// @@ -1287,8 +1314,7 @@ public void AutoCSetDropRestOfWord(bool dropRestOfWord) /// public bool AutoCGetDropRestOfWord() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETDROPRESTOFWORD, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETDROPRESTOFWORD, (IntPtr) Unused, (IntPtr) Unused); } /// Register an XPM image for use in autocompletion lists. (Scintilla feature 2405) @@ -1296,21 +1322,20 @@ public unsafe void RegisterImage(int type, string xpmData) { fixed (byte* xpmDataPtr = Encoding.UTF8.GetBytes(xpmData)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERIMAGE, type, (IntPtr)xpmDataPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERIMAGE, (IntPtr) type, (IntPtr) xpmDataPtr); } } /// Clear all the registered XPM images. (Scintilla feature 2408) public void ClearRegisteredImages() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREGISTEREDIMAGES, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREGISTEREDIMAGES, (IntPtr) Unused, (IntPtr) Unused); } /// Retrieve the auto-completion list type-separator character. (Scintilla feature 2285) public int AutoCGetTypeSeparator() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETTYPESEPARATOR, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETTYPESEPARATOR, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1320,7 +1345,7 @@ public int AutoCGetTypeSeparator() /// public void AutoCSetTypeSeparator(int separatorCharacter) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETTYPESEPARATOR, separatorCharacter, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETTYPESEPARATOR, (IntPtr) separatorCharacter, (IntPtr) Unused); } /// @@ -1330,14 +1355,13 @@ public void AutoCSetTypeSeparator(int separatorCharacter) /// public void AutoCSetMaxWidth(int characterCount) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXWIDTH, characterCount, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXWIDTH, (IntPtr) characterCount, (IntPtr) Unused); } /// Get the maximum width, in characters, of auto-completion and user lists. (Scintilla feature 2209) public int AutoCGetMaxWidth() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXWIDTH, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXWIDTH, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1347,27 +1371,25 @@ public int AutoCGetMaxWidth() /// public void AutoCSetMaxHeight(int rowCount) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXHEIGHT, rowCount, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXHEIGHT, (IntPtr) rowCount, (IntPtr) Unused); } /// Set the maximum height, in rows, of auto-completion and user lists. (Scintilla feature 2211) public int AutoCGetMaxHeight() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXHEIGHT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXHEIGHT, (IntPtr) Unused, (IntPtr) Unused); } /// Set the number of spaces used for one level of indentation. (Scintilla feature 2122) public void SetIndent(int indentSize) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENT, indentSize, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENT, (IntPtr) indentSize, (IntPtr) Unused); } /// Retrieve indentation size. (Scintilla feature 2123) public int GetIndent() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENT, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1377,74 +1399,73 @@ public int GetIndent() /// public void SetUseTabs(bool useTabs) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUSETABS, useTabs ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETUSETABS, new IntPtr(useTabs ? 1 : 0), (IntPtr) Unused); } /// Retrieve whether tabs will be used in indentation. (Scintilla feature 2125) public bool GetUseTabs() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUSETABS, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETUSETABS, (IntPtr) Unused, (IntPtr) Unused); } /// Change the indentation of a line to a number of columns. (Scintilla feature 2126) - public void SetLineIndentation(int line, int indentSize) + public void SetLineIndentation(int line, int indentation) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEINDENTATION, line, indentSize); + Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEINDENTATION, (IntPtr) line, (IntPtr) indentation); } /// Retrieve the number of columns that a line is indented. (Scintilla feature 2127) public int GetLineIndentation(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTATION, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTATION, (IntPtr) line, (IntPtr) Unused); } /// Retrieve the position before the first non indentation character on a line. (Scintilla feature 2128) - public Position GetLineIndentPosition(int line) + public int GetLineIndentPosition(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTPOSITION, line, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTPOSITION, (IntPtr) line, (IntPtr) Unused); } /// Retrieve the column number of a position, taking tab width into account. (Scintilla feature 2129) - public int GetColumn(Position pos) + public int GetColumn(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCOLUMN, pos.Value, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCOLUMN, (IntPtr) pos, (IntPtr) Unused); } /// Count characters between two positions. (Scintilla feature 2633) - public int CountCharacters(int startPos, int endPos) + public int CountCharacters(int start, int end) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COUNTCHARACTERS, startPos, endPos); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_COUNTCHARACTERS, (IntPtr) start, (IntPtr) end); + } + + /// Count code units between two positions. (Scintilla feature 2715) + public int CountCodeUnits(int start, int end) + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_COUNTCODEUNITS, (IntPtr) start, (IntPtr) end); } /// Show or hide the horizontal scroll bar. (Scintilla feature 2130) - public void SetHScrollBar(bool show) + public void SetHScrollBar(bool visible) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHSCROLLBAR, show ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETHSCROLLBAR, new IntPtr(visible ? 1 : 0), (IntPtr) Unused); } /// Is the horizontal scroll bar visible? (Scintilla feature 2131) public bool GetHScrollBar() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHSCROLLBAR, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETHSCROLLBAR, (IntPtr) Unused, (IntPtr) Unused); } /// Show or hide indentation guides. (Scintilla feature 2132) - public void SetIndentationGuides(int indentView) + public void SetIndentationGuides(IndentView indentView) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENTATIONGUIDES, indentView, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENTATIONGUIDES, (IntPtr) indentView, (IntPtr) Unused); } /// Are the indentation guides visible? (Scintilla feature 2133) - public int GetIndentationGuides() + public IndentView GetIndentationGuides() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENTATIONGUIDES, Unused, Unused); - return (int)res; + return (IndentView)Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENTATIONGUIDES, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1454,120 +1475,109 @@ public int GetIndentationGuides() /// public void SetHighlightGuide(int column) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHIGHLIGHTGUIDE, column, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETHIGHLIGHTGUIDE, (IntPtr) column, (IntPtr) Unused); } /// Get the highlighted indentation guide column. (Scintilla feature 2135) public int GetHighlightGuide() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHIGHLIGHTGUIDE, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETHIGHLIGHTGUIDE, (IntPtr) Unused, (IntPtr) Unused); } /// Get the position after the last visible characters on a line. (Scintilla feature 2136) - public Position GetLineEndPosition(int line) + public int GetLineEndPosition(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDPOSITION, line, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDPOSITION, (IntPtr) line, (IntPtr) Unused); } /// Get the code page used to interpret the bytes of the document as characters. (Scintilla feature 2137) public int GetCodePage() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCODEPAGE, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCODEPAGE, (IntPtr) Unused, (IntPtr) Unused); } /// Get the foreground colour of the caret. (Scintilla feature 2138) public Colour GetCaretFore() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETFORE, Unused, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETFORE, (IntPtr) Unused, (IntPtr) Unused)); } /// In read-only mode? (Scintilla feature 2140) public bool GetReadOnly() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETREADONLY, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETREADONLY, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the position of the caret. (Scintilla feature 2141) - public void SetCurrentPos(Position pos) + public void SetCurrentPos(int caret) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCURRENTPOS, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCURRENTPOS, (IntPtr) caret, (IntPtr) Unused); } /// Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2142) - public void SetSelectionStart(Position pos) + public void SetSelectionStart(Int64 anchor) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONSTART, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONSTART, (IntPtr) anchor, (IntPtr) Unused); } /// Returns the position at the start of the selection. (Scintilla feature 2143) - public Position GetSelectionStart() + public int GetSelectionStart() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONSTART, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONSTART, (IntPtr) Unused, (IntPtr) Unused); } - /// Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2144) - public void SetSelectionEnd(Position pos) + /// Sets the position that ends the selection - this becomes the caret. (Scintilla feature 2144) + public void SetSelectionEnd(int caret) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONEND, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONEND, (IntPtr) caret, (IntPtr) Unused); } /// Returns the position at the end of the selection. (Scintilla feature 2145) - public Position GetSelectionEnd() + public int GetSelectionEnd() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEND, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEND, (IntPtr) Unused, (IntPtr) Unused); } /// Set caret to a position, while removing any existing selection. (Scintilla feature 2556) - public void SetEmptySelection(Position pos) + public void SetEmptySelection(int caret) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEMPTYSELECTION, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETEMPTYSELECTION, (IntPtr) caret, (IntPtr) Unused); } /// Sets the print magnification added to the point size of each style for printing. (Scintilla feature 2146) public void SetPrintMagnification(int magnification) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTMAGNIFICATION, magnification, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTMAGNIFICATION, (IntPtr) magnification, (IntPtr) Unused); } /// Returns the print magnification. (Scintilla feature 2147) public int GetPrintMagnification() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTMAGNIFICATION, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTMAGNIFICATION, (IntPtr) Unused, (IntPtr) Unused); } /// Modify colours when printing for clearer printed text. (Scintilla feature 2148) - public void SetPrintColourMode(int mode) + public void SetPrintColourMode(PrintOption mode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTCOLOURMODE, mode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTCOLOURMODE, (IntPtr) mode, (IntPtr) Unused); } /// Returns the print colour mode. (Scintilla feature 2149) - public int GetPrintColourMode() + public PrintOption GetPrintColourMode() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTCOLOURMODE, Unused, Unused); - return (int)res; + return (PrintOption)Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTCOLOURMODE, (IntPtr) Unused, (IntPtr) Unused); } /// Find some text in the document. (Scintilla feature 2150) - public Position FindText(int flags, TextToFind ft) + public int FindText(FindOption searchFlags, TextToFind ft) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDTEXT, flags, ft.NativePointer); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_FINDTEXT, (IntPtr) searchFlags, ft.NativePointer); } /// Retrieve the display line at the top of the display. (Scintilla feature 2152) public int GetFirstVisibleLine() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFIRSTVISIBLELINE, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETFIRSTVISIBLELINE, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1577,59 +1587,49 @@ public int GetFirstVisibleLine() /// public unsafe string GetLine(int line) { - int length = LineLength(line); - byte[] textBuffer = new byte[length + 2]; - fixed (byte* textPtr = textBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINE, line, (IntPtr)textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETLINE, (IntPtr)line); } /// Returns the number of lines in the document. There is always at least one. (Scintilla feature 2154) public int GetLineCount() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINECOUNT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINECOUNT, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the size in pixels of the left margin. (Scintilla feature 2155) public void SetMarginLeft(int pixelWidth) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINLEFT, Unused, pixelWidth); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINLEFT, (IntPtr) Unused, (IntPtr) pixelWidth); } /// Returns the size in pixels of the left margin. (Scintilla feature 2156) public int GetMarginLeft() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINLEFT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINLEFT, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the size in pixels of the right margin. (Scintilla feature 2157) public void SetMarginRight(int pixelWidth) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINRIGHT, Unused, pixelWidth); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINRIGHT, (IntPtr) Unused, (IntPtr) pixelWidth); } /// Returns the size in pixels of the right margin. (Scintilla feature 2158) public int GetMarginRight() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINRIGHT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINRIGHT, (IntPtr) Unused, (IntPtr) Unused); } /// Is the document different from when it was last saved? (Scintilla feature 2159) public bool GetModify() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMODIFY, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMODIFY, (IntPtr) Unused, (IntPtr) Unused); } /// Select a range of text. (Scintilla feature 2160) - public void SetSel(Position start, Position end) + public void SetSel(int anchor, int caret) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSEL, start.Value, end.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSEL, (IntPtr) anchor, (IntPtr) caret); } /// @@ -1640,12 +1640,7 @@ public void SetSel(Position start, Position end) /// public unsafe string GetSelText() { - byte[] textBuffer = new byte[10000]; - fixed (byte* textPtr = textBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELTEXT, Unused, (IntPtr)textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETSELTEXT); } /// @@ -1655,54 +1650,49 @@ public unsafe string GetSelText() /// public int GetTextRange(TextRange tr) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTRANGE, Unused, tr.NativePointer); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTRANGE, (IntPtr) Unused, tr.NativePointer); } - /// Draw the selection in normal style or with selection highlighted. (Scintilla feature 2163) - public void HideSelection(bool normal) + /// Draw the selection either highlighted or in normal (non-highlighted) style. (Scintilla feature 2163) + public void HideSelection(bool hide) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HIDESELECTION, normal ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_HIDESELECTION, new IntPtr(hide ? 1 : 0), (IntPtr) Unused); } /// Retrieve the x value of the point in the window where a position is displayed. (Scintilla feature 2164) - public int PointXFromPosition(Position pos) + public int PointXFromPosition(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POINTXFROMPOSITION, Unused, pos.Value); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POINTXFROMPOSITION, (IntPtr) Unused, (IntPtr) pos); } /// Retrieve the y value of the point in the window where a position is displayed. (Scintilla feature 2165) - public int PointYFromPosition(Position pos) + public int PointYFromPosition(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POINTYFROMPOSITION, Unused, pos.Value); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POINTYFROMPOSITION, (IntPtr) Unused, (IntPtr) pos); } /// Retrieve the line containing a position. (Scintilla feature 2166) - public int LineFromPosition(Position pos) + public int LineFromPosition(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEFROMPOSITION, pos.Value, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_LINEFROMPOSITION, (IntPtr) pos, (IntPtr) Unused); } /// Retrieve the position at the start of a line. (Scintilla feature 2167) - public Position PositionFromLine(int line) + public int PositionFromLine(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMLINE, line, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMLINE, (IntPtr) line, (IntPtr) Unused); } /// Scroll horizontally and vertically. (Scintilla feature 2168) public void LineScroll(int columns, int lines) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLL, columns, lines); + Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLL, (IntPtr) columns, (IntPtr) lines); } /// Ensure the caret is visible. (Scintilla feature 2169) public void ScrollCaret() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLCARET, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLCARET, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1711,9 +1701,9 @@ public void ScrollCaret() /// This may be used to make a search match visible. /// (Scintilla feature 2569) /// - public void ScrollRange(Position secondary, Position primary) + public void ScrollRange(int secondary, int primary) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLRANGE, secondary.Value, primary.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLRANGE, (IntPtr) secondary, (IntPtr) primary); } /// Replace the selected text with the argument text. (Scintilla feature 2170) @@ -1721,70 +1711,68 @@ public unsafe void ReplaceSel(string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACESEL, Unused, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_REPLACESEL, (IntPtr) Unused, (IntPtr) textPtr); } } /// Set to read only or read write. (Scintilla feature 2171) public void SetReadOnly(bool readOnly) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETREADONLY, readOnly ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETREADONLY, new IntPtr(readOnly ? 1 : 0), (IntPtr) Unused); } /// Null operation. (Scintilla feature 2172) public void Null() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_NULL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_NULL, (IntPtr) Unused, (IntPtr) Unused); } /// Will a paste succeed? (Scintilla feature 2173) public bool CanPaste() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANPASTE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_CANPASTE, (IntPtr) Unused, (IntPtr) Unused); } /// Are there any undoable actions in the undo history? (Scintilla feature 2174) public bool CanUndo() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANUNDO, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_CANUNDO, (IntPtr) Unused, (IntPtr) Unused); } /// Delete the undo history. (Scintilla feature 2175) public void EmptyUndoBuffer() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EMPTYUNDOBUFFER, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_EMPTYUNDOBUFFER, (IntPtr) Unused, (IntPtr) Unused); } /// Undo one action in the undo history. (Scintilla feature 2176) public void Undo() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_UNDO, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_UNDO, (IntPtr) Unused, (IntPtr) Unused); } /// Cut the selection to the clipboard. (Scintilla feature 2177) public void Cut() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CUT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CUT, (IntPtr) Unused, (IntPtr) Unused); } /// Copy the selection to the clipboard. (Scintilla feature 2178) public void Copy() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPY, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_COPY, (IntPtr) Unused, (IntPtr) Unused); } /// Paste the contents of the clipboard into the document replacing the selection. (Scintilla feature 2179) public void Paste() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PASTE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PASTE, (IntPtr) Unused, (IntPtr) Unused); } /// Clear the selection. (Scintilla feature 2180) public void Clear() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEAR, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEAR, (IntPtr) Unused, (IntPtr) Unused); } /// Replace the contents of the document with the argument text. (Scintilla feature 2181) @@ -1792,37 +1780,32 @@ public unsafe void SetText(string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTEXT, Unused, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETTEXT, (IntPtr) Unused, (IntPtr) textPtr); } } - /// - /// Retrieve all the text in the document. - /// Returns number of characters retrieved. - /// Result is NUL-terminated. - /// (Scintilla feature 2182) - /// - public unsafe string GetText(int length) + public unsafe string GetText(int length = -1) { + if (length < 1 && !TryGetLengthAsInt(out length)) + return ""; byte[] textBuffer = new byte[length]; fixed (byte* textPtr = textBuffer) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXT, length, (IntPtr)textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); + Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXT, length, (IntPtr)textPtr); + return Utf8BytesToNullStrippedString(textBuffer); } } /// Retrieve the number of characters in the document. (Scintilla feature 2183) public int GetTextLength() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTLENGTH, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTLENGTH, (IntPtr) Unused, (IntPtr) Unused); } /// Retrieve a pointer to a function that processes messages for this Scintilla. (Scintilla feature 2184) public IntPtr GetDirectFunction() { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTFUNCTION, Unused, Unused); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTFUNCTION, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1832,33 +1815,31 @@ public IntPtr GetDirectFunction() /// public IntPtr GetDirectPointer() { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTPOINTER, Unused, Unused); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTPOINTER, (IntPtr) Unused, (IntPtr) Unused); } /// Set to overtype (true) or insert mode. (Scintilla feature 2186) - public void SetOvertype(bool overtype) + public void SetOvertype(bool overType) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETOVERTYPE, overtype ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETOVERTYPE, new IntPtr(overType ? 1 : 0), (IntPtr) Unused); } /// Returns true if overtype mode is active otherwise false is returned. (Scintilla feature 2187) public bool GetOvertype() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETOVERTYPE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETOVERTYPE, (IntPtr) Unused, (IntPtr) Unused); } /// Set the width of the insert mode caret. (Scintilla feature 2188) public void SetCaretWidth(int pixelWidth) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETWIDTH, pixelWidth, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETWIDTH, (IntPtr) pixelWidth, (IntPtr) Unused); } /// Returns the width of the insert mode caret. (Scintilla feature 2189) public int GetCaretWidth() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETWIDTH, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETWIDTH, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1866,16 +1847,15 @@ public int GetCaretWidth() /// document without affecting the scroll position. /// (Scintilla feature 2190) /// - public void SetTargetStart(Position pos) + public void SetTargetStart(int start) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETSTART, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETSTART, (IntPtr) start, (IntPtr) Unused); } /// Get the position that starts the target. (Scintilla feature 2191) - public Position GetTargetStart() + public int GetTargetStart() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETSTART, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETSTART, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1883,33 +1863,39 @@ public Position GetTargetStart() /// document without affecting the scroll position. /// (Scintilla feature 2192) /// - public void SetTargetEnd(Position pos) + public void SetTargetEnd(int end) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETEND, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETEND, (IntPtr) end, (IntPtr) Unused); } /// Get the position that ends the target. (Scintilla feature 2193) - public Position GetTargetEnd() + public int GetTargetEnd() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETEND, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETEND, (IntPtr) Unused, (IntPtr) Unused); } /// Sets both the start and end of the target in one call. (Scintilla feature 2686) - public void SetTargetRange(Position start, Position end) + public void SetTargetRange(int start, int end) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETRANGE, start.Value, end.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETRANGE, (IntPtr) start, (IntPtr) end); } /// Retrieve the text in the target. (Scintilla feature 2687) public unsafe string GetTargetText() { - byte[] charactersBuffer = new byte[10000]; - fixed (byte* charactersPtr = charactersBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETTEXT, Unused, (IntPtr)charactersPtr); - return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETTARGETTEXT); + } + + /// Make the target range start and end be the same as the selection range start and end. (Scintilla feature 2287) + public void TargetFromSelection() + { + Win32.SendMessage(scintilla, SciMsg.SCI_TARGETFROMSELECTION, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Sets the target to the whole document. (Scintilla feature 2690) + public void TargetWholeDocument() + { + Win32.SendMessage(scintilla, SciMsg.SCI_TARGETWHOLEDOCUMENT, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -1922,8 +1908,7 @@ public unsafe int ReplaceTarget(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGET, length, (IntPtr)textPtr); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGET, (IntPtr) length, (IntPtr) textPtr); } } @@ -1940,129 +1925,121 @@ public unsafe int ReplaceTargetRE(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGETRE, length, (IntPtr)textPtr); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGETRE, (IntPtr) length, (IntPtr) textPtr); } } /// /// Search for a counted string in the target and set the target to the found /// range. Text is counted so it can contain NULs. - /// Returns length of range or -1 for failure in which case target is not moved. + /// Returns start of found range or -1 for failure in which case target is not moved. /// (Scintilla feature 2197) /// public unsafe int SearchInTarget(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHINTARGET, length, (IntPtr)textPtr); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHINTARGET, (IntPtr) length, (IntPtr) textPtr); } } /// Set the search flags used by SearchInTarget. (Scintilla feature 2198) - public void SetSearchFlags(int flags) + public void SetSearchFlags(FindOption searchFlags) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSEARCHFLAGS, flags, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSEARCHFLAGS, (IntPtr) searchFlags, (IntPtr) Unused); } /// Get the search flags used by SearchInTarget. (Scintilla feature 2199) - public int GetSearchFlags() + public FindOption GetSearchFlags() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSEARCHFLAGS, Unused, Unused); - return (int)res; + return (FindOption)Win32.SendMessage(scintilla, SciMsg.SCI_GETSEARCHFLAGS, (IntPtr) Unused, (IntPtr) Unused); } /// Show a call tip containing a definition near position pos. (Scintilla feature 2200) - public unsafe void CallTipShow(Position pos, string definition) + public unsafe void CallTipShow(int pos, string definition) { fixed (byte* definitionPtr = Encoding.UTF8.GetBytes(definition)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSHOW, pos.Value, (IntPtr)definitionPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSHOW, (IntPtr) pos, (IntPtr) definitionPtr); } } /// Remove the call tip from the screen. (Scintilla feature 2201) public void CallTipCancel() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPCANCEL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPCANCEL, (IntPtr) Unused, (IntPtr) Unused); } /// Is there an active call tip? (Scintilla feature 2202) public bool CallTipActive() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPACTIVE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPACTIVE, (IntPtr) Unused, (IntPtr) Unused); } /// Retrieve the position where the caret was before displaying the call tip. (Scintilla feature 2203) - public Position CallTipPosStart() + public int CallTipPosStart() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPPOSSTART, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPPOSSTART, (IntPtr) Unused, (IntPtr) Unused); } /// Set the start position in order to change when backspacing removes the calltip. (Scintilla feature 2214) public void CallTipSetPosStart(int posStart) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSSTART, posStart, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSSTART, (IntPtr) posStart, (IntPtr) Unused); } /// Highlight a segment of the definition. (Scintilla feature 2204) - public void CallTipSetHlt(int start, int end) + public void CallTipSetHlt(int highlightStart, int highlightEnd) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETHLT, start, end); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETHLT, (IntPtr) highlightStart, (IntPtr) highlightEnd); } /// Set the background colour for the call tip. (Scintilla feature 2205) public void CallTipSetBack(Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETBACK, back.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETBACK, back.Value, (IntPtr) Unused); } /// Set the foreground colour for the call tip. (Scintilla feature 2206) public void CallTipSetFore(Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFORE, fore.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFORE, fore.Value, (IntPtr) Unused); } /// Set the foreground colour for the highlighted part of the call tip. (Scintilla feature 2207) public void CallTipSetForeHlt(Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFOREHLT, fore.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFOREHLT, fore.Value, (IntPtr) Unused); } /// Enable use of STYLE_CALLTIP and set call tip tab size in pixels. (Scintilla feature 2212) public void CallTipUseStyle(int tabSize) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPUSESTYLE, tabSize, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPUSESTYLE, (IntPtr) tabSize, (IntPtr) Unused); } /// Set position of calltip, above or below text. (Scintilla feature 2213) public void CallTipSetPosition(bool above) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSITION, above ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSITION, new IntPtr(above ? 1 : 0), (IntPtr) Unused); } /// Find the display line of a document line taking hidden lines into account. (Scintilla feature 2220) - public int VisibleFromDocLine(int line) + public int VisibleFromDocLine(int docLine) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VISIBLEFROMDOCLINE, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_VISIBLEFROMDOCLINE, (IntPtr) docLine, (IntPtr) Unused); } /// Find the document line of a display line taking hidden lines into account. (Scintilla feature 2221) - public int DocLineFromVisible(int lineDisplay) + public int DocLineFromVisible(int displayLine) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCLINEFROMVISIBLE, lineDisplay, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_DOCLINEFROMVISIBLE, (IntPtr) displayLine, (IntPtr) Unused); } /// The number of display lines needed to wrap a document line (Scintilla feature 2235) - public int WrapCount(int line) + public int WrapCount(int docLine) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WRAPCOUNT, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_WRAPCOUNT, (IntPtr) docLine, (IntPtr) Unused); } /// @@ -2071,124 +2048,153 @@ public int WrapCount(int line) /// line is a header and whether it is effectively white space. /// (Scintilla feature 2222) /// - public void SetFoldLevel(int line, int level) + public void SetFoldLevel(int line, FoldLevel level) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDLEVEL, line, level); + Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDLEVEL, (IntPtr) line, (IntPtr) level); } /// Retrieve the fold level of a line. (Scintilla feature 2223) - public int GetFoldLevel(int line) + public FoldLevel GetFoldLevel(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDLEVEL, line, Unused); - return (int)res; + return (FoldLevel)Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDLEVEL, (IntPtr) line, (IntPtr) Unused); } /// Find the last child line of a header line. (Scintilla feature 2224) - public int GetLastChild(int line, int level) + public int GetLastChild(int line, FoldLevel level) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLASTCHILD, line, level); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLASTCHILD, (IntPtr) line, (IntPtr) level); } /// Find the parent line of a child line. (Scintilla feature 2225) public int GetFoldParent(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDPARENT, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDPARENT, (IntPtr) line, (IntPtr) Unused); } /// Make a range of lines visible. (Scintilla feature 2226) public void ShowLines(int lineStart, int lineEnd) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SHOWLINES, lineStart, lineEnd); + Win32.SendMessage(scintilla, SciMsg.SCI_SHOWLINES, (IntPtr) lineStart, (IntPtr) lineEnd); } /// Make a range of lines invisible. (Scintilla feature 2227) public void HideLines(int lineStart, int lineEnd) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HIDELINES, lineStart, lineEnd); + Win32.SendMessage(scintilla, SciMsg.SCI_HIDELINES, (IntPtr) lineStart, (IntPtr) lineEnd); } /// Is a line visible? (Scintilla feature 2228) public bool GetLineVisible(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEVISIBLE, line, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEVISIBLE, (IntPtr) line, (IntPtr) Unused); } /// Are all lines visible? (Scintilla feature 2236) public bool GetAllLinesVisible() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETALLLINESVISIBLE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETALLLINESVISIBLE, (IntPtr) Unused, (IntPtr) Unused); } /// Show the children of a header line. (Scintilla feature 2229) public void SetFoldExpanded(int line, bool expanded) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDEXPANDED, line, expanded ? 1 : 0); + Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDEXPANDED, (IntPtr) line, new IntPtr(expanded ? 1 : 0)); } /// Is a header line expanded? (Scintilla feature 2230) public bool GetFoldExpanded(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDEXPANDED, line, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDEXPANDED, (IntPtr) line, (IntPtr) Unused); } /// Switch a header line between expanded and contracted. (Scintilla feature 2231) public void ToggleFold(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLEFOLD, line, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLEFOLD, (IntPtr) line, (IntPtr) Unused); + } + + /// Switch a header line between expanded and contracted and show some text after the line. (Scintilla feature 2700) + public unsafe void ToggleFoldShowText(int line, string text) + { + fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) + { + Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLEFOLDSHOWTEXT, (IntPtr) line, (IntPtr) textPtr); + } + } + + /// Set the style of fold display text. (Scintilla feature 2701) + public void FoldDisplayTextSetStyle(FoldDisplayTextStyle style) + { + Win32.SendMessage(scintilla, SciMsg.SCI_FOLDDISPLAYTEXTSETSTYLE, (IntPtr) style, (IntPtr) Unused); + } + + /// Get the style of fold display text. (Scintilla feature 2707) + public FoldDisplayTextStyle FoldDisplayTextGetStyle() + { + return (FoldDisplayTextStyle)Win32.SendMessage(scintilla, SciMsg.SCI_FOLDDISPLAYTEXTGETSTYLE, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Set the default fold display text. (Scintilla feature 2722) + public unsafe void SetDefaultFoldDisplayText(string text) + { + fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETDEFAULTFOLDDISPLAYTEXT, (IntPtr) Unused, (IntPtr) textPtr); + } + } + + /// Get the default fold display text. (Scintilla feature 2723) + public unsafe string GetDefaultFoldDisplayText() + { + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETDEFAULTFOLDDISPLAYTEXT); } /// Expand or contract a fold header. (Scintilla feature 2237) - public void FoldLine(int line, int action) + public void FoldLine(int line, FoldAction action) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDLINE, line, action); + Win32.SendMessage(scintilla, SciMsg.SCI_FOLDLINE, (IntPtr) line, (IntPtr) action); } /// Expand or contract a fold header and its children. (Scintilla feature 2238) - public void FoldChildren(int line, int action) + public void FoldChildren(int line, FoldAction action) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDCHILDREN, line, action); + Win32.SendMessage(scintilla, SciMsg.SCI_FOLDCHILDREN, (IntPtr) line, (IntPtr) action); } /// Expand a fold header and all children. Use the level argument instead of the line's current level. (Scintilla feature 2239) - public void ExpandChildren(int line, int level) + public void ExpandChildren(int line, FoldLevel level) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EXPANDCHILDREN, line, level); + Win32.SendMessage(scintilla, SciMsg.SCI_EXPANDCHILDREN, (IntPtr) line, (IntPtr) level); } /// Expand or contract all fold headers. (Scintilla feature 2662) - public void FoldAll(int action) + public void FoldAll(FoldAction action) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDALL, action, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_FOLDALL, (IntPtr) action, (IntPtr) Unused); } /// Ensure a particular line is visible by expanding any header line hiding it. (Scintilla feature 2232) public void EnsureVisible(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLE, line, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLE, (IntPtr) line, (IntPtr) Unused); } /// Set automatic folding behaviours. (Scintilla feature 2663) - public void SetAutomaticFold(int automaticFold) + public void SetAutomaticFold(AutomaticFold automaticFold) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETAUTOMATICFOLD, automaticFold, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETAUTOMATICFOLD, (IntPtr) automaticFold, (IntPtr) Unused); } /// Get automatic folding behaviours. (Scintilla feature 2664) - public int GetAutomaticFold() + public AutomaticFold GetAutomaticFold() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETAUTOMATICFOLD, Unused, Unused); - return (int)res; + return (AutomaticFold)Win32.SendMessage(scintilla, SciMsg.SCI_GETAUTOMATICFOLD, (IntPtr) Unused, (IntPtr) Unused); } /// Set some style options for folding. (Scintilla feature 2233) - public void SetFoldFlags(int flags) + public void SetFoldFlags(FoldFlag flags) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDFLAGS, flags, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDFLAGS, (IntPtr) flags, (IntPtr) Unused); } /// @@ -2198,164 +2204,169 @@ public void SetFoldFlags(int flags) /// public void EnsureVisibleEnforcePolicy(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLEENFORCEPOLICY, line, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLEENFORCEPOLICY, (IntPtr) line, (IntPtr) Unused); } /// Sets whether a tab pressed when caret is within indentation indents. (Scintilla feature 2260) public void SetTabIndents(bool tabIndents) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTABINDENTS, tabIndents ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETTABINDENTS, new IntPtr(tabIndents ? 1 : 0), (IntPtr) Unused); } /// Does a tab pressed when caret is within indentation indent? (Scintilla feature 2261) public bool GetTabIndents() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTABINDENTS, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTABINDENTS, (IntPtr) Unused, (IntPtr) Unused); } /// Sets whether a backspace pressed when caret is within indentation unindents. (Scintilla feature 2262) public void SetBackSpaceUnIndents(bool bsUnIndents) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETBACKSPACEUNINDENTS, bsUnIndents ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETBACKSPACEUNINDENTS, new IntPtr(bsUnIndents ? 1 : 0), (IntPtr) Unused); } /// Does a backspace pressed when caret is within indentation unindent? (Scintilla feature 2263) public bool GetBackSpaceUnIndents() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETBACKSPACEUNINDENTS, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETBACKSPACEUNINDENTS, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the time the mouse must sit still to generate a mouse dwell event. (Scintilla feature 2264) public void SetMouseDwellTime(int periodMilliseconds) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDWELLTIME, periodMilliseconds, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDWELLTIME, (IntPtr) periodMilliseconds, (IntPtr) Unused); } /// Retrieve the time the mouse must sit still to generate a mouse dwell event. (Scintilla feature 2265) public int GetMouseDwellTime() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDWELLTIME, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDWELLTIME, (IntPtr) Unused, (IntPtr) Unused); } /// Get position of start of word. (Scintilla feature 2266) - public int WordStartPosition(Position pos, bool onlyWordCharacters) + public int WordStartPosition(int pos, bool onlyWordCharacters) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDSTARTPOSITION, pos.Value, onlyWordCharacters ? 1 : 0); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_WORDSTARTPOSITION, (IntPtr) pos, new IntPtr(onlyWordCharacters ? 1 : 0)); } /// Get position of end of word. (Scintilla feature 2267) - public int WordEndPosition(Position pos, bool onlyWordCharacters) + public int WordEndPosition(int pos, bool onlyWordCharacters) + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_WORDENDPOSITION, (IntPtr) pos, new IntPtr(onlyWordCharacters ? 1 : 0)); + } + + /// Is the range start..end considered a word? (Scintilla feature 2691) + public bool IsRangeWord(int start, int end) + { + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_ISRANGEWORD, (IntPtr) start, (IntPtr) end); + } + + /// Sets limits to idle styling. (Scintilla feature 2692) + public void SetIdleStyling(IdleStyling idleStyling) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDENDPOSITION, pos.Value, onlyWordCharacters ? 1 : 0); - return (int)res; + Win32.SendMessage(scintilla, SciMsg.SCI_SETIDLESTYLING, (IntPtr) idleStyling, (IntPtr) Unused); + } + + /// Retrieve the limits to idle styling. (Scintilla feature 2693) + public IdleStyling GetIdleStyling() + { + return (IdleStyling)Win32.SendMessage(scintilla, SciMsg.SCI_GETIDLESTYLING, (IntPtr) Unused, (IntPtr) Unused); } /// Sets whether text is word wrapped. (Scintilla feature 2268) - public void SetWrapMode(int mode) + public void SetWrapMode(Wrap wrapMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPMODE, mode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPMODE, (IntPtr) wrapMode, (IntPtr) Unused); } /// Retrieve whether text is word wrapped. (Scintilla feature 2269) - public int GetWrapMode() + public Wrap GetWrapMode() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPMODE, Unused, Unused); - return (int)res; + return (Wrap)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPMODE, (IntPtr) Unused, (IntPtr) Unused); } /// Set the display mode of visual flags for wrapped lines. (Scintilla feature 2460) - public void SetWrapVisualFlags(int wrapVisualFlags) + public void SetWrapVisualFlags(WrapVisualFlag wrapVisualFlags) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGS, (IntPtr) wrapVisualFlags, (IntPtr) Unused); } /// Retrive the display mode of visual flags for wrapped lines. (Scintilla feature 2461) - public int GetWrapVisualFlags() + public WrapVisualFlag GetWrapVisualFlags() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGS, Unused, Unused); - return (int)res; + return (WrapVisualFlag)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGS, (IntPtr) Unused, (IntPtr) Unused); } /// Set the location of visual flags for wrapped lines. (Scintilla feature 2462) - public void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation) + public void SetWrapVisualFlagsLocation(WrapVisualLocation wrapVisualFlagsLocation) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGSLOCATION, (IntPtr) wrapVisualFlagsLocation, (IntPtr) Unused); } /// Retrive the location of visual flags for wrapped lines. (Scintilla feature 2463) - public int GetWrapVisualFlagsLocation() + public WrapVisualLocation GetWrapVisualFlagsLocation() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGSLOCATION, Unused, Unused); - return (int)res; + return (WrapVisualLocation)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGSLOCATION, (IntPtr) Unused, (IntPtr) Unused); } /// Set the start indent for wrapped lines. (Scintilla feature 2464) public void SetWrapStartIndent(int indent) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPSTARTINDENT, indent, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPSTARTINDENT, (IntPtr) indent, (IntPtr) Unused); } /// Retrive the start indent for wrapped lines. (Scintilla feature 2465) public int GetWrapStartIndent() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPSTARTINDENT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPSTARTINDENT, (IntPtr) Unused, (IntPtr) Unused); } /// Sets how wrapped sublines are placed. Default is fixed. (Scintilla feature 2472) - public void SetWrapIndentMode(int mode) + public void SetWrapIndentMode(WrapIndentMode wrapIndentMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPINDENTMODE, mode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPINDENTMODE, (IntPtr) wrapIndentMode, (IntPtr) Unused); } /// Retrieve how wrapped sublines are placed. Default is fixed. (Scintilla feature 2473) - public int GetWrapIndentMode() + public WrapIndentMode GetWrapIndentMode() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPINDENTMODE, Unused, Unused); - return (int)res; + return (WrapIndentMode)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPINDENTMODE, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the degree of caching of layout information. (Scintilla feature 2272) - public void SetLayoutCache(int mode) + public void SetLayoutCache(LineCache cacheMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLAYOUTCACHE, mode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETLAYOUTCACHE, (IntPtr) cacheMode, (IntPtr) Unused); } /// Retrieve the degree of caching of layout information. (Scintilla feature 2273) - public int GetLayoutCache() + public LineCache GetLayoutCache() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLAYOUTCACHE, Unused, Unused); - return (int)res; + return (LineCache)Win32.SendMessage(scintilla, SciMsg.SCI_GETLAYOUTCACHE, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the document width assumed for scrolling. (Scintilla feature 2274) public void SetScrollWidth(int pixelWidth) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTH, pixelWidth, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTH, (IntPtr) pixelWidth, (IntPtr) Unused); } /// Retrieve the document width assumed for scrolling. (Scintilla feature 2275) public int GetScrollWidth() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTH, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTH, (IntPtr) Unused, (IntPtr) Unused); } /// Sets whether the maximum width line displayed is used to set scroll width. (Scintilla feature 2516) public void SetScrollWidthTracking(bool tracking) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTHTRACKING, tracking ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTHTRACKING, new IntPtr(tracking ? 1 : 0), (IntPtr) Unused); } /// Retrieve whether the scroll width tracks wide lines. (Scintilla feature 2517) public bool GetScrollWidthTracking() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTHTRACKING, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTHTRACKING, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2368,8 +2379,7 @@ public unsafe int TextWidth(int style, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TEXTWIDTH, style, (IntPtr)textPtr); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_TEXTWIDTH, (IntPtr) style, (IntPtr) textPtr); } } @@ -2381,7 +2391,7 @@ public unsafe int TextWidth(int style, string text) /// public void SetEndAtLastLine(bool endAtLastLine) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETENDATLASTLINE, endAtLastLine ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETENDATLASTLINE, new IntPtr(endAtLastLine ? 1 : 0), (IntPtr) Unused); } /// @@ -2391,28 +2401,25 @@ public void SetEndAtLastLine(bool endAtLastLine) /// public bool GetEndAtLastLine() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETENDATLASTLINE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETENDATLASTLINE, (IntPtr) Unused, (IntPtr) Unused); } /// Retrieve the height of a particular line of text in pixels. (Scintilla feature 2279) public int TextHeight(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TEXTHEIGHT, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_TEXTHEIGHT, (IntPtr) line, (IntPtr) Unused); } /// Show or hide the vertical scroll bar. (Scintilla feature 2280) - public void SetVScrollBar(bool show) + public void SetVScrollBar(bool visible) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVSCROLLBAR, show ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETVSCROLLBAR, new IntPtr(visible ? 1 : 0), (IntPtr) Unused); } /// Is the vertical scroll bar visible? (Scintilla feature 2281) public bool GetVScrollBar() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVSCROLLBAR, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETVSCROLLBAR, (IntPtr) Unused, (IntPtr) Unused); } /// Append a string to the end of the document without changing the selection. (Scintilla feature 2282) @@ -2420,32 +2427,14 @@ public unsafe void AppendText(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_APPENDTEXT, length, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_APPENDTEXT, (IntPtr) length, (IntPtr) textPtr); } } - /// Is drawing done in two phases with backgrounds drawn before foregrounds? (Scintilla feature 2283) - public bool GetTwoPhaseDraw() - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTWOPHASEDRAW, Unused, Unused); - return 1 == (int)res; - } - - /// - /// In twoPhaseDraw mode, drawing is performed in two phases, first the background - /// and then the foreground. This avoids chopping off characters that overlap the next run. - /// (Scintilla feature 2284) - /// - public void SetTwoPhaseDraw(bool twoPhase) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTWOPHASEDRAW, twoPhase ? 1 : 0, Unused); - } - /// How many phases is drawing done in? (Scintilla feature 2673) - public int GetPhasesDraw() + public PhasesDraw GetPhasesDraw() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPHASESDRAW, Unused, Unused); - return (int)res; + return (PhasesDraw)Win32.SendMessage(scintilla, SciMsg.SCI_GETPHASESDRAW, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2455,41 +2444,39 @@ public int GetPhasesDraw() /// to overlap from one line to the next. /// (Scintilla feature 2674) /// - public void SetPhasesDraw(int phases) + public void SetPhasesDraw(PhasesDraw phases) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPHASESDRAW, phases, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETPHASESDRAW, (IntPtr) phases, (IntPtr) Unused); } /// Choose the quality level for text from the FontQuality enumeration. (Scintilla feature 2611) - public void SetFontQuality(int fontQuality) + public void SetFontQuality(FontQuality fontQuality) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFONTQUALITY, fontQuality, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETFONTQUALITY, (IntPtr) fontQuality, (IntPtr) Unused); } /// Retrieve the quality level for text. (Scintilla feature 2612) - public int GetFontQuality() + public FontQuality GetFontQuality() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFONTQUALITY, Unused, Unused); - return (int)res; + return (FontQuality)Win32.SendMessage(scintilla, SciMsg.SCI_GETFONTQUALITY, (IntPtr) Unused, (IntPtr) Unused); } /// Scroll so that a display line is at the top of the display. (Scintilla feature 2613) - public void SetFirstVisibleLine(int lineDisplay) + public void SetFirstVisibleLine(int displayLine) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFIRSTVISIBLELINE, lineDisplay, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETFIRSTVISIBLELINE, (IntPtr) displayLine, (IntPtr) Unused); } /// Change the effect of pasting when there are multiple selections. (Scintilla feature 2614) - public void SetMultiPaste(int multiPaste) + public void SetMultiPaste(MultiPaste multiPaste) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPASTE, multiPaste, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPASTE, (IntPtr) multiPaste, (IntPtr) Unused); } - /// Retrieve the effect of pasting when there are multiple selections.. (Scintilla feature 2615) - public int GetMultiPaste() + /// Retrieve the effect of pasting when there are multiple selections. (Scintilla feature 2615) + public MultiPaste GetMultiPaste() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPASTE, Unused, Unused); - return (int)res; + return (MultiPaste)Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPASTE, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2499,24 +2486,17 @@ public int GetMultiPaste() /// public unsafe string GetTag(int tagNumber) { - byte[] tagValueBuffer = new byte[10000]; - fixed (byte* tagValuePtr = tagValueBuffer) + if (tagNumber < 0) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTAG, tagNumber, (IntPtr)tagValuePtr); - return Encoding.UTF8.GetString(tagValueBuffer).TrimEnd('\0'); + throw new ArgumentException("tagNumber must be non-negative integer"); } - } - - /// Make the target range start and end be the same as the selection range start and end. (Scintilla feature 2287) - public void TargetFromSelection() - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TARGETFROMSELECTION, Unused, Unused); + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETTAG, (IntPtr)tagNumber); } /// Join the lines in the target. (Scintilla feature 2288) public void LinesJoin() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESJOIN, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINESJOIN, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2526,181 +2506,193 @@ public void LinesJoin() /// public void LinesSplit(int pixelWidth) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESSPLIT, pixelWidth, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINESSPLIT, (IntPtr) pixelWidth, (IntPtr) Unused); } - /// Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2290) + /// Set one of the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2290) public void SetFoldMarginColour(bool useSetting, Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINCOLOUR, useSetting ? 1 : 0, back.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINCOLOUR, new IntPtr(useSetting ? 1 : 0), back.Value); } - /// Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2291) + /// Set the other colour used as a chequerboard pattern in the fold margin (Scintilla feature 2291) public void SetFoldMarginHiColour(bool useSetting, Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINHICOLOUR, useSetting ? 1 : 0, fore.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINHICOLOUR, new IntPtr(useSetting ? 1 : 0), fore.Value); + } + + /// Enable or disable accessibility. (Scintilla feature 2702) + public void SetAccessibility(Accessibility accessibility) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETACCESSIBILITY, (IntPtr) accessibility, (IntPtr) Unused); + } + + /// Report accessibility status. (Scintilla feature 2703) + public Accessibility GetAccessibility() + { + return (Accessibility)Win32.SendMessage(scintilla, SciMsg.SCI_GETACCESSIBILITY, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret down one line. (Scintilla feature 2300) public void LineDown() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWN, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWN, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret down one line extending selection to new caret position. (Scintilla feature 2301) public void LineDownExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret up one line. (Scintilla feature 2302) public void LineUp() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEUP, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret up one line extending selection to new caret position. (Scintilla feature 2303) public void LineUpExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret left one character. (Scintilla feature 2304) public void CharLeft() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFT, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret left one character extending selection to new caret position. (Scintilla feature 2305) public void CharLeftExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret right one character. (Scintilla feature 2306) public void CharRight() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHT, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret right one character extending selection to new caret position. (Scintilla feature 2307) public void CharRightExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret left one word. (Scintilla feature 2308) public void WordLeft() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFT, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret left one word extending selection to new caret position. (Scintilla feature 2309) public void WordLeftExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret right one word. (Scintilla feature 2310) public void WordRight() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHT, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret right one word extending selection to new caret position. (Scintilla feature 2311) public void WordRightExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to first position on line. (Scintilla feature 2312) public void Home() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOME, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_HOME, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to first position on line extending selection to new caret position. (Scintilla feature 2313) public void HomeExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_HOMEEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to last position on line. (Scintilla feature 2314) public void LineEnd() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to last position on line extending selection to new caret position. (Scintilla feature 2315) public void LineEndExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to first position in document. (Scintilla feature 2316) public void DocumentStart() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTART, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTART, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to first position in document extending selection to new caret position. (Scintilla feature 2317) public void DocumentStartExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTARTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTARTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to last position in document. (Scintilla feature 2318) public void DocumentEnd() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to last position in document extending selection to new caret position. (Scintilla feature 2319) public void DocumentEndExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTENDEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTENDEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret one page up. (Scintilla feature 2320) public void PageUp() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUP, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret one page up extending selection to new caret position. (Scintilla feature 2321) public void PageUpExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret one page down. (Scintilla feature 2322) public void PageDown() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWN, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWN, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret one page down extending selection to new caret position. (Scintilla feature 2323) public void PageDownExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Switch from insert to overtype mode or the reverse. (Scintilla feature 2324) public void EditToggleOvertype() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EDITTOGGLEOVERTYPE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_EDITTOGGLEOVERTYPE, (IntPtr) Unused, (IntPtr) Unused); } /// Cancel any modes such as call tip or auto-completion list display. (Scintilla feature 2325) public void Cancel() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANCEL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CANCEL, (IntPtr) Unused, (IntPtr) Unused); } /// Delete the selection or if no selection, the character before the caret. (Scintilla feature 2326) public void DeleteBack() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACK, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACK, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2710,25 +2702,25 @@ public void DeleteBack() /// public void Tab() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TAB, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_TAB, (IntPtr) Unused, (IntPtr) Unused); } /// Dedent the selected lines. (Scintilla feature 2328) public void BackTab() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BACKTAB, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_BACKTAB, (IntPtr) Unused, (IntPtr) Unused); } /// Insert a new line, may use a CRLF, CR or LF depending on EOL mode. (Scintilla feature 2329) public void NewLine() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_NEWLINE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_NEWLINE, (IntPtr) Unused, (IntPtr) Unused); } /// Insert a Form Feed character. (Scintilla feature 2330) public void FormFeed() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FORMFEED, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_FORMFEED, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2738,91 +2730,97 @@ public void FormFeed() /// public void VCHome() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOME, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_VCHOME, (IntPtr) Unused, (IntPtr) Unused); } /// Like VCHome but extending selection to new caret position. (Scintilla feature 2332) public void VCHomeExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Magnify the displayed text by increasing the sizes by 1 point. (Scintilla feature 2333) public void ZoomIn() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMIN, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMIN, (IntPtr) Unused, (IntPtr) Unused); } /// Make the displayed text smaller by decreasing the sizes by 1 point. (Scintilla feature 2334) public void ZoomOut() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMOUT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMOUT, (IntPtr) Unused, (IntPtr) Unused); } /// Delete the word to the left of the caret. (Scintilla feature 2335) public void DelWordLeft() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDLEFT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDLEFT, (IntPtr) Unused, (IntPtr) Unused); } /// Delete the word to the right of the caret. (Scintilla feature 2336) public void DelWordRight() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHT, (IntPtr) Unused, (IntPtr) Unused); } /// Delete the word to the right of the caret, but not the trailing non-word characters. (Scintilla feature 2518) public void DelWordRightEnd() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Cut the line containing the caret. (Scintilla feature 2337) public void LineCut() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINECUT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINECUT, (IntPtr) Unused, (IntPtr) Unused); } /// Delete the line containing the caret. (Scintilla feature 2338) public void LineDelete() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDELETE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEDELETE, (IntPtr) Unused, (IntPtr) Unused); } /// Switch the current line with the previous. (Scintilla feature 2339) public void LineTranspose() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINETRANSPOSE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINETRANSPOSE, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Reverse order of selected lines. (Scintilla feature 2354) + public void LineReverse() + { + Win32.SendMessage(scintilla, SciMsg.SCI_LINEREVERSE, (IntPtr) Unused, (IntPtr) Unused); } /// Duplicate the current line. (Scintilla feature 2404) public void LineDuplicate() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDUPLICATE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEDUPLICATE, (IntPtr) Unused, (IntPtr) Unused); } /// Transform the selection to lower case. (Scintilla feature 2340) public void LowerCase() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LOWERCASE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LOWERCASE, (IntPtr) Unused, (IntPtr) Unused); } /// Transform the selection to upper case. (Scintilla feature 2341) public void UpperCase() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_UPPERCASE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_UPPERCASE, (IntPtr) Unused, (IntPtr) Unused); } /// Scroll the document down, keeping the caret visible. (Scintilla feature 2342) public void LineScrollDown() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLDOWN, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLDOWN, (IntPtr) Unused, (IntPtr) Unused); } /// Scroll the document up, keeping the caret visible. (Scintilla feature 2343) public void LineScrollUp() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLUP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLUP, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2832,13 +2830,13 @@ public void LineScrollUp() /// public void DeleteBackNotLine() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACKNOTLINE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACKNOTLINE, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to first position on display line. (Scintilla feature 2345) public void HomeDisplay() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAY, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAY, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2848,13 +2846,13 @@ public void HomeDisplay() /// public void HomeDisplayExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAYEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAYEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to last position on display line. (Scintilla feature 2347) public void LineEndDisplay() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAY, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAY, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -2864,173 +2862,155 @@ public void LineEndDisplay() /// public void LineEndDisplayExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAYEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAYEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like Home but when word-wrap is enabled goes first to start of display line + /// HomeDisplay, then to start of document line Home. /// (Scintilla feature 2349) /// public void HomeWrap() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAP, (IntPtr) Unused, (IntPtr) Unused); } /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like HomeExtend but when word-wrap is enabled extends first to start of display line + /// HomeDisplayExtend, then to start of document line HomeExtend. /// (Scintilla feature 2450) /// public void HomeWrapExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAPEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAPEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like LineEnd but when word-wrap is enabled goes first to end of display line + /// LineEndDisplay, then to start of document line LineEnd. /// (Scintilla feature 2451) /// public void LineEndWrap() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAP, (IntPtr) Unused, (IntPtr) Unused); } /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like LineEndExtend but when word-wrap is enabled extends first to end of display line + /// LineEndDisplayExtend, then to start of document line LineEndExtend. /// (Scintilla feature 2452) /// public void LineEndWrapExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAPEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAPEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like VCHome but when word-wrap is enabled goes first to start of display line + /// VCHomeDisplay, then behaves like VCHome. /// (Scintilla feature 2453) /// public void VCHomeWrap() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAP, (IntPtr) Unused, (IntPtr) Unused); } /// - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like VCHomeExtend but when word-wrap is enabled extends first to start of display line + /// VCHomeDisplayExtend, then behaves like VCHomeExtend. /// (Scintilla feature 2454) /// public void VCHomeWrapExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAPEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAPEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Copy the line containing the caret. (Scintilla feature 2455) public void LineCopy() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINECOPY, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINECOPY, (IntPtr) Unused, (IntPtr) Unused); } /// Move the caret inside current view if it's not there already. (Scintilla feature 2401) public void MoveCaretInsideView() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVECARETINSIDEVIEW, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_MOVECARETINSIDEVIEW, (IntPtr) Unused, (IntPtr) Unused); } /// How many characters are on a line, including end of line characters? (Scintilla feature 2350) public int LineLength(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINELENGTH, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_LINELENGTH, (IntPtr) line, (IntPtr) Unused); } /// Highlight the characters at two positions. (Scintilla feature 2351) - public void BraceHighlight(Position pos1, Position pos2) + public void BraceHighlight(int posA, int posB) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHT, pos1.Value, pos2.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHT, (IntPtr) posA, (IntPtr) posB); } /// Use specified indicator to highlight matching braces instead of changing their style. (Scintilla feature 2498) - public void BraceHighlightIndicator(bool useBraceHighlightIndicator, int indicator) + public void BraceHighlightIndicator(bool useSetting, int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHTINDICATOR, useBraceHighlightIndicator ? 1 : 0, indicator); + Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHTINDICATOR, new IntPtr(useSetting ? 1 : 0), (IntPtr) indicator); } /// Highlight the character at a position indicating there is no matching brace. (Scintilla feature 2352) - public void BraceBadLight(Position pos) + public void BraceBadLight(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHT, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHT, (IntPtr) pos, (IntPtr) Unused); } /// Use specified indicator to highlight non matching brace instead of changing its style. (Scintilla feature 2499) - public void BraceBadLightIndicator(bool useBraceBadLightIndicator, int indicator) + public void BraceBadLightIndicator(bool useSetting, int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHTINDICATOR, useBraceBadLightIndicator ? 1 : 0, indicator); + Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHTINDICATOR, new IntPtr(useSetting ? 1 : 0), (IntPtr) indicator); } - /// Find the position of a matching brace or INVALID_POSITION if no match. (Scintilla feature 2353) - public Position BraceMatch(Position pos) + /// + /// Find the position of a matching brace or INVALID_POSITION if no match. + /// The maxReStyle must be 0 for now. It may be defined in a future release. + /// (Scintilla feature 2353) + /// + public int BraceMatch(int pos, int maxReStyle) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEMATCH, pos.Value, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_BRACEMATCH, (IntPtr) pos, (IntPtr) maxReStyle); } /// Are the end of line characters visible? (Scintilla feature 2355) public bool GetViewEOL() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWEOL, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWEOL, (IntPtr) Unused, (IntPtr) Unused); } /// Make the end of line characters visible or invisible. (Scintilla feature 2356) public void SetViewEOL(bool visible) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWEOL, visible ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWEOL, new IntPtr(visible ? 1 : 0), (IntPtr) Unused); } /// Retrieve a pointer to the document object. (Scintilla feature 2357) public IntPtr GetDocPointer() { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCPOINTER, Unused, Unused); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCPOINTER, (IntPtr) Unused, (IntPtr) Unused); } /// Change the document object used. (Scintilla feature 2358) - public void SetDocPointer(IntPtr pointer) + public void SetDocPointer(IntPtr doc) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETDOCPOINTER, Unused, pointer); + Win32.SendMessage(scintilla, SciMsg.SCI_SETDOCPOINTER, (IntPtr) Unused, (IntPtr) doc); } /// Set which document modification events are sent to the container. (Scintilla feature 2359) - public void SetModEventMask(int mask) + public void SetModEventMask(ModificationFlags eventMask) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMODEVENTMASK, mask, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMODEVENTMASK, (IntPtr) eventMask, (IntPtr) Unused); } /// Retrieve the column number which text should be kept within. (Scintilla feature 2360) public int GetEdgeColumn() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLUMN, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLUMN, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3040,43 +3020,53 @@ public int GetEdgeColumn() /// public void SetEdgeColumn(int column) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLUMN, column, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLUMN, (IntPtr) column, (IntPtr) Unused); } /// Retrieve the edge highlight mode. (Scintilla feature 2362) - public int GetEdgeMode() + public EdgeVisualStyle GetEdgeMode() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGEMODE, Unused, Unused); - return (int)res; + return (EdgeVisualStyle)Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGEMODE, (IntPtr) Unused, (IntPtr) Unused); } /// - /// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that + /// The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that /// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). /// (Scintilla feature 2363) /// - public void SetEdgeMode(int mode) + public void SetEdgeMode(EdgeVisualStyle edgeMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGEMODE, mode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGEMODE, (IntPtr) edgeMode, (IntPtr) Unused); } /// Retrieve the colour used in edge indication. (Scintilla feature 2364) public Colour GetEdgeColour() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLOUR, Unused, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLOUR, (IntPtr) Unused, (IntPtr) Unused)); } /// Change the colour used in edge indication. (Scintilla feature 2365) public void SetEdgeColour(Colour edgeColour) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLOUR, edgeColour.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLOUR, edgeColour.Value, (IntPtr) Unused); + } + + /// Add a new vertical edge to the view. (Scintilla feature 2694) + public void MultiEdgeAddLine(int column, Colour edgeColour) + { + Win32.SendMessage(scintilla, SciMsg.SCI_MULTIEDGEADDLINE, (IntPtr) column, edgeColour.Value); + } + + /// Clear all vertical edges. (Scintilla feature 2695) + public void MultiEdgeClearAll() + { + Win32.SendMessage(scintilla, SciMsg.SCI_MULTIEDGECLEARALL, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the current caret position to be the search anchor. (Scintilla feature 2366) public void SearchAnchor() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHANCHOR, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHANCHOR, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3084,12 +3074,11 @@ public void SearchAnchor() /// Does not ensure the selection is visible. /// (Scintilla feature 2367) /// - public unsafe int SearchNext(int flags, string text) + public unsafe int SearchNext(FindOption searchFlags, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHNEXT, flags, (IntPtr)textPtr); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHNEXT, (IntPtr) searchFlags, (IntPtr) textPtr); } } @@ -3098,37 +3087,34 @@ public unsafe int SearchNext(int flags, string text) /// Does not ensure the selection is visible. /// (Scintilla feature 2368) /// - public unsafe int SearchPrev(int flags, string text) + public unsafe int SearchPrev(FindOption searchFlags, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHPREV, flags, (IntPtr)textPtr); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHPREV, (IntPtr) searchFlags, (IntPtr) textPtr); } } /// Retrieves the number of lines completely visible. (Scintilla feature 2370) public int LinesOnScreen() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESONSCREEN, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_LINESONSCREEN, (IntPtr) Unused, (IntPtr) Unused); } /// /// Set whether a pop up menu is displayed automatically when the user presses - /// the wrong mouse button. + /// the wrong mouse button on certain areas. /// (Scintilla feature 2371) /// - public void UsePopUp(bool allowPopUp) + public void UsePopUp(PopUp popUpMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_USEPOPUP, allowPopUp ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_USEPOPUP, (IntPtr) popUpMode, (IntPtr) Unused); } /// Is the selection rectangular? The alternative is the more common stream selection. (Scintilla feature 2372) public bool SelectionIsRectangle() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONISRECTANGLE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONISRECTANGLE, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3136,16 +3122,15 @@ public bool SelectionIsRectangle() /// It may be positive to magnify or negative to reduce. /// (Scintilla feature 2373) /// - public void SetZoom(int zoom) + public void SetZoom(int zoomInPoints) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETZOOM, zoom, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETZOOM, (IntPtr) zoomInPoints, (IntPtr) Unused); } /// Retrieve the zoom level. (Scintilla feature 2374) public int GetZoom() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETZOOM, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETZOOM, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3153,81 +3138,105 @@ public int GetZoom() /// Starts with reference count of 1 and not selected into editor. /// (Scintilla feature 2375) /// - public int CreateDocument() + public IntPtr CreateDocument(int bytes, DocumentOption documentOptions) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CREATEDOCUMENT, Unused, Unused); - return (int)res; + return Win32.SendMessage(scintilla, SciMsg.SCI_CREATEDOCUMENT, (IntPtr) bytes, (IntPtr) documentOptions); } /// Extend life of document. (Scintilla feature 2376) - public void AddRefDocument(int doc) + public void AddRefDocument(IntPtr doc) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDREFDOCUMENT, Unused, doc); + Win32.SendMessage(scintilla, SciMsg.SCI_ADDREFDOCUMENT, (IntPtr) Unused, (IntPtr) doc); } /// Release a reference to the document, deleting document if it fades to black. (Scintilla feature 2377) - public void ReleaseDocument(int doc) + public void ReleaseDocument(IntPtr doc) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEDOCUMENT, Unused, doc); + Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEDOCUMENT, (IntPtr) Unused, (IntPtr) doc); + } + + /// Get which document options are set. (Scintilla feature 2379) + public DocumentOption GetDocumentOptions() + { + return (DocumentOption)Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCUMENTOPTIONS, (IntPtr) Unused, (IntPtr) Unused); } /// Get which document modification events are sent to the container. (Scintilla feature 2378) - public int GetModEventMask() + public ModificationFlags GetModEventMask() + { + return (ModificationFlags)Win32.SendMessage(scintilla, SciMsg.SCI_GETMODEVENTMASK, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Set whether command events are sent to the container. (Scintilla feature 2717) + public void SetCommandEvents(bool commandEvents) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETCOMMANDEVENTS, new IntPtr(commandEvents ? 1 : 0), (IntPtr) Unused); + } + + /// Get whether command events are sent to the container. (Scintilla feature 2718) + public bool GetCommandEvents() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMODEVENTMASK, Unused, Unused); - return (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCOMMANDEVENTS, (IntPtr) Unused, (IntPtr) Unused); } /// Change internal focus flag. (Scintilla feature 2380) public void SetFocus(bool focus) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOCUS, focus ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETFOCUS, new IntPtr(focus ? 1 : 0), (IntPtr) Unused); } /// Get internal focus flag. (Scintilla feature 2381) public bool GetFocus() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOCUS, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETFOCUS, (IntPtr) Unused, (IntPtr) Unused); } /// Change error status - 0 = OK. (Scintilla feature 2382) - public void SetStatus(int statusCode) + public void SetStatus(Status status) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTATUS, statusCode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSTATUS, (IntPtr) status, (IntPtr) Unused); } /// Get error status. (Scintilla feature 2383) - public int GetStatus() + public Status GetStatus() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTATUS, Unused, Unused); - return (int)res; + return (Status)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTATUS, (IntPtr) Unused, (IntPtr) Unused); } /// Set whether the mouse is captured when its button is pressed. (Scintilla feature 2384) public void SetMouseDownCaptures(bool captures) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDOWNCAPTURES, captures ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDOWNCAPTURES, new IntPtr(captures ? 1 : 0), (IntPtr) Unused); } /// Get whether mouse gets captured. (Scintilla feature 2385) public bool GetMouseDownCaptures() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDOWNCAPTURES, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDOWNCAPTURES, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Set whether the mouse wheel can be active outside the window. (Scintilla feature 2696) + public void SetMouseWheelCaptures(bool captures) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEWHEELCAPTURES, new IntPtr(captures ? 1 : 0), (IntPtr) Unused); + } + + /// Get whether mouse wheel can be active outside the window. (Scintilla feature 2697) + public bool GetMouseWheelCaptures() + { + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEWHEELCAPTURES, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the cursor to one of the SC_CURSOR* values. (Scintilla feature 2386) - public void SetCursor(int cursorType) + public void SetCursor(CursorShape cursorType) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCURSOR, cursorType, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCURSOR, (IntPtr) cursorType, (IntPtr) Unused); } /// Get cursor type. (Scintilla feature 2387) - public int GetCursor() + public CursorShape GetCursor() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURSOR, Unused, Unused); - return (int)res; + return (CursorShape)Win32.SendMessage(scintilla, SciMsg.SCI_GETCURSOR, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3237,20 +3246,19 @@ public int GetCursor() /// public void SetControlCharSymbol(int symbol) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCONTROLCHARSYMBOL, symbol, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCONTROLCHARSYMBOL, (IntPtr) symbol, (IntPtr) Unused); } /// Get the way control characters are displayed. (Scintilla feature 2389) public int GetControlCharSymbol() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCONTROLCHARSYMBOL, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCONTROLCHARSYMBOL, (IntPtr) Unused, (IntPtr) Unused); } /// Move to the previous change in capitalisation. (Scintilla feature 2390) public void WordPartLeft() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFT, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3260,13 +3268,13 @@ public void WordPartLeft() /// public void WordPartLeftExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move to the change next in capitalisation. (Scintilla feature 2392) public void WordPartRight() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHT, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3276,7 +3284,7 @@ public void WordPartRight() /// public void WordPartRightExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3284,46 +3292,45 @@ public void WordPartRightExtend() /// is to be moved to by Find, FindNext, GotoLine, etc. /// (Scintilla feature 2394) /// - public void SetVisiblePolicy(int visiblePolicy, int visibleSlop) + public void SetVisiblePolicy(VisiblePolicy visiblePolicy, int visibleSlop) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVISIBLEPOLICY, visiblePolicy, visibleSlop); + Win32.SendMessage(scintilla, SciMsg.SCI_SETVISIBLEPOLICY, (IntPtr) visiblePolicy, (IntPtr) visibleSlop); } /// Delete back from the current position to the start of the line. (Scintilla feature 2395) public void DelLineLeft() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELLINELEFT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DELLINELEFT, (IntPtr) Unused, (IntPtr) Unused); } /// Delete forwards from the current position to the end of the line. (Scintilla feature 2396) public void DelLineRight() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELLINERIGHT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DELLINERIGHT, (IntPtr) Unused, (IntPtr) Unused); } - /// Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2397) - public void SetXOffset(int newOffset) + /// Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2397) + public void SetXOffset(int xOffset) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETXOFFSET, newOffset, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETXOFFSET, (IntPtr) xOffset, (IntPtr) Unused); } - /// Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2398) + /// Get the xOffset (ie, horizontal scroll position). (Scintilla feature 2398) public int GetXOffset() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETXOFFSET, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETXOFFSET, (IntPtr) Unused, (IntPtr) Unused); } /// Set the last x chosen value to be the caret x position. (Scintilla feature 2399) public void ChooseCaretX() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHOOSECARETX, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CHOOSECARETX, (IntPtr) Unused, (IntPtr) Unused); } /// Set the focus to this Scintilla widget. (Scintilla feature 2400) public void GrabFocus() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GRABFOCUS, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_GRABFOCUS, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3331,9 +3338,9 @@ public void GrabFocus() /// The exclusion zone is given in pixels. /// (Scintilla feature 2402) /// - public void SetXCaretPolicy(int caretPolicy, int caretSlop) + public void SetXCaretPolicy(CaretPolicy caretPolicy, int caretSlop) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETXCARETPOLICY, caretPolicy, caretSlop); + Win32.SendMessage(scintilla, SciMsg.SCI_SETXCARETPOLICY, (IntPtr) caretPolicy, (IntPtr) caretSlop); } /// @@ -3341,98 +3348,93 @@ public void SetXCaretPolicy(int caretPolicy, int caretSlop) /// The exclusion zone is given in lines. /// (Scintilla feature 2403) /// - public void SetYCaretPolicy(int caretPolicy, int caretSlop) + public void SetYCaretPolicy(CaretPolicy caretPolicy, int caretSlop) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETYCARETPOLICY, caretPolicy, caretSlop); + Win32.SendMessage(scintilla, SciMsg.SCI_SETYCARETPOLICY, (IntPtr) caretPolicy, (IntPtr) caretSlop); } /// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). (Scintilla feature 2406) - public void SetPrintWrapMode(int mode) + public void SetPrintWrapMode(Wrap wrapMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTWRAPMODE, mode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTWRAPMODE, (IntPtr) wrapMode, (IntPtr) Unused); } /// Is printing line wrapped? (Scintilla feature 2407) - public int GetPrintWrapMode() + public Wrap GetPrintWrapMode() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTWRAPMODE, Unused, Unused); - return (int)res; + return (Wrap)Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTWRAPMODE, (IntPtr) Unused, (IntPtr) Unused); } /// Set a fore colour for active hotspots. (Scintilla feature 2410) public void SetHotspotActiveFore(bool useSetting, Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEFORE, useSetting ? 1 : 0, fore.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEFORE, new IntPtr(useSetting ? 1 : 0), fore.Value); } /// Get the fore colour for active hotspots. (Scintilla feature 2494) public Colour GetHotspotActiveFore() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEFORE, Unused, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEFORE, (IntPtr) Unused, (IntPtr) Unused)); } /// Set a back colour for active hotspots. (Scintilla feature 2411) public void SetHotspotActiveBack(bool useSetting, Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEBACK, useSetting ? 1 : 0, back.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEBACK, new IntPtr(useSetting ? 1 : 0), back.Value); } /// Get the back colour for active hotspots. (Scintilla feature 2495) public Colour GetHotspotActiveBack() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEBACK, Unused, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEBACK, (IntPtr) Unused, (IntPtr) Unused)); } /// Enable / Disable underlining active hotspots. (Scintilla feature 2412) public void SetHotspotActiveUnderline(bool underline) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEUNDERLINE, underline ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEUNDERLINE, new IntPtr(underline ? 1 : 0), (IntPtr) Unused); } /// Get whether underlining for active hotspots. (Scintilla feature 2496) public bool GetHotspotActiveUnderline() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEUNDERLINE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEUNDERLINE, (IntPtr) Unused, (IntPtr) Unused); } /// Limit hotspots to single line so hotspots on two lines don't merge. (Scintilla feature 2421) public void SetHotspotSingleLine(bool singleLine) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTSINGLELINE, singleLine ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTSINGLELINE, new IntPtr(singleLine ? 1 : 0), (IntPtr) Unused); } /// Get the HotspotSingleLine property (Scintilla feature 2497) public bool GetHotspotSingleLine() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTSINGLELINE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTSINGLELINE, (IntPtr) Unused, (IntPtr) Unused); } - /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2413) + /// Move caret down one paragraph (delimited by empty lines). (Scintilla feature 2413) public void ParaDown() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWN, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWN, (IntPtr) Unused, (IntPtr) Unused); } - /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2414) + /// Extend selection down one paragraph (delimited by empty lines). (Scintilla feature 2414) public void ParaDownExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWNEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWNEXTEND, (IntPtr) Unused, (IntPtr) Unused); } - /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2415) + /// Move caret up one paragraph (delimited by empty lines). (Scintilla feature 2415) public void ParaUp() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARAUP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PARAUP, (IntPtr) Unused, (IntPtr) Unused); } - /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2416) + /// Extend selection up one paragraph (delimited by empty lines). (Scintilla feature 2416) public void ParaUpExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARAUPEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PARAUPEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3440,10 +3442,9 @@ public void ParaUpExtend() /// page into account. Returns 0 if passed 0. /// (Scintilla feature 2417) /// - public Position PositionBefore(Position pos) + public int PositionBefore(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONBEFORE, pos.Value, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONBEFORE, (IntPtr) pos, (IntPtr) Unused); } /// @@ -3451,10 +3452,9 @@ public Position PositionBefore(Position pos) /// page into account. Maximum value returned is the last position in the document. /// (Scintilla feature 2418) /// - public Position PositionAfter(Position pos) + public int PositionAfter(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONAFTER, pos.Value, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONAFTER, (IntPtr) pos, (IntPtr) Unused); } /// @@ -3462,16 +3462,26 @@ public Position PositionAfter(Position pos) /// of characters. Returned value is always between 0 and last position in document. /// (Scintilla feature 2670) /// - public Position PositionRelative(Position pos, int relative) + public int PositionRelative(int pos, int relative) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONRELATIVE, pos.Value, relative); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONRELATIVE, (IntPtr) pos, (IntPtr) relative); + } + + /// + /// Given a valid document position, return a position that differs in a number + /// of UTF-16 code units. Returned value is always between 0 and last position in document. + /// The result may point half way (2 bytes) inside a non-BMP character. + /// (Scintilla feature 2716) + /// + public int PositionRelativeCodeUnits(int pos, int relative) + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONRELATIVECODEUNITS, (IntPtr) pos, (IntPtr) relative); } /// Copy a range of text to the clipboard. Positions are clipped into the document. (Scintilla feature 2419) - public void CopyRange(Position start, Position end) + public void CopyRange(int start, int end) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYRANGE, start.Value, end.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_COPYRANGE, (IntPtr) start, (IntPtr) end); } /// Copy argument text to the clipboard. (Scintilla feature 2420) @@ -3479,7 +3489,7 @@ public unsafe void CopyText(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYTEXT, length, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_COPYTEXT, (IntPtr) length, (IntPtr) textPtr); } } @@ -3488,60 +3498,63 @@ public unsafe void CopyText(int length, string text) /// by lines (SC_SEL_LINES). /// (Scintilla feature 2422) /// - public void SetSelectionMode(int mode) + public void SetSelectionMode(SelectionMode selectionMode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONMODE, mode, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONMODE, (IntPtr) selectionMode, (IntPtr) Unused); } /// Get the mode of the current selection. (Scintilla feature 2423) - public int GetSelectionMode() + public SelectionMode GetSelectionMode() + { + return (SelectionMode)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONMODE, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Get whether or not regular caret moves will extend or reduce the selection. (Scintilla feature 2706) + public bool GetMoveExtendsSelection() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONMODE, Unused, Unused); - return (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOVEEXTENDSSELECTION, (IntPtr) Unused, (IntPtr) Unused); } /// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2424) - public Position GetLineSelStartPosition(int line) + public int GetLineSelStartPosition(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELSTARTPOSITION, line, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELSTARTPOSITION, (IntPtr) line, (IntPtr) Unused); } /// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2425) - public Position GetLineSelEndPosition(int line) + public int GetLineSelEndPosition(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELENDPOSITION, line, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELENDPOSITION, (IntPtr) line, (IntPtr) Unused); } /// Move caret down one line, extending rectangular selection to new caret position. (Scintilla feature 2426) public void LineDownRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNRECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret up one line, extending rectangular selection to new caret position. (Scintilla feature 2427) public void LineUpRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPRECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret left one character, extending rectangular selection to new caret position. (Scintilla feature 2428) public void CharLeftRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTRECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret right one character, extending rectangular selection to new caret position. (Scintilla feature 2429) public void CharRightRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTRECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to first position on line, extending rectangular selection to new caret position. (Scintilla feature 2430) public void HomeRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMERECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_HOMERECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3552,73 +3565,73 @@ public void HomeRectExtend() /// public void VCHomeRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMERECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMERECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to last position on line, extending rectangular selection to new caret position. (Scintilla feature 2432) public void LineEndRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDRECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret one page up, extending rectangular selection to new caret position. (Scintilla feature 2433) public void PageUpRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPRECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret one page down, extending rectangular selection to new caret position. (Scintilla feature 2434) public void PageDownRectExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNRECTEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to top of page, or one page up if already at top of page. (Scintilla feature 2435) public void StutteredPageUp() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUP, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. (Scintilla feature 2436) public void StutteredPageUpExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUPEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUPEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to bottom of page, or one page down if already at bottom of page. (Scintilla feature 2437) public void StutteredPageDown() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWN, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWN, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. (Scintilla feature 2438) public void StutteredPageDownExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWNEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWNEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret left one word, position cursor at end of word. (Scintilla feature 2439) public void WordLeftEnd() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret left one word, position cursor at end of word, extending selection to new caret position. (Scintilla feature 2440) public void WordLeftEndExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTENDEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTENDEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret right one word, position cursor at end of word. (Scintilla feature 2441) public void WordRightEnd() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Move caret right one word, position cursor at end of word, extending selection to new caret position. (Scintilla feature 2442) public void WordRightEndExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTENDEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTENDEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3630,19 +3643,14 @@ public unsafe void SetWhitespaceChars(string characters) { fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACECHARS, Unused, (IntPtr)charactersPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACECHARS, (IntPtr) Unused, (IntPtr) charactersPtr); } } /// Get the set of characters making up whitespace for when moving or selecting by word. (Scintilla feature 2647) public unsafe string GetWhitespaceChars() { - byte[] charactersBuffer = new byte[10000]; - fixed (byte* charactersPtr = charactersBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACECHARS, Unused, (IntPtr)charactersPtr); - return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETWHITESPACECHARS); } /// @@ -3654,32 +3662,26 @@ public unsafe void SetPunctuationChars(string characters) { fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPUNCTUATIONCHARS, Unused, (IntPtr)charactersPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETPUNCTUATIONCHARS, (IntPtr) Unused, (IntPtr) charactersPtr); } } /// Get the set of characters making up punctuation characters (Scintilla feature 2649) public unsafe string GetPunctuationChars() { - byte[] charactersBuffer = new byte[10000]; - fixed (byte* charactersPtr = charactersBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPUNCTUATIONCHARS, Unused, (IntPtr)charactersPtr); - return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETPUNCTUATIONCHARS); } /// Reset the set of characters for whitespace and word characters to the defaults. (Scintilla feature 2444) public void SetCharsDefault() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCHARSDEFAULT, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCHARSDEFAULT, (IntPtr) Unused, (IntPtr) Unused); } /// Get currently selected item position in the auto-completion list (Scintilla feature 2445) public int AutoCGetCurrent() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENT, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3690,57 +3692,49 @@ public int AutoCGetCurrent() /// public unsafe string AutoCGetCurrentText() { - byte[] sBuffer = new byte[10000]; - fixed (byte* sPtr = sBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENTTEXT, Unused, (IntPtr)sPtr); - return Encoding.UTF8.GetString(sBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_AUTOCGETCURRENTTEXT); } /// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. (Scintilla feature 2634) - public void AutoCSetCaseInsensitiveBehaviour(int behaviour) + public void AutoCSetCaseInsensitiveBehaviour(CaseInsensitiveBehaviour behaviour) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, behaviour, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, (IntPtr) behaviour, (IntPtr) Unused); } /// Get auto-completion case insensitive behaviour. (Scintilla feature 2635) - public int AutoCGetCaseInsensitiveBehaviour() + public CaseInsensitiveBehaviour AutoCGetCaseInsensitiveBehaviour() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, Unused, Unused); - return (int)res; + return (CaseInsensitiveBehaviour)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, (IntPtr) Unused, (IntPtr) Unused); } /// Change the effect of autocompleting when there are multiple selections. (Scintilla feature 2636) - public void AutoCSetMulti(int multi) + public void AutoCSetMulti(MultiAutoComplete multi) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMULTI, multi, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMULTI, (IntPtr) multi, (IntPtr) Unused); } - /// Retrieve the effect of autocompleting when there are multiple selections.. (Scintilla feature 2637) - public int AutoCGetMulti() + /// Retrieve the effect of autocompleting when there are multiple selections. (Scintilla feature 2637) + public MultiAutoComplete AutoCGetMulti() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMULTI, Unused, Unused); - return (int)res; + return (MultiAutoComplete)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMULTI, (IntPtr) Unused, (IntPtr) Unused); } /// Set the way autocompletion lists are ordered. (Scintilla feature 2660) - public void AutoCSetOrder(int order) + public void AutoCSetOrder(Ordering order) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETORDER, order, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETORDER, (IntPtr) order, (IntPtr) Unused); } /// Get the way autocompletion lists are ordered. (Scintilla feature 2661) - public int AutoCGetOrder() + public Ordering AutoCGetOrder() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETORDER, Unused, Unused); - return (int)res; + return (Ordering)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETORDER, (IntPtr) Unused, (IntPtr) Unused); } /// Enlarge the document to a particular size of text bytes. (Scintilla feature 2446) public void Allocate(int bytes) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATE, bytes, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATE, (IntPtr) bytes, (IntPtr) Unused); } /// @@ -3750,12 +3744,7 @@ public void Allocate(int bytes) /// public unsafe string TargetAsUTF8() { - byte[] sBuffer = new byte[10000]; - fixed (byte* sPtr = sBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TARGETASUTF8, Unused, (IntPtr)sPtr); - return Encoding.UTF8.GetString(sBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_TARGETASUTF8); } /// @@ -3765,7 +3754,7 @@ public unsafe string TargetAsUTF8() /// public void SetLengthForEncode(int bytes) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLENGTHFORENCODE, bytes, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETLENGTHFORENCODE, (IntPtr) bytes, (IntPtr) Unused); } /// @@ -3778,12 +3767,7 @@ public unsafe string EncodedFromUTF8(string utf8) { fixed (byte* utf8Ptr = Encoding.UTF8.GetBytes(utf8)) { - byte[] encodedBuffer = new byte[10000]; - fixed (byte* encodedPtr = encodedBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENCODEDFROMUTF8, (IntPtr)utf8Ptr, (IntPtr)encodedPtr); - return Encoding.UTF8.GetString(encodedBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_ENCODEDFROMUTF8, (IntPtr)utf8Ptr); } } @@ -3794,157 +3778,145 @@ public unsafe string EncodedFromUTF8(string utf8) /// public int FindColumn(int line, int column) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDCOLUMN, line, column); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_FINDCOLUMN, (IntPtr) line, (IntPtr) column); } /// Can the caret preferred x position only be changed by explicit movement commands? (Scintilla feature 2457) - public int GetCaretSticky() + public CaretSticky GetCaretSticky() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTICKY, Unused, Unused); - return (int)res; + return (CaretSticky)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTICKY, (IntPtr) Unused, (IntPtr) Unused); } /// Stop the caret preferred x position changing when the user types. (Scintilla feature 2458) - public void SetCaretSticky(int useCaretStickyBehaviour) + public void SetCaretSticky(CaretSticky useCaretStickyBehaviour) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTICKY, useCaretStickyBehaviour, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTICKY, (IntPtr) useCaretStickyBehaviour, (IntPtr) Unused); } /// Switch between sticky and non-sticky: meant to be bound to a key. (Scintilla feature 2459) public void ToggleCaretSticky() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLECARETSTICKY, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLECARETSTICKY, (IntPtr) Unused, (IntPtr) Unused); } /// Enable/Disable convert-on-paste for line endings (Scintilla feature 2467) public void SetPasteConvertEndings(bool convert) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPASTECONVERTENDINGS, convert ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETPASTECONVERTENDINGS, new IntPtr(convert ? 1 : 0), (IntPtr) Unused); } /// Get convert-on-paste setting (Scintilla feature 2468) public bool GetPasteConvertEndings() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPASTECONVERTENDINGS, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPASTECONVERTENDINGS, (IntPtr) Unused, (IntPtr) Unused); } /// Duplicate the selection. If selection empty duplicate the line containing the caret. (Scintilla feature 2469) public void SelectionDuplicate() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONDUPLICATE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONDUPLICATE, (IntPtr) Unused, (IntPtr) Unused); } /// Set background alpha of the caret line. (Scintilla feature 2470) - public void SetCaretLineBackAlpha(int alpha) + public void SetCaretLineBackAlpha(Alpha alpha) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACKALPHA, alpha, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACKALPHA, (IntPtr) alpha, (IntPtr) Unused); } /// Get the background alpha of the caret line. (Scintilla feature 2471) - public int GetCaretLineBackAlpha() + public Alpha GetCaretLineBackAlpha() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACKALPHA, Unused, Unused); - return (int)res; + return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACKALPHA, (IntPtr) Unused, (IntPtr) Unused); } /// Set the style of the caret to be drawn. (Scintilla feature 2512) - public void SetCaretStyle(int caretStyle) + public void SetCaretStyle(CaretStyle caretStyle) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTYLE, caretStyle, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTYLE, (IntPtr) caretStyle, (IntPtr) Unused); } /// Returns the current style of the caret. (Scintilla feature 2513) - public int GetCaretStyle() + public CaretStyle GetCaretStyle() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTYLE, Unused, Unused); - return (int)res; + return (CaretStyle)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTYLE, (IntPtr) Unused, (IntPtr) Unused); } /// Set the indicator used for IndicatorFillRange and IndicatorClearRange (Scintilla feature 2500) public void SetIndicatorCurrent(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORCURRENT, indicator, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORCURRENT, (IntPtr) indicator, (IntPtr) Unused); } /// Get the current indicator (Scintilla feature 2501) public int GetIndicatorCurrent() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORCURRENT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORCURRENT, (IntPtr) Unused, (IntPtr) Unused); } /// Set the value used for IndicatorFillRange (Scintilla feature 2502) public void SetIndicatorValue(int value) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORVALUE, value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORVALUE, (IntPtr) value, (IntPtr) Unused); } /// Get the current indicator value (Scintilla feature 2503) public int GetIndicatorValue() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORVALUE, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORVALUE, (IntPtr) Unused, (IntPtr) Unused); } /// Turn a indicator on over a range. (Scintilla feature 2504) - public void IndicatorFillRange(int position, int fillLength) + public void IndicatorFillRange(int start, int lengthFill) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORFILLRANGE, position, fillLength); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORFILLRANGE, (IntPtr) start, (IntPtr) lengthFill); } /// Turn a indicator off over a range. (Scintilla feature 2505) - public void IndicatorClearRange(int position, int clearLength) + public void IndicatorClearRange(int start, int lengthClear) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORCLEARRANGE, position, clearLength); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORCLEARRANGE, (IntPtr) start, (IntPtr) lengthClear); } - /// Are any indicators present at position? (Scintilla feature 2506) - public int IndicatorAllOnFor(int position) + /// Are any indicators present at pos? (Scintilla feature 2506) + public int IndicatorAllOnFor(int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORALLONFOR, position, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORALLONFOR, (IntPtr) pos, (IntPtr) Unused); } - /// What value does a particular indicator have at at a position? (Scintilla feature 2507) - public int IndicatorValueAt(int indicator, int position) + /// What value does a particular indicator have at a position? (Scintilla feature 2507) + public int IndicatorValueAt(int indicator, int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORVALUEAT, indicator, position); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORVALUEAT, (IntPtr) indicator, (IntPtr) pos); } /// Where does a particular indicator start? (Scintilla feature 2508) - public int IndicatorStart(int indicator, int position) + public int IndicatorStart(int indicator, int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORSTART, indicator, position); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORSTART, (IntPtr) indicator, (IntPtr) pos); } /// Where does a particular indicator end? (Scintilla feature 2509) - public int IndicatorEnd(int indicator, int position) + public int IndicatorEnd(int indicator, int pos) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATOREND, indicator, position); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICATOREND, (IntPtr) indicator, (IntPtr) pos); } /// Set number of entries in position cache (Scintilla feature 2514) public void SetPositionCache(int size) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPOSITIONCACHE, size, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETPOSITIONCACHE, (IntPtr) size, (IntPtr) Unused); } /// How many entries are allocated to the position cache? (Scintilla feature 2515) public int GetPositionCache() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPOSITIONCACHE, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPOSITIONCACHE, (IntPtr) Unused, (IntPtr) Unused); } /// Copy the selection, if selection empty copy the line with the caret (Scintilla feature 2519) public void CopyAllowLine() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYALLOWLINE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_COPYALLOWLINE, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -3954,18 +3926,18 @@ public void CopyAllowLine() /// public IntPtr GetCharacterPointer() { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERPOINTER, Unused, Unused); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERPOINTER, (IntPtr) Unused, (IntPtr) Unused); } /// /// Return a read-only pointer to a range of characters in the document. /// May move the gap so that the range is contiguous, but will only move up - /// to rangeLength bytes. + /// to lengthRange bytes. /// (Scintilla feature 2643) /// - public IntPtr GetRangePointer(int position, int rangeLength) + public IntPtr GetRangePointer(int start, int lengthRange) { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETRANGEPOINTER, position, rangeLength); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETRANGEPOINTER, (IntPtr) start, (IntPtr) lengthRange); } /// @@ -3973,69 +3945,63 @@ public IntPtr GetRangePointer(int position, int rangeLength) /// the range of a call to GetRangePointer. /// (Scintilla feature 2644) /// - public Position GetGapPosition() + public int GetGapPosition() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETGAPPOSITION, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETGAPPOSITION, (IntPtr) Unused, (IntPtr) Unused); } /// Set the alpha fill colour of the given indicator. (Scintilla feature 2523) - public void IndicSetAlpha(int indicator, int alpha) + public void IndicSetAlpha(int indicator, Alpha alpha) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETALPHA, indicator, alpha); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETALPHA, (IntPtr) indicator, (IntPtr) alpha); } /// Get the alpha fill colour of the given indicator. (Scintilla feature 2524) - public int IndicGetAlpha(int indicator) + public Alpha IndicGetAlpha(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETALPHA, indicator, Unused); - return (int)res; + return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETALPHA, (IntPtr) indicator, (IntPtr) Unused); } /// Set the alpha outline colour of the given indicator. (Scintilla feature 2558) - public void IndicSetOutlineAlpha(int indicator, int alpha) + public void IndicSetOutlineAlpha(int indicator, Alpha alpha) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETOUTLINEALPHA, indicator, alpha); + Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETOUTLINEALPHA, (IntPtr) indicator, (IntPtr) alpha); } /// Get the alpha outline colour of the given indicator. (Scintilla feature 2559) - public int IndicGetOutlineAlpha(int indicator) + public Alpha IndicGetOutlineAlpha(int indicator) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETOUTLINEALPHA, indicator, Unused); - return (int)res; + return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETOUTLINEALPHA, (IntPtr) indicator, (IntPtr) Unused); } /// Set extra ascent for each line (Scintilla feature 2525) public void SetExtraAscent(int extraAscent) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRAASCENT, extraAscent, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRAASCENT, (IntPtr) extraAscent, (IntPtr) Unused); } /// Get extra ascent for each line (Scintilla feature 2526) public int GetExtraAscent() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRAASCENT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRAASCENT, (IntPtr) Unused, (IntPtr) Unused); } /// Set extra descent for each line (Scintilla feature 2527) public void SetExtraDescent(int extraDescent) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRADESCENT, extraDescent, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRADESCENT, (IntPtr) extraDescent, (IntPtr) Unused); } /// Get extra descent for each line (Scintilla feature 2528) public int GetExtraDescent() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRADESCENT, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRADESCENT, (IntPtr) Unused, (IntPtr) Unused); } /// Which symbol was defined for markerNumber with MarkerDefine (Scintilla feature 2529) public int MarkerSymbolDefined(int markerNumber) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSYMBOLDEFINED, markerNumber, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSYMBOLDEFINED, (IntPtr) markerNumber, (IntPtr) Unused); } /// Set the text in the text margin for a line (Scintilla feature 2530) @@ -4043,32 +4009,26 @@ public unsafe void MarginSetText(int line, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETTEXT, line, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETTEXT, (IntPtr) line, (IntPtr) textPtr); } } /// Get the text in the text margin for a line (Scintilla feature 2531) public unsafe string MarginGetText(int line) { - byte[] textBuffer = new byte[10000]; - fixed (byte* textPtr = textBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETTEXT, line, (IntPtr)textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_MARGINGETTEXT, (IntPtr)line); } /// Set the style number for the text margin for a line (Scintilla feature 2532) public void MarginSetStyle(int line, int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLE, line, style); + Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLE, (IntPtr) line, (IntPtr) style); } /// Get the style number for the text margin for a line (Scintilla feature 2533) public int MarginGetStyle(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLE, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLE, (IntPtr) line, (IntPtr) Unused); } /// Set the style in the text margin for a line (Scintilla feature 2534) @@ -4076,51 +4036,44 @@ public unsafe void MarginSetStyles(int line, string styles) { fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLES, line, (IntPtr)stylesPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLES, (IntPtr) line, (IntPtr) stylesPtr); } } /// Get the styles in the text margin for a line (Scintilla feature 2535) public unsafe string MarginGetStyles(int line) { - byte[] stylesBuffer = new byte[10000]; - fixed (byte* stylesPtr = stylesBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLES, line, (IntPtr)stylesPtr); - return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_MARGINGETSTYLES, (IntPtr)line); } /// Clear the margin text on all lines (Scintilla feature 2536) public void MarginTextClearAll() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINTEXTCLEARALL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_MARGINTEXTCLEARALL, (IntPtr) Unused, (IntPtr) Unused); } /// Get the start of the range of style numbers used for margin text (Scintilla feature 2537) public void MarginSetStyleOffset(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLEOFFSET, style, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLEOFFSET, (IntPtr) style, (IntPtr) Unused); } /// Get the start of the range of style numbers used for margin text (Scintilla feature 2538) public int MarginGetStyleOffset() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLEOFFSET, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLEOFFSET, (IntPtr) Unused, (IntPtr) Unused); } /// Set the margin options. (Scintilla feature 2539) - public void SetMarginOptions(int marginOptions) + public void SetMarginOptions(MarginOption marginOptions) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINOPTIONS, marginOptions, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINOPTIONS, (IntPtr) marginOptions, (IntPtr) Unused); } /// Get the margin options. (Scintilla feature 2557) - public int GetMarginOptions() + public MarginOption GetMarginOptions() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINOPTIONS, Unused, Unused); - return (int)res; + return (MarginOption)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINOPTIONS, (IntPtr) Unused, (IntPtr) Unused); } /// Set the annotation text for a line (Scintilla feature 2540) @@ -4128,32 +4081,26 @@ public unsafe void AnnotationSetText(int line, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETTEXT, line, (IntPtr)textPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETTEXT, (IntPtr) line, (IntPtr) textPtr); } } /// Get the annotation text for a line (Scintilla feature 2541) public unsafe string AnnotationGetText(int line) { - byte[] textBuffer = new byte[10000]; - fixed (byte* textPtr = textBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETTEXT, line, (IntPtr)textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_ANNOTATIONGETTEXT, (IntPtr)line); } /// Set the style number for the annotations for a line (Scintilla feature 2542) public void AnnotationSetStyle(int line, int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLE, line, style); + Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLE, (IntPtr) line, (IntPtr) style); } /// Get the style number for the annotations for a line (Scintilla feature 2543) public int AnnotationGetStyle(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLE, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLE, (IntPtr) line, (IntPtr) Unused); } /// Set the annotation styles for a line (Scintilla feature 2544) @@ -4161,84 +4108,74 @@ public unsafe void AnnotationSetStyles(int line, string styles) { fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLES, line, (IntPtr)stylesPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLES, (IntPtr) line, (IntPtr) stylesPtr); } } /// Get the annotation styles for a line (Scintilla feature 2545) public unsafe string AnnotationGetStyles(int line) { - byte[] stylesBuffer = new byte[10000]; - fixed (byte* stylesPtr = stylesBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLES, line, (IntPtr)stylesPtr); - return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_ANNOTATIONGETSTYLES, (IntPtr)line); } /// Get the number of annotation lines for a line (Scintilla feature 2546) public int AnnotationGetLines(int line) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETLINES, line, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETLINES, (IntPtr) line, (IntPtr) Unused); } /// Clear the annotations from all lines (Scintilla feature 2547) public void AnnotationClearAll() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONCLEARALL, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONCLEARALL, (IntPtr) Unused, (IntPtr) Unused); } /// Set the visibility for the annotations for a view (Scintilla feature 2548) - public void AnnotationSetVisible(int visible) + public void AnnotationSetVisible(AnnotationVisible visible) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETVISIBLE, visible, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETVISIBLE, (IntPtr) visible, (IntPtr) Unused); } /// Get the visibility for the annotations for a view (Scintilla feature 2549) - public int AnnotationGetVisible() + public AnnotationVisible AnnotationGetVisible() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETVISIBLE, Unused, Unused); - return (int)res; + return (AnnotationVisible)Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETVISIBLE, (IntPtr) Unused, (IntPtr) Unused); } /// Get the start of the range of style numbers used for annotations (Scintilla feature 2550) public void AnnotationSetStyleOffset(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLEOFFSET, style, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLEOFFSET, (IntPtr) style, (IntPtr) Unused); } /// Get the start of the range of style numbers used for annotations (Scintilla feature 2551) public int AnnotationGetStyleOffset() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLEOFFSET, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLEOFFSET, (IntPtr) Unused, (IntPtr) Unused); } /// Release all extended (>255) style numbers (Scintilla feature 2552) public void ReleaseAllExtendedStyles() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEALLEXTENDEDSTYLES, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEALLEXTENDEDSTYLES, (IntPtr) Unused, (IntPtr) Unused); } /// Allocate some extended (>255) style numbers and return the start of the range (Scintilla feature 2553) public int AllocateExtendedStyles(int numberStyles) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATEEXTENDEDSTYLES, numberStyles, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATEEXTENDEDSTYLES, (IntPtr) numberStyles, (IntPtr) Unused); } /// Add a container action to the undo stack (Scintilla feature 2560) - public void AddUndoAction(int token, int flags) + public void AddUndoAction(int token, UndoFlags flags) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDUNDOACTION, token, flags); + Win32.SendMessage(scintilla, SciMsg.SCI_ADDUNDOACTION, (IntPtr) token, (IntPtr) flags); } /// Find the position of a character from a point within the window. (Scintilla feature 2561) - public Position CharPositionFromPoint(int x, int y) + public int CharPositionFromPoint(int x, int y) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINT, x, y); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINT, (IntPtr) x, (IntPtr) y); } /// @@ -4246,275 +4183,253 @@ public Position CharPositionFromPoint(int x, int y) /// Return INVALID_POSITION if not close to text. /// (Scintilla feature 2562) /// - public Position CharPositionFromPointClose(int x, int y) + public int CharPositionFromPointClose(int x, int y) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINTCLOSE, x, y); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINTCLOSE, (IntPtr) x, (IntPtr) y); } /// Set whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2668) public void SetMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSESELECTIONRECTANGULARSWITCH, mouseSelectionRectangularSwitch ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSESELECTIONRECTANGULARSWITCH, new IntPtr(mouseSelectionRectangularSwitch ? 1 : 0), (IntPtr) Unused); } /// Whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2669) public bool GetMouseSelectionRectangularSwitch() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSESELECTIONRECTANGULARSWITCH, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSESELECTIONRECTANGULARSWITCH, (IntPtr) Unused, (IntPtr) Unused); } /// Set whether multiple selections can be made (Scintilla feature 2563) public void SetMultipleSelection(bool multipleSelection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPLESELECTION, multipleSelection ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPLESELECTION, new IntPtr(multipleSelection ? 1 : 0), (IntPtr) Unused); } /// Whether multiple selections can be made (Scintilla feature 2564) public bool GetMultipleSelection() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPLESELECTION, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPLESELECTION, (IntPtr) Unused, (IntPtr) Unused); } /// Set whether typing can be performed into multiple selections (Scintilla feature 2565) public void SetAdditionalSelectionTyping(bool additionalSelectionTyping) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELECTIONTYPING, additionalSelectionTyping ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELECTIONTYPING, new IntPtr(additionalSelectionTyping ? 1 : 0), (IntPtr) Unused); } /// Whether typing can be performed into multiple selections (Scintilla feature 2566) public bool GetAdditionalSelectionTyping() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELECTIONTYPING, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELECTIONTYPING, (IntPtr) Unused, (IntPtr) Unused); } /// Set whether additional carets will blink (Scintilla feature 2567) public void SetAdditionalCaretsBlink(bool additionalCaretsBlink) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSBLINK, additionalCaretsBlink ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSBLINK, new IntPtr(additionalCaretsBlink ? 1 : 0), (IntPtr) Unused); } /// Whether additional carets will blink (Scintilla feature 2568) public bool GetAdditionalCaretsBlink() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSBLINK, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSBLINK, (IntPtr) Unused, (IntPtr) Unused); } /// Set whether additional carets are visible (Scintilla feature 2608) - public void SetAdditionalCaretsVisible(bool additionalCaretsBlink) + public void SetAdditionalCaretsVisible(bool additionalCaretsVisible) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSVISIBLE, additionalCaretsBlink ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSVISIBLE, new IntPtr(additionalCaretsVisible ? 1 : 0), (IntPtr) Unused); } /// Whether additional carets are visible (Scintilla feature 2609) public bool GetAdditionalCaretsVisible() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSVISIBLE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSVISIBLE, (IntPtr) Unused, (IntPtr) Unused); } /// How many selections are there? (Scintilla feature 2570) public int GetSelections() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONS, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONS, (IntPtr) Unused, (IntPtr) Unused); } /// Is every selected range empty? (Scintilla feature 2650) public bool GetSelectionEmpty() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEMPTY, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEMPTY, (IntPtr) Unused, (IntPtr) Unused); } /// Clear selections to a single empty stream selection (Scintilla feature 2571) public void ClearSelections() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARSELECTIONS, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEARSELECTIONS, (IntPtr) Unused, (IntPtr) Unused); } /// Set a simple selection (Scintilla feature 2572) - public int SetSelection(int caret, int anchor) + public void SetSelection(int caret, int anchor) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTION, caret, anchor); - return (int)res; + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTION, (IntPtr) caret, (IntPtr) anchor); } /// Add a selection (Scintilla feature 2573) - public int AddSelection(int caret, int anchor) + public void AddSelection(int caret, int anchor) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDSELECTION, caret, anchor); - return (int)res; + Win32.SendMessage(scintilla, SciMsg.SCI_ADDSELECTION, (IntPtr) caret, (IntPtr) anchor); } /// Drop one selection (Scintilla feature 2671) public void DropSelectionN(int selection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DROPSELECTIONN, selection, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_DROPSELECTIONN, (IntPtr) selection, (IntPtr) Unused); } /// Set the main selection (Scintilla feature 2574) public void SetMainSelection(int selection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMAINSELECTION, selection, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETMAINSELECTION, (IntPtr) selection, (IntPtr) Unused); } /// Which selection is the main selection (Scintilla feature 2575) public int GetMainSelection() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMAINSELECTION, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMAINSELECTION, (IntPtr) Unused, (IntPtr) Unused); } - /// Which selection is the main selection (Scintilla feature 2576) - public void SetSelectionNCaret(int selection, Position pos) + /// Set the caret position of the nth selection. (Scintilla feature 2576) + public void SetSelectionNCaret(int selection, int caret) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARET, selection, pos.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARET, (IntPtr) selection, (IntPtr) caret); } - /// Which selection is the main selection (Scintilla feature 2577) - public Position GetSelectionNCaret(int selection) + /// Return the caret position of the nth selection. (Scintilla feature 2577) + public int GetSelectionNCaret(int selection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARET, selection, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARET, (IntPtr) selection, (IntPtr) Unused); } - /// Which selection is the main selection (Scintilla feature 2578) - public void SetSelectionNAnchor(int selection, Position posAnchor) + /// Set the anchor position of the nth selection. (Scintilla feature 2578) + public void SetSelectionNAnchor(int selection, int anchor) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHOR, selection, posAnchor.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHOR, (IntPtr) selection, (IntPtr) anchor); } - /// Which selection is the main selection (Scintilla feature 2579) - public Position GetSelectionNAnchor(int selection) + /// Return the anchor position of the nth selection. (Scintilla feature 2579) + public int GetSelectionNAnchor(int selection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHOR, selection, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHOR, (IntPtr) selection, (IntPtr) Unused); } - /// Which selection is the main selection (Scintilla feature 2580) + /// Set the virtual space of the caret of the nth selection. (Scintilla feature 2580) public void SetSelectionNCaretVirtualSpace(int selection, int space) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARETVIRTUALSPACE, selection, space); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARETVIRTUALSPACE, (IntPtr) selection, (IntPtr) space); } - /// Which selection is the main selection (Scintilla feature 2581) + /// Return the virtual space of the caret of the nth selection. (Scintilla feature 2581) public int GetSelectionNCaretVirtualSpace(int selection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARETVIRTUALSPACE, selection, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARETVIRTUALSPACE, (IntPtr) selection, (IntPtr) Unused); } - /// Which selection is the main selection (Scintilla feature 2582) + /// Set the virtual space of the anchor of the nth selection. (Scintilla feature 2582) public void SetSelectionNAnchorVirtualSpace(int selection, int space) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHORVIRTUALSPACE, selection, space); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHORVIRTUALSPACE, (IntPtr) selection, (IntPtr) space); } - /// Which selection is the main selection (Scintilla feature 2583) + /// Return the virtual space of the anchor of the nth selection. (Scintilla feature 2583) public int GetSelectionNAnchorVirtualSpace(int selection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHORVIRTUALSPACE, selection, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHORVIRTUALSPACE, (IntPtr) selection, (IntPtr) Unused); } /// Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2584) - public void SetSelectionNStart(int selection, Position pos) + public void SetSelectionNStart(int selection, int anchor) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNSTART, selection, pos.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNSTART, (IntPtr) selection, (IntPtr) anchor); } /// Returns the position at the start of the selection. (Scintilla feature 2585) - public Position GetSelectionNStart(int selection) + public int GetSelectionNStart(int selection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNSTART, selection, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNSTART, (IntPtr) selection, (IntPtr) Unused); } /// Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2586) - public void SetSelectionNEnd(int selection, Position pos) + public void SetSelectionNEnd(int selection, int caret) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNEND, selection, pos.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNEND, (IntPtr) selection, (IntPtr) caret); } /// Returns the position at the end of the selection. (Scintilla feature 2587) - public Position GetSelectionNEnd(int selection) + public int GetSelectionNEnd(int selection) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNEND, selection, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNEND, (IntPtr) selection, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2588) - public void SetRectangularSelectionCaret(Position pos) + /// Set the caret position of the rectangular selection. (Scintilla feature 2588) + public void SetRectangularSelectionCaret(int caret) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARET, pos.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARET, (IntPtr) caret, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2589) - public Position GetRectangularSelectionCaret() + /// Return the caret position of the rectangular selection. (Scintilla feature 2589) + public int GetRectangularSelectionCaret() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARET, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARET, (IntPtr) Unused, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2590) - public void SetRectangularSelectionAnchor(Position posAnchor) + /// Set the anchor position of the rectangular selection. (Scintilla feature 2590) + public void SetRectangularSelectionAnchor(int anchor) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHOR, posAnchor.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHOR, (IntPtr) anchor, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2591) - public Position GetRectangularSelectionAnchor() + /// Return the anchor position of the rectangular selection. (Scintilla feature 2591) + public int GetRectangularSelectionAnchor() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHOR, Unused, Unused); - return new Position((int)res); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHOR, (IntPtr) Unused, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2592) + /// Set the virtual space of the caret of the rectangular selection. (Scintilla feature 2592) public void SetRectangularSelectionCaretVirtualSpace(int space) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, space, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, (IntPtr) space, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2593) + /// Return the virtual space of the caret of the rectangular selection. (Scintilla feature 2593) public int GetRectangularSelectionCaretVirtualSpace() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, (IntPtr) Unused, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2594) + /// Set the virtual space of the anchor of the rectangular selection. (Scintilla feature 2594) public void SetRectangularSelectionAnchorVirtualSpace(int space) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, space, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, (IntPtr) space, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2595) + /// Return the virtual space of the anchor of the rectangular selection. (Scintilla feature 2595) public int GetRectangularSelectionAnchorVirtualSpace() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, (IntPtr) Unused, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2596) - public void SetVirtualSpaceOptions(int virtualSpaceOptions) + /// Set options for virtual space behaviour. (Scintilla feature 2596) + public void SetVirtualSpaceOptions(VirtualSpace virtualSpaceOptions) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETVIRTUALSPACEOPTIONS, (IntPtr) virtualSpaceOptions, (IntPtr) Unused); } - /// Returns the position at the end of the selection. (Scintilla feature 2597) - public int GetVirtualSpaceOptions() + /// Return options for virtual space behaviour. (Scintilla feature 2597) + public VirtualSpace GetVirtualSpaceOptions() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIRTUALSPACEOPTIONS, Unused, Unused); - return (int)res; + return (VirtualSpace)Win32.SendMessage(scintilla, SciMsg.SCI_GETVIRTUALSPACEOPTIONS, (IntPtr) Unused, (IntPtr) Unused); } /// - /// On GTK+, allow selecting the modifier key to use for mouse-based + /// On GTK, allow selecting the modifier key to use for mouse-based /// rectangular selection. Often the window manager requires Alt+Mouse Drag /// for moving windows. /// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. @@ -4522,14 +4437,13 @@ public int GetVirtualSpaceOptions() /// public void SetRectangularSelectionModifier(int modifier) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONMODIFIER, modifier, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONMODIFIER, (IntPtr) modifier, (IntPtr) Unused); } /// Get the modifier key used for rectangular selection. (Scintilla feature 2599) public int GetRectangularSelectionModifier() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONMODIFIER, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONMODIFIER, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -4539,7 +4453,7 @@ public int GetRectangularSelectionModifier() /// public void SetAdditionalSelFore(Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELFORE, fore.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELFORE, fore.Value, (IntPtr) Unused); } /// @@ -4549,45 +4463,63 @@ public void SetAdditionalSelFore(Colour fore) /// public void SetAdditionalSelBack(Colour back) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELBACK, back.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELBACK, back.Value, (IntPtr) Unused); } /// Set the alpha of the selection. (Scintilla feature 2602) - public void SetAdditionalSelAlpha(int alpha) + public void SetAdditionalSelAlpha(Alpha alpha) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELALPHA, alpha, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELALPHA, (IntPtr) alpha, (IntPtr) Unused); } /// Get the alpha of the selection. (Scintilla feature 2603) - public int GetAdditionalSelAlpha() + public Alpha GetAdditionalSelAlpha() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELALPHA, Unused, Unused); - return (int)res; + return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELALPHA, (IntPtr) Unused, (IntPtr) Unused); } /// Set the foreground colour of additional carets. (Scintilla feature 2604) public void SetAdditionalCaretFore(Colour fore) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETFORE, fore.Value, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETFORE, fore.Value, (IntPtr) Unused); } /// Get the foreground colour of additional carets. (Scintilla feature 2605) public Colour GetAdditionalCaretFore() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETFORE, Unused, Unused); - return new Colour((int)res); + return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETFORE, (IntPtr) Unused, (IntPtr) Unused)); } /// Set the main selection to the next selection. (Scintilla feature 2606) public void RotateSelection() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ROTATESELECTION, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_ROTATESELECTION, (IntPtr) Unused, (IntPtr) Unused); } /// Swap that caret and anchor of the main selection. (Scintilla feature 2607) public void SwapMainAnchorCaret() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SWAPMAINANCHORCARET, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SWAPMAINANCHORCARET, (IntPtr) Unused, (IntPtr) Unused); + } + + /// + /// Add the next occurrence of the main selection to the set of selections as main. + /// If the current selection is empty then select word around caret. + /// (Scintilla feature 2688) + /// + public void MultipleSelectAddNext() + { + Win32.SendMessage(scintilla, SciMsg.SCI_MULTIPLESELECTADDNEXT, (IntPtr) Unused, (IntPtr) Unused); + } + + /// + /// Add each occurrence of the main selection in the target to the set of selections. + /// If the current selection is empty then select word around caret. + /// (Scintilla feature 2689) + /// + public void MultipleSelectAddEach() + { + Win32.SendMessage(scintilla, SciMsg.SCI_MULTIPLESELECTADDEACH, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -4595,10 +4527,9 @@ public void SwapMainAnchorCaret() /// there may be a need to redraw. /// (Scintilla feature 2617) /// - public int ChangeLexerState(Position start, Position end) + public int ChangeLexerState(int start, int end) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHANGELEXERSTATE, start.Value, end.Value); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CHANGELEXERSTATE, (IntPtr) start, (IntPtr) end); } /// @@ -4608,57 +4539,55 @@ public int ChangeLexerState(Position start, Position end) /// public int ContractedFoldNext(int lineStart) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CONTRACTEDFOLDNEXT, lineStart, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CONTRACTEDFOLDNEXT, (IntPtr) lineStart, (IntPtr) Unused); } /// Centre current line in window. (Scintilla feature 2619) public void VerticalCentreCaret() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VERTICALCENTRECARET, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_VERTICALCENTRECARET, (IntPtr) Unused, (IntPtr) Unused); } /// Move the selected lines up one line, shifting the line above after the selection (Scintilla feature 2620) public void MoveSelectedLinesUp() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESUP, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESUP, (IntPtr) Unused, (IntPtr) Unused); } /// Move the selected lines down one line, shifting the line below before the selection (Scintilla feature 2621) public void MoveSelectedLinesDown() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESDOWN, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESDOWN, (IntPtr) Unused, (IntPtr) Unused); } - /// Set the identifier reported as IdFrom in notification messages. (Scintilla feature 2622) + /// Set the identifier reported as idFrom in notification messages. (Scintilla feature 2622) public void SetIdentifier(int identifier) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIER, identifier, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIER, (IntPtr) identifier, (IntPtr) Unused); } /// Get the identifier. (Scintilla feature 2623) public int GetIdentifier() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETIDENTIFIER, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETIDENTIFIER, (IntPtr) Unused, (IntPtr) Unused); } /// Set the width for future RGBA image data. (Scintilla feature 2624) public void RGBAImageSetWidth(int width) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETWIDTH, width, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETWIDTH, (IntPtr) width, (IntPtr) Unused); } /// Set the height for future RGBA image data. (Scintilla feature 2625) public void RGBAImageSetHeight(int height) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETHEIGHT, height, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETHEIGHT, (IntPtr) height, (IntPtr) Unused); } /// Set the scale factor in percent for future RGBA image data. (Scintilla feature 2651) public void RGBAImageSetScale(int scalePercent) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETSCALE, scalePercent, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETSCALE, (IntPtr) scalePercent, (IntPtr) Unused); } /// @@ -4670,7 +4599,7 @@ public unsafe void MarkerDefineRGBAImage(int markerNumber, string pixels) { fixed (byte* pixelsPtr = Encoding.UTF8.GetBytes(pixels)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINERGBAIMAGE, markerNumber, (IntPtr)pixelsPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINERGBAIMAGE, (IntPtr) markerNumber, (IntPtr) pixelsPtr); } } @@ -4683,58 +4612,56 @@ public unsafe void RegisterRGBAImage(int type, string pixels) { fixed (byte* pixelsPtr = Encoding.UTF8.GetBytes(pixels)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERRGBAIMAGE, type, (IntPtr)pixelsPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERRGBAIMAGE, (IntPtr) type, (IntPtr) pixelsPtr); } } /// Scroll to start of document. (Scintilla feature 2628) public void ScrollToStart() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOSTART, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOSTART, (IntPtr) Unused, (IntPtr) Unused); } /// Scroll to end of document. (Scintilla feature 2629) public void ScrollToEnd() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOEND, (IntPtr) Unused, (IntPtr) Unused); } /// Set the technology used. (Scintilla feature 2630) - public void SetTechnology(int technology) + public void SetTechnology(Technology technology) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTECHNOLOGY, technology, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETTECHNOLOGY, (IntPtr) technology, (IntPtr) Unused); } /// Get the tech. (Scintilla feature 2631) - public int GetTechnology() + public Technology GetTechnology() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTECHNOLOGY, Unused, Unused); - return (int)res; + return (Technology)Win32.SendMessage(scintilla, SciMsg.SCI_GETTECHNOLOGY, (IntPtr) Unused, (IntPtr) Unused); } /// Create an ILoader*. (Scintilla feature 2632) - public int CreateLoader(int bytes) + public IntPtr CreateLoader(int bytes, DocumentOption documentOptions) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CREATELOADER, bytes, Unused); - return (int)res; + return Win32.SendMessage(scintilla, SciMsg.SCI_CREATELOADER, (IntPtr) bytes, (IntPtr) documentOptions); } /// On OS X, show a find indicator. (Scintilla feature 2640) - public void FindIndicatorShow(Position start, Position end) + public void FindIndicatorShow(int start, int end) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORSHOW, start.Value, end.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORSHOW, (IntPtr) start, (IntPtr) end); } /// On OS X, flash a find indicator, then fade out. (Scintilla feature 2641) - public void FindIndicatorFlash(Position start, Position end) + public void FindIndicatorFlash(int start, int end) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORFLASH, start.Value, end.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORFLASH, (IntPtr) start, (IntPtr) end); } /// On OS X, hide the find indicator. (Scintilla feature 2642) public void FindIndicatorHide() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORHIDE, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORHIDE, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -4744,46 +4671,43 @@ public void FindIndicatorHide() /// public void VCHomeDisplay() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAY, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAY, (IntPtr) Unused, (IntPtr) Unused); } /// Like VCHomeDisplay but extending selection to new caret position. (Scintilla feature 2653) public void VCHomeDisplayExtend() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAYEXTEND, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAYEXTEND, (IntPtr) Unused, (IntPtr) Unused); } /// Is the caret line always visible? (Scintilla feature 2654) public bool GetCaretLineVisibleAlways() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLEALWAYS, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLEALWAYS, (IntPtr) Unused, (IntPtr) Unused); } /// Sets the caret line to always visible. (Scintilla feature 2655) public void SetCaretLineVisibleAlways(bool alwaysVisible) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLEALWAYS, alwaysVisible ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLEALWAYS, new IntPtr(alwaysVisible ? 1 : 0), (IntPtr) Unused); } /// Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. (Scintilla feature 2656) - public void SetLineEndTypesAllowed(int lineEndBitSet) + public void SetLineEndTypesAllowed(LineEndType lineEndBitSet) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEENDTYPESALLOWED, lineEndBitSet, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEENDTYPESALLOWED, (IntPtr) lineEndBitSet, (IntPtr) Unused); } /// Get the line end types currently allowed. (Scintilla feature 2657) - public int GetLineEndTypesAllowed() + public LineEndType GetLineEndTypesAllowed() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESALLOWED, Unused, Unused); - return (int)res; + return (LineEndType)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESALLOWED, (IntPtr) Unused, (IntPtr) Unused); } /// Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. (Scintilla feature 2658) - public int GetLineEndTypesActive() + public LineEndType GetLineEndTypesActive() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESACTIVE, Unused, Unused); - return (int)res; + return (LineEndType)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESACTIVE, (IntPtr) Unused, (IntPtr) Unused); } /// Set the way a character is drawn. (Scintilla feature 2665) @@ -4793,7 +4717,7 @@ public unsafe void SetRepresentation(string encodedCharacter, string representat { fixed (byte* representationPtr = Encoding.UTF8.GetBytes(representation)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETREPRESENTATION, (IntPtr)encodedCharacterPtr, (IntPtr)representationPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) representationPtr); } } } @@ -4807,12 +4731,7 @@ public unsafe string GetRepresentation(string encodedCharacter) { fixed (byte* encodedCharacterPtr = Encoding.UTF8.GetBytes(encodedCharacter)) { - byte[] representationBuffer = new byte[10000]; - fixed (byte* representationPtr = representationBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETREPRESENTATION, (IntPtr)encodedCharacterPtr, (IntPtr)representationPtr); - return Encoding.UTF8.GetString(representationBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETREPRESENTATION, (IntPtr)encodedCharacterPtr); } } @@ -4821,39 +4740,38 @@ public unsafe void ClearRepresentation(string encodedCharacter) { fixed (byte* encodedCharacterPtr = Encoding.UTF8.GetBytes(encodedCharacter)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREPRESENTATION, (IntPtr)encodedCharacterPtr, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) Unused); } } /// Start notifying the container of all key presses and commands. (Scintilla feature 3001) public void StartRecord() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STARTRECORD, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_STARTRECORD, (IntPtr) Unused, (IntPtr) Unused); } /// Stop notifying the container of all key presses and commands. (Scintilla feature 3002) public void StopRecord() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STOPRECORD, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_STOPRECORD, (IntPtr) Unused, (IntPtr) Unused); } /// Set the lexing language of the document. (Scintilla feature 4001) public void SetLexer(int lexer) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXER, lexer, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXER, (IntPtr) lexer, (IntPtr) Unused); } /// Retrieve the lexing language of the document. (Scintilla feature 4002) public int GetLexer() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXER, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXER, (IntPtr) Unused, (IntPtr) Unused); } /// Colourise a segment of the document using the current lexing language. (Scintilla feature 4003) - public void Colourise(Position start, Position end) + public void Colourise(int start, int end) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COLOURISE, start.Value, end.Value); + Win32.SendMessage(scintilla, SciMsg.SCI_COLOURISE, (IntPtr) start, (IntPtr) end); } /// Set up a value that may be used by a lexer for some optional feature. (Scintilla feature 4004) @@ -4863,17 +4781,17 @@ public unsafe void SetProperty(string key, string value) { fixed (byte* valuePtr = Encoding.UTF8.GetBytes(value)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPROPERTY, (IntPtr)keyPtr, (IntPtr)valuePtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETPROPERTY, (IntPtr) keyPtr, (IntPtr) valuePtr); } } } /// Set up the key words used by the lexer. (Scintilla feature 4005) - public unsafe void SetKeyWords(int keywordSet, string keyWords) + public unsafe void SetKeyWords(int keyWordSet, string keyWords) { fixed (byte* keyWordsPtr = Encoding.UTF8.GetBytes(keyWords)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYWORDS, keywordSet, (IntPtr)keyWordsPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYWORDS, (IntPtr) keyWordSet, (IntPtr) keyWordsPtr); } } @@ -4882,7 +4800,7 @@ public unsafe void SetLexerLanguage(string language) { fixed (byte* languagePtr = Encoding.UTF8.GetBytes(language)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXERLANGUAGE, Unused, (IntPtr)languagePtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXERLANGUAGE, (IntPtr) Unused, (IntPtr) languagePtr); } } @@ -4891,7 +4809,7 @@ public unsafe void LoadLexerLibrary(string path) { fixed (byte* pathPtr = Encoding.UTF8.GetBytes(path)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LOADLEXERLIBRARY, Unused, (IntPtr)pathPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_LOADLEXERLIBRARY, (IntPtr) Unused, (IntPtr) pathPtr); } } @@ -4904,12 +4822,7 @@ public unsafe string GetProperty(string key) { fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key)) { - byte[] bufBuffer = new byte[10000]; - fixed (byte* bufPtr = bufBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTY, (IntPtr)keyPtr, (IntPtr)bufPtr); - return Encoding.UTF8.GetString(bufBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETPROPERTY, (IntPtr)keyPtr); } } @@ -4923,12 +4836,7 @@ public unsafe string GetPropertyExpanded(string key) { fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key)) { - byte[] bufBuffer = new byte[10000]; - fixed (byte* bufPtr = bufBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYEXPANDED, (IntPtr)keyPtr, (IntPtr)bufPtr); - return Encoding.UTF8.GetString(bufBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETPROPERTYEXPANDED, (IntPtr)keyPtr); } } @@ -4937,22 +4845,14 @@ public unsafe string GetPropertyExpanded(string key) /// interpreted as an int AFTER any "$()" variable replacement. /// (Scintilla feature 4010) /// - public unsafe int GetPropertyInt(string key) + public unsafe int GetPropertyInt(string key, int defaultValue) { fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYINT, (IntPtr)keyPtr, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYINT, (IntPtr) keyPtr, (IntPtr) defaultValue); } } - /// Retrieve the number of bits the current lexer needs for styling. (Scintilla feature 4011) - public int GetStyleBitsNeeded() - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITSNEEDED, Unused, Unused); - return (int)res; - } - /// /// Retrieve the name of the lexer. /// Return the length of the text. @@ -4961,19 +4861,13 @@ public int GetStyleBitsNeeded() /// public unsafe string GetLexerLanguage() { - byte[] textBuffer = new byte[10000]; - fixed (byte* textPtr = textBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXERLANGUAGE, Unused, (IntPtr)textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETLEXERLANGUAGE); } /// For private communication between an application and a known lexer. (Scintilla feature 4013) - public int PrivateLexerCall(int operation, int pointer) + public IntPtr PrivateLexerCall(int operation, IntPtr pointer) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PRIVATELEXERCALL, operation, pointer); - return (int)res; + return Win32.SendMessage(scintilla, SciMsg.SCI_PRIVATELEXERCALL, (IntPtr) operation, (IntPtr) pointer); } /// @@ -4983,21 +4877,15 @@ public int PrivateLexerCall(int operation, int pointer) /// public unsafe string PropertyNames() { - byte[] namesBuffer = new byte[10000]; - fixed (byte* namesPtr = namesBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYNAMES, Unused, (IntPtr)namesPtr); - return Encoding.UTF8.GetString(namesBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_PROPERTYNAMES); } /// Retrieve the type of a property. (Scintilla feature 4015) - public unsafe int PropertyType(string name) + public unsafe TypeProperty PropertyType(string name) { fixed (byte* namePtr = Encoding.UTF8.GetBytes(name)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYTYPE, (IntPtr)namePtr, Unused); - return (int)res; + return (TypeProperty)Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYTYPE, (IntPtr) namePtr, (IntPtr) Unused); } } @@ -5010,12 +4898,7 @@ public unsafe string DescribeProperty(string name) { fixed (byte* namePtr = Encoding.UTF8.GetBytes(name)) { - byte[] descriptionBuffer = new byte[10000]; - fixed (byte* descriptionPtr = descriptionBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIBEPROPERTY, (IntPtr)namePtr, (IntPtr)descriptionPtr); - return Encoding.UTF8.GetString(descriptionBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_DESCRIBEPROPERTY, (IntPtr)namePtr); } } @@ -5026,12 +4909,7 @@ public unsafe string DescribeProperty(string name) /// public unsafe string DescribeKeyWordSets() { - byte[] descriptionsBuffer = new byte[10000]; - fixed (byte* descriptionsPtr = descriptionsBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIBEKEYWORDSETS, Unused, (IntPtr)descriptionsPtr); - return Encoding.UTF8.GetString(descriptionsBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_DESCRIBEKEYWORDSETS); } /// @@ -5041,49 +4919,43 @@ public unsafe string DescribeKeyWordSets() /// public int GetLineEndTypesSupported() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESSUPPORTED, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESSUPPORTED, (IntPtr) Unused, (IntPtr) Unused); } /// Allocate a set of sub styles for a particular base style, returning start of range (Scintilla feature 4020) public int AllocateSubStyles(int styleBase, int numberStyles) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATESUBSTYLES, styleBase, numberStyles); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATESUBSTYLES, (IntPtr) styleBase, (IntPtr) numberStyles); } /// The starting style number for the sub styles associated with a base style (Scintilla feature 4021) public int GetSubStylesStart(int styleBase) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESSTART, styleBase, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESSTART, (IntPtr) styleBase, (IntPtr) Unused); } /// The number of sub styles associated with a base style (Scintilla feature 4022) public int GetSubStylesLength(int styleBase) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESLENGTH, styleBase, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESLENGTH, (IntPtr) styleBase, (IntPtr) Unused); } /// For a sub style, return the base style, else return the argument. (Scintilla feature 4027) public int GetStyleFromSubStyle(int subStyle) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEFROMSUBSTYLE, subStyle, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEFROMSUBSTYLE, (IntPtr) subStyle, (IntPtr) Unused); } /// For a secondary style, return the primary style, else return the argument. (Scintilla feature 4028) public int GetPrimaryStyleFromStyle(int style) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRIMARYSTYLEFROMSTYLE, style, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPRIMARYSTYLEFROMSTYLE, (IntPtr) style, (IntPtr) Unused); } /// Free allocated sub styles (Scintilla feature 4023) public void FreeSubStyles() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FREESUBSTYLES, Unused, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_FREESUBSTYLES, (IntPtr) Unused, (IntPtr) Unused); } /// Set the identifiers that are shown in a particular style (Scintilla feature 4024) @@ -5091,7 +4963,7 @@ public unsafe void SetIdentifiers(int style, string identifiers) { fixed (byte* identifiersPtr = Encoding.UTF8.GetBytes(identifiers)) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIERS, style, (IntPtr)identifiersPtr); + Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIERS, (IntPtr) style, (IntPtr) identifiersPtr); } } @@ -5102,8 +4974,7 @@ public unsafe void SetIdentifiers(int style, string identifiers) /// public int DistanceToSecondaryStyles() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DISTANCETOSECONDARYSTYLES, Unused, Unused); - return (int)res; + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_DISTANCETOSECONDARYSTYLES, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -5113,33 +4984,108 @@ public int DistanceToSecondaryStyles() /// public unsafe string GetSubStyleBases() { - byte[] stylesBuffer = new byte[10000]; - fixed (byte* stylesPtr = stylesBuffer) - { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLEBASES, Unused, (IntPtr)stylesPtr); - return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0'); - } + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_GETSUBSTYLEBASES); + } + + /// Retrieve the number of named styles for the lexer. (Scintilla feature 4029) + public int GetNamedStyles() + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETNAMEDSTYLES, (IntPtr) Unused, (IntPtr) Unused); + } + + /// + /// Retrieve the name of a style. + /// Result is NUL-terminated. + /// (Scintilla feature 4030) + /// + public unsafe string NameOfStyle(int style) + { + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_NAMEOFSTYLE, (IntPtr)style); } /// - /// Deprecated in 2.30 - /// In palette mode? - /// (Scintilla feature 2139) + /// Retrieve a ' ' separated list of style tags like "literal quoted string". + /// Result is NUL-terminated. + /// (Scintilla feature 4031) + /// + public unsafe string TagsOfStyle(int style) + { + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_TAGSOFSTYLE, (IntPtr)style); + } + + /// + /// Retrieve a description of a style. + /// Result is NUL-terminated. + /// (Scintilla feature 4032) /// - public bool GetUsePalette() + public unsafe string DescriptionOfStyle(int style) + { + return GetNullStrippedStringFromMessageThatReturnsLength(SciMsg.SCI_DESCRIPTIONOFSTYLE, (IntPtr)style); + } + + /// Retrieve bidirectional text display state. (Scintilla feature 2708) + public Bidirectional GetBidirectional() + { + return (Bidirectional)Win32.SendMessage(scintilla, SciMsg.SCI_GETBIDIRECTIONAL, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Set bidirectional text display state. (Scintilla feature 2709) + public void SetBidirectional(Bidirectional bidirectional) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETBIDIRECTIONAL, (IntPtr) bidirectional, (IntPtr) Unused); + } + + /// Retrieve line character index state. (Scintilla feature 2710) + public LineCharacterIndexType GetLineCharacterIndex() + { + return (LineCharacterIndexType)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINECHARACTERINDEX, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Request line character index be created or its use count increased. (Scintilla feature 2711) + public void AllocateLineCharacterIndex(LineCharacterIndexType lineCharacterIndex) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUSEPALETTE, Unused, Unused); - return 1 == (int)res; + Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATELINECHARACTERINDEX, (IntPtr) lineCharacterIndex, (IntPtr) Unused); + } + + /// Decrease use count of line character index and remove if 0. (Scintilla feature 2712) + public void ReleaseLineCharacterIndex(LineCharacterIndexType lineCharacterIndex) + { + Win32.SendMessage(scintilla, SciMsg.SCI_RELEASELINECHARACTERINDEX, (IntPtr) lineCharacterIndex, (IntPtr) Unused); + } + + /// Retrieve the document line containing a position measured in index units. (Scintilla feature 2713) + public int LineFromIndexPosition(int pos, LineCharacterIndexType lineCharacterIndex) + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_LINEFROMINDEXPOSITION, (IntPtr) pos, (IntPtr) lineCharacterIndex); + } + + /// Retrieve the position measured in index units at the start of a document line. (Scintilla feature 2714) + public int IndexPositionFromLine(int line, LineCharacterIndexType lineCharacterIndex) + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDEXPOSITIONFROMLINE, (IntPtr) line, (IntPtr) lineCharacterIndex); } /// - /// In palette mode, Scintilla uses the environment's palette calls to display - /// more colours. This may lead to ugly displays. - /// (Scintilla feature 2039) + /// Divide each styling byte into lexical class bits (default: 5) and indicator + /// bits (default: 3). If a lexer requires more than 32 lexical states, then this + /// is used to expand the possible states. + /// (Scintilla feature 2090) /// - public void SetUsePalette(bool usePalette) + public void SetStyleBits(int bits) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLEBITS, (IntPtr) bits, (IntPtr) Unused); + } + + /// Retrieve number of bits in style bytes used to hold the lexical state. (Scintilla feature 2091) + public int GetStyleBits() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUSEPALETTE, usePalette ? 1 : 0, Unused); + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITS, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Retrieve the number of bits the current lexer needs for styling. (Scintilla feature 4011) + public int GetStyleBitsNeeded() + { + return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITSNEEDED, (IntPtr) Unused, (IntPtr) Unused); } /// @@ -5149,14 +5095,29 @@ public void SetUsePalette(bool usePalette) /// public void SetKeysUnicode(bool keysUnicode) { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYSUNICODE, keysUnicode ? 1 : 0, Unused); + Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYSUNICODE, new IntPtr(keysUnicode ? 1 : 0), (IntPtr) Unused); } /// Are keys always interpreted as Unicode? (Scintilla feature 2522) public bool GetKeysUnicode() { - IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETKEYSUNICODE, Unused, Unused); - return 1 == (int)res; + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETKEYSUNICODE, (IntPtr) Unused, (IntPtr) Unused); + } + + /// Is drawing done in two phases with backgrounds drawn before foregrounds? (Scintilla feature 2283) + public bool GetTwoPhaseDraw() + { + return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTWOPHASEDRAW, (IntPtr) Unused, (IntPtr) Unused); + } + + /// + /// In twoPhaseDraw mode, drawing is performed in two phases, first the background + /// and then the foreground. This avoids chopping off characters that overlap the next run. + /// (Scintilla feature 2284) + /// + public void SetTwoPhaseDraw(bool twoPhase) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETTWOPHASEDRAW, new IntPtr(twoPhase ? 1 : 0), (IntPtr) Unused); } /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/Scintilla_iface.cs b/CSharpRegexTools4Npp/PluginInfrastructure/Scintilla_iface.cs index c08ad83..b3f0632 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/Scintilla_iface.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/Scintilla_iface.cs @@ -38,13 +38,13 @@ public struct ScNotificationHeader public struct ScNotification { public ScNotificationHeader Header; - private int position; /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ + private IntPtr position; /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ public int character; /* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETE, SCN_AUTOCSELECTION, SCN_USERLISTSELECTION */ public int Mmodifiers; /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE */ public int ModificationType; /* SCN_MODIFIED - modification types are name "SC_MOD_*" */ public IntPtr TextPointer; /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ - public int Length; /* SCN_MODIFIED */ - public int LinesAdded; /* SCN_MODIFIED */ + public IntPtr Length; /* SCN_MODIFIED */ + public IntPtr LinesAdded; /* SCN_MODIFIED */ public int Message; /* SCN_MACRORECORD */ public IntPtr wParam; /* SCN_MACRORECORD */ public IntPtr lParam; /* SCN_MACRORECORD */ @@ -52,7 +52,7 @@ public struct ScNotification /// /// 0-based index /// - public int LineNumber; /* SCN_MODIFIED */ + public IntPtr LineNumber; /* SCN_MODIFIED */ public int FoldLevelNow; /* SCN_MODIFIED */ public int FoldLevelPrev; /* SCN_MODIFIED */ public int Margin; /* SCN_MARGINCLICK */ @@ -60,14 +60,15 @@ public struct ScNotification public int X; /* SCN_DWELLSTART, SCN_DWELLEND */ public int Y; /* SCN_DWELLSTART, SCN_DWELLEND */ public int Token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ - public int AnnotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */ + public IntPtr AnnotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */ public int Updated; /* SCN_UPDATEUI */ public int ListCompletionMethod; /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION */ + public int CharacterSource; /* SCN_CHARADDED */ /// /// SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION /// - public Position Position { get { return new Position(position); } } + public TextPosition Position { get { return new TextPosition(position.ToInt32()); } } /// /// Character of the notification - eg keydown @@ -160,6 +161,8 @@ public enum SciMsg : uint SCWS_VISIBLEAFTERINDENT = 2, + SCWS_VISIBLEONLYININDENT = 3, + /// Are white space characters currently visible? /// Returns one of SCWS_* constants. SCI_GETVIEWWS = 2020, @@ -167,6 +170,17 @@ public enum SciMsg : uint /// Make white space characters invisible, always visible or visible outside indentation. SCI_SETVIEWWS = 2021, + SCTD_LONGARROW = 0, + + SCTD_STRIKEOUT = 1, + + /// Retrieve the current tab draw mode. + /// Returns one of SCTD_* constants. + SCI_GETTABDRAWMODE = 2698, + + /// Set how tabs are drawn when visible. + SCI_SETTABDRAWMODE = 2699, + /// Find the position from a point within the window. SCI_POSITIONFROMPOINT = 2022, @@ -207,8 +221,8 @@ public enum SciMsg : uint /// Set the current end of line mode. SCI_SETEOLMODE = 2031, - /// Set the current styling position to pos and the styling mask to mask. - /// The styling mask can be used to protect some bits in each styling byte from modification. + /// Set the current styling position to start. + /// The unused parameter is no longer used and should be set to 0. SCI_STARTSTYLING = 2032, /// Change style from current styling position for length characters to a style @@ -247,7 +261,7 @@ public enum SciMsg : uint SC_IME_INLINE = 1, - /// Is the IME displayed in a winow or inline? + /// Is the IME displayed in a window or inline? SCI_GETIMEINTERACTION = 2678, /// Choose to display the the IME in a winow or inline. @@ -319,6 +333,8 @@ public enum SciMsg : uint SC_MARK_BOOKMARK = 31, + SC_MARK_VERTICALBOOKMARK = 32, + SC_MARK_CHARACTER = 10000, SC_MARKNUM_FOLDEREND = 25, @@ -394,6 +410,8 @@ public enum SciMsg : uint SC_MARGIN_RTEXT = 5, + SC_MARGIN_COLOUR = 6, + /// Set a margin to be either numeric or symbolic. SCI_SETMARGINTYPEN = 2240, @@ -424,6 +442,18 @@ public enum SciMsg : uint /// Retrieve the cursor shown in a margin. SCI_GETMARGINCURSORN = 2249, + /// Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. + SCI_SETMARGINBACKN = 2250, + + /// Retrieve the background colour of a margin + SCI_GETMARGINBACKN = 2251, + + /// Allocate a non-standard number of margins. + SCI_SETMARGINS = 2252, + + /// How many margins are there?. + SCI_GETMARGINS = 2253, + STYLE_DEFAULT = 32, STYLE_LINENUMBER = 33, @@ -438,6 +468,8 @@ public enum SciMsg : uint STYLE_CALLTIP = 38, + STYLE_FOLDDISPLAYTEXT = 39, + STYLE_LASTPREDEFINED = 39, STYLE_MAX = 255, @@ -464,6 +496,8 @@ public enum SciMsg : uint SC_CHARSET_RUSSIAN = 204, + SC_CHARSET_OEM866 = 866, + SC_CHARSET_CYRILLIC = 1251, SC_CHARSET_SHIFTJIS = 128, @@ -520,6 +554,8 @@ public enum SciMsg : uint SC_CASE_LOWER = 2, + SC_CASE_CAMEL = 3, + /// Get the foreground colour of a style. SCI_STYLEGETFORE = 2481, @@ -612,10 +648,10 @@ public enum SciMsg : uint /// Set the foreground colour of the caret. SCI_SETCARETFORE = 2069, - /// When key+modifier combination km is pressed perform msg. + /// When key+modifier combination keyDefinition is pressed perform sciCommand. SCI_ASSIGNCMDKEY = 2070, - /// When key+modifier combination km is pressed do nothing. + /// When key+modifier combination keyDefinition is pressed do nothing. SCI_CLEARCMDKEY = 2071, /// Drop all key mappings. @@ -641,6 +677,12 @@ public enum SciMsg : uint /// Returns the number of characters SCI_GETWORDCHARS = 2646, + /// Set the number of characters to have directly indexed categories + SCI_SETCHARACTERCATEGORYOPTIMIZATION = 2720, + + /// Get the number of characters to have directly indexed categories + SCI_GETCHARACTERCATEGORYOPTIMIZATION = 2721, + /// Start a sequence of actions that is undone and redone as a unit. /// May be nested. SCI_BEGINUNDOACTION = 2078, @@ -684,21 +726,29 @@ public enum SciMsg : uint INDIC_TEXTFORE = 17, + INDIC_POINT = 18, + + INDIC_POINTCHARACTER = 19, + + INDIC_GRADIENT = 20, + + INDIC_GRADIENTCENTRE = 21, + + INDIC_CONTAINER = 8, + INDIC_IME = 32, INDIC_IME_MAX = 35, INDIC_MAX = 35, - INDIC_CONTAINER = 8, + INDICATOR_CONTAINER = 8, - INDIC0_MASK = 0x20, - - INDIC1_MASK = 0x40, + INDICATOR_IME = 32, - INDIC2_MASK = 0x80, + INDICATOR_IME_MAX = 35, - INDICS_MASK = 0xE0, + INDICATOR_MAX = 35, /// Set an indicator to plain, squiggle or TT. SCI_INDICSETSTYLE = 2080, @@ -754,14 +804,6 @@ public enum SciMsg : uint /// Get the size of the dots used to mark space characters. SCI_GETWHITESPACESIZE = 2087, - /// Divide each styling byte into lexical class bits (default: 5) and indicator - /// bits (default: 3). If a lexer requires more than 32 lexical states, then this - /// is used to expand the possible states. - SCI_SETSTYLEBITS = 2090, - - /// Retrieve number of bits in style bytes used to hold the lexical state. - SCI_GETSTYLEBITS = 2091, - /// Used to hold extra styling information for each line. SCI_SETLINESTATE = 2092, @@ -783,12 +825,20 @@ public enum SciMsg : uint /// Set the colour of the background of the line containing the caret. SCI_SETCARETLINEBACK = 2098, + /// Retrieve the caret line frame width. + /// Width = 0 means this option is disabled. + SCI_GETCARETLINEFRAME = 2704, + + /// Display the caret line framed. + /// Set width != 0 to enable this option and width = 0 to disable it. + SCI_SETCARETLINEFRAME = 2705, + /// Set a style to be changeable or not (read only). /// Experimental feature, currently buggy. SCI_STYLESETCHANGEABLE = 2099, /// Display a auto-completion list. - /// The lenEntered parameter indicates how many characters before + /// The lengthEntered parameter indicates how many characters before /// the caret should be used to provide context. SCI_AUTOCSHOW = 2100, @@ -912,6 +962,9 @@ public enum SciMsg : uint /// Count characters between two positions. SCI_COUNTCHARACTERS = 2633, + /// Count code units between two positions. + SCI_COUNTCODEUNITS = 2715, + /// Show or hide the horizontal scroll bar. SCI_SETHSCROLLBAR = 2130, @@ -960,7 +1013,7 @@ public enum SciMsg : uint /// Returns the position at the start of the selection. SCI_GETSELECTIONSTART = 2143, - /// Sets the position that ends the selection - this becomes the currentPosition. + /// Sets the position that ends the selection - this becomes the caret. SCI_SETSELECTIONEND = 2144, /// Returns the position at the end of the selection. @@ -985,12 +1038,16 @@ public enum SciMsg : uint SC_PRINT_COLOURONWHITEDEFAULTBG = 4, + SC_PRINT_SCREENCOLOURS = 5, + /// Modify colours when printing for clearer printed text. SCI_SETPRINTCOLOURMODE = 2148, /// Returns the print colour mode. SCI_GETPRINTCOLOURMODE = 2149, + SCFIND_NONE = 0x0, + SCFIND_WHOLEWORD = 0x2, SCFIND_MATCHCASE = 0x4, @@ -1046,7 +1103,7 @@ public enum SciMsg : uint /// Return the length of the text. SCI_GETTEXTRANGE = 2162, - /// Draw the selection in normal style or with selection highlighted. + /// Draw the selection either highlighted or in normal (non-highlighted) style. SCI_HIDESELECTION = 2163, /// Retrieve the x value of the point in the window where a position is displayed. @@ -1155,6 +1212,12 @@ public enum SciMsg : uint /// Retrieve the text in the target. SCI_GETTARGETTEXT = 2687, + /// Make the target range start and end be the same as the selection range start and end. + SCI_TARGETFROMSELECTION = 2287, + + /// Sets the target to the whole document. + SCI_TARGETWHOLEDOCUMENT = 2690, + /// Replace the target text with the argument text. /// Text is counted so it can contain NULs. /// Returns the length of the replacement text. @@ -1170,7 +1233,7 @@ public enum SciMsg : uint /// Search for a counted string in the target and set the target to the found /// range. Text is counted so it can contain NULs. - /// Returns length of range or -1 for failure in which case target is not moved. + /// Returns start of found range or -1 for failure in which case target is not moved. SCI_SEARCHINTARGET = 2197, /// Set the search flags used by SearchInTarget. @@ -1264,6 +1327,27 @@ public enum SciMsg : uint /// Switch a header line between expanded and contracted. SCI_TOGGLEFOLD = 2231, + /// Switch a header line between expanded and contracted and show some text after the line. + SCI_TOGGLEFOLDSHOWTEXT = 2700, + + SC_FOLDDISPLAYTEXT_HIDDEN = 0, + + SC_FOLDDISPLAYTEXT_STANDARD = 1, + + SC_FOLDDISPLAYTEXT_BOXED = 2, + + /// Set the style of fold display text. + SCI_FOLDDISPLAYTEXTSETSTYLE = 2701, + + /// Get the style of fold display text. + SCI_FOLDDISPLAYTEXTGETSTYLE = 2707, + + /// Set the default fold display text. + SCI_SETDEFAULTFOLDDISPLAYTEXT = 2722, + + /// Get the default fold display text. + SCI_GETDEFAULTFOLDDISPLAYTEXT = 2723, + SC_FOLDACTION_CONTRACT = 0, SC_FOLDACTION_EXPAND = 1, @@ -1342,6 +1426,23 @@ public enum SciMsg : uint /// Get position of end of word. SCI_WORDENDPOSITION = 2267, + /// Is the range start..end considered a word? + SCI_ISRANGEWORD = 2691, + + SC_IDLESTYLING_NONE = 0, + + SC_IDLESTYLING_TOVISIBLE = 1, + + SC_IDLESTYLING_AFTERVISIBLE = 2, + + SC_IDLESTYLING_ALL = 3, + + /// Sets limits to idle styling. + SCI_SETIDLESTYLING = 2692, + + /// Retrieve the limits to idle styling. + SCI_GETIDLESTYLING = 2693, + SC_WRAP_NONE = 0, SC_WRAP_WORD = 1, @@ -1394,6 +1495,8 @@ public enum SciMsg : uint SC_WRAPINDENT_INDENT = 2, + SC_WRAPINDENT_DEEPINDENT = 3, + /// Sets how wrapped sublines are placed. Default is fixed. SCI_SETWRAPINDENTMODE = 2472, @@ -1452,13 +1555,6 @@ public enum SciMsg : uint /// Append a string to the end of the document without changing the selection. SCI_APPENDTEXT = 2282, - /// Is drawing done in two phases with backgrounds drawn before foregrounds? - SCI_GETTWOPHASEDRAW = 2283, - - /// In twoPhaseDraw mode, drawing is performed in two phases, first the background - /// and then the foreground. This avoids chopping off characters that overlap the next run. - SCI_SETTWOPHASEDRAW = 2284, - SC_PHASES_ONE = 0, SC_PHASES_TWO = 1, @@ -1500,16 +1596,13 @@ public enum SciMsg : uint /// Change the effect of pasting when there are multiple selections. SCI_SETMULTIPASTE = 2614, - /// Retrieve the effect of pasting when there are multiple selections.. + /// Retrieve the effect of pasting when there are multiple selections. SCI_GETMULTIPASTE = 2615, /// Retrieve the value of a tag from a regular expression search. /// Result is NUL-terminated. SCI_GETTAG = 2616, - /// Make the target range start and end be the same as the selection range start and end. - SCI_TARGETFROMSELECTION = 2287, - /// Join the lines in the target. SCI_LINESJOIN = 2288, @@ -1517,12 +1610,22 @@ public enum SciMsg : uint /// where possible. SCI_LINESSPLIT = 2289, - /// Set the colours used as a chequerboard pattern in the fold margin + /// Set one of the colours used as a chequerboard pattern in the fold margin SCI_SETFOLDMARGINCOLOUR = 2290, - /// Set the colours used as a chequerboard pattern in the fold margin + /// Set the other colour used as a chequerboard pattern in the fold margin SCI_SETFOLDMARGINHICOLOUR = 2291, + SC_ACCESSIBILITY_DISABLED = 0, + + SC_ACCESSIBILITY_ENABLED = 1, + + /// Enable or disable accessibility. + SCI_SETACCESSIBILITY = 2702, + + /// Report accessibility status. + SCI_GETACCESSIBILITY = 2703, + /// Move caret down one line. SCI_LINEDOWN = 2300, @@ -1648,6 +1751,9 @@ public enum SciMsg : uint /// Switch the current line with the previous. SCI_LINETRANSPOSE = 2339, + /// Reverse order of selected lines. + SCI_LINEREVERSE = 2354, + /// Duplicate the current line. SCI_LINEDUPLICATE = 2404, @@ -1681,46 +1787,28 @@ public enum SciMsg : uint /// caret position. SCI_LINEENDDISPLAYEXTEND = 2348, - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like Home but when word-wrap is enabled goes first to start of display line + /// HomeDisplay, then to start of document line Home. SCI_HOMEWRAP = 2349, - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like HomeExtend but when word-wrap is enabled extends first to start of display line + /// HomeDisplayExtend, then to start of document line HomeExtend. SCI_HOMEWRAPEXTEND = 2450, - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like LineEnd but when word-wrap is enabled goes first to end of display line + /// LineEndDisplay, then to start of document line LineEnd. SCI_LINEENDWRAP = 2451, - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like LineEndExtend but when word-wrap is enabled extends first to end of display line + /// LineEndDisplayExtend, then to start of document line LineEndExtend. SCI_LINEENDWRAPEXTEND = 2452, - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like VCHome but when word-wrap is enabled goes first to start of display line + /// VCHomeDisplay, then behaves like VCHome. SCI_VCHOMEWRAP = 2453, - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + /// Like VCHomeExtend but when word-wrap is enabled extends first to start of display line + /// VCHomeDisplayExtend, then behaves like VCHomeExtend. SCI_VCHOMEWRAPEXTEND = 2454, /// Copy the line containing the caret. @@ -1745,6 +1833,7 @@ public enum SciMsg : uint SCI_BRACEBADLIGHTINDICATOR = 2499, /// Find the position of a matching brace or INVALID_POSITION if no match. + /// The maxReStyle must be 0 for now. It may be defined in a future release. SCI_BRACEMATCH = 2353, /// Are the end of line characters visible? @@ -1768,6 +1857,8 @@ public enum SciMsg : uint EDGE_BACKGROUND = 2, + EDGE_MULTILINE = 3, + /// Retrieve the column number which text should be kept within. SCI_GETEDGECOLUMN = 2360, @@ -1778,7 +1869,7 @@ public enum SciMsg : uint /// Retrieve the edge highlight mode. SCI_GETEDGEMODE = 2362, - /// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that + /// The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that /// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). SCI_SETEDGEMODE = 2363, @@ -1788,6 +1879,12 @@ public enum SciMsg : uint /// Change the colour used in edge indication. SCI_SETEDGECOLOUR = 2365, + /// Add a new vertical edge to the view. + SCI_MULTIEDGEADDLINE = 2694, + + /// Clear all vertical edges. + SCI_MULTIEDGECLEARALL = 2695, + /// Sets the current caret position to be the search anchor. SCI_SEARCHANCHOR = 2366, @@ -1802,8 +1899,14 @@ public enum SciMsg : uint /// Retrieves the number of lines completely visible. SCI_LINESONSCREEN = 2370, + SC_POPUP_NEVER = 0, + + SC_POPUP_ALL = 1, + + SC_POPUP_TEXT = 2, + /// Set whether a pop up menu is displayed automatically when the user presses - /// the wrong mouse button. + /// the wrong mouse button on certain areas. SCI_USEPOPUP = 2371, /// Is the selection rectangular? The alternative is the more common stream selection. @@ -1816,6 +1919,12 @@ public enum SciMsg : uint /// Retrieve the zoom level. SCI_GETZOOM = 2374, + SC_DOCUMENTOPTION_DEFAULT = 0, + + SC_DOCUMENTOPTION_STYLES_NONE = 0x1, + + SC_DOCUMENTOPTION_TEXT_LARGE = 0x100, + /// Create a new document object. /// Starts with reference count of 1 and not selected into editor. SCI_CREATEDOCUMENT = 2375, @@ -1826,9 +1935,18 @@ public enum SciMsg : uint /// Release a reference to the document, deleting document if it fades to black. SCI_RELEASEDOCUMENT = 2377, + /// Get which document options are set. + SCI_GETDOCUMENTOPTIONS = 2379, + /// Get which document modification events are sent to the container. SCI_GETMODEVENTMASK = 2378, + /// Set whether command events are sent to the container. + SCI_SETCOMMANDEVENTS = 2717, + + /// Get whether command events are sent to the container. + SCI_GETCOMMANDEVENTS = 2718, + /// Change internal focus flag. SCI_SETFOCUS = 2380, @@ -1857,6 +1975,12 @@ public enum SciMsg : uint /// Get whether mouse gets captured. SCI_GETMOUSEDOWNCAPTURES = 2385, + /// Set whether the mouse wheel can be active outside the window. + SCI_SETMOUSEWHEELCAPTURES = 2696, + + /// Get whether mouse wheel can be active outside the window. + SCI_GETMOUSEWHEELCAPTURES = 2697, + SC_CURSORNORMAL = 0xFFFFFFFF, SC_CURSORARROW = 2, @@ -1906,10 +2030,10 @@ public enum SciMsg : uint /// Delete forwards from the current position to the end of the line. SCI_DELLINERIGHT = 2396, - /// Get and Set the xOffset (ie, horizontal scroll position). + /// Set the xOffset (ie, horizontal scroll position). SCI_SETXOFFSET = 2397, - /// Get and Set the xOffset (ie, horizontal scroll position). + /// Get the xOffset (ie, horizontal scroll position). SCI_GETXOFFSET = 2398, /// Set the last x chosen value to be the caret x position. @@ -1964,16 +2088,16 @@ public enum SciMsg : uint /// Get the HotspotSingleLine property SCI_GETHOTSPOTSINGLELINE = 2497, - /// Move caret between paragraphs (delimited by empty lines). + /// Move caret down one paragraph (delimited by empty lines). SCI_PARADOWN = 2413, - /// Move caret between paragraphs (delimited by empty lines). + /// Extend selection down one paragraph (delimited by empty lines). SCI_PARADOWNEXTEND = 2414, - /// Move caret between paragraphs (delimited by empty lines). + /// Move caret up one paragraph (delimited by empty lines). SCI_PARAUP = 2415, - /// Move caret between paragraphs (delimited by empty lines). + /// Extend selection up one paragraph (delimited by empty lines). SCI_PARAUPEXTEND = 2416, /// Given a valid document position, return the previous position taking code @@ -1988,6 +2112,11 @@ public enum SciMsg : uint /// of characters. Returned value is always between 0 and last position in document. SCI_POSITIONRELATIVE = 2670, + /// Given a valid document position, return a position that differs in a number + /// of UTF-16 code units. Returned value is always between 0 and last position in document. + /// The result may point half way (2 bytes) inside a non-BMP character. + SCI_POSITIONRELATIVECODEUNITS = 2716, + /// Copy a range of text to the clipboard. Positions are clipped into the document. SCI_COPYRANGE = 2419, @@ -2009,6 +2138,9 @@ public enum SciMsg : uint /// Get the mode of the current selection. SCI_GETSELECTIONMODE = 2423, + /// Get whether or not regular caret moves will extend or reduce the selection. + SCI_GETMOVEEXTENDSSELECTION = 2706, + /// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). SCI_GETLINESELSTARTPOSITION = 2424, @@ -2110,7 +2242,7 @@ public enum SciMsg : uint /// Change the effect of autocompleting when there are multiple selections. SCI_AUTOCSETMULTI = 2636, - /// Retrieve the effect of autocompleting when there are multiple selections.. + /// Retrieve the effect of autocompleting when there are multiple selections. SCI_AUTOCGETMULTI = 2637, SC_ORDER_PRESORTED = 0, @@ -2187,6 +2319,14 @@ public enum SciMsg : uint CARETSTYLE_BLOCK = 2, + CARETSTYLE_OVERSTRIKE_BAR = 0, + + CARETSTYLE_OVERSTRIKE_BLOCK = 0x10, + + CARETSTYLE_INS_MASK = 0xF, + + CARETSTYLE_BLOCK_AFTER = 0x100, + /// Set the style of the caret to be drawn. SCI_SETCARETSTYLE = 2512, @@ -2211,10 +2351,10 @@ public enum SciMsg : uint /// Turn a indicator off over a range. SCI_INDICATORCLEARRANGE = 2505, - /// Are any indicators present at position? + /// Are any indicators present at pos? SCI_INDICATORALLONFOR = 2506, - /// What value does a particular indicator have at at a position? + /// What value does a particular indicator have at a position? SCI_INDICATORVALUEAT = 2507, /// Where does a particular indicator start? @@ -2238,7 +2378,7 @@ public enum SciMsg : uint /// Return a read-only pointer to a range of characters in the document. /// May move the gap so that the range is contiguous, but will only move up - /// to rangeLength bytes. + /// to lengthRange bytes. SCI_GETRANGEPOINTER = 2643, /// Return a position which, to avoid performance costs, should not be within @@ -2359,6 +2499,8 @@ public enum SciMsg : uint /// Allocate some extended (>255) style numbers and return the start of the range SCI_ALLOCATEEXTENDEDSTYLES = 2553, + UNDO_NONE = 0, + UNDO_MAY_COALESCE = 1, /// Add a container action to the undo stack @@ -2425,28 +2567,28 @@ public enum SciMsg : uint /// Which selection is the main selection SCI_GETMAINSELECTION = 2575, - /// Which selection is the main selection + /// Set the caret position of the nth selection. SCI_SETSELECTIONNCARET = 2576, - /// Which selection is the main selection + /// Return the caret position of the nth selection. SCI_GETSELECTIONNCARET = 2577, - /// Which selection is the main selection + /// Set the anchor position of the nth selection. SCI_SETSELECTIONNANCHOR = 2578, - /// Which selection is the main selection + /// Return the anchor position of the nth selection. SCI_GETSELECTIONNANCHOR = 2579, - /// Which selection is the main selection + /// Set the virtual space of the caret of the nth selection. SCI_SETSELECTIONNCARETVIRTUALSPACE = 2580, - /// Which selection is the main selection + /// Return the virtual space of the caret of the nth selection. SCI_GETSELECTIONNCARETVIRTUALSPACE = 2581, - /// Which selection is the main selection + /// Set the virtual space of the anchor of the nth selection. SCI_SETSELECTIONNANCHORVIRTUALSPACE = 2582, - /// Which selection is the main selection + /// Return the virtual space of the anchor of the nth selection. SCI_GETSELECTIONNANCHORVIRTUALSPACE = 2583, /// Sets the position that starts the selection - this becomes the anchor. @@ -2461,28 +2603,28 @@ public enum SciMsg : uint /// Returns the position at the end of the selection. SCI_GETSELECTIONNEND = 2587, - /// Returns the position at the end of the selection. + /// Set the caret position of the rectangular selection. SCI_SETRECTANGULARSELECTIONCARET = 2588, - /// Returns the position at the end of the selection. + /// Return the caret position of the rectangular selection. SCI_GETRECTANGULARSELECTIONCARET = 2589, - /// Returns the position at the end of the selection. + /// Set the anchor position of the rectangular selection. SCI_SETRECTANGULARSELECTIONANCHOR = 2590, - /// Returns the position at the end of the selection. + /// Return the anchor position of the rectangular selection. SCI_GETRECTANGULARSELECTIONANCHOR = 2591, - /// Returns the position at the end of the selection. + /// Set the virtual space of the caret of the rectangular selection. SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE = 2592, - /// Returns the position at the end of the selection. + /// Return the virtual space of the caret of the rectangular selection. SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE = 2593, - /// Returns the position at the end of the selection. + /// Set the virtual space of the anchor of the rectangular selection. SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE = 2594, - /// Returns the position at the end of the selection. + /// Return the virtual space of the anchor of the rectangular selection. SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE = 2595, SCVS_NONE = 0, @@ -2491,13 +2633,15 @@ public enum SciMsg : uint SCVS_USERACCESSIBLE = 2, - /// Returns the position at the end of the selection. + SCVS_NOWRAPLINESTART = 4, + + /// Set options for virtual space behaviour. SCI_SETVIRTUALSPACEOPTIONS = 2596, - /// Returns the position at the end of the selection. + /// Return options for virtual space behaviour. SCI_GETVIRTUALSPACEOPTIONS = 2597, - /// On GTK+, allow selecting the modifier key to use for mouse-based + /// On GTK, allow selecting the modifier key to use for mouse-based /// rectangular selection. Often the window manager requires Alt+Mouse Drag /// for moving windows. /// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. @@ -2532,6 +2676,14 @@ public enum SciMsg : uint /// Swap that caret and anchor of the main selection. SCI_SWAPMAINANCHORCARET = 2607, + /// Add the next occurrence of the main selection to the set of selections as main. + /// If the current selection is empty then select word around caret. + SCI_MULTIPLESELECTADDNEXT = 2688, + + /// Add each occurrence of the main selection in the target to the set of selections. + /// If the current selection is empty then select word around caret. + SCI_MULTIPLESELECTADDEACH = 2689, + /// Indicate that the internal state of a lexer has changed over a range and therefore /// there may be a need to redraw. SCI_CHANGELEXERSTATE = 2617, @@ -2549,7 +2701,7 @@ public enum SciMsg : uint /// Move the selected lines down one line, shifting the line below before the selection SCI_MOVESELECTEDLINESDOWN = 2621, - /// Set the identifier reported as IdFrom in notification messages. + /// Set the identifier reported as idFrom in notification messages. SCI_SETIDENTIFIER = 2622, /// Get the identifier. @@ -2682,9 +2834,6 @@ public enum SciMsg : uint /// interpreted as an int AFTER any "$()" variable replacement. SCI_GETPROPERTYINT = 4010, - /// Retrieve the number of bits the current lexer needs for styling. - SCI_GETSTYLEBITSNEEDED = 4011, - /// Retrieve the name of the lexer. /// Return the length of the text. /// Result is NUL-terminated. @@ -2747,6 +2896,23 @@ public enum SciMsg : uint /// Result is NUL-terminated. SCI_GETSUBSTYLEBASES = 4026, + /// Retrieve the number of named styles for the lexer. + SCI_GETNAMEDSTYLES = 4029, + + /// Retrieve the name of a style. + /// Result is NUL-terminated. + SCI_NAMEOFSTYLE = 4030, + + /// Retrieve a ' ' separated list of style tags like "literal quoted string". + /// Result is NUL-terminated. + SCI_TAGSOFSTYLE = 4031, + + /// Retrieve a description of a style. + /// Result is NUL-terminated. + SCI_DESCRIPTIONOFSTYLE = 4032, + + SC_MOD_NONE = 0x0, + SC_MOD_INSERTTEXT = 0x1, SC_MOD_DELETETEXT = 0x2, @@ -2859,6 +3025,22 @@ public enum SciMsg : uint SCMOD_META = 16, + SC_AC_FILLUP = 1, + + SC_AC_DOUBLECLICK = 2, + + SC_AC_TAB = 3, + + SC_AC_NEWLINE = 4, + + SC_AC_COMMAND = 5, + + SC_CHARACTERSOURCE_DIRECT_INPUT = 0, + + SC_CHARACTERSOURCE_TENTATIVE_INPUT = 1, + + SC_CHARACTERSOURCE_IME_RESULT = 2, + /// Events SCN_STYLENEEDED = 2000, @@ -2874,87 +3056,130 @@ public enum SciMsg : uint /// Events SCN_MODIFYATTEMPTRO = 2004, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_KEY = 2005, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_DOUBLECLICK = 2006, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_UPDATEUI = 2007, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_MODIFIED = 2008, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_MACRORECORD = 2009, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_MARGINCLICK = 2010, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_NEEDSHOWN = 2011, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_PAINTED = 2013, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_USERLISTSELECTION = 2014, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_URIDROPPED = 2015, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_DWELLSTART = 2016, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_DWELLEND = 2017, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_ZOOM = 2018, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_HOTSPOTCLICK = 2019, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_HOTSPOTDOUBLECLICK = 2020, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_CALLTIPCLICK = 2021, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_AUTOCSELECTION = 2022, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_INDICATORCLICK = 2023, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_INDICATORRELEASE = 2024, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_AUTOCCANCELLED = 2025, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_AUTOCCHARDELETED = 2026, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_HOTSPOTRELEASECLICK = 2027, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_FOCUSIN = 2028, - /// GTK+ Specific to work around focus and accelerator problems: + /// GTK Specific to work around focus and accelerator problems: SCN_FOCUSOUT = 2029, - SC_CP_DBCS = 1, + /// GTK Specific to work around focus and accelerator problems: + SCN_AUTOCCOMPLETED = 2030, + + /// GTK Specific to work around focus and accelerator problems: + SCN_MARGINRIGHTCLICK = 2031, + + /// GTK Specific to work around focus and accelerator problems: + SCN_AUTOCSELECTIONCHANGE = 2032, + + SC_BIDIRECTIONAL_DISABLED = 0, + + SC_BIDIRECTIONAL_L2R = 1, + + SC_BIDIRECTIONAL_R2L = 2, + + /// Retrieve bidirectional text display state. + SCI_GETBIDIRECTIONAL = 2708, + + /// Set bidirectional text display state. + SCI_SETBIDIRECTIONAL = 2709, + + SC_LINECHARACTERINDEX_NONE = 0, + + SC_LINECHARACTERINDEX_UTF32 = 1, + + SC_LINECHARACTERINDEX_UTF16 = 2, + + /// Retrieve line character index state. + SCI_GETLINECHARACTERINDEX = 2710, + + /// Request line character index be created or its use count increased. + SCI_ALLOCATELINECHARACTERINDEX = 2711, + + /// Decrease use count of line character index and remove if 0. + SCI_RELEASELINECHARACTERINDEX = 2712, + + /// Retrieve the document line containing a position measured in index units. + SCI_LINEFROMINDEXPOSITION = 2713, + + /// Retrieve the position measured in index units at the start of a document line. + SCI_INDEXPOSITIONFROMLINE = 2714, + + /// Divide each styling byte into lexical class bits (default: 5) and indicator + /// bits (default: 3). If a lexer requires more than 32 lexical states, then this + /// is used to expand the possible states. + SCI_SETSTYLEBITS = 2090, - /// Deprecated in 2.30 - /// In palette mode? - SCI_GETUSEPALETTE = 2139, + /// Retrieve number of bits in style bytes used to hold the lexical state. + SCI_GETSTYLEBITS = 2091, - /// In palette mode, Scintilla uses the environment's palette calls to display - /// more colours. This may lead to ugly displays. - SCI_SETUSEPALETTE = 2039, + /// Retrieve the number of bits the current lexer needs for styling. + SCI_GETSTYLEBITSNEEDED = 4011, /// Deprecated in 3.5.5 /// Always interpret keyboard input as Unicode @@ -2963,6 +3188,21 @@ public enum SciMsg : uint /// Are keys always interpreted as Unicode? SCI_GETKEYSUNICODE = 2522, + /// Is drawing done in two phases with backgrounds drawn before foregrounds? + SCI_GETTWOPHASEDRAW = 2283, + + /// In twoPhaseDraw mode, drawing is performed in two phases, first the background + /// and then the foreground. This avoids chopping off characters that overlap the next run. + SCI_SETTWOPHASEDRAW = 2284, + + INDIC0_MASK = 0x20, + + INDIC1_MASK = 0x40, + + INDIC2_MASK = 0x80, + + INDICS_MASK = 0xE0, + /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ SC_SEARCHRESULT_LINEBUFFERMAXLENGTH = 1024 @@ -2993,8 +3233,8 @@ public TextToFind(CharacterRange chrRange, string searchText) /// the search pattern public TextToFind(int cpmin, int cpmax, string searchText) { - _sciTextToFind.chrg.cpMin = cpmin; - _sciTextToFind.chrg.cpMax = cpmax; + _sciTextToFind.chrg.cpMin = new IntPtr(cpmin); + _sciTextToFind.chrg.cpMax = new IntPtr(cpmax); _sciTextToFind.lpstrText = Marshal.StringToHGlobalAnsi(searchText); } @@ -3031,16 +3271,12 @@ void _freeNativeString() public void Dispose() { - try + if (!_disposed) { - if (!_disposed) - { - _freeNativeString(); - if (_ptrSciTextToFind != IntPtr.Zero) Marshal.FreeHGlobal(_ptrSciTextToFind); - _disposed = true; - } + _freeNativeString(); + if (_ptrSciTextToFind != IntPtr.Zero) Marshal.FreeHGlobal(_ptrSciTextToFind); + _disposed = true; } - catch { } } ~TextToFind() diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/Scintilla_iface.cs.bak b/CSharpRegexTools4Npp/PluginInfrastructure/Scintilla_iface.cs.bak deleted file mode 100644 index 1ea6daa..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/Scintilla_iface.cs.bak +++ /dev/null @@ -1,3047 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -// -// This file should stay in sync with the CPP project file -// "notepad-plus-plus/scintilla/include/Scintilla.iface" -// found at -// https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.iface - -using System; -using System.Runtime.InteropServices; - -namespace CSharpRegexTools4Npp.PluginInfrastructure -{ - /// - /// Compatible with Windows NMHDR. - /// hwndFrom is really an environment specific window handle or pointer - /// but most clients of Scintilla.h do not have this type visible. - /// - [StructLayout(LayoutKind.Sequential)] - public struct ScNotificationHeader - { - /// - /// environment specific window handle/pointer - /// - public IntPtr hwndFrom; - - /// - /// CtrlID of the window issuing the notification - /// - public IntPtr IdFrom; - - /// - /// The SCN_* notification Code - /// - public uint Code; - } - - [StructLayout(LayoutKind.Sequential)] - public struct ScNotification - { - public ScNotificationHeader Header; - private int position; /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ - public int character; /* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETE, SCN_AUTOCSELECTION, SCN_USERLISTSELECTION */ - public int Mmodifiers; /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE */ - public int ModificationType; /* SCN_MODIFIED - modification types are name "SC_MOD_*" */ - public IntPtr TextPointer; /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ - public int Length; /* SCN_MODIFIED */ - public int LinesAdded; /* SCN_MODIFIED */ - public int Message; /* SCN_MACRORECORD */ - public IntPtr wParam; /* SCN_MACRORECORD */ - public IntPtr lParam; /* SCN_MACRORECORD */ - - /// - /// 0-based index - /// - public int LineNumber; /* SCN_MODIFIED */ - public int FoldLevelNow; /* SCN_MODIFIED */ - public int FoldLevelPrev; /* SCN_MODIFIED */ - public int Margin; /* SCN_MARGINCLICK */ - public int ListType; /* SCN_USERLISTSELECTION */ - public int X; /* SCN_DWELLSTART, SCN_DWELLEND */ - public int Y; /* SCN_DWELLSTART, SCN_DWELLEND */ - public int Token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ - public int AnnotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */ - public int Updated; /* SCN_UPDATEUI */ - public int ListCompletionMethod; /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION */ - - /// - /// SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION - /// - public Position Position { get { return new Position(position); } } - - /// - /// Character of the notification - eg keydown - /// SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETE, SCN_AUTOCSELECTION, SCN_USERLISTSELECTION - /// - public char Character { get { return (char) character; } } - } - - [Flags] - public enum SciMsg : uint - { - /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ - INVALID_POSITION = 0xFFFFFFFF, - - SCI_START = 2000, - - SCI_OPTIONAL_START = 3000, - - SCI_LEXER_START = 4000, - - /// Add text to the document at current position. - SCI_ADDTEXT = 2001, - - /// Add array of cells to document. - SCI_ADDSTYLEDTEXT = 2002, - - /// Insert string at a position. - SCI_INSERTTEXT = 2003, - - /// Change the text that is being inserted in response to SC_MOD_INSERTCHECK - SCI_CHANGEINSERTION = 2672, - - /// Delete all text in the document. - SCI_CLEARALL = 2004, - - /// Delete a range of text in the document. - SCI_DELETERANGE = 2645, - - /// Set all style bytes to 0, remove all folding information. - SCI_CLEARDOCUMENTSTYLE = 2005, - - /// Returns the number of bytes in the document. - SCI_GETLENGTH = 2006, - - /// Returns the character byte at the position. - SCI_GETCHARAT = 2007, - - /// Returns the position of the caret. - SCI_GETCURRENTPOS = 2008, - - /// Returns the position of the opposite end of the selection to the caret. - SCI_GETANCHOR = 2009, - - /// Returns the style byte at the position. - SCI_GETSTYLEAT = 2010, - - /// Redoes the next action on the undo history. - SCI_REDO = 2011, - - /// Choose between collecting actions into the undo - /// history and discarding them. - SCI_SETUNDOCOLLECTION = 2012, - - /// Select all the text in the document. - SCI_SELECTALL = 2013, - - /// Remember the current position in the undo history as the position - /// at which the document was saved. - SCI_SETSAVEPOINT = 2014, - - /// Retrieve a buffer of cells. - /// Returns the number of bytes in the buffer not including terminating NULs. - SCI_GETSTYLEDTEXT = 2015, - - /// Are there any redoable actions in the undo history? - SCI_CANREDO = 2016, - - /// Retrieve the line number at which a particular marker is located. - SCI_MARKERLINEFROMHANDLE = 2017, - - /// Delete a marker. - SCI_MARKERDELETEHANDLE = 2018, - - /// Is undo history being collected? - SCI_GETUNDOCOLLECTION = 2019, - - SCWS_INVISIBLE = 0, - - SCWS_VISIBLEALWAYS = 1, - - SCWS_VISIBLEAFTERINDENT = 2, - - /// Are white space characters currently visible? - /// Returns one of SCWS_* constants. - SCI_GETVIEWWS = 2020, - - /// Make white space characters invisible, always visible or visible outside indentation. - SCI_SETVIEWWS = 2021, - - /// Find the position from a point within the window. - SCI_POSITIONFROMPOINT = 2022, - - /// Find the position from a point within the window but return - /// INVALID_POSITION if not close to text. - SCI_POSITIONFROMPOINTCLOSE = 2023, - - /// Set caret to start of a line and ensure it is visible. - SCI_GOTOLINE = 2024, - - /// Set caret to a position and ensure it is visible. - SCI_GOTOPOS = 2025, - - /// Set the selection anchor to a position. The anchor is the opposite - /// end of the selection from the caret. - SCI_SETANCHOR = 2026, - - /// Retrieve the text of the line containing the caret. - /// Returns the index of the caret on the line. - /// Result is NUL-terminated. - SCI_GETCURLINE = 2027, - - /// Retrieve the position of the last correctly styled character. - SCI_GETENDSTYLED = 2028, - - SC_EOL_CRLF = 0, - - SC_EOL_CR = 1, - - SC_EOL_LF = 2, - - /// Convert all line endings in the document to one mode. - SCI_CONVERTEOLS = 2029, - - /// Retrieve the current end of line mode - one of CRLF, CR, or LF. - SCI_GETEOLMODE = 2030, - - /// Set the current end of line mode. - SCI_SETEOLMODE = 2031, - - /// Set the current styling position to pos and the styling mask to mask. - /// The styling mask can be used to protect some bits in each styling byte from modification. - SCI_STARTSTYLING = 2032, - - /// Change style from current styling position for length characters to a style - /// and move the current styling position to after this newly styled segment. - SCI_SETSTYLING = 2033, - - /// Is drawing done first into a buffer or direct to the screen? - SCI_GETBUFFEREDDRAW = 2034, - - /// If drawing is buffered then each line of text is drawn into a bitmap buffer - /// before drawing it to the screen to avoid flicker. - SCI_SETBUFFEREDDRAW = 2035, - - /// Change the visible size of a tab to be a multiple of the width of a space character. - SCI_SETTABWIDTH = 2036, - - /// Retrieve the visible size of a tab. - SCI_GETTABWIDTH = 2121, - - /// Clear explicit tabstops on a line. - SCI_CLEARTABSTOPS = 2675, - - /// Add an explicit tab stop for a line. - SCI_ADDTABSTOP = 2676, - - /// Find the next explicit tab stop position on a line after a position. - SCI_GETNEXTTABSTOP = 2677, - - SC_CP_UTF8 = 65001, - - /// Set the code page used to interpret the bytes of the document as characters. - /// The SC_CP_UTF8 value can be used to enter Unicode mode. - SCI_SETCODEPAGE = 2037, - - SC_IME_WINDOWED = 0, - - SC_IME_INLINE = 1, - - /// Is the IME displayed in a winow or inline? - SCI_GETIMEINTERACTION = 2678, - - /// Choose to display the the IME in a winow or inline. - SCI_SETIMEINTERACTION = 2679, - - MARKER_MAX = 31, - - SC_MARK_CIRCLE = 0, - - SC_MARK_ROUNDRECT = 1, - - SC_MARK_ARROW = 2, - - SC_MARK_SMALLRECT = 3, - - SC_MARK_SHORTARROW = 4, - - SC_MARK_EMPTY = 5, - - SC_MARK_ARROWDOWN = 6, - - SC_MARK_MINUS = 7, - - SC_MARK_PLUS = 8, - - SC_MARK_VLINE = 9, - - SC_MARK_LCORNER = 10, - - SC_MARK_TCORNER = 11, - - SC_MARK_BOXPLUS = 12, - - SC_MARK_BOXPLUSCONNECTED = 13, - - SC_MARK_BOXMINUS = 14, - - SC_MARK_BOXMINUSCONNECTED = 15, - - SC_MARK_LCORNERCURVE = 16, - - SC_MARK_TCORNERCURVE = 17, - - SC_MARK_CIRCLEPLUS = 18, - - SC_MARK_CIRCLEPLUSCONNECTED = 19, - - SC_MARK_CIRCLEMINUS = 20, - - SC_MARK_CIRCLEMINUSCONNECTED = 21, - - SC_MARK_BACKGROUND = 22, - - SC_MARK_DOTDOTDOT = 23, - - SC_MARK_ARROWS = 24, - - SC_MARK_PIXMAP = 25, - - SC_MARK_FULLRECT = 26, - - SC_MARK_LEFTRECT = 27, - - SC_MARK_AVAILABLE = 28, - - SC_MARK_UNDERLINE = 29, - - SC_MARK_RGBAIMAGE = 30, - - SC_MARK_BOOKMARK = 31, - - SC_MARK_CHARACTER = 10000, - - SC_MARKNUM_FOLDEREND = 25, - - SC_MARKNUM_FOLDEROPENMID = 26, - - SC_MARKNUM_FOLDERMIDTAIL = 27, - - SC_MARKNUM_FOLDERTAIL = 28, - - SC_MARKNUM_FOLDERSUB = 29, - - SC_MARKNUM_FOLDER = 30, - - SC_MARKNUM_FOLDEROPEN = 31, - - SC_MASK_FOLDERS = 0xFE000000, - - /// Set the symbol used for a particular marker number. - SCI_MARKERDEFINE = 2040, - - /// Set the foreground colour used for a particular marker number. - SCI_MARKERSETFORE = 2041, - - /// Set the background colour used for a particular marker number. - SCI_MARKERSETBACK = 2042, - - /// Set the background colour used for a particular marker number when its folding block is selected. - SCI_MARKERSETBACKSELECTED = 2292, - - /// Enable/disable highlight for current folding bloc (smallest one that contains the caret) - SCI_MARKERENABLEHIGHLIGHT = 2293, - - /// Add a marker to a line, returning an ID which can be used to find or delete the marker. - SCI_MARKERADD = 2043, - - /// Delete a marker from a line. - SCI_MARKERDELETE = 2044, - - /// Delete all markers with a particular number from all lines. - SCI_MARKERDELETEALL = 2045, - - /// Get a bit mask of all the markers set on a line. - SCI_MARKERGET = 2046, - - /// Find the next line at or after lineStart that includes a marker in mask. - /// Return -1 when no more lines. - SCI_MARKERNEXT = 2047, - - /// Find the previous line before lineStart that includes a marker in mask. - SCI_MARKERPREVIOUS = 2048, - - /// Define a marker from a pixmap. - SCI_MARKERDEFINEPIXMAP = 2049, - - /// Add a set of markers to a line. - SCI_MARKERADDSET = 2466, - - /// Set the alpha used for a marker that is drawn in the text area, not the margin. - SCI_MARKERSETALPHA = 2476, - - SC_MAX_MARGIN = 4, - - SC_MARGIN_SYMBOL = 0, - - SC_MARGIN_NUMBER = 1, - - SC_MARGIN_BACK = 2, - - SC_MARGIN_FORE = 3, - - SC_MARGIN_TEXT = 4, - - SC_MARGIN_RTEXT = 5, - - /// Set a margin to be either numeric or symbolic. - SCI_SETMARGINTYPEN = 2240, - - /// Retrieve the type of a margin. - SCI_GETMARGINTYPEN = 2241, - - /// Set the width of a margin to a width expressed in pixels. - SCI_SETMARGINWIDTHN = 2242, - - /// Retrieve the width of a margin in pixels. - SCI_GETMARGINWIDTHN = 2243, - - /// Set a mask that determines which markers are displayed in a margin. - SCI_SETMARGINMASKN = 2244, - - /// Retrieve the marker mask of a margin. - SCI_GETMARGINMASKN = 2245, - - /// Make a margin sensitive or insensitive to mouse clicks. - SCI_SETMARGINSENSITIVEN = 2246, - - /// Retrieve the mouse click sensitivity of a margin. - SCI_GETMARGINSENSITIVEN = 2247, - - /// Set the cursor shown when the mouse is inside a margin. - SCI_SETMARGINCURSORN = 2248, - - /// Retrieve the cursor shown in a margin. - SCI_GETMARGINCURSORN = 2249, - - STYLE_DEFAULT = 32, - - STYLE_LINENUMBER = 33, - - STYLE_BRACELIGHT = 34, - - STYLE_BRACEBAD = 35, - - STYLE_CONTROLCHAR = 36, - - STYLE_INDENTGUIDE = 37, - - STYLE_CALLTIP = 38, - - STYLE_LASTPREDEFINED = 39, - - STYLE_MAX = 255, - - SC_CHARSET_ANSI = 0, - - SC_CHARSET_DEFAULT = 1, - - SC_CHARSET_BALTIC = 186, - - SC_CHARSET_CHINESEBIG5 = 136, - - SC_CHARSET_EASTEUROPE = 238, - - SC_CHARSET_GB2312 = 134, - - SC_CHARSET_GREEK = 161, - - SC_CHARSET_HANGUL = 129, - - SC_CHARSET_MAC = 77, - - SC_CHARSET_OEM = 255, - - SC_CHARSET_RUSSIAN = 204, - - SC_CHARSET_CYRILLIC = 1251, - - SC_CHARSET_SHIFTJIS = 128, - - SC_CHARSET_SYMBOL = 2, - - SC_CHARSET_TURKISH = 162, - - SC_CHARSET_JOHAB = 130, - - SC_CHARSET_HEBREW = 177, - - SC_CHARSET_ARABIC = 178, - - SC_CHARSET_VIETNAMESE = 163, - - SC_CHARSET_THAI = 222, - - SC_CHARSET_8859_15 = 1000, - - /// Clear all the styles and make equivalent to the global default style. - SCI_STYLECLEARALL = 2050, - - /// Set the foreground colour of a style. - SCI_STYLESETFORE = 2051, - - /// Set the background colour of a style. - SCI_STYLESETBACK = 2052, - - /// Set a style to be bold or not. - SCI_STYLESETBOLD = 2053, - - /// Set a style to be italic or not. - SCI_STYLESETITALIC = 2054, - - /// Set the size of characters of a style. - SCI_STYLESETSIZE = 2055, - - /// Set the font of a style. - SCI_STYLESETFONT = 2056, - - /// Set a style to have its end of line filled or not. - SCI_STYLESETEOLFILLED = 2057, - - /// Reset the default style to its state at startup - SCI_STYLERESETDEFAULT = 2058, - - /// Set a style to be underlined or not. - SCI_STYLESETUNDERLINE = 2059, - - SC_CASE_MIXED = 0, - - SC_CASE_UPPER = 1, - - SC_CASE_LOWER = 2, - - /// Get the foreground colour of a style. - SCI_STYLEGETFORE = 2481, - - /// Get the background colour of a style. - SCI_STYLEGETBACK = 2482, - - /// Get is a style bold or not. - SCI_STYLEGETBOLD = 2483, - - /// Get is a style italic or not. - SCI_STYLEGETITALIC = 2484, - - /// Get the size of characters of a style. - SCI_STYLEGETSIZE = 2485, - - /// Get the font of a style. - /// Returns the length of the fontName - /// Result is NUL-terminated. - SCI_STYLEGETFONT = 2486, - - /// Get is a style to have its end of line filled or not. - SCI_STYLEGETEOLFILLED = 2487, - - /// Get is a style underlined or not. - SCI_STYLEGETUNDERLINE = 2488, - - /// Get is a style mixed case, or to force upper or lower case. - SCI_STYLEGETCASE = 2489, - - /// Get the character get of the font in a style. - SCI_STYLEGETCHARACTERSET = 2490, - - /// Get is a style visible or not. - SCI_STYLEGETVISIBLE = 2491, - - /// Get is a style changeable or not (read only). - /// Experimental feature, currently buggy. - SCI_STYLEGETCHANGEABLE = 2492, - - /// Get is a style a hotspot or not. - SCI_STYLEGETHOTSPOT = 2493, - - /// Set a style to be mixed case, or to force upper or lower case. - SCI_STYLESETCASE = 2060, - - SC_FONT_SIZE_MULTIPLIER = 100, - - /// Set the size of characters of a style. Size is in points multiplied by 100. - SCI_STYLESETSIZEFRACTIONAL = 2061, - - /// Get the size of characters of a style in points multiplied by 100 - SCI_STYLEGETSIZEFRACTIONAL = 2062, - - SC_WEIGHT_NORMAL = 400, - - SC_WEIGHT_SEMIBOLD = 600, - - SC_WEIGHT_BOLD = 700, - - /// Set the weight of characters of a style. - SCI_STYLESETWEIGHT = 2063, - - /// Get the weight of characters of a style. - SCI_STYLEGETWEIGHT = 2064, - - /// Set the character set of the font in a style. - SCI_STYLESETCHARACTERSET = 2066, - - /// Set a style to be a hotspot or not. - SCI_STYLESETHOTSPOT = 2409, - - /// Set the foreground colour of the main and additional selections and whether to use this setting. - SCI_SETSELFORE = 2067, - - /// Set the background colour of the main and additional selections and whether to use this setting. - SCI_SETSELBACK = 2068, - - /// Get the alpha of the selection. - SCI_GETSELALPHA = 2477, - - /// Set the alpha of the selection. - SCI_SETSELALPHA = 2478, - - /// Is the selection end of line filled? - SCI_GETSELEOLFILLED = 2479, - - /// Set the selection to have its end of line filled or not. - SCI_SETSELEOLFILLED = 2480, - - /// Set the foreground colour of the caret. - SCI_SETCARETFORE = 2069, - - /// When key+modifier combination km is pressed perform msg. - SCI_ASSIGNCMDKEY = 2070, - - /// When key+modifier combination km is pressed do nothing. - SCI_CLEARCMDKEY = 2071, - - /// Drop all key mappings. - SCI_CLEARALLCMDKEYS = 2072, - - /// Set the styles for a segment of the document. - SCI_SETSTYLINGEX = 2073, - - /// Set a style to be visible or not. - SCI_STYLESETVISIBLE = 2074, - - /// Get the time in milliseconds that the caret is on and off. - SCI_GETCARETPERIOD = 2075, - - /// Get the time in milliseconds that the caret is on and off. 0 = steady on. - SCI_SETCARETPERIOD = 2076, - - /// Set the set of characters making up words for when moving or selecting by word. - /// First sets defaults like SetCharsDefault. - SCI_SETWORDCHARS = 2077, - - /// Get the set of characters making up words for when moving or selecting by word. - /// Returns the number of characters - SCI_GETWORDCHARS = 2646, - - /// Start a sequence of actions that is undone and redone as a unit. - /// May be nested. - SCI_BEGINUNDOACTION = 2078, - - /// End a sequence of actions that is undone and redone as a unit. - SCI_ENDUNDOACTION = 2079, - - INDIC_PLAIN = 0, - - INDIC_SQUIGGLE = 1, - - INDIC_TT = 2, - - INDIC_DIAGONAL = 3, - - INDIC_STRIKE = 4, - - INDIC_HIDDEN = 5, - - INDIC_BOX = 6, - - INDIC_ROUNDBOX = 7, - - INDIC_STRAIGHTBOX = 8, - - INDIC_DASH = 9, - - INDIC_DOTS = 10, - - INDIC_SQUIGGLELOW = 11, - - INDIC_DOTBOX = 12, - - INDIC_SQUIGGLEPIXMAP = 13, - - INDIC_COMPOSITIONTHICK = 14, - - INDIC_COMPOSITIONTHIN = 15, - - INDIC_FULLBOX = 16, - - INDIC_TEXTFORE = 17, - - INDIC_IME = 32, - - INDIC_IME_MAX = 35, - - INDIC_MAX = 35, - - INDIC_CONTAINER = 8, - - INDIC0_MASK = 0x20, - - INDIC1_MASK = 0x40, - - INDIC2_MASK = 0x80, - - INDICS_MASK = 0xE0, - - /// Set an indicator to plain, squiggle or TT. - SCI_INDICSETSTYLE = 2080, - - /// Retrieve the style of an indicator. - SCI_INDICGETSTYLE = 2081, - - /// Set the foreground colour of an indicator. - SCI_INDICSETFORE = 2082, - - /// Retrieve the foreground colour of an indicator. - SCI_INDICGETFORE = 2083, - - /// Set an indicator to draw under text or over(default). - SCI_INDICSETUNDER = 2510, - - /// Retrieve whether indicator drawn under or over text. - SCI_INDICGETUNDER = 2511, - - /// Set a hover indicator to plain, squiggle or TT. - SCI_INDICSETHOVERSTYLE = 2680, - - /// Retrieve the hover style of an indicator. - SCI_INDICGETHOVERSTYLE = 2681, - - /// Set the foreground hover colour of an indicator. - SCI_INDICSETHOVERFORE = 2682, - - /// Retrieve the foreground hover colour of an indicator. - SCI_INDICGETHOVERFORE = 2683, - - SC_INDICVALUEBIT = 0x1000000, - - SC_INDICVALUEMASK = 0xFFFFFF, - - SC_INDICFLAG_VALUEFORE = 1, - - /// Set the attributes of an indicator. - SCI_INDICSETFLAGS = 2684, - - /// Retrieve the attributes of an indicator. - SCI_INDICGETFLAGS = 2685, - - /// Set the foreground colour of all whitespace and whether to use this setting. - SCI_SETWHITESPACEFORE = 2084, - - /// Set the background colour of all whitespace and whether to use this setting. - SCI_SETWHITESPACEBACK = 2085, - - /// Set the size of the dots used to mark space characters. - SCI_SETWHITESPACESIZE = 2086, - - /// Get the size of the dots used to mark space characters. - SCI_GETWHITESPACESIZE = 2087, - - /// Divide each styling byte into lexical class bits (default: 5) and indicator - /// bits (default: 3). If a lexer requires more than 32 lexical states, then this - /// is used to expand the possible states. - SCI_SETSTYLEBITS = 2090, - - /// Retrieve number of bits in style bytes used to hold the lexical state. - SCI_GETSTYLEBITS = 2091, - - /// Used to hold extra styling information for each line. - SCI_SETLINESTATE = 2092, - - /// Retrieve the extra styling information for a line. - SCI_GETLINESTATE = 2093, - - /// Retrieve the last line number that has line state. - SCI_GETMAXLINESTATE = 2094, - - /// Is the background of the line containing the caret in a different colour? - SCI_GETCARETLINEVISIBLE = 2095, - - /// Display the background of the line containing the caret in a different colour. - SCI_SETCARETLINEVISIBLE = 2096, - - /// Get the colour of the background of the line containing the caret. - SCI_GETCARETLINEBACK = 2097, - - /// Set the colour of the background of the line containing the caret. - SCI_SETCARETLINEBACK = 2098, - - /// Set a style to be changeable or not (read only). - /// Experimental feature, currently buggy. - SCI_STYLESETCHANGEABLE = 2099, - - /// Display a auto-completion list. - /// The lenEntered parameter indicates how many characters before - /// the caret should be used to provide context. - SCI_AUTOCSHOW = 2100, - - /// Remove the auto-completion list from the screen. - SCI_AUTOCCANCEL = 2101, - - /// Is there an auto-completion list visible? - SCI_AUTOCACTIVE = 2102, - - /// Retrieve the position of the caret when the auto-completion list was displayed. - SCI_AUTOCPOSSTART = 2103, - - /// User has selected an item so remove the list and insert the selection. - SCI_AUTOCCOMPLETE = 2104, - - /// Define a set of character that when typed cancel the auto-completion list. - SCI_AUTOCSTOPS = 2105, - - /// Change the separator character in the string setting up an auto-completion list. - /// Default is space but can be changed if items contain space. - SCI_AUTOCSETSEPARATOR = 2106, - - /// Retrieve the auto-completion list separator character. - SCI_AUTOCGETSEPARATOR = 2107, - - /// Select the item in the auto-completion list that starts with a string. - SCI_AUTOCSELECT = 2108, - - /// Should the auto-completion list be cancelled if the user backspaces to a - /// position before where the box was created. - SCI_AUTOCSETCANCELATSTART = 2110, - - /// Retrieve whether auto-completion cancelled by backspacing before start. - SCI_AUTOCGETCANCELATSTART = 2111, - - /// Define a set of characters that when typed will cause the autocompletion to - /// choose the selected item. - SCI_AUTOCSETFILLUPS = 2112, - - /// Should a single item auto-completion list automatically choose the item. - SCI_AUTOCSETCHOOSESINGLE = 2113, - - /// Retrieve whether a single item auto-completion list automatically choose the item. - SCI_AUTOCGETCHOOSESINGLE = 2114, - - /// Set whether case is significant when performing auto-completion searches. - SCI_AUTOCSETIGNORECASE = 2115, - - /// Retrieve state of ignore case flag. - SCI_AUTOCGETIGNORECASE = 2116, - - /// Display a list of strings and send notification when user chooses one. - SCI_USERLISTSHOW = 2117, - - /// Set whether or not autocompletion is hidden automatically when nothing matches. - SCI_AUTOCSETAUTOHIDE = 2118, - - /// Retrieve whether or not autocompletion is hidden automatically when nothing matches. - SCI_AUTOCGETAUTOHIDE = 2119, - - /// Set whether or not autocompletion deletes any word characters - /// after the inserted text upon completion. - SCI_AUTOCSETDROPRESTOFWORD = 2270, - - /// Retrieve whether or not autocompletion deletes any word characters - /// after the inserted text upon completion. - SCI_AUTOCGETDROPRESTOFWORD = 2271, - - /// Register an XPM image for use in autocompletion lists. - SCI_REGISTERIMAGE = 2405, - - /// Clear all the registered XPM images. - SCI_CLEARREGISTEREDIMAGES = 2408, - - /// Retrieve the auto-completion list type-separator character. - SCI_AUTOCGETTYPESEPARATOR = 2285, - - /// Change the type-separator character in the string setting up an auto-completion list. - /// Default is '?' but can be changed if items contain '?'. - SCI_AUTOCSETTYPESEPARATOR = 2286, - - /// Set the maximum width, in characters, of auto-completion and user lists. - /// Set to 0 to autosize to fit longest item, which is the default. - SCI_AUTOCSETMAXWIDTH = 2208, - - /// Get the maximum width, in characters, of auto-completion and user lists. - SCI_AUTOCGETMAXWIDTH = 2209, - - /// Set the maximum height, in rows, of auto-completion and user lists. - /// The default is 5 rows. - SCI_AUTOCSETMAXHEIGHT = 2210, - - /// Set the maximum height, in rows, of auto-completion and user lists. - SCI_AUTOCGETMAXHEIGHT = 2211, - - /// Set the number of spaces used for one level of indentation. - SCI_SETINDENT = 2122, - - /// Retrieve indentation size. - SCI_GETINDENT = 2123, - - /// Indentation will only use space characters if useTabs is false, otherwise - /// it will use a combination of tabs and spaces. - SCI_SETUSETABS = 2124, - - /// Retrieve whether tabs will be used in indentation. - SCI_GETUSETABS = 2125, - - /// Change the indentation of a line to a number of columns. - SCI_SETLINEINDENTATION = 2126, - - /// Retrieve the number of columns that a line is indented. - SCI_GETLINEINDENTATION = 2127, - - /// Retrieve the position before the first non indentation character on a line. - SCI_GETLINEINDENTPOSITION = 2128, - - /// Retrieve the column number of a position, taking tab width into account. - SCI_GETCOLUMN = 2129, - - /// Count characters between two positions. - SCI_COUNTCHARACTERS = 2633, - - /// Show or hide the horizontal scroll bar. - SCI_SETHSCROLLBAR = 2130, - - /// Is the horizontal scroll bar visible? - SCI_GETHSCROLLBAR = 2131, - - SC_IV_NONE = 0, - - SC_IV_REAL = 1, - - SC_IV_LOOKFORWARD = 2, - - SC_IV_LOOKBOTH = 3, - - /// Show or hide indentation guides. - SCI_SETINDENTATIONGUIDES = 2132, - - /// Are the indentation guides visible? - SCI_GETINDENTATIONGUIDES = 2133, - - /// Set the highlighted indentation guide column. - /// 0 = no highlighted guide. - SCI_SETHIGHLIGHTGUIDE = 2134, - - /// Get the highlighted indentation guide column. - SCI_GETHIGHLIGHTGUIDE = 2135, - - /// Get the position after the last visible characters on a line. - SCI_GETLINEENDPOSITION = 2136, - - /// Get the code page used to interpret the bytes of the document as characters. - SCI_GETCODEPAGE = 2137, - - /// Get the foreground colour of the caret. - SCI_GETCARETFORE = 2138, - - /// In read-only mode? - SCI_GETREADONLY = 2140, - - /// Sets the position of the caret. - SCI_SETCURRENTPOS = 2141, - - /// Sets the position that starts the selection - this becomes the anchor. - SCI_SETSELECTIONSTART = 2142, - - /// Returns the position at the start of the selection. - SCI_GETSELECTIONSTART = 2143, - - /// Sets the position that ends the selection - this becomes the currentPosition. - SCI_SETSELECTIONEND = 2144, - - /// Returns the position at the end of the selection. - SCI_GETSELECTIONEND = 2145, - - /// Set caret to a position, while removing any existing selection. - SCI_SETEMPTYSELECTION = 2556, - - /// Sets the print magnification added to the point size of each style for printing. - SCI_SETPRINTMAGNIFICATION = 2146, - - /// Returns the print magnification. - SCI_GETPRINTMAGNIFICATION = 2147, - - SC_PRINT_NORMAL = 0, - - SC_PRINT_INVERTLIGHT = 1, - - SC_PRINT_BLACKONWHITE = 2, - - SC_PRINT_COLOURONWHITE = 3, - - SC_PRINT_COLOURONWHITEDEFAULTBG = 4, - - /// Modify colours when printing for clearer printed text. - SCI_SETPRINTCOLOURMODE = 2148, - - /// Returns the print colour mode. - SCI_GETPRINTCOLOURMODE = 2149, - - SCFIND_WHOLEWORD = 0x2, - - SCFIND_MATCHCASE = 0x4, - - SCFIND_WORDSTART = 0x00100000, - - SCFIND_REGEXP = 0x00200000, - - SCFIND_POSIX = 0x00400000, - - SCFIND_CXX11REGEX = 0x00800000, - - /// Find some text in the document. - SCI_FINDTEXT = 2150, - - /// On Windows, will draw the document into a display context such as a printer. - SCI_FORMATRANGE = 2151, - - /// Retrieve the display line at the top of the display. - SCI_GETFIRSTVISIBLELINE = 2152, - - /// Retrieve the contents of a line. - /// Returns the length of the line. - SCI_GETLINE = 2153, - - /// Returns the number of lines in the document. There is always at least one. - SCI_GETLINECOUNT = 2154, - - /// Sets the size in pixels of the left margin. - SCI_SETMARGINLEFT = 2155, - - /// Returns the size in pixels of the left margin. - SCI_GETMARGINLEFT = 2156, - - /// Sets the size in pixels of the right margin. - SCI_SETMARGINRIGHT = 2157, - - /// Returns the size in pixels of the right margin. - SCI_GETMARGINRIGHT = 2158, - - /// Is the document different from when it was last saved? - SCI_GETMODIFY = 2159, - - /// Select a range of text. - SCI_SETSEL = 2160, - - /// Retrieve the selected text. - /// Return the length of the text. - /// Result is NUL-terminated. - SCI_GETSELTEXT = 2161, - - /// Retrieve a range of text. - /// Return the length of the text. - SCI_GETTEXTRANGE = 2162, - - /// Draw the selection in normal style or with selection highlighted. - SCI_HIDESELECTION = 2163, - - /// Retrieve the x value of the point in the window where a position is displayed. - SCI_POINTXFROMPOSITION = 2164, - - /// Retrieve the y value of the point in the window where a position is displayed. - SCI_POINTYFROMPOSITION = 2165, - - /// Retrieve the line containing a position. - SCI_LINEFROMPOSITION = 2166, - - /// Retrieve the position at the start of a line. - SCI_POSITIONFROMLINE = 2167, - - /// Scroll horizontally and vertically. - SCI_LINESCROLL = 2168, - - /// Ensure the caret is visible. - SCI_SCROLLCARET = 2169, - - /// Scroll the argument positions and the range between them into view giving - /// priority to the primary position then the secondary position. - /// This may be used to make a search match visible. - SCI_SCROLLRANGE = 2569, - - /// Replace the selected text with the argument text. - SCI_REPLACESEL = 2170, - - /// Set to read only or read write. - SCI_SETREADONLY = 2171, - - /// Null operation. - SCI_NULL = 2172, - - /// Will a paste succeed? - SCI_CANPASTE = 2173, - - /// Are there any undoable actions in the undo history? - SCI_CANUNDO = 2174, - - /// Delete the undo history. - SCI_EMPTYUNDOBUFFER = 2175, - - /// Undo one action in the undo history. - SCI_UNDO = 2176, - - /// Cut the selection to the clipboard. - SCI_CUT = 2177, - - /// Copy the selection to the clipboard. - SCI_COPY = 2178, - - /// Paste the contents of the clipboard into the document replacing the selection. - SCI_PASTE = 2179, - - /// Clear the selection. - SCI_CLEAR = 2180, - - /// Replace the contents of the document with the argument text. - SCI_SETTEXT = 2181, - - /// Retrieve all the text in the document. - /// Returns number of characters retrieved. - /// Result is NUL-terminated. - SCI_GETTEXT = 2182, - - /// Retrieve the number of characters in the document. - SCI_GETTEXTLENGTH = 2183, - - /// Retrieve a pointer to a function that processes messages for this Scintilla. - SCI_GETDIRECTFUNCTION = 2184, - - /// Retrieve a pointer value to use as the first argument when calling - /// the function returned by GetDirectFunction. - SCI_GETDIRECTPOINTER = 2185, - - /// Set to overtype (true) or insert mode. - SCI_SETOVERTYPE = 2186, - - /// Returns true if overtype mode is active otherwise false is returned. - SCI_GETOVERTYPE = 2187, - - /// Set the width of the insert mode caret. - SCI_SETCARETWIDTH = 2188, - - /// Returns the width of the insert mode caret. - SCI_GETCARETWIDTH = 2189, - - /// Sets the position that starts the target which is used for updating the - /// document without affecting the scroll position. - SCI_SETTARGETSTART = 2190, - - /// Get the position that starts the target. - SCI_GETTARGETSTART = 2191, - - /// Sets the position that ends the target which is used for updating the - /// document without affecting the scroll position. - SCI_SETTARGETEND = 2192, - - /// Get the position that ends the target. - SCI_GETTARGETEND = 2193, - - /// Sets both the start and end of the target in one call. - SCI_SETTARGETRANGE = 2686, - - /// Retrieve the text in the target. - SCI_GETTARGETTEXT = 2687, - - /// Replace the target text with the argument text. - /// Text is counted so it can contain NULs. - /// Returns the length of the replacement text. - SCI_REPLACETARGET = 2194, - - /// Replace the target text with the argument text after \d processing. - /// Text is counted so it can contain NULs. - /// Looks for \d where d is between 1 and 9 and replaces these with the strings - /// matched in the last search operation which were surrounded by \( and \). - /// Returns the length of the replacement text including any change - /// caused by processing the \d patterns. - SCI_REPLACETARGETRE = 2195, - - /// Search for a counted string in the target and set the target to the found - /// range. Text is counted so it can contain NULs. - /// Returns length of range or -1 for failure in which case target is not moved. - SCI_SEARCHINTARGET = 2197, - - /// Set the search flags used by SearchInTarget. - SCI_SETSEARCHFLAGS = 2198, - - /// Get the search flags used by SearchInTarget. - SCI_GETSEARCHFLAGS = 2199, - - /// Show a call tip containing a definition near position pos. - SCI_CALLTIPSHOW = 2200, - - /// Remove the call tip from the screen. - SCI_CALLTIPCANCEL = 2201, - - /// Is there an active call tip? - SCI_CALLTIPACTIVE = 2202, - - /// Retrieve the position where the caret was before displaying the call tip. - SCI_CALLTIPPOSSTART = 2203, - - /// Set the start position in order to change when backspacing removes the calltip. - SCI_CALLTIPSETPOSSTART = 2214, - - /// Highlight a segment of the definition. - SCI_CALLTIPSETHLT = 2204, - - /// Set the background colour for the call tip. - SCI_CALLTIPSETBACK = 2205, - - /// Set the foreground colour for the call tip. - SCI_CALLTIPSETFORE = 2206, - - /// Set the foreground colour for the highlighted part of the call tip. - SCI_CALLTIPSETFOREHLT = 2207, - - /// Enable use of STYLE_CALLTIP and set call tip tab size in pixels. - SCI_CALLTIPUSESTYLE = 2212, - - /// Set position of calltip, above or below text. - SCI_CALLTIPSETPOSITION = 2213, - - /// Find the display line of a document line taking hidden lines into account. - SCI_VISIBLEFROMDOCLINE = 2220, - - /// Find the document line of a display line taking hidden lines into account. - SCI_DOCLINEFROMVISIBLE = 2221, - - /// The number of display lines needed to wrap a document line - SCI_WRAPCOUNT = 2235, - - SC_FOLDLEVELBASE = 0x400, - - SC_FOLDLEVELWHITEFLAG = 0x1000, - - SC_FOLDLEVELHEADERFLAG = 0x2000, - - SC_FOLDLEVELNUMBERMASK = 0x0FFF, - - /// Set the fold level of a line. - /// This encodes an integer level along with flags indicating whether the - /// line is a header and whether it is effectively white space. - SCI_SETFOLDLEVEL = 2222, - - /// Retrieve the fold level of a line. - SCI_GETFOLDLEVEL = 2223, - - /// Find the last child line of a header line. - SCI_GETLASTCHILD = 2224, - - /// Find the parent line of a child line. - SCI_GETFOLDPARENT = 2225, - - /// Make a range of lines visible. - SCI_SHOWLINES = 2226, - - /// Make a range of lines invisible. - SCI_HIDELINES = 2227, - - /// Is a line visible? - SCI_GETLINEVISIBLE = 2228, - - /// Are all lines visible? - SCI_GETALLLINESVISIBLE = 2236, - - /// Show the children of a header line. - SCI_SETFOLDEXPANDED = 2229, - - /// Is a header line expanded? - SCI_GETFOLDEXPANDED = 2230, - - /// Switch a header line between expanded and contracted. - SCI_TOGGLEFOLD = 2231, - - SC_FOLDACTION_CONTRACT = 0, - - SC_FOLDACTION_EXPAND = 1, - - SC_FOLDACTION_TOGGLE = 2, - - /// Expand or contract a fold header. - SCI_FOLDLINE = 2237, - - /// Expand or contract a fold header and its children. - SCI_FOLDCHILDREN = 2238, - - /// Expand a fold header and all children. Use the level argument instead of the line's current level. - SCI_EXPANDCHILDREN = 2239, - - /// Expand or contract all fold headers. - SCI_FOLDALL = 2662, - - /// Ensure a particular line is visible by expanding any header line hiding it. - SCI_ENSUREVISIBLE = 2232, - - SC_AUTOMATICFOLD_SHOW = 0x0001, - - SC_AUTOMATICFOLD_CLICK = 0x0002, - - SC_AUTOMATICFOLD_CHANGE = 0x0004, - - /// Set automatic folding behaviours. - SCI_SETAUTOMATICFOLD = 2663, - - /// Get automatic folding behaviours. - SCI_GETAUTOMATICFOLD = 2664, - - SC_FOLDFLAG_LINEBEFORE_EXPANDED = 0x0002, - - SC_FOLDFLAG_LINEBEFORE_CONTRACTED = 0x0004, - - SC_FOLDFLAG_LINEAFTER_EXPANDED = 0x0008, - - SC_FOLDFLAG_LINEAFTER_CONTRACTED = 0x0010, - - SC_FOLDFLAG_LEVELNUMBERS = 0x0040, - - SC_FOLDFLAG_LINESTATE = 0x0080, - - /// Set some style options for folding. - SCI_SETFOLDFLAGS = 2233, - - /// Ensure a particular line is visible by expanding any header line hiding it. - /// Use the currently set visibility policy to determine which range to display. - SCI_ENSUREVISIBLEENFORCEPOLICY = 2234, - - /// Sets whether a tab pressed when caret is within indentation indents. - SCI_SETTABINDENTS = 2260, - - /// Does a tab pressed when caret is within indentation indent? - SCI_GETTABINDENTS = 2261, - - /// Sets whether a backspace pressed when caret is within indentation unindents. - SCI_SETBACKSPACEUNINDENTS = 2262, - - /// Does a backspace pressed when caret is within indentation unindent? - SCI_GETBACKSPACEUNINDENTS = 2263, - - SC_TIME_FOREVER = 10000000, - - /// Sets the time the mouse must sit still to generate a mouse dwell event. - SCI_SETMOUSEDWELLTIME = 2264, - - /// Retrieve the time the mouse must sit still to generate a mouse dwell event. - SCI_GETMOUSEDWELLTIME = 2265, - - /// Get position of start of word. - SCI_WORDSTARTPOSITION = 2266, - - /// Get position of end of word. - SCI_WORDENDPOSITION = 2267, - - SC_WRAP_NONE = 0, - - SC_WRAP_WORD = 1, - - SC_WRAP_CHAR = 2, - - SC_WRAP_WHITESPACE = 3, - - /// Sets whether text is word wrapped. - SCI_SETWRAPMODE = 2268, - - /// Retrieve whether text is word wrapped. - SCI_GETWRAPMODE = 2269, - - SC_WRAPVISUALFLAG_NONE = 0x0000, - - SC_WRAPVISUALFLAG_END = 0x0001, - - SC_WRAPVISUALFLAG_START = 0x0002, - - SC_WRAPVISUALFLAG_MARGIN = 0x0004, - - /// Set the display mode of visual flags for wrapped lines. - SCI_SETWRAPVISUALFLAGS = 2460, - - /// Retrive the display mode of visual flags for wrapped lines. - SCI_GETWRAPVISUALFLAGS = 2461, - - SC_WRAPVISUALFLAGLOC_DEFAULT = 0x0000, - - SC_WRAPVISUALFLAGLOC_END_BY_TEXT = 0x0001, - - SC_WRAPVISUALFLAGLOC_START_BY_TEXT = 0x0002, - - /// Set the location of visual flags for wrapped lines. - SCI_SETWRAPVISUALFLAGSLOCATION = 2462, - - /// Retrive the location of visual flags for wrapped lines. - SCI_GETWRAPVISUALFLAGSLOCATION = 2463, - - /// Set the start indent for wrapped lines. - SCI_SETWRAPSTARTINDENT = 2464, - - /// Retrive the start indent for wrapped lines. - SCI_GETWRAPSTARTINDENT = 2465, - - SC_WRAPINDENT_FIXED = 0, - - SC_WRAPINDENT_SAME = 1, - - SC_WRAPINDENT_INDENT = 2, - - /// Sets how wrapped sublines are placed. Default is fixed. - SCI_SETWRAPINDENTMODE = 2472, - - /// Retrieve how wrapped sublines are placed. Default is fixed. - SCI_GETWRAPINDENTMODE = 2473, - - SC_CACHE_NONE = 0, - - SC_CACHE_CARET = 1, - - SC_CACHE_PAGE = 2, - - SC_CACHE_DOCUMENT = 3, - - /// Sets the degree of caching of layout information. - SCI_SETLAYOUTCACHE = 2272, - - /// Retrieve the degree of caching of layout information. - SCI_GETLAYOUTCACHE = 2273, - - /// Sets the document width assumed for scrolling. - SCI_SETSCROLLWIDTH = 2274, - - /// Retrieve the document width assumed for scrolling. - SCI_GETSCROLLWIDTH = 2275, - - /// Sets whether the maximum width line displayed is used to set scroll width. - SCI_SETSCROLLWIDTHTRACKING = 2516, - - /// Retrieve whether the scroll width tracks wide lines. - SCI_GETSCROLLWIDTHTRACKING = 2517, - - /// Measure the pixel width of some text in a particular style. - /// NUL terminated text argument. - /// Does not handle tab or control characters. - SCI_TEXTWIDTH = 2276, - - /// Sets the scroll range so that maximum scroll position has - /// the last line at the bottom of the view (default). - /// Setting this to false allows scrolling one page below the last line. - SCI_SETENDATLASTLINE = 2277, - - /// Retrieve whether the maximum scroll position has the last - /// line at the bottom of the view. - SCI_GETENDATLASTLINE = 2278, - - /// Retrieve the height of a particular line of text in pixels. - SCI_TEXTHEIGHT = 2279, - - /// Show or hide the vertical scroll bar. - SCI_SETVSCROLLBAR = 2280, - - /// Is the vertical scroll bar visible? - SCI_GETVSCROLLBAR = 2281, - - /// Append a string to the end of the document without changing the selection. - SCI_APPENDTEXT = 2282, - - /// Is drawing done in two phases with backgrounds drawn before foregrounds? - SCI_GETTWOPHASEDRAW = 2283, - - /// In twoPhaseDraw mode, drawing is performed in two phases, first the background - /// and then the foreground. This avoids chopping off characters that overlap the next run. - SCI_SETTWOPHASEDRAW = 2284, - - SC_PHASES_ONE = 0, - - SC_PHASES_TWO = 1, - - SC_PHASES_MULTIPLE = 2, - - /// How many phases is drawing done in? - SCI_GETPHASESDRAW = 2673, - - /// In one phase draw, text is drawn in a series of rectangular blocks with no overlap. - /// In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally. - /// In multiple phase draw, each element is drawn over the whole drawing area, allowing text - /// to overlap from one line to the next. - SCI_SETPHASESDRAW = 2674, - - SC_EFF_QUALITY_MASK = 0xF, - - SC_EFF_QUALITY_DEFAULT = 0, - - SC_EFF_QUALITY_NON_ANTIALIASED = 1, - - SC_EFF_QUALITY_ANTIALIASED = 2, - - SC_EFF_QUALITY_LCD_OPTIMIZED = 3, - - /// Choose the quality level for text from the FontQuality enumeration. - SCI_SETFONTQUALITY = 2611, - - /// Retrieve the quality level for text. - SCI_GETFONTQUALITY = 2612, - - /// Scroll so that a display line is at the top of the display. - SCI_SETFIRSTVISIBLELINE = 2613, - - SC_MULTIPASTE_ONCE = 0, - - SC_MULTIPASTE_EACH = 1, - - /// Change the effect of pasting when there are multiple selections. - SCI_SETMULTIPASTE = 2614, - - /// Retrieve the effect of pasting when there are multiple selections.. - SCI_GETMULTIPASTE = 2615, - - /// Retrieve the value of a tag from a regular expression search. - /// Result is NUL-terminated. - SCI_GETTAG = 2616, - - /// Make the target range start and end be the same as the selection range start and end. - SCI_TARGETFROMSELECTION = 2287, - - /// Join the lines in the target. - SCI_LINESJOIN = 2288, - - /// Split the lines in the target into lines that are less wide than pixelWidth - /// where possible. - SCI_LINESSPLIT = 2289, - - /// Set the colours used as a chequerboard pattern in the fold margin - SCI_SETFOLDMARGINCOLOUR = 2290, - - /// Set the colours used as a chequerboard pattern in the fold margin - SCI_SETFOLDMARGINHICOLOUR = 2291, - - /// Move caret down one line. - SCI_LINEDOWN = 2300, - - /// Move caret down one line extending selection to new caret position. - SCI_LINEDOWNEXTEND = 2301, - - /// Move caret up one line. - SCI_LINEUP = 2302, - - /// Move caret up one line extending selection to new caret position. - SCI_LINEUPEXTEND = 2303, - - /// Move caret left one character. - SCI_CHARLEFT = 2304, - - /// Move caret left one character extending selection to new caret position. - SCI_CHARLEFTEXTEND = 2305, - - /// Move caret right one character. - SCI_CHARRIGHT = 2306, - - /// Move caret right one character extending selection to new caret position. - SCI_CHARRIGHTEXTEND = 2307, - - /// Move caret left one word. - SCI_WORDLEFT = 2308, - - /// Move caret left one word extending selection to new caret position. - SCI_WORDLEFTEXTEND = 2309, - - /// Move caret right one word. - SCI_WORDRIGHT = 2310, - - /// Move caret right one word extending selection to new caret position. - SCI_WORDRIGHTEXTEND = 2311, - - /// Move caret to first position on line. - SCI_HOME = 2312, - - /// Move caret to first position on line extending selection to new caret position. - SCI_HOMEEXTEND = 2313, - - /// Move caret to last position on line. - SCI_LINEEND = 2314, - - /// Move caret to last position on line extending selection to new caret position. - SCI_LINEENDEXTEND = 2315, - - /// Move caret to first position in document. - SCI_DOCUMENTSTART = 2316, - - /// Move caret to first position in document extending selection to new caret position. - SCI_DOCUMENTSTARTEXTEND = 2317, - - /// Move caret to last position in document. - SCI_DOCUMENTEND = 2318, - - /// Move caret to last position in document extending selection to new caret position. - SCI_DOCUMENTENDEXTEND = 2319, - - /// Move caret one page up. - SCI_PAGEUP = 2320, - - /// Move caret one page up extending selection to new caret position. - SCI_PAGEUPEXTEND = 2321, - - /// Move caret one page down. - SCI_PAGEDOWN = 2322, - - /// Move caret one page down extending selection to new caret position. - SCI_PAGEDOWNEXTEND = 2323, - - /// Switch from insert to overtype mode or the reverse. - SCI_EDITTOGGLEOVERTYPE = 2324, - - /// Cancel any modes such as call tip or auto-completion list display. - SCI_CANCEL = 2325, - - /// Delete the selection or if no selection, the character before the caret. - SCI_DELETEBACK = 2326, - - /// If selection is empty or all on one line replace the selection with a tab character. - /// If more than one line selected, indent the lines. - SCI_TAB = 2327, - - /// Dedent the selected lines. - SCI_BACKTAB = 2328, - - /// Insert a new line, may use a CRLF, CR or LF depending on EOL mode. - SCI_NEWLINE = 2329, - - /// Insert a Form Feed character. - SCI_FORMFEED = 2330, - - /// Move caret to before first visible character on line. - /// If already there move to first character on line. - SCI_VCHOME = 2331, - - /// Like VCHome but extending selection to new caret position. - SCI_VCHOMEEXTEND = 2332, - - /// Magnify the displayed text by increasing the sizes by 1 point. - SCI_ZOOMIN = 2333, - - /// Make the displayed text smaller by decreasing the sizes by 1 point. - SCI_ZOOMOUT = 2334, - - /// Delete the word to the left of the caret. - SCI_DELWORDLEFT = 2335, - - /// Delete the word to the right of the caret. - SCI_DELWORDRIGHT = 2336, - - /// Delete the word to the right of the caret, but not the trailing non-word characters. - SCI_DELWORDRIGHTEND = 2518, - - /// Cut the line containing the caret. - SCI_LINECUT = 2337, - - /// Delete the line containing the caret. - SCI_LINEDELETE = 2338, - - /// Switch the current line with the previous. - SCI_LINETRANSPOSE = 2339, - - /// Duplicate the current line. - SCI_LINEDUPLICATE = 2404, - - /// Transform the selection to lower case. - SCI_LOWERCASE = 2340, - - /// Transform the selection to upper case. - SCI_UPPERCASE = 2341, - - /// Scroll the document down, keeping the caret visible. - SCI_LINESCROLLDOWN = 2342, - - /// Scroll the document up, keeping the caret visible. - SCI_LINESCROLLUP = 2343, - - /// Delete the selection or if no selection, the character before the caret. - /// Will not delete the character before at the start of a line. - SCI_DELETEBACKNOTLINE = 2344, - - /// Move caret to first position on display line. - SCI_HOMEDISPLAY = 2345, - - /// Move caret to first position on display line extending selection to - /// new caret position. - SCI_HOMEDISPLAYEXTEND = 2346, - - /// Move caret to last position on display line. - SCI_LINEENDDISPLAY = 2347, - - /// Move caret to last position on display line extending selection to new - /// caret position. - SCI_LINEENDDISPLAYEXTEND = 2348, - - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - SCI_HOMEWRAP = 2349, - - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - SCI_HOMEWRAPEXTEND = 2450, - - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - SCI_LINEENDWRAP = 2451, - - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - SCI_LINEENDWRAPEXTEND = 2452, - - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - SCI_VCHOMEWRAP = 2453, - - /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? - /// except they behave differently when word-wrap is enabled: - /// They go first to the start / end of the display line, like (Home|LineEnd)Display - /// The difference is that, the cursor is already at the point, it goes on to the start - /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - SCI_VCHOMEWRAPEXTEND = 2454, - - /// Copy the line containing the caret. - SCI_LINECOPY = 2455, - - /// Move the caret inside current view if it's not there already. - SCI_MOVECARETINSIDEVIEW = 2401, - - /// How many characters are on a line, including end of line characters? - SCI_LINELENGTH = 2350, - - /// Highlight the characters at two positions. - SCI_BRACEHIGHLIGHT = 2351, - - /// Use specified indicator to highlight matching braces instead of changing their style. - SCI_BRACEHIGHLIGHTINDICATOR = 2498, - - /// Highlight the character at a position indicating there is no matching brace. - SCI_BRACEBADLIGHT = 2352, - - /// Use specified indicator to highlight non matching brace instead of changing its style. - SCI_BRACEBADLIGHTINDICATOR = 2499, - - /// Find the position of a matching brace or INVALID_POSITION if no match. - SCI_BRACEMATCH = 2353, - - /// Are the end of line characters visible? - SCI_GETVIEWEOL = 2355, - - /// Make the end of line characters visible or invisible. - SCI_SETVIEWEOL = 2356, - - /// Retrieve a pointer to the document object. - SCI_GETDOCPOINTER = 2357, - - /// Change the document object used. - SCI_SETDOCPOINTER = 2358, - - /// Set which document modification events are sent to the container. - SCI_SETMODEVENTMASK = 2359, - - EDGE_NONE = 0, - - EDGE_LINE = 1, - - EDGE_BACKGROUND = 2, - - /// Retrieve the column number which text should be kept within. - SCI_GETEDGECOLUMN = 2360, - - /// Set the column number of the edge. - /// If text goes past the edge then it is highlighted. - SCI_SETEDGECOLUMN = 2361, - - /// Retrieve the edge highlight mode. - SCI_GETEDGEMODE = 2362, - - /// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that - /// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). - SCI_SETEDGEMODE = 2363, - - /// Retrieve the colour used in edge indication. - SCI_GETEDGECOLOUR = 2364, - - /// Change the colour used in edge indication. - SCI_SETEDGECOLOUR = 2365, - - /// Sets the current caret position to be the search anchor. - SCI_SEARCHANCHOR = 2366, - - /// Find some text starting at the search anchor. - /// Does not ensure the selection is visible. - SCI_SEARCHNEXT = 2367, - - /// Find some text starting at the search anchor and moving backwards. - /// Does not ensure the selection is visible. - SCI_SEARCHPREV = 2368, - - /// Retrieves the number of lines completely visible. - SCI_LINESONSCREEN = 2370, - - /// Set whether a pop up menu is displayed automatically when the user presses - /// the wrong mouse button. - SCI_USEPOPUP = 2371, - - /// Is the selection rectangular? The alternative is the more common stream selection. - SCI_SELECTIONISRECTANGLE = 2372, - - /// Set the zoom level. This number of points is added to the size of all fonts. - /// It may be positive to magnify or negative to reduce. - SCI_SETZOOM = 2373, - - /// Retrieve the zoom level. - SCI_GETZOOM = 2374, - - /// Create a new document object. - /// Starts with reference count of 1 and not selected into editor. - SCI_CREATEDOCUMENT = 2375, - - /// Extend life of document. - SCI_ADDREFDOCUMENT = 2376, - - /// Release a reference to the document, deleting document if it fades to black. - SCI_RELEASEDOCUMENT = 2377, - - /// Get which document modification events are sent to the container. - SCI_GETMODEVENTMASK = 2378, - - /// Change internal focus flag. - SCI_SETFOCUS = 2380, - - /// Get internal focus flag. - SCI_GETFOCUS = 2381, - - SC_STATUS_OK = 0, - - SC_STATUS_FAILURE = 1, - - SC_STATUS_BADALLOC = 2, - - SC_STATUS_WARN_START = 1000, - - SC_STATUS_WARN_REGEX = 1001, - - /// Change error status - 0 = OK. - SCI_SETSTATUS = 2382, - - /// Get error status. - SCI_GETSTATUS = 2383, - - /// Set whether the mouse is captured when its button is pressed. - SCI_SETMOUSEDOWNCAPTURES = 2384, - - /// Get whether mouse gets captured. - SCI_GETMOUSEDOWNCAPTURES = 2385, - - SC_CURSORNORMAL = 0xFFFFFFFF, - - SC_CURSORARROW = 2, - - SC_CURSORWAIT = 4, - - SC_CURSORREVERSEARROW = 7, - - /// Sets the cursor to one of the SC_CURSOR* values. - SCI_SETCURSOR = 2386, - - /// Get cursor type. - SCI_GETCURSOR = 2387, - - /// Change the way control characters are displayed: - /// If symbol is < 32, keep the drawn way, else, use the given character. - SCI_SETCONTROLCHARSYMBOL = 2388, - - /// Get the way control characters are displayed. - SCI_GETCONTROLCHARSYMBOL = 2389, - - /// Move to the previous change in capitalisation. - SCI_WORDPARTLEFT = 2390, - - /// Move to the previous change in capitalisation extending selection - /// to new caret position. - SCI_WORDPARTLEFTEXTEND = 2391, - - /// Move to the change next in capitalisation. - SCI_WORDPARTRIGHT = 2392, - - /// Move to the next change in capitalisation extending selection - /// to new caret position. - SCI_WORDPARTRIGHTEXTEND = 2393, - - VISIBLE_SLOP = 0x01, - - VISIBLE_STRICT = 0x04, - - /// Set the way the display area is determined when a particular line - /// is to be moved to by Find, FindNext, GotoLine, etc. - SCI_SETVISIBLEPOLICY = 2394, - - /// Delete back from the current position to the start of the line. - SCI_DELLINELEFT = 2395, - - /// Delete forwards from the current position to the end of the line. - SCI_DELLINERIGHT = 2396, - - /// Get and Set the xOffset (ie, horizontal scroll position). - SCI_SETXOFFSET = 2397, - - /// Get and Set the xOffset (ie, horizontal scroll position). - SCI_GETXOFFSET = 2398, - - /// Set the last x chosen value to be the caret x position. - SCI_CHOOSECARETX = 2399, - - /// Set the focus to this Scintilla widget. - SCI_GRABFOCUS = 2400, - - CARET_SLOP = 0x01, - - CARET_STRICT = 0x04, - - CARET_JUMPS = 0x10, - - CARET_EVEN = 0x08, - - /// Set the way the caret is kept visible when going sideways. - /// The exclusion zone is given in pixels. - SCI_SETXCARETPOLICY = 2402, - - /// Set the way the line the caret is on is kept visible. - /// The exclusion zone is given in lines. - SCI_SETYCARETPOLICY = 2403, - - /// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). - SCI_SETPRINTWRAPMODE = 2406, - - /// Is printing line wrapped? - SCI_GETPRINTWRAPMODE = 2407, - - /// Set a fore colour for active hotspots. - SCI_SETHOTSPOTACTIVEFORE = 2410, - - /// Get the fore colour for active hotspots. - SCI_GETHOTSPOTACTIVEFORE = 2494, - - /// Set a back colour for active hotspots. - SCI_SETHOTSPOTACTIVEBACK = 2411, - - /// Get the back colour for active hotspots. - SCI_GETHOTSPOTACTIVEBACK = 2495, - - /// Enable / Disable underlining active hotspots. - SCI_SETHOTSPOTACTIVEUNDERLINE = 2412, - - /// Get whether underlining for active hotspots. - SCI_GETHOTSPOTACTIVEUNDERLINE = 2496, - - /// Limit hotspots to single line so hotspots on two lines don't merge. - SCI_SETHOTSPOTSINGLELINE = 2421, - - /// Get the HotspotSingleLine property - SCI_GETHOTSPOTSINGLELINE = 2497, - - /// Move caret between paragraphs (delimited by empty lines). - SCI_PARADOWN = 2413, - - /// Move caret between paragraphs (delimited by empty lines). - SCI_PARADOWNEXTEND = 2414, - - /// Move caret between paragraphs (delimited by empty lines). - SCI_PARAUP = 2415, - - /// Move caret between paragraphs (delimited by empty lines). - SCI_PARAUPEXTEND = 2416, - - /// Given a valid document position, return the previous position taking code - /// page into account. Returns 0 if passed 0. - SCI_POSITIONBEFORE = 2417, - - /// Given a valid document position, return the next position taking code - /// page into account. Maximum value returned is the last position in the document. - SCI_POSITIONAFTER = 2418, - - /// Given a valid document position, return a position that differs in a number - /// of characters. Returned value is always between 0 and last position in document. - SCI_POSITIONRELATIVE = 2670, - - /// Copy a range of text to the clipboard. Positions are clipped into the document. - SCI_COPYRANGE = 2419, - - /// Copy argument text to the clipboard. - SCI_COPYTEXT = 2420, - - SC_SEL_STREAM = 0, - - SC_SEL_RECTANGLE = 1, - - SC_SEL_LINES = 2, - - SC_SEL_THIN = 3, - - /// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or - /// by lines (SC_SEL_LINES). - SCI_SETSELECTIONMODE = 2422, - - /// Get the mode of the current selection. - SCI_GETSELECTIONMODE = 2423, - - /// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). - SCI_GETLINESELSTARTPOSITION = 2424, - - /// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). - SCI_GETLINESELENDPOSITION = 2425, - - /// Move caret down one line, extending rectangular selection to new caret position. - SCI_LINEDOWNRECTEXTEND = 2426, - - /// Move caret up one line, extending rectangular selection to new caret position. - SCI_LINEUPRECTEXTEND = 2427, - - /// Move caret left one character, extending rectangular selection to new caret position. - SCI_CHARLEFTRECTEXTEND = 2428, - - /// Move caret right one character, extending rectangular selection to new caret position. - SCI_CHARRIGHTRECTEXTEND = 2429, - - /// Move caret to first position on line, extending rectangular selection to new caret position. - SCI_HOMERECTEXTEND = 2430, - - /// Move caret to before first visible character on line. - /// If already there move to first character on line. - /// In either case, extend rectangular selection to new caret position. - SCI_VCHOMERECTEXTEND = 2431, - - /// Move caret to last position on line, extending rectangular selection to new caret position. - SCI_LINEENDRECTEXTEND = 2432, - - /// Move caret one page up, extending rectangular selection to new caret position. - SCI_PAGEUPRECTEXTEND = 2433, - - /// Move caret one page down, extending rectangular selection to new caret position. - SCI_PAGEDOWNRECTEXTEND = 2434, - - /// Move caret to top of page, or one page up if already at top of page. - SCI_STUTTEREDPAGEUP = 2435, - - /// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. - SCI_STUTTEREDPAGEUPEXTEND = 2436, - - /// Move caret to bottom of page, or one page down if already at bottom of page. - SCI_STUTTEREDPAGEDOWN = 2437, - - /// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. - SCI_STUTTEREDPAGEDOWNEXTEND = 2438, - - /// Move caret left one word, position cursor at end of word. - SCI_WORDLEFTEND = 2439, - - /// Move caret left one word, position cursor at end of word, extending selection to new caret position. - SCI_WORDLEFTENDEXTEND = 2440, - - /// Move caret right one word, position cursor at end of word. - SCI_WORDRIGHTEND = 2441, - - /// Move caret right one word, position cursor at end of word, extending selection to new caret position. - SCI_WORDRIGHTENDEXTEND = 2442, - - /// Set the set of characters making up whitespace for when moving or selecting by word. - /// Should be called after SetWordChars. - SCI_SETWHITESPACECHARS = 2443, - - /// Get the set of characters making up whitespace for when moving or selecting by word. - SCI_GETWHITESPACECHARS = 2647, - - /// Set the set of characters making up punctuation characters - /// Should be called after SetWordChars. - SCI_SETPUNCTUATIONCHARS = 2648, - - /// Get the set of characters making up punctuation characters - SCI_GETPUNCTUATIONCHARS = 2649, - - /// Reset the set of characters for whitespace and word characters to the defaults. - SCI_SETCHARSDEFAULT = 2444, - - /// Get currently selected item position in the auto-completion list - SCI_AUTOCGETCURRENT = 2445, - - /// Get currently selected item text in the auto-completion list - /// Returns the length of the item text - /// Result is NUL-terminated. - SCI_AUTOCGETCURRENTTEXT = 2610, - - SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE = 0, - - SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE = 1, - - /// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. - SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR = 2634, - - /// Get auto-completion case insensitive behaviour. - SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR = 2635, - - SC_MULTIAUTOC_ONCE = 0, - - SC_MULTIAUTOC_EACH = 1, - - /// Change the effect of autocompleting when there are multiple selections. - SCI_AUTOCSETMULTI = 2636, - - /// Retrieve the effect of autocompleting when there are multiple selections.. - SCI_AUTOCGETMULTI = 2637, - - SC_ORDER_PRESORTED = 0, - - SC_ORDER_PERFORMSORT = 1, - - SC_ORDER_CUSTOM = 2, - - /// Set the way autocompletion lists are ordered. - SCI_AUTOCSETORDER = 2660, - - /// Get the way autocompletion lists are ordered. - SCI_AUTOCGETORDER = 2661, - - /// Enlarge the document to a particular size of text bytes. - SCI_ALLOCATE = 2446, - - /// Returns the target converted to UTF8. - /// Return the length in bytes. - SCI_TARGETASUTF8 = 2447, - - /// Set the length of the utf8 argument for calling EncodedFromUTF8. - /// Set to -1 and the string will be measured to the first nul. - SCI_SETLENGTHFORENCODE = 2448, - - /// Translates a UTF8 string into the document encoding. - /// Return the length of the result in bytes. - /// On error return 0. - SCI_ENCODEDFROMUTF8 = 2449, - - /// Find the position of a column on a line taking into account tabs and - /// multi-byte characters. If beyond end of line, return line end position. - SCI_FINDCOLUMN = 2456, - - /// Can the caret preferred x position only be changed by explicit movement commands? - SCI_GETCARETSTICKY = 2457, - - /// Stop the caret preferred x position changing when the user types. - SCI_SETCARETSTICKY = 2458, - - SC_CARETSTICKY_OFF = 0, - - SC_CARETSTICKY_ON = 1, - - SC_CARETSTICKY_WHITESPACE = 2, - - /// Switch between sticky and non-sticky: meant to be bound to a key. - SCI_TOGGLECARETSTICKY = 2459, - - /// Enable/Disable convert-on-paste for line endings - SCI_SETPASTECONVERTENDINGS = 2467, - - /// Get convert-on-paste setting - SCI_GETPASTECONVERTENDINGS = 2468, - - /// Duplicate the selection. If selection empty duplicate the line containing the caret. - SCI_SELECTIONDUPLICATE = 2469, - - SC_ALPHA_TRANSPARENT = 0, - - SC_ALPHA_OPAQUE = 255, - - SC_ALPHA_NOALPHA = 256, - - /// Set background alpha of the caret line. - SCI_SETCARETLINEBACKALPHA = 2470, - - /// Get the background alpha of the caret line. - SCI_GETCARETLINEBACKALPHA = 2471, - - CARETSTYLE_INVISIBLE = 0, - - CARETSTYLE_LINE = 1, - - CARETSTYLE_BLOCK = 2, - - /// Set the style of the caret to be drawn. - SCI_SETCARETSTYLE = 2512, - - /// Returns the current style of the caret. - SCI_GETCARETSTYLE = 2513, - - /// Set the indicator used for IndicatorFillRange and IndicatorClearRange - SCI_SETINDICATORCURRENT = 2500, - - /// Get the current indicator - SCI_GETINDICATORCURRENT = 2501, - - /// Set the value used for IndicatorFillRange - SCI_SETINDICATORVALUE = 2502, - - /// Get the current indicator value - SCI_GETINDICATORVALUE = 2503, - - /// Turn a indicator on over a range. - SCI_INDICATORFILLRANGE = 2504, - - /// Turn a indicator off over a range. - SCI_INDICATORCLEARRANGE = 2505, - - /// Are any indicators present at position? - SCI_INDICATORALLONFOR = 2506, - - /// What value does a particular indicator have at at a position? - SCI_INDICATORVALUEAT = 2507, - - /// Where does a particular indicator start? - SCI_INDICATORSTART = 2508, - - /// Where does a particular indicator end? - SCI_INDICATOREND = 2509, - - /// Set number of entries in position cache - SCI_SETPOSITIONCACHE = 2514, - - /// How many entries are allocated to the position cache? - SCI_GETPOSITIONCACHE = 2515, - - /// Copy the selection, if selection empty copy the line with the caret - SCI_COPYALLOWLINE = 2519, - - /// Compact the document buffer and return a read-only pointer to the - /// characters in the document. - SCI_GETCHARACTERPOINTER = 2520, - - /// Return a read-only pointer to a range of characters in the document. - /// May move the gap so that the range is contiguous, but will only move up - /// to rangeLength bytes. - SCI_GETRANGEPOINTER = 2643, - - /// Return a position which, to avoid performance costs, should not be within - /// the range of a call to GetRangePointer. - SCI_GETGAPPOSITION = 2644, - - /// Set the alpha fill colour of the given indicator. - SCI_INDICSETALPHA = 2523, - - /// Get the alpha fill colour of the given indicator. - SCI_INDICGETALPHA = 2524, - - /// Set the alpha outline colour of the given indicator. - SCI_INDICSETOUTLINEALPHA = 2558, - - /// Get the alpha outline colour of the given indicator. - SCI_INDICGETOUTLINEALPHA = 2559, - - /// Set extra ascent for each line - SCI_SETEXTRAASCENT = 2525, - - /// Get extra ascent for each line - SCI_GETEXTRAASCENT = 2526, - - /// Set extra descent for each line - SCI_SETEXTRADESCENT = 2527, - - /// Get extra descent for each line - SCI_GETEXTRADESCENT = 2528, - - /// Which symbol was defined for markerNumber with MarkerDefine - SCI_MARKERSYMBOLDEFINED = 2529, - - /// Set the text in the text margin for a line - SCI_MARGINSETTEXT = 2530, - - /// Get the text in the text margin for a line - SCI_MARGINGETTEXT = 2531, - - /// Set the style number for the text margin for a line - SCI_MARGINSETSTYLE = 2532, - - /// Get the style number for the text margin for a line - SCI_MARGINGETSTYLE = 2533, - - /// Set the style in the text margin for a line - SCI_MARGINSETSTYLES = 2534, - - /// Get the styles in the text margin for a line - SCI_MARGINGETSTYLES = 2535, - - /// Clear the margin text on all lines - SCI_MARGINTEXTCLEARALL = 2536, - - /// Get the start of the range of style numbers used for margin text - SCI_MARGINSETSTYLEOFFSET = 2537, - - /// Get the start of the range of style numbers used for margin text - SCI_MARGINGETSTYLEOFFSET = 2538, - - SC_MARGINOPTION_NONE = 0, - - SC_MARGINOPTION_SUBLINESELECT = 1, - - /// Set the margin options. - SCI_SETMARGINOPTIONS = 2539, - - /// Get the margin options. - SCI_GETMARGINOPTIONS = 2557, - - /// Set the annotation text for a line - SCI_ANNOTATIONSETTEXT = 2540, - - /// Get the annotation text for a line - SCI_ANNOTATIONGETTEXT = 2541, - - /// Set the style number for the annotations for a line - SCI_ANNOTATIONSETSTYLE = 2542, - - /// Get the style number for the annotations for a line - SCI_ANNOTATIONGETSTYLE = 2543, - - /// Set the annotation styles for a line - SCI_ANNOTATIONSETSTYLES = 2544, - - /// Get the annotation styles for a line - SCI_ANNOTATIONGETSTYLES = 2545, - - /// Get the number of annotation lines for a line - SCI_ANNOTATIONGETLINES = 2546, - - /// Clear the annotations from all lines - SCI_ANNOTATIONCLEARALL = 2547, - - ANNOTATION_HIDDEN = 0, - - ANNOTATION_STANDARD = 1, - - ANNOTATION_BOXED = 2, - - ANNOTATION_INDENTED = 3, - - /// Set the visibility for the annotations for a view - SCI_ANNOTATIONSETVISIBLE = 2548, - - /// Get the visibility for the annotations for a view - SCI_ANNOTATIONGETVISIBLE = 2549, - - /// Get the start of the range of style numbers used for annotations - SCI_ANNOTATIONSETSTYLEOFFSET = 2550, - - /// Get the start of the range of style numbers used for annotations - SCI_ANNOTATIONGETSTYLEOFFSET = 2551, - - /// Release all extended (>255) style numbers - SCI_RELEASEALLEXTENDEDSTYLES = 2552, - - /// Allocate some extended (>255) style numbers and return the start of the range - SCI_ALLOCATEEXTENDEDSTYLES = 2553, - - UNDO_MAY_COALESCE = 1, - - /// Add a container action to the undo stack - SCI_ADDUNDOACTION = 2560, - - /// Find the position of a character from a point within the window. - SCI_CHARPOSITIONFROMPOINT = 2561, - - /// Find the position of a character from a point within the window. - /// Return INVALID_POSITION if not close to text. - SCI_CHARPOSITIONFROMPOINTCLOSE = 2562, - - /// Set whether switching to rectangular mode while selecting with the mouse is allowed. - SCI_SETMOUSESELECTIONRECTANGULARSWITCH = 2668, - - /// Whether switching to rectangular mode while selecting with the mouse is allowed. - SCI_GETMOUSESELECTIONRECTANGULARSWITCH = 2669, - - /// Set whether multiple selections can be made - SCI_SETMULTIPLESELECTION = 2563, - - /// Whether multiple selections can be made - SCI_GETMULTIPLESELECTION = 2564, - - /// Set whether typing can be performed into multiple selections - SCI_SETADDITIONALSELECTIONTYPING = 2565, - - /// Whether typing can be performed into multiple selections - SCI_GETADDITIONALSELECTIONTYPING = 2566, - - /// Set whether additional carets will blink - SCI_SETADDITIONALCARETSBLINK = 2567, - - /// Whether additional carets will blink - SCI_GETADDITIONALCARETSBLINK = 2568, - - /// Set whether additional carets are visible - SCI_SETADDITIONALCARETSVISIBLE = 2608, - - /// Whether additional carets are visible - SCI_GETADDITIONALCARETSVISIBLE = 2609, - - /// How many selections are there? - SCI_GETSELECTIONS = 2570, - - /// Is every selected range empty? - SCI_GETSELECTIONEMPTY = 2650, - - /// Clear selections to a single empty stream selection - SCI_CLEARSELECTIONS = 2571, - - /// Set a simple selection - SCI_SETSELECTION = 2572, - - /// Add a selection - SCI_ADDSELECTION = 2573, - - /// Drop one selection - SCI_DROPSELECTIONN = 2671, - - /// Set the main selection - SCI_SETMAINSELECTION = 2574, - - /// Which selection is the main selection - SCI_GETMAINSELECTION = 2575, - - /// Which selection is the main selection - SCI_SETSELECTIONNCARET = 2576, - - /// Which selection is the main selection - SCI_GETSELECTIONNCARET = 2577, - - /// Which selection is the main selection - SCI_SETSELECTIONNANCHOR = 2578, - - /// Which selection is the main selection - SCI_GETSELECTIONNANCHOR = 2579, - - /// Which selection is the main selection - SCI_SETSELECTIONNCARETVIRTUALSPACE = 2580, - - /// Which selection is the main selection - SCI_GETSELECTIONNCARETVIRTUALSPACE = 2581, - - /// Which selection is the main selection - SCI_SETSELECTIONNANCHORVIRTUALSPACE = 2582, - - /// Which selection is the main selection - SCI_GETSELECTIONNANCHORVIRTUALSPACE = 2583, - - /// Sets the position that starts the selection - this becomes the anchor. - SCI_SETSELECTIONNSTART = 2584, - - /// Returns the position at the start of the selection. - SCI_GETSELECTIONNSTART = 2585, - - /// Sets the position that ends the selection - this becomes the currentPosition. - SCI_SETSELECTIONNEND = 2586, - - /// Returns the position at the end of the selection. - SCI_GETSELECTIONNEND = 2587, - - /// Returns the position at the end of the selection. - SCI_SETRECTANGULARSELECTIONCARET = 2588, - - /// Returns the position at the end of the selection. - SCI_GETRECTANGULARSELECTIONCARET = 2589, - - /// Returns the position at the end of the selection. - SCI_SETRECTANGULARSELECTIONANCHOR = 2590, - - /// Returns the position at the end of the selection. - SCI_GETRECTANGULARSELECTIONANCHOR = 2591, - - /// Returns the position at the end of the selection. - SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE = 2592, - - /// Returns the position at the end of the selection. - SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE = 2593, - - /// Returns the position at the end of the selection. - SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE = 2594, - - /// Returns the position at the end of the selection. - SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE = 2595, - - SCVS_NONE = 0, - - SCVS_RECTANGULARSELECTION = 1, - - SCVS_USERACCESSIBLE = 2, - - /// Returns the position at the end of the selection. - SCI_SETVIRTUALSPACEOPTIONS = 2596, - - /// Returns the position at the end of the selection. - SCI_GETVIRTUALSPACEOPTIONS = 2597, - - /// On GTK+, allow selecting the modifier key to use for mouse-based - /// rectangular selection. Often the window manager requires Alt+Mouse Drag - /// for moving windows. - /// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. - SCI_SETRECTANGULARSELECTIONMODIFIER = 2598, - - /// Get the modifier key used for rectangular selection. - SCI_GETRECTANGULARSELECTIONMODIFIER = 2599, - - /// Set the foreground colour of additional selections. - /// Must have previously called SetSelFore with non-zero first argument for this to have an effect. - SCI_SETADDITIONALSELFORE = 2600, - - /// Set the background colour of additional selections. - /// Must have previously called SetSelBack with non-zero first argument for this to have an effect. - SCI_SETADDITIONALSELBACK = 2601, - - /// Set the alpha of the selection. - SCI_SETADDITIONALSELALPHA = 2602, - - /// Get the alpha of the selection. - SCI_GETADDITIONALSELALPHA = 2603, - - /// Set the foreground colour of additional carets. - SCI_SETADDITIONALCARETFORE = 2604, - - /// Get the foreground colour of additional carets. - SCI_GETADDITIONALCARETFORE = 2605, - - /// Set the main selection to the next selection. - SCI_ROTATESELECTION = 2606, - - /// Swap that caret and anchor of the main selection. - SCI_SWAPMAINANCHORCARET = 2607, - - /// Indicate that the internal state of a lexer has changed over a range and therefore - /// there may be a need to redraw. - SCI_CHANGELEXERSTATE = 2617, - - /// Find the next line at or after lineStart that is a contracted fold header line. - /// Return -1 when no more lines. - SCI_CONTRACTEDFOLDNEXT = 2618, - - /// Centre current line in window. - SCI_VERTICALCENTRECARET = 2619, - - /// Move the selected lines up one line, shifting the line above after the selection - SCI_MOVESELECTEDLINESUP = 2620, - - /// Move the selected lines down one line, shifting the line below before the selection - SCI_MOVESELECTEDLINESDOWN = 2621, - - /// Set the identifier reported as IdFrom in notification messages. - SCI_SETIDENTIFIER = 2622, - - /// Get the identifier. - SCI_GETIDENTIFIER = 2623, - - /// Set the width for future RGBA image data. - SCI_RGBAIMAGESETWIDTH = 2624, - - /// Set the height for future RGBA image data. - SCI_RGBAIMAGESETHEIGHT = 2625, - - /// Set the scale factor in percent for future RGBA image data. - SCI_RGBAIMAGESETSCALE = 2651, - - /// Define a marker from RGBA data. - /// It has the width and height from RGBAImageSetWidth/Height - SCI_MARKERDEFINERGBAIMAGE = 2626, - - /// Register an RGBA image for use in autocompletion lists. - /// It has the width and height from RGBAImageSetWidth/Height - SCI_REGISTERRGBAIMAGE = 2627, - - /// Scroll to start of document. - SCI_SCROLLTOSTART = 2628, - - /// Scroll to end of document. - SCI_SCROLLTOEND = 2629, - - SC_TECHNOLOGY_DEFAULT = 0, - - SC_TECHNOLOGY_DIRECTWRITE = 1, - - SC_TECHNOLOGY_DIRECTWRITERETAIN = 2, - - SC_TECHNOLOGY_DIRECTWRITEDC = 3, - - /// Set the technology used. - SCI_SETTECHNOLOGY = 2630, - - /// Get the tech. - SCI_GETTECHNOLOGY = 2631, - - /// Create an ILoader*. - SCI_CREATELOADER = 2632, - - /// On OS X, show a find indicator. - SCI_FINDINDICATORSHOW = 2640, - - /// On OS X, flash a find indicator, then fade out. - SCI_FINDINDICATORFLASH = 2641, - - /// On OS X, hide the find indicator. - SCI_FINDINDICATORHIDE = 2642, - - /// Move caret to before first visible character on display line. - /// If already there move to first character on display line. - SCI_VCHOMEDISPLAY = 2652, - - /// Like VCHomeDisplay but extending selection to new caret position. - SCI_VCHOMEDISPLAYEXTEND = 2653, - - /// Is the caret line always visible? - SCI_GETCARETLINEVISIBLEALWAYS = 2654, - - /// Sets the caret line to always visible. - SCI_SETCARETLINEVISIBLEALWAYS = 2655, - - SC_LINE_END_TYPE_DEFAULT = 0, - - SC_LINE_END_TYPE_UNICODE = 1, - - /// Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. - SCI_SETLINEENDTYPESALLOWED = 2656, - - /// Get the line end types currently allowed. - SCI_GETLINEENDTYPESALLOWED = 2657, - - /// Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. - SCI_GETLINEENDTYPESACTIVE = 2658, - - /// Set the way a character is drawn. - SCI_SETREPRESENTATION = 2665, - - /// Set the way a character is drawn. - /// Result is NUL-terminated. - SCI_GETREPRESENTATION = 2666, - - /// Remove a character representation. - SCI_CLEARREPRESENTATION = 2667, - - /// Start notifying the container of all key presses and commands. - SCI_STARTRECORD = 3001, - - /// Stop notifying the container of all key presses and commands. - SCI_STOPRECORD = 3002, - - /// Set the lexing language of the document. - SCI_SETLEXER = 4001, - - /// Retrieve the lexing language of the document. - SCI_GETLEXER = 4002, - - /// Colourise a segment of the document using the current lexing language. - SCI_COLOURISE = 4003, - - /// Set up a value that may be used by a lexer for some optional feature. - SCI_SETPROPERTY = 4004, - - KEYWORDSET_MAX = 8, - - /// Set up the key words used by the lexer. - SCI_SETKEYWORDS = 4005, - - /// Set the lexing language of the document based on string name. - SCI_SETLEXERLANGUAGE = 4006, - - /// Load a lexer library (dll / so). - SCI_LOADLEXERLIBRARY = 4007, - - /// Retrieve a "property" value previously set with SetProperty. - /// Result is NUL-terminated. - SCI_GETPROPERTY = 4008, - - /// Retrieve a "property" value previously set with SetProperty, - /// with "$()" variable replacement on returned buffer. - /// Result is NUL-terminated. - SCI_GETPROPERTYEXPANDED = 4009, - - /// Retrieve a "property" value previously set with SetProperty, - /// interpreted as an int AFTER any "$()" variable replacement. - SCI_GETPROPERTYINT = 4010, - - /// Retrieve the number of bits the current lexer needs for styling. - SCI_GETSTYLEBITSNEEDED = 4011, - - /// Retrieve the name of the lexer. - /// Return the length of the text. - /// Result is NUL-terminated. - SCI_GETLEXERLANGUAGE = 4012, - - /// For private communication between an application and a known lexer. - SCI_PRIVATELEXERCALL = 4013, - - /// Retrieve a '\n' separated list of properties understood by the current lexer. - /// Result is NUL-terminated. - SCI_PROPERTYNAMES = 4014, - - SC_TYPE_BOOLEAN = 0, - - SC_TYPE_INTEGER = 1, - - SC_TYPE_STRING = 2, - - /// Retrieve the type of a property. - SCI_PROPERTYTYPE = 4015, - - /// Describe a property. - /// Result is NUL-terminated. - SCI_DESCRIBEPROPERTY = 4016, - - /// Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. - /// Result is NUL-terminated. - SCI_DESCRIBEKEYWORDSETS = 4017, - - /// Bit set of LineEndType enumertion for which line ends beyond the standard - /// LF, CR, and CRLF are supported by the lexer. - SCI_GETLINEENDTYPESSUPPORTED = 4018, - - /// Allocate a set of sub styles for a particular base style, returning start of range - SCI_ALLOCATESUBSTYLES = 4020, - - /// The starting style number for the sub styles associated with a base style - SCI_GETSUBSTYLESSTART = 4021, - - /// The number of sub styles associated with a base style - SCI_GETSUBSTYLESLENGTH = 4022, - - /// For a sub style, return the base style, else return the argument. - SCI_GETSTYLEFROMSUBSTYLE = 4027, - - /// For a secondary style, return the primary style, else return the argument. - SCI_GETPRIMARYSTYLEFROMSTYLE = 4028, - - /// Free allocated sub styles - SCI_FREESUBSTYLES = 4023, - - /// Set the identifiers that are shown in a particular style - SCI_SETIDENTIFIERS = 4024, - - /// Where styles are duplicated by a feature such as active/inactive code - /// return the distance between the two types. - SCI_DISTANCETOSECONDARYSTYLES = 4025, - - /// Get the set of base styles that can be extended with sub styles - /// Result is NUL-terminated. - SCI_GETSUBSTYLEBASES = 4026, - - SC_MOD_INSERTTEXT = 0x1, - - SC_MOD_DELETETEXT = 0x2, - - SC_MOD_CHANGESTYLE = 0x4, - - SC_MOD_CHANGEFOLD = 0x8, - - SC_PERFORMED_USER = 0x10, - - SC_PERFORMED_UNDO = 0x20, - - SC_PERFORMED_REDO = 0x40, - - SC_MULTISTEPUNDOREDO = 0x80, - - SC_LASTSTEPINUNDOREDO = 0x100, - - SC_MOD_CHANGEMARKER = 0x200, - - SC_MOD_BEFOREINSERT = 0x400, - - SC_MOD_BEFOREDELETE = 0x800, - - SC_MULTILINEUNDOREDO = 0x1000, - - SC_STARTACTION = 0x2000, - - SC_MOD_CHANGEINDICATOR = 0x4000, - - SC_MOD_CHANGELINESTATE = 0x8000, - - SC_MOD_CHANGEMARGIN = 0x10000, - - SC_MOD_CHANGEANNOTATION = 0x20000, - - SC_MOD_CONTAINER = 0x40000, - - SC_MOD_LEXERSTATE = 0x80000, - - SC_MOD_INSERTCHECK = 0x100000, - - SC_MOD_CHANGETABSTOPS = 0x200000, - - SC_MODEVENTMASKALL = 0x3FFFFF, - - SC_UPDATE_CONTENT = 0x1, - - SC_UPDATE_SELECTION = 0x2, - - SC_UPDATE_V_SCROLL = 0x4, - - SC_UPDATE_H_SCROLL = 0x8, - - SCEN_CHANGE = 768, - - SCEN_SETFOCUS = 512, - - SCEN_KILLFOCUS = 256, - - SCK_DOWN = 300, - - SCK_UP = 301, - - SCK_LEFT = 302, - - SCK_RIGHT = 303, - - SCK_HOME = 304, - - SCK_END = 305, - - SCK_PRIOR = 306, - - SCK_NEXT = 307, - - SCK_DELETE = 308, - - SCK_INSERT = 309, - - SCK_ESCAPE = 7, - - SCK_BACK = 8, - - SCK_TAB = 9, - - SCK_RETURN = 13, - - SCK_ADD = 310, - - SCK_SUBTRACT = 311, - - SCK_DIVIDE = 312, - - SCK_WIN = 313, - - SCK_RWIN = 314, - - SCK_MENU = 315, - - SCMOD_NORM = 0, - - SCMOD_SHIFT = 1, - - SCMOD_CTRL = 2, - - SCMOD_ALT = 4, - - SCMOD_SUPER = 8, - - SCMOD_META = 16, - - /// Events - SCN_STYLENEEDED = 2000, - - /// Events - SCN_CHARADDED = 2001, - - /// Events - SCN_SAVEPOINTREACHED = 2002, - - /// Events - SCN_SAVEPOINTLEFT = 2003, - - /// Events - SCN_MODIFYATTEMPTRO = 2004, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_KEY = 2005, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_DOUBLECLICK = 2006, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_UPDATEUI = 2007, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_MODIFIED = 2008, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_MACRORECORD = 2009, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_MARGINCLICK = 2010, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_NEEDSHOWN = 2011, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_PAINTED = 2013, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_USERLISTSELECTION = 2014, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_URIDROPPED = 2015, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_DWELLSTART = 2016, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_DWELLEND = 2017, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_ZOOM = 2018, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_HOTSPOTCLICK = 2019, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_HOTSPOTDOUBLECLICK = 2020, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_CALLTIPCLICK = 2021, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_AUTOCSELECTION = 2022, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_INDICATORCLICK = 2023, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_INDICATORRELEASE = 2024, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_AUTOCCANCELLED = 2025, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_AUTOCCHARDELETED = 2026, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_HOTSPOTRELEASECLICK = 2027, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_FOCUSIN = 2028, - - /// GTK+ Specific to work around focus and accelerator problems: - SCN_FOCUSOUT = 2029, - - SC_CP_DBCS = 1, - - /// Deprecated in 2.30 - /// In palette mode? - SCI_GETUSEPALETTE = 2139, - - /// In palette mode, Scintilla uses the environment's palette calls to display - /// more colours. This may lead to ugly displays. - SCI_SETUSEPALETTE = 2039, - - /// Deprecated in 3.5.5 - /// Always interpret keyboard input as Unicode - SCI_SETKEYSUNICODE = 2521, - - /// Are keys always interpreted as Unicode? - SCI_GETKEYSUNICODE = 2522, - - /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ - - SC_SEARCHRESULT_LINEBUFFERMAXLENGTH = 1024 - } - - public class TextToFind : IDisposable - { - Sci_TextToFind _sciTextToFind; - IntPtr _ptrSciTextToFind; - bool _disposed = false; - - /// - /// text to find - /// - /// range to search - /// the search pattern - public TextToFind(CharacterRange chrRange, string searchText) - { - _sciTextToFind.chrg = chrRange; - _sciTextToFind.lpstrText = Marshal.StringToHGlobalAnsi(searchText); - } - - /// - /// text to find - /// - /// range to search - /// range to search - /// the search pattern - public TextToFind(int cpmin, int cpmax, string searchText) - { - _sciTextToFind.chrg.cpMin = cpmin; - _sciTextToFind.chrg.cpMax = cpmax; - _sciTextToFind.lpstrText = Marshal.StringToHGlobalAnsi(searchText); - } - - [StructLayout(LayoutKind.Sequential)] - struct Sci_TextToFind - { - public CharacterRange chrg; - public IntPtr lpstrText; - public CharacterRange chrgText; - } - - public IntPtr NativePointer { get { _initNativeStruct(); return _ptrSciTextToFind; } } - public string lpstrText { set { _freeNativeString(); _sciTextToFind.lpstrText = Marshal.StringToHGlobalAnsi(value); } } - public CharacterRange chrg { get { _readNativeStruct(); return _sciTextToFind.chrg; } set { _sciTextToFind.chrg = value; _initNativeStruct(); } } - public CharacterRange chrgText { get { _readNativeStruct(); return _sciTextToFind.chrgText; } } - - void _initNativeStruct() - { - if (_ptrSciTextToFind == IntPtr.Zero) - _ptrSciTextToFind = Marshal.AllocHGlobal(Marshal.SizeOf(_sciTextToFind)); - Marshal.StructureToPtr(_sciTextToFind, _ptrSciTextToFind, false); - } - - void _readNativeStruct() - { - if (_ptrSciTextToFind != IntPtr.Zero) - _sciTextToFind = (Sci_TextToFind)Marshal.PtrToStructure(_ptrSciTextToFind, typeof(Sci_TextToFind)); - } - - void _freeNativeString() - { - if (_sciTextToFind.lpstrText != IntPtr.Zero) Marshal.FreeHGlobal(_sciTextToFind.lpstrText); - } - - public void Dispose() - { - if (!_disposed) - { - _freeNativeString(); - if (_ptrSciTextToFind != IntPtr.Zero) Marshal.FreeHGlobal(_ptrSciTextToFind); - _disposed = true; - } - } - - ~TextToFind() - { - Dispose(); - } - } -} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/TextPosition.cs b/CSharpRegexTools4Npp/PluginInfrastructure/TextPosition.cs new file mode 100644 index 0000000..6dbb947 --- /dev/null +++ b/CSharpRegexTools4Npp/PluginInfrastructure/TextPosition.cs @@ -0,0 +1,116 @@ +// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. +using System; + +namespace CSharpRegexTools4Npp.PluginInfrastructure +{ + /// + /// Positions within the Scintilla document refer to a character or the gap before that character. + /// The first character in a document is 0, the second 1 and so on. If a document contains nLen characters, the last character is numbered nLen-1. The caret exists between character positions and can be located from before the first character (0) to after the last character (nLen). + /// + /// There are places where the caret can not go where two character bytes make up one character. + /// This occurs when a DBCS character from a language like Japanese is included in the document or when line ends are marked with the CP/M + /// standard of a carriage return followed by a line feed.The INVALID_POSITION constant(-1) represents an invalid position within the document. + /// + /// All lines of text in Scintilla are the same height, and this height is calculated from the largest font in any current style.This restriction + /// is for performance; if lines differed in height then calculations involving positioning of text would require the text to be styled first. + /// + /// If you use messages, there is nothing to stop you setting a position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. + /// However, keyboard commands will not move the caret into such positions. + /// + public class TextPosition : IEquatable + { + private readonly int pos; + + public static TextPosition From(int pos) + { + return new TextPosition(pos); + } + + public TextPosition(int pos) + { + this.pos = pos; + } + + public int Value + { + get { return pos; } + } + + public static TextPosition operator +(TextPosition a, TextPosition b) + { + return new TextPosition(a.pos + b.pos); + } + + public static TextPosition operator -(TextPosition a, TextPosition b) + { + return new TextPosition(a.pos - b.pos); + } + + public static bool operator ==(TextPosition a, TextPosition b) + { + if (ReferenceEquals(a, b)) + return true; + if (ReferenceEquals(a, null)) + return false; + if (ReferenceEquals(b, null)) + return false; + return a.pos == b.pos; + } + + public static bool operator !=(TextPosition a, TextPosition b) + { + return !(a == b); + } + + public static bool operator >(TextPosition a, TextPosition b) + { + return a.Value > b.Value; + } + + public static bool operator <(TextPosition a, TextPosition b) + { + return a.Value < b.Value; + } + + public static TextPosition Min(TextPosition a, TextPosition b) + { + if (a < b) + return a; + return b; + } + + public static TextPosition Max(TextPosition a, TextPosition b) + { + if (a > b) + return a; + return b; + } + + public override string ToString() + { + return "TextPosition: " + pos; + } + + public bool Equals(TextPosition other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return pos == other.pos; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((TextPosition)obj); + } + + public override int GetHashCode() + { + return pos.GetHashCode(); + } + } + /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ + +} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs b/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs index dc4eb51..e6f63f3 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs @@ -1,15 +1,14 @@ // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -using CSharpRegexTools4Npp.PluginInfrastructure; -using NppPlugin.DllExport; using System; using System.Runtime.InteropServices; -using System.Windows.Forms; +using CSharpRegexTools4Npp.PluginInfrastructure; +using RGiesecke.DllExport; namespace CSharpRegexTools4Npp { - public class UnmanagedExports + class UnmanagedExports { - [DllExport(CallingConvention = CallingConvention.Cdecl)] + [DllExport(CallingConvention=CallingConvention.Cdecl)] static bool isUnicode() { return true; @@ -18,15 +17,8 @@ static bool isUnicode() [DllExport(CallingConvention = CallingConvention.Cdecl)] static void setInfo(NppData notepadPlusData) { - try - { - PluginBase.nppData = notepadPlusData; - Main.CommandMenuInit(); - } - catch (Exception exception) - { - MessageBox.Show($"{exception.Message}\r\n{exception.StackTrace}{(exception.InnerException == null ? string.Empty : $"\r\nInner Exception :\r\n{exception.InnerException.Message}\r\n{exception.InnerException.StackTrace}")}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + PluginBase.nppData = notepadPlusData; + Main.CommandMenuInit(); } [DllExport(CallingConvention = CallingConvention.Cdecl)] @@ -37,7 +29,7 @@ static IntPtr getFuncsArray(ref int nbF) } [DllExport(CallingConvention = CallingConvention.Cdecl)] - static uint messageProc(uint Message, IntPtr wParam, IntPtr lParam) + static uint messageProc(uint message, IntPtr wParam, IntPtr lParam) { return 1; } @@ -54,26 +46,20 @@ static IntPtr getName() [DllExport(CallingConvention = CallingConvention.Cdecl)] static void beNotified(IntPtr notifyCode) { - try + ScNotification notification = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification)); + if (notification.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION) + { + PluginBase._funcItems.RefreshItems(); + Main.SetToolBarIcon(); + } + else if (notification.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN) { - ScNotification notification = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification)); - if (notification.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION) - { - PluginBase._funcItems.RefreshItems(); - Main.SetToolBarIcon(); - } - else if (notification.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN) - { - Marshal.FreeHGlobal(_ptrPluginName); - } - else - { - Main.OnNotification(notification); - } + Main.PluginCleanUp(); + Marshal.FreeHGlobal(_ptrPluginName); } - catch (Exception exception) + else { - MessageBox.Show($"{exception.Message}\r\n{exception.StackTrace}{(exception.InnerException == null ? string.Empty : $"\r\nInner Exception :\r\n{exception.InnerException.Message}\r\n{exception.InnerException.StackTrace}")}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + Main.OnNotification(notification); } } } diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs.bak b/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs.bak deleted file mode 100644 index c22e693..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs.bak +++ /dev/null @@ -1,65 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -using CSharpRegexTools4Npp.PluginInfrastructure; -using NppPlugin.DllExport; -using System; -using System.Runtime.InteropServices; - -namespace CSharpRegexTools4Npp -{ - public class UnmanagedExports - { - [DllExport(CallingConvention=CallingConvention.Cdecl)] - static bool isUnicode() - { - return true; - } - - [DllExport(CallingConvention = CallingConvention.Cdecl)] - static void setInfo(NppData notepadPlusData) - { - PluginBase.nppData = notepadPlusData; - Main.CommandMenuInit(); - } - - [DllExport(CallingConvention = CallingConvention.Cdecl)] - static IntPtr getFuncsArray(ref int nbF) - { - nbF = PluginBase._funcItems.Items.Count; - return PluginBase._funcItems.NativePointer; - } - - [DllExport(CallingConvention = CallingConvention.Cdecl)] - static uint messageProc(uint Message, IntPtr wParam, IntPtr lParam) - { - return 1; - } - - static IntPtr _ptrPluginName = IntPtr.Zero; - [DllExport(CallingConvention = CallingConvention.Cdecl)] - static IntPtr getName() - { - if (_ptrPluginName == IntPtr.Zero) - _ptrPluginName = Marshal.StringToHGlobalUni(Main.PluginName); - return _ptrPluginName; - } - - [DllExport(CallingConvention = CallingConvention.Cdecl)] - static void beNotified(IntPtr notifyCode) - { - ScNotification notification = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification)); - if (notification.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION) - { - PluginBase._funcItems.RefreshItems(); - Main.SetToolBarIcon(); - } - else if (notification.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN) - { - Marshal.FreeHGlobal(_ptrPluginName); - } - else - { - Main.OnNotification(notification); - } - } - } -} diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/Win32.cs b/CSharpRegexTools4Npp/PluginInfrastructure/Win32.cs index 4a17fd9..e65be3d 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/Win32.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/Win32.cs @@ -48,6 +48,73 @@ public struct ScrollInfo public int nTrackPos; } + /// + /// @see https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-nmhdr + /// + [StructLayout(LayoutKind.Sequential)] + public struct TagNMHDR + { + public IntPtr hwndFrom; + public UIntPtr idFrom; + public uint code; + } + + /// + /// see https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-menuiteminfow + /// + [StructLayout(LayoutKind.Sequential)] + public struct MenuItemInfo + { + /// + /// this is always equal to the size of this struct + /// + public uint cbSize { get; private set; } + public uint fMask; + public uint fType; + public uint fState; + public uint wID; + public IntPtr hSubMenu; + public IntPtr hbmpChecked; + public IntPtr hbmpUnchecked; + public UIntPtr dwItemData; + public IntPtr dwTypeData; + public uint cch; + public IntPtr hbmpItem; + + public MenuItemInfo(MenuItemMask fMask) + { + cbSize = 0; + this.fMask = (uint)fMask; + fType = 0; + fState = 0; + wID = 0; + hSubMenu = IntPtr.Zero; + hbmpChecked = IntPtr.Zero; + hbmpUnchecked = IntPtr.Zero; + dwItemData = UIntPtr.Zero; + dwTypeData = IntPtr.Zero; + cch = 0; + hbmpItem = IntPtr.Zero; + cbSize = (uint)Marshal.SizeOf(this); + } + } + + /// + /// See the description of the fMask MenuItemInfo attribute in https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-menuiteminfow + /// + public enum MenuItemMask : uint + { + MIIM_BITMAP = 0X80, + MIIM_CHECKMARKS = 8, + MIIM_DATA = 0X20, + MIIM_FTYPE = 0X100, + MIIM_ID = 2, + MIIM_STATE = 1, + MIIM_STRING = 0X40, + MIIM_SUBMENU = 4, + // MIIM_TYPE = 0X10, // deprecated + } + /// /// Used for the ScrollInfo fMask /// SIF_ALL => Combination of SIF_PAGE, SIF_POS, SIF_RANGE, and SIF_TRACKPOS. @@ -84,7 +151,7 @@ public enum ScrollInfoBar /// If gateways are missing or incomplete, please help extend them and send your code to the project /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net /// - [DllImport("user32", CharSet = CharSet.Auto)] + [DllImport("user32")] public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); /// @@ -93,7 +160,7 @@ public enum ScrollInfoBar /// If gateways are missing or incomplete, please help extend them and send your code to the project /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net /// - [DllImport("user32", CharSet = CharSet.Auto)] + [DllImport("user32")] public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lParam); /// @@ -102,7 +169,7 @@ public enum ScrollInfoBar /// If gateways are missing or incomplete, please help extend them and send your code to the project /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net /// - [DllImport("user32", CharSet = CharSet.Auto)] + [DllImport("user32")] public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); /// @@ -111,18 +178,9 @@ public enum ScrollInfoBar /// If gateways are missing or incomplete, please help extend them and send your code to the project /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net /// - [DllImport("user32", CharSet = CharSet.Auto)] + [DllImport("user32")] public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, out IntPtr lParam); - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - [DllImport("user32", CharSet = CharSet.Auto)] - public static extern bool SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, ref ShortcutKey lParam); - /// /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as /// or . @@ -275,7 +333,7 @@ public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, IntPtr wParam, IntPtr /// If gateways are missing or incomplete, please help extend them and send your code to the project /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, ref LangType lParam) + public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, ref LangType lParam) { IntPtr outVal; IntPtr retval = SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), out outVal); @@ -288,20 +346,94 @@ public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, ref LangType [DllImport("kernel32")] public static extern int GetPrivateProfileInt(string lpAppName, string lpKeyName, int nDefault, string lpFileName); + [DllImport("kernel32")] + public static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName); + [DllImport("kernel32")] public static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName); + [DllImport("kernel32.dll")] + public static extern int GetPrivateProfileSection(string lpAppName, byte[] lpszReturnBuffer, int nSize, string lpFileName); + public const int MF_BYCOMMAND = 0; public const int MF_CHECKED = 8; public const int MF_UNCHECKED = 0; + public const int MF_ENABLED = 0; + public const int MF_GRAYED = 1; + public const int MF_DISABLED = 2; [DllImport("user32")] public static extern IntPtr GetMenu(IntPtr hWnd); [DllImport("user32")] - public static extern int CheckMenuItem(IntPtr hmenu, int uIDCheckItem, int uCheck); + public static extern IntPtr GetSubMenu(IntPtr hMenu, int index); + + [DllImport("user32")] + public static extern bool SetMenuItemInfo(IntPtr hMenu, uint item, bool fByPosition, IntPtr ptrMenuItemInfo); + + [DllImport("user32")] + public static extern bool GetMenuItemInfo(IntPtr hMenu, uint item, bool fByPosition, IntPtr ptrMenuItemInfo); + + [DllImport("user32")] + public static extern int GetMenuItemCount(IntPtr hMenu); + + [DllImport("user32")] + public static extern int CheckMenuItem(IntPtr hMenu, int uIDCheckItem, int uCheck); + + [DllImport("user32")] + public static extern bool EnableMenuItem(IntPtr hMenu, int uIDEnableItem, int uEnable); public const int WM_CREATE = 1; + public const int WM_NOTIFY = 0x004e; + public const int GWL_EXSTYLE = -20; + public const int GWLP_HINSTANCE = -6; + public const int GWLP_HWNDPARENT = -8; + public const int GWLP_ID = -12; + public const int GWL_STYLE = -16; + public const int GWLP_USERDATA = -21; + public const int GWLP_WNDPROC = -4; + public const long WS_EX_ACCEPTFILES = 0x00000010L; + public const long WS_EX_APPWINDOW = 0x00040000L; + public const long WS_EX_CLIENTEDGE = 0x00000200L; + public const long WS_EX_COMPOSITED = 0x02000000L; + public const long WS_EX_CONTEXTHELP = 0x00000400L; + public const long WS_EX_CONTROLPARENT = 0x00010000L; + public const long WS_EX_DLGMODALFRAME = 0x00000001L; + public const long WS_EX_LAYERED = 0x00080000L; + public const long WS_EX_LAYOUTRTL = 0x00400000L; + public const long WS_EX_LEFT = 0x00000000L; + public const long WS_EX_LEFTSCROLLBAR = 0x00004000L; + public const long WS_EX_LTRREADING = 0x00000000L; + public const long WS_EX_MDICHILD = 0x00000040L; + public const long WS_EX_NOACTIVATE = 0x08000000L; + public const long WS_EX_NOINHERITLAYOUT = 0x00100000L; + public const long WS_EX_NOPARENTNOTIFY = 0x00000004L; + public const long WS_EX_NOREDIRECTIONBITMAP = 0x00200000L; + public const long WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); + public const long WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST); + public const long WS_EX_RIGHT = 0x00001000L; + public const long WS_EX_RIGHTSCROLLBAR = 0x00000000L; + public const long WS_EX_RTLREADING = 0x00002000L; + public const long WS_EX_STATICEDGE = 0x00020000L; + public const long WS_EX_TOOLWINDOW = 0x00000080L; + public const long WS_EX_TOPMOST = 0x00000008L; + public const long WS_EX_TRANSPARENT = 0x00000020L; + public const long WS_EX_WINDOWEDGE = 0x00000100L; + + public delegate IntPtr WindowLongGetter(IntPtr hWnd, int nIndex); + public delegate IntPtr WindowLongSetter(IntPtr hWnd, int nIndex, IntPtr dwNewLong); + + [DllImport("user32")] + public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex); + + [DllImport("user32")] + public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); + + [DllImport("user32")] + public static extern IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong); + + [DllImport("user32")] + public static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong); [DllImport("user32")] public static extern bool ClientToScreen(IntPtr hWnd, ref Point lpPoint); diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/Win32.cs.bak b/CSharpRegexTools4Npp/PluginInfrastructure/Win32.cs.bak deleted file mode 100644 index 99af369..0000000 --- a/CSharpRegexTools4Npp/PluginInfrastructure/Win32.cs.bak +++ /dev/null @@ -1,313 +0,0 @@ -// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. -using System; -using System.Drawing; -using System.Runtime.InteropServices; -using System.Text; - -namespace CSharpRegexTools4Npp.PluginInfrastructure -{ - public class Win32 - { - /// - /// Get the scroll information of a scroll bar or window with scroll bar - /// @see https://msdn.microsoft.com/en-us/library/windows/desktop/bb787537(v=vs.85).aspx - /// - [StructLayout(LayoutKind.Sequential)] - public struct ScrollInfo - { - /// - /// Specifies the size, in bytes, of this structure. The caller must set this to sizeof(SCROLLINFO). - /// - public uint cbSize; - /// - /// Specifies the scroll bar parameters to set or retrieve. - /// @see ScrollInfoMask - /// - public uint fMask; - /// - /// Specifies the minimum scrolling position. - /// - public int nMin; - /// - /// Specifies the maximum scrolling position. - /// - public int nMax; - /// - /// Specifies the page size, in device units. A scroll bar uses this value to determine the appropriate size of the proportional scroll box. - /// - public uint nPage; - /// - /// Specifies the position of the scroll box. - /// - public int nPos; - /// - /// Specifies the immediate position of a scroll box that the user is dragging. - /// An application can retrieve this value while processing the SB_THUMBTRACK request code. - /// An application cannot set the immediate scroll position; the SetScrollInfo function ignores this member. - /// - public int nTrackPos; - } - - /// - /// Used for the ScrollInfo fMask - /// SIF_ALL => Combination of SIF_PAGE, SIF_POS, SIF_RANGE, and SIF_TRACKPOS. - /// SIF_DISABLENOSCROLL => This value is used only when setting a scroll bar's parameters. If the scroll bar's new parameters make the scroll bar unnecessary, disable the scroll bar instead of removing it. - /// SIF_PAGE => The nPage member contains the page size for a proportional scroll bar. - /// SIF_POS => The nPos member contains the scroll box position, which is not updated while the user drags the scroll box. - /// SIF_RANGE => The nMin and nMax members contain the minimum and maximum values for the scrolling range. - /// SIF_TRACKPOS => The nTrackPos member contains the current position of the scroll box while the user is dragging it. - /// - public enum ScrollInfoMask - { - SIF_RANGE = 0x1, - SIF_PAGE = 0x2, - SIF_POS = 0x4, - SIF_DISABLENOSCROLL = 0x8, - SIF_TRACKPOS = 0x10, - SIF_ALL = SIF_RANGE + SIF_PAGE + SIF_POS + SIF_TRACKPOS - } - - /// - /// Used for the GetScrollInfo() nBar parameter - /// - public enum ScrollInfoBar - { - SB_HORZ = 0, - SB_VERT = 1, - SB_CTL = 2, - SB_BOTH = 3 - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - [DllImport("user32", CharSet = CharSet.Auto)] - public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - [DllImport("user32", CharSet = CharSet.Auto)] - public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lParam); - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - [DllImport("user32", CharSet = CharSet.Auto)] - public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - [DllImport("user32", CharSet = CharSet.Auto)] - public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, out IntPtr lParam); - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, NppMenuCmd lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), new IntPtr((uint)lParam)); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, IntPtr lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), new IntPtr(lParam)); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, out int lParam) - { - IntPtr outVal; - IntPtr retval = SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), out outVal); - lParam = outVal.ToInt32(); - return retval; - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, int lParam) - { - return SendMessage(hWnd, (UInt32)Msg, wParam, new IntPtr(lParam)); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, IntPtr wParam, int lParam) - { - return SendMessage(hWnd, (UInt32)Msg, wParam, new IntPtr(lParam)); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, IntPtr lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, string lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, [MarshalAs(UnmanagedType.LPStr)] StringBuilder lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, int lParam) - { - return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), new IntPtr(lParam)); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, IntPtr wParam, IntPtr lParam) - { - return SendMessage(hWnd, (UInt32)Msg, wParam, lParam); - } - - /// - /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as - /// or . - /// If gateways are missing or incomplete, please help extend them and send your code to the project - /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net - /// - public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, ref LangType lParam) - { - IntPtr outVal; - IntPtr retval = SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), out outVal); - lParam = (LangType)outVal; - return retval; - } - - public const int MAX_PATH = 260; - - [DllImport("kernel32")] - public static extern int GetPrivateProfileInt(string lpAppName, string lpKeyName, int nDefault, string lpFileName); - - [DllImport("kernel32")] - public static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName); - - public const int MF_BYCOMMAND = 0; - public const int MF_CHECKED = 8; - public const int MF_UNCHECKED = 0; - - [DllImport("user32")] - public static extern IntPtr GetMenu(IntPtr hWnd); - - [DllImport("user32")] - public static extern int CheckMenuItem(IntPtr hmenu, int uIDCheckItem, int uCheck); - - public const int WM_CREATE = 1; - - [DllImport("user32")] - public static extern bool ClientToScreen(IntPtr hWnd, ref Point lpPoint); - - [DllImport("kernel32")] - public static extern void OutputDebugString(string lpOutputString); - - /// - /// @see https://msdn.microsoft.com/en-us/library/windows/desktop/bb787583(v=vs.85).aspx - /// - /// - /// - /// - /// - [DllImport("user32")] - public static extern int GetScrollInfo(IntPtr hwnd, int nBar, ref ScrollInfo scrollInfo); - } -} diff --git a/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs b/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs index 66a05a2..caf058c 100644 --- a/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs +++ b/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CodingSeb")] [assembly: AssemblyProduct("C# Regex Tools 4 Npp")] -[assembly: AssemblyCopyright("Copyright © CodingSeb 2019")] +[assembly: AssemblyCopyright("Copyright © CodingSeb 2025")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -19,7 +19,7 @@ [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("31492674-6fe0-485c-91f0-2e17244588ff")] +[assembly: Guid("2f8c343a-3fa0-47ba-b3b5-23a5757f8779")] // Version information for an assembly consists of the following four values: // @@ -28,8 +28,5 @@ // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.3.0")] -[assembly: AssemblyFileVersion("1.1.3.0")] \ No newline at end of file +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.0.0")] diff --git a/CSharpRegexTools4Npp/Properties/Resources.Designer.cs b/CSharpRegexTools4Npp/Properties/Resources.Designer.cs new file mode 100644 index 0000000..2b59fc0 --- /dev/null +++ b/CSharpRegexTools4Npp/Properties/Resources.Designer.cs @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3603 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Kbg.Demo.Namespace.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NppPluginNET.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + internal static System.Drawing.Bitmap star_bmp + { + get + { + object obj = ResourceManager.GetObject("star_bmp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/CSharpRegexTools4Npp/Resources.resx b/CSharpRegexTools4Npp/Properties/Resources.resx similarity index 96% rename from CSharpRegexTools4Npp/Resources.resx rename to CSharpRegexTools4Npp/Properties/Resources.resx index 3cf2bad..2f96abe 100644 --- a/CSharpRegexTools4Npp/Resources.resx +++ b/CSharpRegexTools4Npp/Properties/Resources.resx @@ -118,7 +118,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - img\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - \ No newline at end of file diff --git a/CSharpRegexTools4Npp/Properties/Resources1.Designer.cs b/CSharpRegexTools4Npp/Properties/Resources1.Designer.cs new file mode 100644 index 0000000..d63f368 --- /dev/null +++ b/CSharpRegexTools4Npp/Properties/Resources1.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CSharpRegexTools4Npp.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CSharpRegexTools4Npp.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/CSharpRegexTools4Npp/Properties/star.png b/CSharpRegexTools4Npp/Properties/star.png new file mode 100644 index 0000000..164d16b Binary files /dev/null and b/CSharpRegexTools4Npp/Properties/star.png differ diff --git a/CSharpRegexTools4Npp/Properties/star_black.ico b/CSharpRegexTools4Npp/Properties/star_black.ico new file mode 100644 index 0000000..99ec4c5 Binary files /dev/null and b/CSharpRegexTools4Npp/Properties/star_black.ico differ diff --git a/CSharpRegexTools4Npp/Properties/star_bmp.bmp b/CSharpRegexTools4Npp/Properties/star_bmp.bmp new file mode 100644 index 0000000..689ab17 Binary files /dev/null and b/CSharpRegexTools4Npp/Properties/star_bmp.bmp differ diff --git a/CSharpRegexTools4Npp/Properties/star_white.ico b/CSharpRegexTools4Npp/Properties/star_white.ico new file mode 100644 index 0000000..4c7cced Binary files /dev/null and b/CSharpRegexTools4Npp/Properties/star_white.ico differ diff --git a/CSharpRegexTools4Npp/Res.Designer.cs b/CSharpRegexTools4Npp/Res.Designer.cs new file mode 100644 index 0000000..4141407 --- /dev/null +++ b/CSharpRegexTools4Npp/Res.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CSharpRegexTools4Npp { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Res { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Res() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CSharpRegexTools4Npp.Res", typeof(Res).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Icon { + get { + object obj = ResourceManager.GetObject("Icon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/CSharpRegexTools4Npp/Res.resx b/CSharpRegexTools4Npp/Res.resx new file mode 100644 index 0000000..7d5b837 --- /dev/null +++ b/CSharpRegexTools4Npp/Res.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Resources\Icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/CSharpRegexTools4Npp/Resources.Designer.cs b/CSharpRegexTools4Npp/Resources.Designer.cs index b583df6..9b78da6 100644 --- a/CSharpRegexTools4Npp/Resources.Designer.cs +++ b/CSharpRegexTools4Npp/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Ce code a été généré par un outil. -// Version du runtime :4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si -// le code est régénéré. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,13 +13,13 @@ namespace CSharpRegexTools4Npp { /// - /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder - // à l'aide d'un outil, tel que ResGen ou Visual Studio. - // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen - // avec l'option /str ou régénérez votre projet VS. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -33,7 +33,7 @@ internal Resources() { } /// - /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal Resources() { } /// - /// Remplace la propriété CurrentUICulture du thread actuel pour toutes - /// les recherches de ressources à l'aide de cette classe de ressource fortement typée. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal Resources() { } /// - /// Recherche une ressource localisée de type System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap icon { get { diff --git a/CSharpRegexTools4Npp/img/icon.png b/CSharpRegexTools4Npp/Resources/Icon.png similarity index 100% rename from CSharpRegexTools4Npp/img/icon.png rename to CSharpRegexTools4Npp/Resources/Icon.png diff --git a/CSharpRegexTools4Npp/Utils/ArrayExtensions.cs b/CSharpRegexTools4Npp/Utils/ArrayExtensions.cs new file mode 100644 index 0000000..d09f213 --- /dev/null +++ b/CSharpRegexTools4Npp/Utils/ArrayExtensions.cs @@ -0,0 +1,399 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CSharpRegexTools4Npp.Utils +{ + public static class ArrayExtensions + { + /// + /// Allows the use of Python-style slices, where start, stop, and stride must be declared as individual paramters.

+ /// Thus e.g. arr.Slice(2, null, -1) is just like arr[slice(2, None, -1)] in Python.

+ /// This just yields the elements one by one.

+ /// If you want a function that yields a shallow copy of the sliced region of the iterable, use Slice<T> instead. + ///
+ /// + /// + /// + /// + /// + /// + public static IEnumerable LazySlice(this IList source, int? start, int? stop = null, int? stride = null) + { + int len = source.Count; + if (len <= 0) + { + yield break; + } + int istop, istart, istride; + if (stride is int istride_) + { + istride = istride_; + if (istride_ < 0) + { + if (start is int istart_) + { + if (istart_ < -len) + yield break; + istart = ClampWithinLen(len, istart_, true); + } + else + istart = len - 1; + + if (stop is int istop_) + istop = ClampWithinLen(len, istop_, false); + else + istop = -1; + } + else if (istride_ == 0) + { + throw new ArgumentException("The stride parameter of a slice must be a non-zero integer, or must be left empty"); + } + else // positive stride + { + if (start is int istart_) + { + if (istart_ >= len) + yield break; + istart = ClampWithinLen(len, istart_, true); + } + else + istart = 0; + + if (stop is int istop_) + istop = ClampWithinLen(len, istop_, false); + else + istop = len; + } + } + else // stride unspecified, assumed to be 1 + { + istride = 1; + + if (start is int istart_) + istart = ClampWithinLen(len, istart_, true); + else + istart = 0; + + if (stop is int istop_) + istop = ClampWithinLen(len, istop_, false); + else + istop = len; + } + + if (istride < 0) + { + for (int ii = istart; ii > istop; ii += istride) + { + yield return source[ii]; + } + } + else + { + for (int ii = istart; ii < istop; ii += istride) + { + yield return source[ii]; + } + } + } + + /// + /// If num is negative, use Python-style negative indices (e.g., -1 is the last element, -len is the first elememnt) + /// Otherwise, restrict num to between 0 and len (inclusive unless is_start_idx) + /// + /// + /// + /// + public static int ClampWithinLen(int len, int num, bool is_start_idx) + { + if (num >= len) + return is_start_idx ? len - 1: len; + if (num < 0) + { + num += len; + if (num < 0) + return is_start_idx ? 0 : -1; + return num; + } + return num; + } + + /// + /// Allows the use of Python-style slices, passed as strings (e.g., ":", "1::-2").

+ /// Because LazySlice is an extension method, all arrays in this namespace can use this method.

+ /// See https://stackoverflow.com/questions/509211/understanding-slicing + /// This just yields the elements one by one.

+ /// If you want a function that yields a shallow copy of the sliced region of the iterable, use Slice<T> instead. + ///
+ public static IEnumerable LazySlice(this IList source, string slicer) + // note the "this" before the type and type. + // that designates Slice as a new method that can be used by T[] objects + // (i.e., arrays of any object type) using the "." syntax. + // That's why later on we see a.Slice(":" + a.Length) even though a doesn't + // come with the Slice method built in. + { + string[] parts = slicer.Split(':'); + int? start = 0, stop = 0, stride = 1; + switch (parts.Length) + { + case 1: start = 0; stop = int.Parse(parts[0]); break; + case 2: + if (parts[0] == "") start = null; else start = int.Parse(parts[0]); + if (parts[1] == "") stop = null; else stop = int.Parse(parts[1]); + break; + case 3: + if (parts[0] == "") start = null; else start = int.Parse(parts[0]); + if (parts[1] == "") stop = null; else stop = int.Parse(parts[1]); + if (parts[2] == "") stride = null; else stride = int.Parse(parts[2]); + break; + } + foreach (T item in source.LazySlice(start, stop, stride)) { yield return item; } + } + + /// + /// This just yields the elements one by one.

+ /// If you want a function that yields a shallow copy of the sliced region of the iterable, use Slice<T> instead. + ///
+ /// + /// + /// + /// + public static IEnumerable LazySlice(this IList source, int?[] slicer) + { + int? start = 0, stop = 0, stride = 1; + switch (slicer.Length) + { + case 1: start = 0; stop = slicer[0]; break; + case 2: + start = slicer[0]; + stop = slicer[1]; + break; + case 3: + start = slicer[0]; + stop = slicer[1]; + stride = slicer[2]; + break; + } + foreach (T item in source.LazySlice(start, stop, stride)) { yield return item; } + } + + /// + /// Allows use of Python-style slices, except that these create a copy of the sliced object rather than a view.

+ /// For higher performance at the cost of only producing an iterator and not a new iterable, use LazySlice.

+ /// See the documentation for LazySlice with three int arguments. + ///
+ /// + /// + /// + /// + /// + /// + /// + public static IList Slice(this IList source, int? start, int? stop = null, int? stride = null) + { + if (source is T[]) + return source.LazySlice(start, stop, stride).ToArray(); + if (source is List) + return source.LazySlice(start, stop, stride).ToList(); + throw new NotImplementedException("Slice extension is only implemented for strings, Lists, and arrays"); + } + + /// + /// Allows use of Python-style slices, except that these create a copy of the sliced object rather than a view.

+ /// For higher performance at the cost of only producing an iterator and not a new iterable, use LazySlice.

+ /// See the documentation for LazySlice with a string argument + ///
+ /// + /// + /// + /// + /// + /// + /// + public static IList Slice(this IList source, string slicer) + { + string[] parts = slicer.Split(':'); + int? start = 0, stop = 0, stride = 1; + switch (parts.Length) + { + case 1: start = 0; stop = int.Parse(parts[0]); break; + case 2: + if (parts[0] == "") start = null; else start = int.Parse(parts[0]); + if (parts[1] == "") stop = null; else stop = int.Parse(parts[1]); + break; + case 3: + if (parts[0] == "") start = null; else start = int.Parse(parts[0]); + if (parts[1] == "") stop = null; else stop = int.Parse(parts[1]); + if (parts[2] == "") stride = null; else stride = int.Parse(parts[2]); + break; + } + return source.Slice(start, stop, stride); + } + + /// + /// Allows use of Python-style slices, except that these create a copy of the sliced object rather than a view.

+ /// For higher performance at the cost of only producing an iterator and not a new iterable, use LazySlice.

+ /// See the documentation for LazySlice with three int arguments. + ///
+ /// + /// + /// + /// + /// + /// + /// + public static IList Slice(this IList source, int?[] slicer) + { + int? start = 0, stop = 0, stride = 1; + switch (slicer.Length) + { + case 1: start = 0; stop = slicer[0]; break; + case 2: + start = slicer[0]; + stop = slicer[1]; + break; + case 3: + start = slicer[0]; + stop = slicer[1]; + stride = slicer[2]; + break; + } + return source.Slice(start, stop, stride); + } + + public static string Slice(this string source, string slicer) + { + return new string(source.ToCharArray().LazySlice(slicer).ToArray()); + } + + public static string Slice(this string source, int start, int stop, int stride) + { + return new string(source.ToCharArray().LazySlice(start, stop, stride).ToArray()); + } + + /// + /// s_slice(x: string, sli: integer | slicer) -> string

+ /// uses Python slicing syntax.

+ /// EXAMPLES:

+ /// * s_slice(abcde, 1:-2) returns "bc"

+ /// * s_slice(abcde, :2) returns "ab"

+ /// * s_slice(abcde, -2) returns "d"

+ ///
+ public static string Slice(this string source, int?[] slicer) + { + return new string(source.ToCharArray().LazySlice(slicer).ToArray()); + } + + /// + /// randomize the order of the elements in arr + /// + public static void Shuffle(this IList arr) + { + for (int ii = 1; ii < arr.Count; ii++) + { + int swapWith = Npp.random.Next(0, ii + 1); + if (swapWith < ii) + { + T temp = arr[ii]; + arr[ii] = arr[swapWith]; + arr[swapWith] = temp; + } + } + } + + /// + /// Removes and returns the last element of a list. + /// + /// + /// + /// + public static T Pop(this List list) + { + int lastIdx = list.Count - 1; + T last = list[lastIdx]; + list.RemoveAt(lastIdx); + return last; + } + + /// + /// e.g., int[]{1,2,3,4,5} -> + /// "[1, 2, 3, 4, 5]" + /// + /// + /// + /// + public static string ArrayToString(this IList list) + { + var sb = new StringBuilder(); + sb.Append('['); + for (int ii = 0; ii < list.Count; ii++) + { + T x = list[ii]; + sb.Append(x.ToString()); + if (ii < list.Count - 1) + sb.Append(", "); + } + sb.Append(']'); + return sb.ToString(); + } + + /// + /// If idx is between [0, source length) exclusive, atIdx = source[idx] and return true.

+ /// If idx is between [-(source length), -1] inclusive, atIdx = source[idx + source length] and return true.

+ /// else atIdx = default(T) and return false + ///
+ /// + /// + /// + /// + /// + public static bool WrappedIndex(this IList source, int idx, out T atIdx) + { + int count = source.Count; + if (idx >= count || idx < -count) + { + atIdx = default(T); + return false; + } + idx = idx >= 0 ? idx : idx + count; + atIdx = source[idx]; + return true; + } + + /// + /// see WrappedIndex docs for lists and arrays.

+ /// Returns null if idx is out of bounds.

+ /// EXAMPLES

+ /// 1. WrappedIndex("abc", 1) -> "b"

+ /// 2. WrappedIndex("abc", -3) -> "a"

+ /// 3. WrappedIndex("abc", 4) -> null

+ /// 4. WrappedIndex("abc", -5) -> null

+ ///
+ /// + /// + /// + /// + public static bool WrappedIndex(this string source, int idx, out string atIdx) + { + int count = source.Length; + if (idx >= count || idx < -count) + { + atIdx = null; + return false; + } + idx = idx >= 0 ? idx : idx + count; + atIdx = source.Substring(idx, 1); + return true; + } + + /// + /// Return the first element of list if idx is not a valid index for this IList.

+ /// Otherwise return list[idx] + ///
+ public static T FirstIfOutOfBounds(this IList list, int idx) + { + return list[idx >= list.Count || idx < 0 ? 0 : idx]; + } + } +} diff --git a/CSharpRegexTools4Npp/Utils/BEncoding.cs b/CSharpRegexTools4Npp/Utils/BEncoding.cs new file mode 100644 index 0000000..23b67af --- /dev/null +++ b/CSharpRegexTools4Npp/Utils/BEncoding.cs @@ -0,0 +1,71 @@ +using CSharpRegexTools4Npp.PluginInfrastructure; +using System.Text; + +namespace CSharpRegexTools4Npp +{ + /// + /// Offre des fonctions simples pour convertir l'encodage d'un texte + /// entre l'encodage du document courant dans Notepad++ et l'encodage en C# (UTF8) + /// + internal static class BEncoding + { + private static readonly Encoding utf8 = Encoding.UTF8; + + /// + /// Convertit le texte spécifier de l'encodage du document Notepad++ courant à l'encodage C# (UTF8) + /// + public static string GetUtf8TextFromScintillaText(string scText) + { + switch ((int)Win32.SendMessage(PluginBase.nppData._nppHandle, SciMsg.SCI_GETCODEPAGE, 0, 0)) + { + case 65001: // UTF8 + return utf8.GetString(Encoding.Default.GetBytes(scText)); + default: + Encoding ANSI = Encoding.GetEncoding(1252); + + byte[] ansiBytes = ANSI.GetBytes(scText); + byte[] utf8Bytes = Encoding.Convert(ANSI, Encoding.UTF8, ansiBytes); + + return Encoding.UTF8.GetString(utf8Bytes); + } + } + + /// + /// Convertit le texte spécifier de l'encodage C# (UTF8) à l'encodage document Notepad++ courant + /// + public static string GetScintillaTextFromUtf8Text(string utf8Text) + { + switch ((int)Win32.SendMessage(PluginBase.nppData._nppHandle, SciMsg.SCI_GETCODEPAGE, 0, 0)) + { + case 65001: // UTF8 + return Encoding.Default.GetString(utf8.GetBytes(utf8Text)); + default: + Encoding ANSI = Encoding.GetEncoding(1252); + + byte[] utf8Bytes = utf8.GetBytes(utf8Text); + byte[] ansiBytes = Encoding.Convert(Encoding.UTF8, ANSI, utf8Bytes); + + return ANSI.GetString(ansiBytes); + } + } + + /// + /// Convertit le texte spécifier de l'encodage C# (UTF8) à l'encodage document Notepad++ courant + /// + public static string GetScintillaTextFromUtf8Text(string utf8Text, out int length) + { + byte[] utf8Bytes = utf8.GetBytes(utf8Text); + length = utf8Bytes.Length; + + switch ((int)Win32.SendMessage(PluginBase.nppData._nppHandle, SciMsg.SCI_GETCODEPAGE, 0, 0)) + { + case 65001: // UTF8 + return Encoding.Default.GetString(utf8.GetBytes(utf8Text)); + default: + Encoding ANSI = Encoding.GetEncoding(1252); + byte[] ansiBytes = Encoding.Convert(Encoding.UTF8, ANSI, utf8Bytes); + return ANSI.GetString(ansiBytes); + } + } + } +} diff --git a/CSharpRegexTools4Npp/Utils/FormStyle.cs b/CSharpRegexTools4Npp/Utils/FormStyle.cs new file mode 100644 index 0000000..ce4ca9d --- /dev/null +++ b/CSharpRegexTools4Npp/Utils/FormStyle.cs @@ -0,0 +1,116 @@ +using System.Drawing; +using System.Windows.Forms; + +namespace CSharpRegexTools4Npp.Utils +{ + public static class FormStyle + { + public static Color SlightlyDarkControl = Color.FromArgb( + 3 * SystemColors.Control.R / 4 + SystemColors.ControlDark.R / 4, + 3 * SystemColors.Control.G / 4 + SystemColors.ControlDark.G / 4, + 3 * SystemColors.Control.B / 4 + SystemColors.ControlDark.B / 4 + ); + + + /// + /// Changes the background and text color of the form + /// and any child forms to match the editor window.

+ /// Fires when the form is first opened + /// and also whenever the style is changed.

+ /// Heavily based on CsvQuery (https://github.com/jokedst/CsvQuery) + ///
+ public static void ApplyStyle(Control ctrl, bool useNppStyle, bool darkMode = false) + { + if (ctrl == null || ctrl.IsDisposed) return; + if (!Npp.nppVersionAtLeast8) + useNppStyle = false; // trying to follow editor style looks weird for Notepad++ 7.3.3 + if (ctrl is Form form) + { + foreach (Form childForm in form.OwnedForms) + { + ApplyStyle(childForm, useNppStyle, darkMode); + } + } + Color backColor = Npp.Notepad.GetDefaultBackgroundColor(); + if (!useNppStyle || ( + backColor.R > 240 && + backColor.G > 240 && + backColor.B > 240)) + { + // if the background is basically white, + // use the system defaults because they + // look best on a white or nearly white background + ctrl.BackColor = SystemColors.Control; + ctrl.ForeColor = SystemColors.ControlText; + foreach (Control child in ctrl.Controls) + { + if (child.HasChildren && !(child is Form)) + // recursively apply style to children of container controls (GroupBoxes, SplitContainers, etc.) + ApplyStyle(child, useNppStyle, darkMode); + // controls containing text + if (child is TextBox || child is ListBox || child is ComboBox || child is TreeView) + { + child.BackColor = SystemColors.Window; // white background + child.ForeColor = SystemColors.WindowText; + } + else if (child is DataGridView dgv) + { + dgv.EnableHeadersVisualStyles = true; + dgv.BackgroundColor = SystemColors.ControlDark; + dgv.ForeColor = SystemColors.ControlText; + dgv.GridColor = SystemColors.ControlLight; + dgv.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; + dgv.RowsDefaultCellStyle.BackColor = SystemColors.Window; + } + else + { + // buttons should be a bit darker but everything else is the same color as the background + child.BackColor = (child is Button) ? SlightlyDarkControl : SystemColors.Control; + child.ForeColor = SystemColors.ControlText; + if (child is LinkLabel llbl) + { + llbl.LinkColor = Color.Blue; + llbl.ActiveLinkColor = Color.Red; + llbl.VisitedLinkColor = Color.Purple; + } + } + } + return; + } + Color foreColor = Npp.Notepad.GetDefaultForegroundColor(); + ctrl.BackColor = backColor; + Color InBetween = Color.FromArgb( + foreColor.R / 4 + 3 * backColor.R / 4, + foreColor.G / 4 + 3 * backColor.G / 4, + foreColor.B / 4 + 3 * backColor.B / 4 + ); + foreach (Control child in ctrl.Controls) + { + child.BackColor = backColor; + child.ForeColor = foreColor; + if (child.HasChildren && !(child is Form)) + // recursively apply style to children of container controls (GroupBoxes, SplitContainers, etc.) + ApplyStyle(child, useNppStyle, darkMode); + if (child is LinkLabel llbl) + { + llbl.LinkColor = foreColor; + llbl.ActiveLinkColor = foreColor; + llbl.VisitedLinkColor = foreColor; + } + else if (child is DataGridView dgv) + { + dgv.EnableHeadersVisualStyles = false; + dgv.BackgroundColor = InBetween; + dgv.ForeColor = foreColor; + dgv.GridColor = foreColor; + dgv.ColumnHeadersDefaultCellStyle.ForeColor = foreColor; + dgv.ColumnHeadersDefaultCellStyle.BackColor = backColor; + dgv.RowHeadersDefaultCellStyle.ForeColor = foreColor; + dgv.RowHeadersDefaultCellStyle.BackColor = backColor; + dgv.RowsDefaultCellStyle.ForeColor = foreColor; + dgv.RowsDefaultCellStyle.BackColor = backColor; + } + } + } + } +} diff --git a/CSharpRegexTools4Npp/Utils/KeyboardHookManager.cs b/CSharpRegexTools4Npp/Utils/KeyboardHookManager.cs new file mode 100644 index 0000000..41e3c55 --- /dev/null +++ b/CSharpRegexTools4Npp/Utils/KeyboardHookManager.cs @@ -0,0 +1,151 @@ +using System; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Forms; +using System.Windows.Interop; + +namespace CSharpRegexTools4Npp.PluginInfrastructure +{ + public class KeyboardHookManager + { + private const int WH_KEYBOARD_LL = 13; + private const int WM_KEYDOWN = 0x0100; + private const int WM_SYSKEYDOWN = 0x0104; + + private static IntPtr _hookID = IntPtr.Zero; + private static Window _targetWindow; + private static LowLevelKeyboardProc _proc; + private static bool _isHookInstalled = false; + + public static event EventHandler KeyPressed; + + public static void Initialize(Window window) + { + _targetWindow = window; + _proc = HookCallback; + + // S'abonner aux événements de focus de la fenêtre + window.Activated += Window_Activated; + window.Deactivated += Window_Deactivated; + } + + private static void Window_Activated(object sender, EventArgs e) + { + InstallHook(); + } + + private static void Window_Deactivated(object sender, EventArgs e) + { + UninstallHook(); + } + + private static void InstallHook() + { + if (!_isHookInstalled) + { + _hookID = SetHook(_proc); + _isHookInstalled = true; + } + } + + private static void UninstallHook() + { + if (_isHookInstalled) + { + UnhookWindowsHookEx(_hookID); + _isHookInstalled = false; + } + } + + private static IntPtr SetHook(LowLevelKeyboardProc proc) + { + using (var curProcess = System.Diagnostics.Process.GetCurrentProcess()) + using (var curModule = curProcess.MainModule) + { + return SetWindowsHookEx(WH_KEYBOARD_LL, proc, + GetModuleHandle(curModule.ModuleName), 0); + } + } + + private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam); + + private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) + { + if (nCode >= 0) + { + var windowHandle = GetForegroundWindow(); + var activeWindow = HwndSource.FromHwnd(windowHandle)?.RootVisual as Window; + + // Vérifier si la fenêtre active est notre fenêtre cible + if (activeWindow == _targetWindow) + { + if ((wParam == (IntPtr)WM_KEYDOWN) || (wParam == (IntPtr)WM_SYSKEYDOWN)) + { + int vkCode = Marshal.ReadInt32(lParam); + bool isCtrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0; + bool isAltPressed = (GetKeyState(VK_MENU) & 0x8000) != 0; + bool isShiftPressed = (GetKeyState(VK_SHIFT) & 0x8000) != 0; + + var args = new KeyPressedEventArgs( + (Keys)vkCode, + isCtrlPressed, + isAltPressed, + isShiftPressed + ); + + KeyPressed?.Invoke(null, args); + + // Si l'événement a été géré, on empêche sa propagation + if (args.Handled) + { + return (IntPtr)1; + } + } + } + } + return CallNextHookEx(_hookID, nCode, wParam, lParam); + } + + private const int VK_CONTROL = 0x11; + private const int VK_MENU = 0x12; // ALT + private const int VK_SHIFT = 0x10; + + [DllImport("user32.dll")] + private static extern IntPtr GetForegroundWindow(); + + [DllImport("user32.dll")] + private static extern short GetKeyState(int nVirtKey); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, + IntPtr hMod, uint dwThreadId); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern bool UnhookWindowsHookEx(IntPtr hhk); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, + IntPtr wParam, IntPtr lParam); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr GetModuleHandle(string lpModuleName); + } + + public class KeyPressedEventArgs : EventArgs + { + public Keys Key { get; private set; } + public bool Control { get; private set; } + public bool Alt { get; private set; } + public bool Shift { get; private set; } + public bool Handled { get; set; } + + public KeyPressedEventArgs(Keys key, bool control, bool alt, bool shift) + { + Key = key; + Control = control; + Alt = alt; + Shift = shift; + Handled = false; + } + } +} \ No newline at end of file diff --git a/CSharpRegexTools4Npp/Utils/NanInf.cs b/CSharpRegexTools4Npp/Utils/NanInf.cs new file mode 100644 index 0000000..23052dd --- /dev/null +++ b/CSharpRegexTools4Npp/Utils/NanInf.cs @@ -0,0 +1,21 @@ +namespace CSharpRegexTools4Npp.Utils +{ + public class NanInf + { + /// + /// a/b

+ /// may be necessary to generate infinity or nan at runtime + /// to avoid the compiler pre-computing things

+ /// since if the compiler sees literal division by 0d in the code + /// it just pre-computes it at compile time + ///
+ /// + /// + /// + public static double Divide(double a, double b) { return a / b; } + + public static readonly double inf = Divide(1d, 0d); + public static readonly double neginf = Divide(-1d, 0d); + public static readonly double nan = Divide(0d, 0d); + } +} diff --git a/CSharpRegexTools4Npp/Utils/Npp.cs b/CSharpRegexTools4Npp/Utils/Npp.cs new file mode 100644 index 0000000..7f5b108 --- /dev/null +++ b/CSharpRegexTools4Npp/Utils/Npp.cs @@ -0,0 +1,595 @@ +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using CSharpRegexTools4Npp; +using CSharpRegexTools4Npp.PluginInfrastructure; + +/// +/// miscellaneous useful things like a connector to Notepad++ +/// +namespace CSharpRegexTools4Npp.Utils +{ + /// + /// contains connectors to Scintilla (editor) and Notepad++ (notepad) + /// + public class Npp + { + /// + /// connector to Scintilla + /// + public static ScintillaGateway Editor => new ScintillaGateway(PluginBase.GetCurrentScintilla()); + + /// + /// connector to Notepad++ + /// + public static NotepadPPGateway Notepad { get; set; } = new NotepadPPGateway(); + + /// + /// this should only be instantiated once in your entire project + /// + public static Random random = new Random(); + + public static readonly int[] nppVersion = Notepad.GetNppVersion(); + + public static readonly string nppVersionStr = NppVersionString(true); + + public static readonly bool nppVersionAtLeast8 = nppVersion[0] >= 8; + + /// + /// the directory containing of the plugin DLL (i.e., the DLL that this code compiles into)

+ /// usually Path.Combine(notepad.GetNppPath(), "plugins", Main.PluginName) would work just as well,

+ /// but under some weird circumstances (see this GitHub issue comment: https://github.com/molsonkiko/NppCSharpPluginPack/issues/5#issuecomment-1982167513)

+ /// it can fail. + ///
+ public static readonly string pluginDllDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + + /// + /// append text to current doc, then append newline and move cursor + /// + /// + public static void AddLine(string inp) + { + Editor.AppendText(Encoding.UTF8.GetByteCount(inp), inp); + Editor.AppendText(Environment.NewLine.Length, Environment.NewLine); + } + + public enum PathType + { + FULL_CURRENT_PATH, + FILE_NAME, + DIRECTORY + } + + /// + /// input is one of 'p', 'd', 'f'

+ /// if 'p', get full path to current file (default)

+ /// if 'd', get directory of current file

+ /// if 'f', get filename of current file + ///
+ /// + /// + public static string GetCurrentPath(PathType which = PathType.FULL_CURRENT_PATH) + { + NppMsg msg = NppMsg.NPPM_GETFULLCURRENTPATH; + switch (which) + { + case PathType.FULL_CURRENT_PATH: break; + case PathType.DIRECTORY: msg = NppMsg.NPPM_GETCURRENTDIRECTORY; break; + case PathType.FILE_NAME: msg = NppMsg.NPPM_GETFILENAME; break; + default: throw new ArgumentException("GetCurrentPath argument must be member of PathType enum"); + } + + StringBuilder path = new StringBuilder(Win32.MAX_PATH); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)msg, 0, path); + + return path.ToString(); + } + + /// + /// Récupère les caractères de fin de lignes courant + /// !!! Attention pour le moment bug. !!! Enlève la coloration syntaxique du fichier courant + /// + public static string CurrentEOL + { + get + { + string eol = "\n"; + EndOfLine value = Editor.GetEOLMode(); + + switch (value) + { + case EndOfLine.CRLF: + eol = "\r\n"; + break; + case EndOfLine.CR: + eol = "\r"; + break; + } + + return eol; + } + } + + /// + /// Récupère ou attribue le texte complet du tab Notepad++ courant + ///
(Gère la conversion d'encodage Npp/C#) + ///
+ public static string Text + { + get + { + ScintillaGateway scintilla = Editor; + // Multiply by 2 to managed 2 bytes encoded chars + return BEncoding.GetUtf8TextFromScintillaText(scintilla.GetText(scintilla.GetTextLength() * 2)); + } + + set + { + ScintillaGateway scintilla = Editor; + string text = BEncoding.GetScintillaTextFromUtf8Text(value, out _); + scintilla.SetText(text); + } + } + + /// + /// Récupère ou attribue le début de la sélection de texte + ///
(Gère la conversion d'encodage Npp/C#) + ///
+ public static int SelectionStart + { + get + { + return Editor.GetSelectionStart(); + } + + set + { + Editor.SetSelectionStart((new TextPosition(value)).Value); + } + } + + /// + /// Récupère ou attribue la fin de la sélection de texte + ///
si aucun texte n'est sélectionné SelectionEnd = SelectionStart + ///
(Gère la conversion d'encodage Npp/C#) + ///
+ public static int SelectionEnd + { + get + { + int curPos = (int)Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_GETSELECTIONEND, 0, 0); + ScintillaGateway scintilla = Editor; + string beginingText = scintilla.GetText(curPos); + BEncoding.GetScintillaTextFromUtf8Text(beginingText, out int length); + return length; + } + + set + { + string allText = Text; + Int64 endToUse = value; + + if (value < 0) + { + endToUse = 0; + } + else if (value > allText.Length) + { + endToUse = allText.Length; + } + + string afterText = allText.Substring(0, (int)endToUse); + BEncoding.GetScintillaTextFromUtf8Text(afterText, out int defaultEnd); + + Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_SETSELECTIONEND, defaultEnd, 0); + } + } + + /// + /// Récupère ou attribue la longueur de la sélection de texte + ///
Si aucun texte n'est sélectionné SelectionEnd = 0 + ///
(Gère la conversion d'encodage Npp/C#) + ///
+ public static int SelectionLength + { + get + { + return SelectionEnd - SelectionStart; + } + + set + { + SelectionEnd = SelectionStart + (value < 0 ? 0 : value); + } + } + + /// + /// Récupère ou remplace le texte actuellement sélectionné + ///
(Gère la conversion d'encodage Npp/C#) + ///
+ public static string SelectedText + { + get + { + ScintillaGateway scintilla = Editor; + return BEncoding.GetUtf8TextFromScintillaText(scintilla.GetSelText()); + } + + set + { + ScintillaGateway scintilla = Editor; + string defaultNewText = BEncoding.GetScintillaTextFromUtf8Text(value); + scintilla.ReplaceSel(defaultNewText); + } + } + + /// + /// Sélectionne dans le tab Notepad++ courant le texte entre start et end + /// et positionne le scroll pour voir la sélection. + ///
(Gère la conversion d'encodage Npp/C#) + ///
+ /// Position du début du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length + /// Position de fin du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length
Si plus petit que start -> forcé à start + public static void SelectTextAndShow(int start, int end) + { + string allText = Text; + int startToUse = start; + int endToUse = end; + + if (start < 0) + { + startToUse = 0; + } + else if (start > allText.Length) + { + startToUse = allText.Length; + } + + if (end < 0) + { + endToUse = 0; + } + else if (end > allText.Length) + { + endToUse = allText.Length; + } + else if (endToUse < startToUse) + { + endToUse = startToUse; + } + + string beforeText = allText.Substring(0, startToUse); + BEncoding.GetScintillaTextFromUtf8Text(beforeText, out int defaultStart); + string endText = allText.Substring(0, endToUse); + BEncoding.GetScintillaTextFromUtf8Text(endText, out int defaultEnd); + + Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_GOTOPOS, defaultStart, 0); + Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_SETSELECTIONEND, defaultEnd, 0); + } + + /// + /// Si la sélection multiple est activée ajoute la sélection spécifié + ///
(Gère la conversion d'encodage Npp/C#) + ///
+ /// Position du début du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length + /// Position de fin du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length
Si plus petit que start -> forcé à start + public static void AddSelection(int start, int end) + { + string allText = Text; + int startToUse = start; + int endToUse = end; + + if (start < 0) + { + startToUse = 0; + } + else if (start > allText.Length) + { + startToUse = allText.Length; + } + + if (end < 0) + { + endToUse = 0; + } + else if (end > allText.Length) + { + endToUse = allText.Length; + } + else if (endToUse < startToUse) + { + endToUse = startToUse; + } + + string beforeText = allText.Substring(0, startToUse); + BEncoding.GetScintillaTextFromUtf8Text(beforeText, out int defaultStart); + string endText = allText.Substring(0, endToUse); + BEncoding.GetScintillaTextFromUtf8Text(endText, out int defaultEnd); + + Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_ADDSELECTION, defaultStart, defaultEnd); + } + + /// + /// Récupère le texte de la ligne spécifiée + /// + /// Numéro de la ligne dont on veut récupérer le texte + /// Le texte de la ligne spécifiée + public static string GetLineText(int lineNb) + { + string result = ""; + + try + { + result = Text.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)[lineNb - 1]; + } + catch { } + + return result; + } + + /// + /// Get the file type for a file path (no period)

+ /// Default path is the currently open file. + ///
+ /// + /// + public static string FileExtension(string path = null) + { + if (path == null) + path = GetCurrentPath(Npp.PathType.FILE_NAME); + StringBuilder sb = new StringBuilder(); + for (int ii = path.Length - 1; ii >= 0; ii--) + { + char c = path[ii]; + if (c == '.') break; + sb.Append(c); + } + // the chars were added in the wrong direction, so reverse them + return sb.ToString().Slice("::-1"); + } + + /// + /// Trying to copy an empty string or null to the clipboard raises an error.

+ /// This shows a message box if the user tries to do that. + ///
+ /// + public static void TryCopyToClipboard(string text) + { + if (text == null || text.Length == 0) + { + MessageBox.Show("Couldn't find anything to copy to the clipboard", + "Nothing to copy to clipboard", + MessageBoxButtons.OK, + MessageBoxIcon.Warning + ); + return; + } + Clipboard.SetText(text); + } + + private static bool stopShowingFileTooLongNotifications = false; + + private static void WarnFileTooBig(bool showMessage) + { + if (showMessage && !stopShowingFileTooLongNotifications) + stopShowingFileTooLongNotifications = MessageBox.Show( + $"{Main.PluginName} cannot perform this plugin command on a file with more than 2147483647 bytes.\r\nDo you want to stop showing notifications when a file is too long?", + $"File too long for {Main.PluginName}", + MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes; + } + + /// + /// if returns a number greater than , return false and set len to -1.

+ /// Otherwise, return true and set len to the length of the document.

+ /// If showMessageOnFail, show a message box warning the user that the command could not be executed. + ///
+ public static bool TryGetLengthAsInt(out int len, bool showMessageOnFail = true) + { + if (!Editor.TryGetLengthAsInt(out len)) + { + WarnFileTooBig(showMessageOnFail); + return false; + } + return true; + } + + /// + /// if returns a number greater than , return false and set text to an empty string.

+ /// Otherwise, return true and set text with .

+ /// If showMessageOnFail, show a message box warning the user that the command could not be executed. + ///
+ public static bool TryGetText(out string text, bool showMessageOnFail = true, int length = -1) + { + if (length < 0 && !Editor.TryGetLengthAsInt(out length)) + { + text = ""; + WarnFileTooBig(showMessageOnFail); + return false; + } + text = Editor.GetText(length); + return true; + } + + public static string AssemblyVersionString() + { + string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + while (version.EndsWith(".0")) + version = version.Substring(0, version.Length - 2); +#if DEBUG + return $"{version} Debug"; +#else + return version; +#endif // DEBUG + } + + public static void CreateConfigSubDirectoryIfNotExists() + { + var ConfigDirInfo = new DirectoryInfo(Main.PluginConfigDirectory); + if (!ConfigDirInfo.Exists) + ConfigDirInfo.Create(); + } + + /// + /// get all text starting at position start in the current document + /// and ending at position end in the current document + /// + /// + /// + /// + public static string GetSlice(int start, int end) + { + int len = end - start; + IntPtr rangePtr = Editor.GetRangePointer(start, len); + string ansi = Marshal.PtrToStringAnsi(rangePtr, len); + // TODO: figure out a way to do this that involves less memcopy for non-ASCII + if (ansi.Any(c => c >= 128)) + return Encoding.UTF8.GetString(Encoding.Default.GetBytes(ansi)); + return ansi; + } + + private static readonly string[] newlines = new string[] { "\r\n", "\r", "\n" }; + + /// 0: CRLF, 1: CR, 2: LF

+ /// Anything less than 0 or greater than 2: LF
+ public static string GetEndOfLineString(int eolType) + { + if (eolType < 0 || eolType >= 3) + return "\n"; + return newlines[eolType]; + } + + private static string NppVersionString(bool include32bitVs64bit) + { + int[] nppVer = Notepad.GetNppVersion(); + string nppVerStr = $"{nppVer[0]}.{nppVer[1]}.{nppVer[2]}"; + return include32bitVs64bit ? $"{nppVerStr} {IntPtr.Size * 8}bit" : nppVerStr; + } + + /// + /// appends the JSON representation of char c to a StringBuilder.

+ /// for most characters, this just means appending the character itself, but for example '\n' would become "\\n", '\t' would become "\\t",

+ /// and most other chars less than 32 would be appended as "\\u00{char value in hex}" (e.g., '\x14' becomes "\\u0014") + ///
+ public static void CharToSb(StringBuilder sb, char c) + { + switch (c) + { + case '\\': sb.Append("\\\\"); break; + case '"': sb.Append("\\\""); break; + case '\x01': sb.Append("\\u0001"); break; + case '\x02': sb.Append("\\u0002"); break; + case '\x03': sb.Append("\\u0003"); break; + case '\x04': sb.Append("\\u0004"); break; + case '\x05': sb.Append("\\u0005"); break; + case '\x06': sb.Append("\\u0006"); break; + case '\x07': sb.Append("\\u0007"); break; + case '\x08': sb.Append("\\b"); break; + case '\x09': sb.Append("\\t"); break; + case '\x0A': sb.Append("\\n"); break; + case '\x0B': sb.Append("\\v"); break; + case '\x0C': sb.Append("\\f"); break; + case '\x0D': sb.Append("\\r"); break; + case '\x0E': sb.Append("\\u000E"); break; + case '\x0F': sb.Append("\\u000F"); break; + case '\x10': sb.Append("\\u0010"); break; + case '\x11': sb.Append("\\u0011"); break; + case '\x12': sb.Append("\\u0012"); break; + case '\x13': sb.Append("\\u0013"); break; + case '\x14': sb.Append("\\u0014"); break; + case '\x15': sb.Append("\\u0015"); break; + case '\x16': sb.Append("\\u0016"); break; + case '\x17': sb.Append("\\u0017"); break; + case '\x18': sb.Append("\\u0018"); break; + case '\x19': sb.Append("\\u0019"); break; + case '\x1A': sb.Append("\\u001A"); break; + case '\x1B': sb.Append("\\u001B"); break; + case '\x1C': sb.Append("\\u001C"); break; + case '\x1D': sb.Append("\\u001D"); break; + case '\x1E': sb.Append("\\u001E"); break; + case '\x1F': sb.Append("\\u001F"); break; + default: sb.Append(c); break; + } + } + + /// + /// the string representation of a JSON string + /// if not quoted, this will not have the enclosing quotes a JSON string normally has + /// + public static string StrToString(string s, bool quoted) + { + int slen = s.Length; + int ii = 0; + for (; ii < slen; ii++) + { + char c = s[ii]; + if (c < 32 || c == '\\' || c == '"') + break; + } + if (ii == slen) + return quoted ? $"\"{s}\"" : s; + var sb = new StringBuilder(); + if (quoted) + sb.Append('"'); + if (ii > 0) + { + ii--; + sb.Append(s, 0, ii); + } + for (; ii < slen; ii++) + CharToSb(sb, s[ii]); + if (quoted) + sb.Append('"'); + return sb.ToString(); + } + + /// + /// Based on the value of askUser, do one of three things:

+ /// DONT_DO_DONT_ASK: return false (don't do the thing)

+ /// ASK_BEFORE_DOING:

+ /// 1. show a Yes/No message box with text messageBoxText and caption messageBoxCaption.

+ /// 2. if and only if the user clicks Yes, return true.

+ /// DO_WITHOUT_ASKING: return true (do the thing without asking) + ///
+ /// whether to ask user + /// text of message box (if and only if askUser = ASK_BEFORE_DOING + /// caption of message box (if and only if askUser = ASK_BEFORE_DOING + /// + public static bool AskBeforeDoingSomething(AskUserWhetherToDoThing askUser, string messageBoxText, string messageBoxCaption) + { + switch (askUser) + { + case AskUserWhetherToDoThing.DONT_DO_DONT_ASK: + return false; + case AskUserWhetherToDoThing.ASK_BEFORE_DOING: + return MessageBox.Show(messageBoxText, + messageBoxCaption, + MessageBoxButtons.YesNo, MessageBoxIcon.Question + ) != DialogResult.No; + case AskUserWhetherToDoThing.DO_WITHOUT_ASKING: + default: + break; + } + return true; + } + } + + public enum AskUserWhetherToDoThing + { + /// + /// don't do the thing, and don't prompt the user either + /// + DONT_DO_DONT_ASK, + /// + /// prompt the user to ask whether to do it + /// + ASK_BEFORE_DOING, + /// + /// do it without prompting the user + /// + DO_WITHOUT_ASKING, + } +} diff --git a/CSharpRegexTools4Npp/Utils/NppListener.cs b/CSharpRegexTools4Npp/Utils/NppListener.cs new file mode 100644 index 0000000..6648329 --- /dev/null +++ b/CSharpRegexTools4Npp/Utils/NppListener.cs @@ -0,0 +1,22 @@ +using System.Windows.Forms; + +namespace CSharpRegexTools4Npp.Utils +{ + /// + /// This class listens to messages that are not broadcast by the plugins manager (e.g., Notepad++ internal messages).

+ /// The original idea comes from Peter Frentrup's NppMenuSearch plugin (https://github.com/search?q=repo%3Apeter-frentrup%2FNppMenuSearch%20NppListener&type=code) + ///
+ public class NppListener : NativeWindow + { + /// + /// the NPPM_INTERNAL_RELOADNATIVELANG message is fired twice every time we change the native language preference. + /// I don't know why, but we should ignore every other one of those messages. + /// + //private static bool reloadNativeLangToggle = false; + + protected override void WndProc(ref Message m) + { + base.WndProc(ref m); + } + } +} diff --git a/CSharpRegexTools4Npp/app.config b/CSharpRegexTools4Npp/app.config deleted file mode 100644 index db7075c..0000000 --- a/CSharpRegexTools4Npp/app.config +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CSharpRegexTools4Npp/packages.config b/CSharpRegexTools4Npp/packages.config deleted file mode 100644 index d2b312f..0000000 --- a/CSharpRegexTools4Npp/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 99c8346..e0c4f46 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # CSharpRegexTools4Npp -Some tools for using C# Regex in Notepad++ (As Notepad++ Plugin) +Some tools to use C# Regex in Notepad++ (As Notepad++ Plugin) ## Features * Syntax Highlight of the C# Regex @@ -16,7 +16,7 @@ Some tools for using C# Regex in Notepad++ (As Notepad++ Plugin) Need a [Notepad++](https://notepad-plus-plus.org/) x86 or x64 installed on the machine and the right to write in the plugin directory. (At least version 7.6.3, older versions can work but need modification of the file [NppPlugin.DllExport.targets](https://github.com/codingseb/CSharpRegexTools4Npp/blob/master/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.targets) see [Notepad++ plugins new directories structures](https://notepad-plus-plus.org/community/topic/16996/new-plugins-home-round-2)) -Need .Net Framework 4.6 or greater +Need .Net Framework 4.7 or greater ## Installation @@ -61,15 +61,17 @@ To Launch the tools use one of these 3 methods : ![Text-sources](https://raw.githubusercontent.com/codingseb/CSharpRegexTools4Npp/master/doc/Text-Sources.png) ## Credits -Based on : [NotepadPlusPlusPluginPack](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net) (under the [Apache-2.0 license](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/blob/master/LICENSE.md)) Merged manually with a part of the version used in [CS-Script.Npp](https://github.com/oleg-shilo/cs-script.npp) (under MIT license) for better x64 support and remodified for the way I use it. +Based on : [NotepadPlusPlusPluginPack](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net) and from version 1.3.0.0 on [NppCSharpPluginPack](https://github.com/molsonkiko/NppCSharpPluginPack) ([Apache-2.0 license](https://github.com/molsonkiko/NppCSharpPluginPack?tab=Apache-2.0-1-ov-file#readme)) Merged manually with a part of the version used in [CS-Script.Npp](https://github.com/oleg-shilo/cs-script.npp) (under MIT license) for better x64 support and remodified for the way I use it. use : -[AvalonEdit](https://github.com/icsharpcode/AvalonEdit) For Regex edition and syntax Highlighting (under MIT license) -[CS-Script](https://github.com/oleg-shilo/cs-script/) For C# Match replace (under MIT license) -[Newtonsoft.Json](https://www.newtonsoft.com/json) (under MIT license) -[Ookii.Dialogs](http://www.ookii.org/software/dialogs/) (For Open and Save dialogs [under specific license](https://github.com/codingseb/CSharpRegexTools4Npp/blob/master/Licenses/Ooki%20license.txt)) -[PropertyChanged.Fody](https://github.com/Fody/PropertyChanged) (under MIT license) -[Costura.fody](https://github.com/Fody/Costura) Merge all in one DLL, without it it doesn't work (under MIT license) +[AvalonEdit](https://github.com/icsharpcode/AvalonEdit) For Regex edition and syntax Highlighting (MIT license) +[CS-Script](https://github.com/oleg-shilo/cs-script/) For C# Match replace (MIT license) +[Newtonsoft.Json](https://www.newtonsoft.com/json) (MIT license) +[Ookii.Dialogs](http://www.ookii.org/software/dialogs/) (For Open and Save dialogs [specific license](https://github.com/codingseb/CSharpRegexTools4Npp/blob/master/Licenses/Ooki%20license.txt)) +[PropertyChanged.Fody](https://github.com/Fody/PropertyChanged) (MIT license) +[Costura.fody](https://github.com/Fody/Costura) Merge all in one DLL, without it it doesn't work (MIT license) And for icons : -[FatCow](https://www.fatcow.com/free-icons) (under [Creative Commons 3.0](https://creativecommons.org/licenses/by/3.0/us/)) +GUI : [FatCow](https://www.fatcow.com/free-icons) ([Creative Commons 3.0](https://creativecommons.org/licenses/by/3.0/us/)) +C# Autocomplete : [vscode-icons](https://github.com/microsoft/vscode-icons) : ([Creative Commons Attribution 4.0 International](https://github.com/microsoft/vscode-icons/blob/main/LICENSE) + diff --git a/RegexDialog/BracketColorizer.cs b/RegexDialog/BracketColorizer.cs index 302abcb..450d88e 100644 --- a/RegexDialog/BracketColorizer.cs +++ b/RegexDialog/BracketColorizer.cs @@ -27,6 +27,5 @@ protected override void ColorizeLine(DocumentLine line) } } } - } } diff --git a/RegexDialog/FodyWeavers.xml b/RegexDialog/FodyWeavers.xml index 4e68ed1..79b41a9 100644 --- a/RegexDialog/FodyWeavers.xml +++ b/RegexDialog/FodyWeavers.xml @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/RegexDialog/FodyWeavers.xsd b/RegexDialog/FodyWeavers.xsd index 2f1b8aa..408a212 100644 --- a/RegexDialog/FodyWeavers.xsd +++ b/RegexDialog/FodyWeavers.xsd @@ -11,6 +11,16 @@ Used to control if the On_PropertyName_Changed feature is enabled. + + + Used to control if the Dependent properties feature is enabled. + + + + + Used to control if the IsChanged property feature is enabled. + + Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form. @@ -31,6 +41,167 @@ Used to control if equality checks should use the static Equals method resolved from the base class. + + + Used to turn off build warnings from this weaver. + + + + + Used to turn off build warnings about mismatched On_PropertyName_Changed methods. + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + Obsolete, use UnmanagedWinX86Assemblies instead + + + + + A list of unmanaged X86 (32 bit) assembly names to include, delimited with line breaks. + + + + + Obsolete, use UnmanagedWinX64Assemblies instead. + + + + + A list of unmanaged X64 (64 bit) assembly names to include, delimited with line breaks. + + + + + A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + The attach method no longer subscribes to the `AppDomain.AssemblyResolve` (.NET 4.x) and `AssemblyLoadContext.Resolving` (.NET 6.0+) events. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + Obsolete, use UnmanagedWinX86Assemblies instead + + + + + A list of unmanaged X86 (32 bit) assembly names to include, delimited with |. + + + + + Obsolete, use UnmanagedWinX64Assemblies instead + + + + + A list of unmanaged X64 (64 bit) assembly names to include, delimited with |. + + + + + A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + diff --git a/RegexDialog/GlobalSuppressions.cs b/RegexDialog/GlobalSuppressions.cs new file mode 100644 index 0000000..936a7f6 --- /dev/null +++ b/RegexDialog/GlobalSuppressions.cs @@ -0,0 +1,8 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "", Scope = "namespaceanddescendants", Target = "~N:RegexDialog")] diff --git a/RegexDialog/LaunchExcelVbsScript.vbs b/RegexDialog/LaunchExcelVbsScript.vbs new file mode 100644 index 0000000..8cd89de --- /dev/null +++ b/RegexDialog/LaunchExcelVbsScript.vbs @@ -0,0 +1,57 @@ +' Check arguments +If WScript.Arguments.Count < 3 Then + WScript.Echo "Usage: cscript open_excel.vbs ""file_path"" ""sheet_name"" ""cell""" + WScript.Echo "Example: cscript open_excel.vbs ""C:\MyFile.xlsx"" ""My Sheet"" ""B5""" + WScript.Quit +End If + +' Get parameters +filePath = WScript.Arguments(0) +sheetName = WScript.Arguments(1) +cell = WScript.Arguments(2) + +' Check if file exists +Set fso = CreateObject("Scripting.FileSystemObject") +If Not fso.FileExists(filePath) Then + WScript.Echo "Error: File '" & filePath & "' does not exist" + WScript.Quit +End If + +On Error Resume Next + +' Try to connect to already opened file +Set xl = GetObject(,"Excel.Application") + +If Err.Number <> 0 Then + Set xl = CreateObject("Excel.Application") + xl.Visible = True + Set wb = xl.Workbooks.Open(filePath) +Else + fileFound = False + For Each wb In xl.Workbooks + If UCase(wb.FullName) = UCase(filePath) Then + fileFound = True + Set wb = wb + Exit For + End If + Next + + ' Si le fichier n'est pas ouvert, l'ouvrir + If Not fileFound Then + Set wb = xl.Workbooks.Open(filePath) + End If +End If + +' Activate sheet and cell +xl.Visible = True + +' Force Excel to the foreground +Set sh = CreateObject("WScript.Shell") +sh.AppActivate xl.Caption + +On Error Resume Next +Set ws = xl.Sheets(sheetName) +ws.Activate +Set rng = ws.Range(cell) +rng.Activate +rng.Select diff --git a/RegexDialog/Model/ExcelCellFilterExample.cs b/RegexDialog/Model/ExcelCellFilterExample.cs new file mode 100644 index 0000000..d72b8b5 --- /dev/null +++ b/RegexDialog/Model/ExcelCellFilterExample.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace RegexDialog +{ + public class ExcelCellFilterExample + { + public string Name { get; set; } + public string Value { get; set; } + + public ExcelCellFilterExample(string name, string value) + { + Name=name; + Value=value; + } + + public static List ExamplesList { get; set; } = + [ + new("Only one cell", "C9"), + new("Multiple cells","A2;C3;D1;D4;BD10"), + new("Only the row 5", "5"), + new("Some contiguous rows", "3:6"), + new("Some discontiguous rows", "3;6;10:12"), + new("Only column D", "D"), + new("Some contiguous columns", "C:F"), + new("Some discontiguous columns", "B;D;F:H"), + new("Only the first used row", "{FR}"), + new("Only the last used row", "{LR}"), + new("Only the first used column", "{FC}"), + new("Only the last used column", "{LC}"), + new("Only the 5th row of used cells", "{FR + 4}"), + new("All rows without header row", "{FR + 1}:{LR}"), + new("Half of rows", "{FR}:{(LR-FR)/ 2 + FR}"), + new("All used cells without FR,LF,FC and LC", "{(FCN + 1).ToLetter()}{FR + 1}:{(LCN - 1).ToLetter()}{LR - 1}"), + ]; + } +} \ No newline at end of file diff --git a/RegexDialog/Model/ExcelCellTextSource.cs b/RegexDialog/Model/ExcelCellTextSource.cs new file mode 100644 index 0000000..fc3a805 --- /dev/null +++ b/RegexDialog/Model/ExcelCellTextSource.cs @@ -0,0 +1,16 @@ +using ClosedXML.Excel; +using Newtonsoft.Json; +using System; + +namespace RegexDialog +{ + public class ExcelCellTextSource : NotifyPropertyChangedBaseClass + { + public bool IsSelected { get; set; } + + public string Name { get; set; } + + [JsonIgnore] + public Func GetValue { get; set; } + } +} \ No newline at end of file diff --git a/RegexDialog/Model/ExcelSheetSelection.cs b/RegexDialog/Model/ExcelSheetSelection.cs new file mode 100644 index 0000000..aa855a1 --- /dev/null +++ b/RegexDialog/Model/ExcelSheetSelection.cs @@ -0,0 +1,130 @@ +using ClosedXML.Excel; +using DocumentFormat.OpenXml.Bibliography; +using Newtonsoft.Json; +using RegexDialog.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Windows; +using System.Windows.Input; + +namespace RegexDialog +{ + public class ExcelSheetSelection : NotifyPropertyChangedBaseClass + { + private readonly static Regex simpleCellRegex = new("^[A-Z]+[1-9][0-9]*$", RegexOptions.Compiled); + private readonly static Regex simpleColumnRegex = new("^[A-Z]+$", RegexOptions.Compiled); + private readonly static Regex simpleRowRegex = new("^[1-9][0-9]*$", RegexOptions.Compiled); + private readonly static Regex rangeRegex = new("^[A-Z]+([1-9][0-9]*)?:[A-Z]+([1-9][0-9]*)?|[1-9][0-9]*:[1-9][0-9]*$", RegexOptions.Compiled); + private readonly static Regex evaluatedExpressionRegex = new(@"\{(?[^\}]*)\}", RegexOptions.Compiled); + + public bool IsSelected { get; set; } = true; + public string Name { get; set; } = string.Empty; + public string Filter { get; set; } = string.Empty; + + [JsonIgnore] + public ICommand EvaluateCommand => new RelayCommand(_ => + { + using(XLWorkbook workbook = new(Config.Instance.TextSourceExcelPath.MakeCopyIfLocked())) + { + try + { + MessageBox.Show(InterpretStuffInFilter(Filter, workbook.Worksheet(Name))); + } + catch(Exception exception) + { + MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); + } + } + }); + + public IEnumerable GetCells(IXLWorksheet sheet) + { + if (string.IsNullOrWhiteSpace(Filter)) + { + foreach (var item in sheet.CellsUsed()) + { + yield return item; + } + } + + foreach (string filter in InterpretStuffInFilter(Filter, sheet).Split(';').Select(filter => filter.Trim().ToUpper())) + { + if (simpleCellRegex.IsMatch(filter)) + yield return sheet.Cell(filter); + if (simpleColumnRegex.IsMatch(filter)) + { + foreach (var cell in sheet.Column(filter).CellsUsed()) + { + yield return cell; + } + } + else if (simpleRowRegex.IsMatch(filter)) + { + foreach (var cell in sheet.Row(int.Parse(filter)).CellsUsed()) + { + yield return cell; + } + } + else if (rangeRegex.IsMatch(filter)) + { + foreach (var cell in sheet.Range(filter).CellsUsed()) + { + yield return cell; + } + } + } + } + + private string InterpretStuffInFilter(string filter, IXLWorksheet sheet) + { + ExpressionEvaluator evaluator = new(new Dictionary() + { + { "FR", sheet.FirstRowUsed().RangeAddress.FirstAddress.RowNumber }, + { "LR", sheet.LastRowUsed().RangeAddress.FirstAddress.RowNumber }, + { "FC", sheet.FirstColumnUsed().RangeAddress.FirstAddress.ColumnLetter }, + { "LC", sheet.LastColumnUsed().RangeAddress.FirstAddress.ColumnLetter }, + { "FCN", sheet.FirstColumnUsed().RangeAddress.FirstAddress.ColumnNumber }, + { "LCN", sheet.LastColumnUsed().RangeAddress.FirstAddress.ColumnNumber }, + { "sheet", sheet }, + }); + + evaluator.EvaluateFunction += Evaluator_EvaluateFunction; + + string result = evaluatedExpressionRegex.Replace(filter, match => evaluator.Evaluate(match.Groups["expression"].Value).ToString()); + + evaluator.EvaluateFunction -= Evaluator_EvaluateFunction; + + return result; + } + + private void Evaluator_EvaluateFunction(object sender, FunctionEvaluationEventArg e) + { + IXLWorksheet sheet = e.Evaluator.Variables["sheet"] as IXLWorksheet; + + if(e.Name.Equals("ToNumber")) + { + if(e.This != null) + { + e.Value = sheet.Column((string)e.This).ColumnNumber(); + } + else + { + e.Value = sheet.Column(e.EvaluateArg(0)).ColumnNumber(); + } + } + if(e.Name.Equals("ToLetter")) + { + if(e.This != null) + { + e.Value = sheet.Column((int)e.This).ColumnLetter(); + } + else + { + e.Value = sheet.Column(e.EvaluateArg(0)).ColumnLetter(); + } + } + } + } +} \ No newline at end of file diff --git a/RegexDialog/Model/IntellisenseModels.cs b/RegexDialog/Model/IntellisenseModels.cs new file mode 100644 index 0000000..f9f580e --- /dev/null +++ b/RegexDialog/Model/IntellisenseModels.cs @@ -0,0 +1,100 @@ +using ICSharpCode.AvalonEdit.CodeCompletion; +using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.AvalonEdit.Editing; +using System; +using System.Diagnostics; +using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace RegexDialog.Model +{ + public class CompletionData : ICompletionData + { + public string Text { get; set; } + public string Description { get; set; } + public CompletionItemKind Kind { get; set; } + + public object Content => Text; + public double Priority => 0; + + object ICompletionData.Description => Description; + + private ImageSource _image; + public ImageSource Image + { + get + { + if (_image == null) + { + _image = GetImageForKind(Kind); + } + return _image; + } + } + + public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs) + { + textArea.Document.Replace(completionSegment, Text); + } + + private ImageSource GetImageForKind(CompletionItemKind kind) + { + try + { + // Construire le chemin de l'image en fonction du type + string imageName = kind.ToString(); + string resourcePath = $"/RegexDialog;component/img/{imageName}.png"; + + // Charger l'image depuis les ressources + var uri = new Uri(resourcePath, UriKind.Relative); + var resourceStream = Application.GetResourceStream(uri); + + if (resourceStream != null) + { + // Créer une BitmapImage à partir du flux + var bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.StreamSource = resourceStream.Stream; + bitmap.CacheOption = BitmapCacheOption.OnLoad; // Charger en mémoire et fermer le flux + bitmap.EndInit(); + bitmap.Freeze(); // Pour une utilisation thread-safe + + return bitmap; + } + + // Si l'image spécifique n'est pas trouvée, essayer de charger une image par défaut + if (kind != CompletionItemKind.Other) + { + return GetImageForKind(CompletionItemKind.Other); + } + + return null; + } + catch (Exception ex) + { + Debug.WriteLine($"Error loading image for {kind}: {ex.Message}"); + return null; + } + } + } + + public enum CompletionItemKind + { + Class, + Method, + Extension, + Property, + Field, + Event, + Interface, + Enum, + EnumMember, + Keyword, + Namespace, + Variable, + Constant, + Struct, + Other + } +} \ No newline at end of file diff --git a/RegexDialog/Model/RegExOptionModel.cs b/RegexDialog/Model/RegExOptionModel.cs index 0504b64..c82311c 100644 --- a/RegexDialog/Model/RegExOptionModel.cs +++ b/RegexDialog/Model/RegExOptionModel.cs @@ -1,10 +1,14 @@ -using System; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; using System.Text.RegularExpressions; namespace RegexDialog { internal class RegExOptionViewModel : NotifyPropertyChangedBaseClass { + private static readonly Dictionary optionNameToDescriptionDictionary = JsonConvert.DeserializeObject>(Res.RegexOptionsDescriptions); + /// /// Sélectionné /// @@ -18,34 +22,19 @@ public bool Selected { Config.Instance.RegexOptionsSelection[Name] = value; Config.Instance.Save(); - NotifyPropertyChanged(); } } - private RegexOptions regexOptions; - /// /// L'option d'expression régulière représentée /// - public RegexOptions RegexOptions - { - get { return regexOptions; } - set - { - regexOptions = value; - NotifyPropertyChanged(); - } - } + public RegexOptions RegexOptions { get; set; } /// /// Nom à affiché /// - public string Name - { - get - { - return Enum.GetName(typeof(RegexOptions), regexOptions); - } - } + public string Name => Enum.GetName(typeof(RegexOptions), RegexOptions); + + public string Description => optionNameToDescriptionDictionary[Name]; } } diff --git a/RegexDialog/Model/RegexExcelSheetResult.cs b/RegexDialog/Model/RegexExcelSheetResult.cs new file mode 100644 index 0000000..c255388 --- /dev/null +++ b/RegexDialog/Model/RegexExcelSheetResult.cs @@ -0,0 +1,24 @@ +using System.Text.RegularExpressions; + +namespace RegexDialog +{ + internal class RegexExcelSheetResult :RegexResult + { + public RegexExcelSheetResult(Regex regex, Capture regexElement, int regexElementNb, string fileName, string sheetName) : base(regex, regexElement, regexElementNb, fileName, 0) + { + SheetName = sheetName; + } + public override string Name => $"Sheet [{SheetName}]: {Children.Count} matches found"; + + public string SheetName { get; set; } + + public override bool IsExpanded { get => true; } + + public override void RefreshExpands() + { + Children.ForEach(child => child.RefreshExpands()); + } + + public override string ElementType => "Excel"; + } +} \ No newline at end of file diff --git a/RegexDialog/Model/RegexGroupResult.cs b/RegexDialog/Model/RegexGroupResult.cs index 07a6964..e73e99b 100644 --- a/RegexDialog/Model/RegexGroupResult.cs +++ b/RegexDialog/Model/RegexGroupResult.cs @@ -47,7 +47,7 @@ public override string Name return result; } } - + public string GroupName { get diff --git a/RegexDialog/Model/RegexLanguageElement.cs b/RegexDialog/Model/RegexLanguageElement.cs index d486487..8b39cf5 100644 --- a/RegexDialog/Model/RegexLanguageElement.cs +++ b/RegexDialog/Model/RegexLanguageElement.cs @@ -1,5 +1,8 @@ -namespace RegexDialog +using System.Diagnostics; + +namespace RegexDialog { + [DebuggerDisplay("[{GetType().Name}] - {Name} - {Value} - {Description}")] internal class RegexLanguageElement : NotifyPropertyChangedBaseClass { public string Name { get; set; } diff --git a/RegexDialog/Model/RegexLanguageElementGroup.cs b/RegexDialog/Model/RegexLanguageElementGroup.cs index c1ef779..d74460e 100644 --- a/RegexDialog/Model/RegexLanguageElementGroup.cs +++ b/RegexDialog/Model/RegexLanguageElementGroup.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; +using System.Diagnostics; namespace RegexDialog { + [DebuggerDisplay("[{GetType().Name}] - {Name} - {Description}")] internal class RegexLanguageElementGroup : NotifyPropertyChangedBaseClass { public string Name { get; set; } diff --git a/RegexDialog/Model/RegexResult.cs b/RegexDialog/Model/RegexResult.cs index cbcaf71..ca945ed 100644 --- a/RegexDialog/Model/RegexResult.cs +++ b/RegexDialog/Model/RegexResult.cs @@ -19,9 +19,9 @@ public RegexResult(Regex regex, Capture regexElement, int regexElementNb, string public virtual void RefreshExpands() { } - public virtual bool IsExpanded { get; set; } = false; + public virtual bool IsExpanded { get; set; } - public bool IsSelected { get; set; } = false; + public bool IsSelected { get; set; } public virtual string ElementType { @@ -33,15 +33,17 @@ public virtual string ElementType public string FileName { get; set; } = string.Empty; - public Capture RegexElement { get; } = null; + public string InfoSup { get; set; } = string.Empty; - public int RegexElementNb { get; } = 0; + public Capture RegexElement { get; } - public RegexResult Parent { get; set; } = null; + public int RegexElementNb { get; } - public List Children { get; set; } = new List(); + public RegexResult Parent { get; set; } - public Regex Regex { get; private set; } + public List Children { get; set; } = []; + + public Regex Regex { get; } public virtual string Name { @@ -53,7 +55,7 @@ public virtual string Name { if (RegexElement != null) { - result = ElementType + " " + RegexElementNb.ToString() + " [" + RegexElement.Index.ToString() + "," + RegexElement.Length.ToString() + "]: "; + result = $"{ElementType} {RegexElementNb.ToString()} [{RegexElement.Index.ToString()},{RegexElement.Length.ToString()}]{(string.IsNullOrEmpty(InfoSup) ? "" : $" - {InfoSup} ")}: "; } } catch @@ -91,7 +93,7 @@ public virtual string OneLineValue } } - public virtual int SelectionIndex { get; set; } = 0; + public virtual int SelectionIndex { get; set; } public virtual int Index { diff --git a/RegexDialog/Properties/AssemblyInfo.cs b/RegexDialog/Properties/AssemblyInfo.cs deleted file mode 100644 index a3ee8c5..0000000 --- a/RegexDialog/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Les informations générales relatives à un assembly dépendent de -// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations -// associées à un assembly. -[assembly: AssemblyTitle("RegexDialog")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("CodingSeb")] -[assembly: AssemblyProduct("RegexDialog")] -[assembly: AssemblyCopyright("Copyright © CodingSeb 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly -// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de -// COM, affectez la valeur true à l'attribut ComVisible sur ce type. -[assembly: ComVisible(false)] - -// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM -[assembly: Guid("3ba683f4-fbeb-44c0-9fcb-af1f38602c39")] - -// Les informations de version pour un assembly se composent des quatre valeurs suivantes : -// -// Version principale -// Version secondaire -// Numéro de build -// Révision -// -// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut -// en utilisant '*', comme indiqué ci-dessous : -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/RegexDialog/RegExToolDialog.xaml b/RegexDialog/RegExToolDialog.xaml index de6933e..3f5284f 100644 --- a/RegexDialog/RegExToolDialog.xaml +++ b/RegexDialog/RegExToolDialog.xaml @@ -7,18 +7,15 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:behaviors="clr-namespace:RegexDialog.Behaviors" Title="C# Regex Tools" - Height="422.75" + Height="600" MinHeight="300" MinWidth="600" Width="1427.97" - WindowStyle="ToolWindow" Closing="Window_Closing" Loaded="Root_Loaded" SizeChanged="Root_SizeChanged" LocationChanged="Root_LocationChanged" - PreviewKeyDown="Root_PreviewKeyDown" DataContext="{x:Static local:Config.Instance}" - local:WindowHelper.CloseOnKey="Esc" x:Name="Root"> @@ -30,6 +27,7 @@ + @@ -46,7 +44,7 @@ - - + - + - + - + - + - + - + + - + - + - + - + - + + + + + + + @@ -169,85 +176,61 @@ + + + - + + A new version of C# Regex Tools is available - + - + @@ -438,7 +471,7 @@