From 66a3c6526f1fff12ad10b73630dfe0baa2df6255 Mon Sep 17 00:00:00 2001 From: muqing <1966944300@qq.com> Date: Sun, 11 Aug 2024 19:16:42 +0800 Subject: [PATCH] EMM --- .filenesting.json | 3 - RustTools.sln | 30 +- RustTools/App.xaml.cs | 16 +- RustTools/Assets/Icon.ico | Bin 45451 -> 0 bytes RustTools/Assets/创意工坊.svg | 1 - RustTools/Editor/EditorWin.xaml | 44 +- RustTools/Editor/EditorWin.xaml.cs | 54 +- RustTools/RustTools.csproj | 14 +- TextControlBox/Enums/LineEnding.cs | 28 + TextControlBox/Enums/LineMoveDirection.cs | 7 + TextControlBox/Enums/SearchResult.cs | 39 + TextControlBox/Extensions/ColorExtension.cs | 13 + TextControlBox/Extensions/IntExtension.cs | 10 + TextControlBox/Extensions/ListExtension.cs | 137 + TextControlBox/Extensions/PointExtension.cs | 16 + TextControlBox/Extensions/StringExtension.cs | 63 + TextControlBox/Helper/CanvasHelper.cs | 41 + TextControlBox/Helper/FlyoutHelper.cs | 41 + TextControlBox/Helper/InputHandlerControl.cs | 13 + TextControlBox/Helper/ListHelper.cs | 75 + TextControlBox/Helper/SearchHelper.cs | 218 + TextControlBox/Helper/TabSpaceHelper.cs | 74 + TextControlBox/Helper/TextLayoutHelper.cs | 64 + TextControlBox/Helper/Utils.cs | 160 + TextControlBox/Languages/Languages.cs | 511 + TextControlBox/Models/AutoPairingPair.cs | 45 + TextControlBox/Models/CodeFontStyle.cs | 37 + TextControlBox/Models/CodeLanguage.cs | 39 + TextControlBox/Models/CodeLanguageId.cs | 116 + TextControlBox/Models/CursorPosition.cs | 51 + TextControlBox/Models/CursorSize.cs | 43 + TextControlBox/Models/JsonCodeLanguage.cs | 11 + TextControlBox/Models/JsonLoadResult.cs | 29 + TextControlBox/Models/ScrollBarPosition.cs | 40 + .../Models/SelectionChangedEventHandler.cs | 28 + TextControlBox/Models/SyntaxHighlights.cs | 71 + TextControlBox/Models/TextControlBoxDesign.cs | 89 + TextControlBox/Models/TextSelection.cs | 52 + .../Models/TextSelectionPosition.cs | 29 + TextControlBox/Models/UndoRedoItem.cs | 14 + TextControlBox/Renderer/CursorRenderer.cs | 52 + .../Renderer/LineHighlighterRenderer.cs | 17 + .../Renderer/SearchHighlightsRenderer.cs | 47 + TextControlBox/Renderer/SelectionRenderer.cs | 209 + .../Renderer/SyntaxHighlightingRenderer.cs | 73 + TextControlBox/Text/AutoPairing.cs | 38 + TextControlBox/Text/Cursor.cs | 170 + TextControlBox/Text/LineEndings.cs | 31 + TextControlBox/Text/MoveLine.cs | 35 + TextControlBox/Text/Selection.cs | 527 + TextControlBox/Text/StringManager.cs | 20 + TextControlBox/Text/TabKey.cs | 92 + TextControlBox/Text/UndoRedo.cs | 176 + TextControlBox/TextControlBox.csproj | 32 + TextControlBox/TextControlBox.xaml | 117 + TextControlBox/TextControlBox.xaml.cs | 2674 ++++++ UseWinUI3.txt | 1 - WinUIEditor/CodeEditorControl.cpp | 336 - WinUIEditor/CodeEditorControl.h | 75 - WinUIEditor/CodeEditorControl.idl | 19 - WinUIEditor/CodeEditorHandler.SciEdit.cpp | 669 -- WinUIEditor/CodeEditorHandler.SciEdit.h | 91 - .../CodeEditorHandler.SyntaxHighlighting.cpp | 395 - WinUIEditor/CodeEditorHandler.cpp | 557 -- WinUIEditor/CodeEditorHandler.h | 102 - WinUIEditor/ControlIncludes.h | 4 - WinUIEditor/DarkPlus.h | 213 - WinUIEditor/Defines.idl | 5 - WinUIEditor/DummyPage.cpp | 13 - WinUIEditor/DummyPage.h | 19 - WinUIEditor/DummyPage.idl | 11 - WinUIEditor/DummyPage.xaml | 8 - WinUIEditor/EditorBaseControl.cpp | 665 -- WinUIEditor/EditorBaseControl.h | 121 - WinUIEditor/EditorBaseControl.idl | 15 - .../EditorBaseControlAutomationPeer.cpp | 190 - WinUIEditor/EditorBaseControlAutomationPeer.h | 43 - .../EditorBaseControlAutomationPeer.idl | 15 - WinUIEditor/EditorWrapper.cpp | 8461 ---------------- WinUIEditor/EditorWrapper.h | 4756 --------- WinUIEditor/EditorWrapper.idl | 8489 ----------------- WinUIEditor/Helpers.cpp | 81 - WinUIEditor/Helpers.h | 8 - WinUIEditor/IEditorAccess.idl | 10 - WinUIEditor/LightPlus.h | 225 - WinUIEditor/TextMateScope.h | 215 - WinUIEditor/TextRangeProvider.cpp | 334 - WinUIEditor/TextRangeProvider.h | 38 - WinUIEditor/Themes/Generic.xaml | 67 - WinUIEditor/WinUIEditor.def | 3 - WinUIEditor/WinUIEditor.vcxproj | 847 -- WinUIEditor/WinUIEditor.vcxproj.filters | 785 -- WinUIEditor/Wrapper.cpp | 261 - WinUIEditor/Wrapper.h | 70 - WinUIEditor/packages.config | 7 - WinUIEditor/pch.cpp | 1 - WinUIEditor/pch.h | 144 - WinUIEditorCsWinRT/WinUIEditorCsWinRT.csproj | 49 - 98 files changed, 6629 insertions(+), 28465 deletions(-) delete mode 100644 .filenesting.json delete mode 100644 RustTools/Assets/Icon.ico delete mode 100644 RustTools/Assets/创意工坊.svg create mode 100644 TextControlBox/Enums/LineEnding.cs create mode 100644 TextControlBox/Enums/LineMoveDirection.cs create mode 100644 TextControlBox/Enums/SearchResult.cs create mode 100644 TextControlBox/Extensions/ColorExtension.cs create mode 100644 TextControlBox/Extensions/IntExtension.cs create mode 100644 TextControlBox/Extensions/ListExtension.cs create mode 100644 TextControlBox/Extensions/PointExtension.cs create mode 100644 TextControlBox/Extensions/StringExtension.cs create mode 100644 TextControlBox/Helper/CanvasHelper.cs create mode 100644 TextControlBox/Helper/FlyoutHelper.cs create mode 100644 TextControlBox/Helper/InputHandlerControl.cs create mode 100644 TextControlBox/Helper/ListHelper.cs create mode 100644 TextControlBox/Helper/SearchHelper.cs create mode 100644 TextControlBox/Helper/TabSpaceHelper.cs create mode 100644 TextControlBox/Helper/TextLayoutHelper.cs create mode 100644 TextControlBox/Helper/Utils.cs create mode 100644 TextControlBox/Languages/Languages.cs create mode 100644 TextControlBox/Models/AutoPairingPair.cs create mode 100644 TextControlBox/Models/CodeFontStyle.cs create mode 100644 TextControlBox/Models/CodeLanguage.cs create mode 100644 TextControlBox/Models/CodeLanguageId.cs create mode 100644 TextControlBox/Models/CursorPosition.cs create mode 100644 TextControlBox/Models/CursorSize.cs create mode 100644 TextControlBox/Models/JsonCodeLanguage.cs create mode 100644 TextControlBox/Models/JsonLoadResult.cs create mode 100644 TextControlBox/Models/ScrollBarPosition.cs create mode 100644 TextControlBox/Models/SelectionChangedEventHandler.cs create mode 100644 TextControlBox/Models/SyntaxHighlights.cs create mode 100644 TextControlBox/Models/TextControlBoxDesign.cs create mode 100644 TextControlBox/Models/TextSelection.cs create mode 100644 TextControlBox/Models/TextSelectionPosition.cs create mode 100644 TextControlBox/Models/UndoRedoItem.cs create mode 100644 TextControlBox/Renderer/CursorRenderer.cs create mode 100644 TextControlBox/Renderer/LineHighlighterRenderer.cs create mode 100644 TextControlBox/Renderer/SearchHighlightsRenderer.cs create mode 100644 TextControlBox/Renderer/SelectionRenderer.cs create mode 100644 TextControlBox/Renderer/SyntaxHighlightingRenderer.cs create mode 100644 TextControlBox/Text/AutoPairing.cs create mode 100644 TextControlBox/Text/Cursor.cs create mode 100644 TextControlBox/Text/LineEndings.cs create mode 100644 TextControlBox/Text/MoveLine.cs create mode 100644 TextControlBox/Text/Selection.cs create mode 100644 TextControlBox/Text/StringManager.cs create mode 100644 TextControlBox/Text/TabKey.cs create mode 100644 TextControlBox/Text/UndoRedo.cs create mode 100644 TextControlBox/TextControlBox.csproj create mode 100644 TextControlBox/TextControlBox.xaml create mode 100644 TextControlBox/TextControlBox.xaml.cs delete mode 100644 UseWinUI3.txt delete mode 100644 WinUIEditor/CodeEditorControl.cpp delete mode 100644 WinUIEditor/CodeEditorControl.h delete mode 100644 WinUIEditor/CodeEditorControl.idl delete mode 100644 WinUIEditor/CodeEditorHandler.SciEdit.cpp delete mode 100644 WinUIEditor/CodeEditorHandler.SciEdit.h delete mode 100644 WinUIEditor/CodeEditorHandler.SyntaxHighlighting.cpp delete mode 100644 WinUIEditor/CodeEditorHandler.cpp delete mode 100644 WinUIEditor/CodeEditorHandler.h delete mode 100644 WinUIEditor/ControlIncludes.h delete mode 100644 WinUIEditor/DarkPlus.h delete mode 100644 WinUIEditor/Defines.idl delete mode 100644 WinUIEditor/DummyPage.cpp delete mode 100644 WinUIEditor/DummyPage.h delete mode 100644 WinUIEditor/DummyPage.idl delete mode 100644 WinUIEditor/DummyPage.xaml delete mode 100644 WinUIEditor/EditorBaseControl.cpp delete mode 100644 WinUIEditor/EditorBaseControl.h delete mode 100644 WinUIEditor/EditorBaseControl.idl delete mode 100644 WinUIEditor/EditorBaseControlAutomationPeer.cpp delete mode 100644 WinUIEditor/EditorBaseControlAutomationPeer.h delete mode 100644 WinUIEditor/EditorBaseControlAutomationPeer.idl delete mode 100644 WinUIEditor/EditorWrapper.cpp delete mode 100644 WinUIEditor/EditorWrapper.h delete mode 100644 WinUIEditor/EditorWrapper.idl delete mode 100644 WinUIEditor/Helpers.cpp delete mode 100644 WinUIEditor/Helpers.h delete mode 100644 WinUIEditor/IEditorAccess.idl delete mode 100644 WinUIEditor/LightPlus.h delete mode 100644 WinUIEditor/TextMateScope.h delete mode 100644 WinUIEditor/TextRangeProvider.cpp delete mode 100644 WinUIEditor/TextRangeProvider.h delete mode 100644 WinUIEditor/Themes/Generic.xaml delete mode 100644 WinUIEditor/WinUIEditor.def delete mode 100644 WinUIEditor/WinUIEditor.vcxproj delete mode 100644 WinUIEditor/WinUIEditor.vcxproj.filters delete mode 100644 WinUIEditor/Wrapper.cpp delete mode 100644 WinUIEditor/Wrapper.h delete mode 100644 WinUIEditor/packages.config delete mode 100644 WinUIEditor/pch.cpp delete mode 100644 WinUIEditor/pch.h delete mode 100644 WinUIEditorCsWinRT/WinUIEditorCsWinRT.csproj diff --git a/.filenesting.json b/.filenesting.json deleted file mode 100644 index 0b71966..0000000 --- a/.filenesting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "help":"https://go.microsoft.com/fwlink/?linkid=866610" -} \ No newline at end of file diff --git a/RustTools.sln b/RustTools.sln index f3db4c6..f5aad77 100644 --- a/RustTools.sln +++ b/RustTools.sln @@ -5,15 +5,17 @@ VisualStudioVersion = 17.10.34928.147 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RustTools", "RustTools\RustTools.csproj", "{2B938A8C-2116-4961-A9D7-5A755FFC1943}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{64F47B2C-DECA-42CB-AE37-EE7DC9F0035E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TextControlBox", "TextControlBox\TextControlBox.csproj", "{70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM Debug|arm64 = Debug|arm64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM Release|arm64 = Release|arm64 Release|x64 = Release|x64 Release|x86 = Release|x86 @@ -22,6 +24,9 @@ Global {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|Any CPU.ActiveCfg = Debug|x64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|Any CPU.Build.0 = Debug|x64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|Any CPU.Deploy.0 = Debug|x64 + {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|ARM.ActiveCfg = Debug|x64 + {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|ARM.Build.0 = Debug|x64 + {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|ARM.Deploy.0 = Debug|x64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|arm64.ActiveCfg = Debug|arm64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|arm64.Build.0 = Debug|arm64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Debug|arm64.Deploy.0 = Debug|arm64 @@ -34,6 +39,9 @@ Global {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|Any CPU.ActiveCfg = Release|x64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|Any CPU.Build.0 = Release|x64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|Any CPU.Deploy.0 = Release|x64 + {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|ARM.ActiveCfg = Release|x64 + {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|ARM.Build.0 = Release|x64 + {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|ARM.Deploy.0 = Release|x64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|arm64.ActiveCfg = Release|arm64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|arm64.Build.0 = Release|arm64 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|arm64.Deploy.0 = Release|arm64 @@ -43,6 +51,26 @@ Global {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|x86.ActiveCfg = Release|x86 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|x86.Build.0 = Release|x86 {2B938A8C-2116-4961-A9D7-5A755FFC1943}.Release|x86.Deploy.0 = Release|x86 + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|ARM.ActiveCfg = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|ARM.Build.0 = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|arm64.ActiveCfg = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|arm64.Build.0 = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|x64.ActiveCfg = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|x64.Build.0 = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|x86.ActiveCfg = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Debug|x86.Build.0 = Debug|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|Any CPU.Build.0 = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|ARM.ActiveCfg = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|ARM.Build.0 = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|arm64.ActiveCfg = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|arm64.Build.0 = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|x64.ActiveCfg = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|x64.Build.0 = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|x86.ActiveCfg = Release|Any CPU + {70FED101-CE0C-4B8E-90BD-DC56C2ACA86F}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RustTools/App.xaml.cs b/RustTools/App.xaml.cs index 11428cd..a439d5a 100644 --- a/RustTools/App.xaml.cs +++ b/RustTools/App.xaml.cs @@ -47,10 +47,6 @@ public partial class App : Microsoft.UI.Xaml.Application public App() { InitializeComponent(); - //if (!Directory.Exists(wj.CD)) - //{ - // Directory.CreateDirectory(wj.CD); - //} // 注册激活事件处理程序 Host = Microsoft.Extensions.Hosting.Host. CreateDefaultBuilder(). @@ -136,26 +132,18 @@ public partial class App : Microsoft.UI.Xaml.Application } return; } - // If this is the first instance launched, then register it as the "main" instance. - // If this isn't the first instance launched, then "main" will already be registered, - // so retrieve it. var mainInstance = Microsoft.Windows.AppLifecycle.AppInstance.FindOrRegisterForKey("main"); - // If the instance that's executing the OnLaunched handler right now - // isn't the "main" instance. if (!mainInstance.IsCurrent) { - // Redirect the activation (and args) to the "main" instance, and exit. await mainInstance.RedirectActivationToAsync(activatedEventArgs); System.Diagnostics.Process.GetCurrentProcess().Kill(); return; } else { - //MainWindow.Activate(); + new Editor.EditorWin().Activate(); //MainWindow = new MainWindow(); - //new Editor.EditorWin().Activate(); - MainWindow = new MainWindow(); - await App.GetService().ActivateAsync(args); + //await App.GetService().ActivateAsync(args); } } } diff --git a/RustTools/Assets/Icon.ico b/RustTools/Assets/Icon.ico deleted file mode 100644 index 5d06b9f2857b39f0b5d3395e3e7999ba6bcc3a38..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45451 zcmeHQ2V4`$_n!>`f|LYoh=qWPSiy=FB49<4^YlDC1oTw&lwubJvRJ^5oLDFdo((IW z*bpR96!ApE*^r{)4iE(uM5G8w{xgB)x2_3AY2KgtFnKfc-n{pHZ`JR%LyWA^>Ijs5h#!!DKZ6<{ARP;Z)WQ z%>g()gwV$Z;XMI(w3^Td>rl`75JDdtETRL@{VV`mZLBA#x6x?>)v8aLXgM8elUh`Q z#BO=`LR4EZeS$eS_n^ybSfM+OojMkPKmAlI=0Z$B#ciVP3IH_XP{!`KhR+9}P530s zu`|}%zkP1CsB3a3{`*Xq&9AyUKAzJjCUVX{?Yi7cqHm<1?do<=St)r4DzgMu3+ z8%zG|YM{VZ7WR7a=w+ZP=)Bc6hIfBZdoXO5_S(?kUk$+0c7GOlnZ#LwXWH}r^^6Gp z1kP*TiZ6FCdV*!#_jMcH|{@C(TfwziW> z-aXHZi`dk~<$2VK6DzcTQhuPaLogF$#Tj)@jgKGir8t{~9h^ZAJ7qF$*!k<%ug54k zZ^2Dn#sg-z(HU{BKr`v~IA9;M*8k9G_urGlx@soHjRQ}gJ}uNb!={bA*bTqn8t_Im z;?4_Jjl?|91i=fw+z$9I1I}$Ga7E(gVwiiU-z@Kf9lQwtZkzw{Lbj2 z2N=H6->r-a9I*T8Lylb$g9SEq96_Ulwf%piGr;a~JK&*s&2l^ZU1zxs{(jn`<=r+o zIN1Hqt_!%G_8U1ou*xj^^xnk%WVZ#Oey$>3#2caTa#U2*#fujMl22WVj9j5_blFD} zxT)oL$7n#!#)+N^j}5)GJE1n8tbx#$w)Yii*U|D2#DEW6yA?9xduX2DCHHtqXNJAZ zPqVmkp``EHPeqIEb*812(BUCg--E8kBN8#++u^?p6b;uql#RT9|NbiR3z$AWP_^QIJyG2iex!r4M5u@QK}1I#x4h>ssPRL+4)K~oqzs^bE1xO ztvO3cMYQqCv3~vf9TiH>rE`zWun3aPF>h#s{9qA+acwn?0*y zPv}gqmt%FkF8YBX8PWN%Q?IxR(b?xiU$46YL$lKriAj)?m65@Ie(loZP94_wGz+fS zQ5bnsiI!yS=Sx>Bd#exn7p$Df-z^+QOVVOWo4SMkk!w*ClNN>_v!MA@#IiuoeqFST zvr2q{;gR>daXp>`oufAuiFjNRD~hrEJZhtP($TwT3ARrj~lRFJZrO)@+}SsSn@$E8a;|{MhiQT ze(}e5LSctPT{EE8DRG|V?yGTEI%lAI$=jS1ELIa7%kmQG_z0o62`wz(c=^W)`bH@X=Dcxwl6?h6#PeM8n(?ii&SCs^Fl8xszi-776TZS)YHIPFhA2orKsgs#uI zW&%Y{_Fwkg{jLR~_tUOCOii7gqiZ{${J!~1dZ{G{=)L}}L-D6V^;md%t(ctK@7|IH zu`_OkfKUcLDARsT{)@bhy+`RdTH|JPPT;b0(IsiHVQ^K0{|^x&W@NI_pa+Za5tx_- z#*L49VfvRnFJbr*4C*%r0oui>+`#Kz{y&UYNK`4<3=9V*mWWS3%j?)_^$@-%%|j1N z?y~0K^<7Y8u2f_rFmy}5BpF%qX`Iqdr2}mm)qWm*^~|KrDD z#h=D)lXme27tfTZ@_e9<7k`5lG!HiDKPu+jxy2C85 z2}c5%{Gy_j_OzgnFN1l1S*?cklt`x!T1jUD108aDMkgv~S1CFP#1e z0>-G096EIGgHZ0M2<-lDi)ksvXI3oJDoDL#men(?)65;C(_-m{c67&u3k~4ODtl;{ z{qkb2mzQZo%1eDPZ|+>ZsZ*w84Gl9jaea|!ReX}cX>W1(?%lg9;iWf5>9NK5ppHiN ziA##3I$?|v?S8hiOI*Ualyyt^@Zog(z7yi!^W544y*mrFFb!p!o>31k#>9jqSJ<@0 z`)oJV+-K-O8=@Uaei*p{#J#KQA+xh%2DXvPzk+HFdewsDw(Ty8py%e>l zn3fLudxB}jOo#mBK@}ZO(b&0L@Mo#1lcS@f4|0o(iwjTl{Rf{A96jk^z3TXW-V2Q- zX_;;DUmv#z9M!3q%^EG6M@GuwL6_gAJ)a3UeRqyB*^4>014As{GH?dJ?b)=*TnnHN zm_uCebMJ#*Z^z0>AvDjbt}_{g=Ri&l1m=XETzpwv6R zJsc5#8te|?4Xww3uj<-!CP1w00dA)EI;#E%4rIZkan_dS%pEttQ8j?0a^MIv8mdcE z<;cCVTscCPmd(x0!PKc!!OuVc41S&WD{ygf0q$$pf=wGYf}=-{f{1ew;9Ar*kR%X* z$B!R_ms!~$FE0T7W!Qw7mF#UF|(GMSY- zcb(!7JE*E6?RD0VDJv85mA=55ocI&Ieop_x^3o`h;$9gj`SFn>Pm>o<+43}aev@&& z`aJ4VR8l-&h*zE8; zX8%!2_y_$(ej@)7Rj8uMRg_spb*rdZ73D&T;)I5k@DGzx9Ck-_Y5J0)`&2f}9GI)` zQ{ii!>O{Fut-eQfuDnO}@$muv{{A2+Fz~Z`)!VmjSKptOm6cViYb~@!pfv*DR|KRd z=mvqTAtN#Wr&$IUHdPB~XjBbM$=7LR4fxW#GHGa#8ASPWzB(mgSbh0~UJOI3zU+@- zYH%!}pa%KUKdOEVYopF!sJD^Nrz6GihDM%#MZ|!^4>^1l)UK|sB9D(@G<9`!+b0hn zykmgqYvNbN09pCcf7JTF)Chd3<5F}|7}WS8uMjTyhmz74d;%Q7ChcF+u4F#!UCjn) z|00-D6G-|0*kAHLXG{4~qg6i?Hsnk1tqBn-8_tcOB$9372p~%k$3;WX%JG9l0>>k| z@M$x%pkcEv)Mo}W7iLKT9J-XkVM_&I5@sc6oWg>c4RiH41&vLJBx9U{#wKW75)u+3 z9h;!%=jhov@!Xu~+Dcm^&>Dg7KLWDHDQ!pz`3Nt(L_!nRU|ppuVMLv#LQ_$}RI2NA zObLk)bp{QiDU<3dNSrLM!a(BH^3n>q4pmE^_!0J`!f?#+dA+h)jh8OvLcBym;J--d zUXQO(kE{%3;dO+si|!2@X)2$pkeJFhaB2Gq-R``TaRmD&)n3trZ3;SqW!*!zU{8YkF=f)y7t@^5w~B-`kngOImiA?ORo?HceH_qcQnZogR^3Cw3MZ%4S7=`ZrLrM6CbPt#YqxH(d8<377avaZ%DMcb zSo`&uHy_vC6KiihpbC;-9rNerUbb@C6VJTP@V=Eu$Cs2oe8qF?ywlWZ6URJ78P=22 z-&tLmB=8%pN!vQVGdTB;)iiFh^N!cfY`Rv$08p`c%wGMt*jN+UE7ymle&~rhBmr9iH8*^>2p_D4n~7wdjUxg?;cHmm}|g z4Vba%m)I4Y9=SBWU%9QoZxX{hVTL+pC>q$)N5OxQDjtz;y{~NimFVbS-oAM=BP}gW zl(})Ef@E6KJ~-p+H)rRwaOzu0sO2~~?aTnAz7ietx7sLt_ADH}Wv)2!N=q*+_&C^- zT5c7`<4R1`9WZl_(Nv6mom((Q^f1pVjw`N+lF)Tnw2>znAh|Sqyl&tpRsEfk;Zaa_l$5^BDjTV^gbTBjL?9ak7#24nL>kcUv3WX7e zOg(c2VO{mYe0|!mua@jzY?`&1l{D4@B&d$k+4CZ_uh?Cm{_qhC6n1>_Yp`>(xy#b*NZd8)CB*o4x|&;jK~7Q)F8 zr*GdL$L+8;eK5O3BVi2v_Fva%yMwJ9)1F7KIeq{BRLHVZHH_8D&;gIT(^D+~TXhp> z6a&oP$lBruI6pDGufmEiYl|=7>|=Njhn4Lt#st7#vWcTj11a6b8?qfYOgGQy%9|GNscBXoH-3P9%qzd3GI8`Bad_9m`F8{& ziBXYYn)BktCuiH*zIXb&f62P*zT)93eLx1oc^1tp6nfL;NH%NYHUN%04n-O#cd)<# zSm@XvRmSf#hZUXkT5wWf((X;1cMK2)rv=);DYu4jB5pf4=c3Jc02I3ee8YPUI*U!iVV+l9>E~e5<28ZLjt8RTxzghJ9fIm&;-JnqgMgYQ7(ZpO7>W8YfI`;I7yZ;{i=W%l z6jo~jr7lCI`dD<%%U!|c5ph9)L1VAbJ2rX=jRWSp1Vu?ko>2kV?mrjji1W@H06Hh$ zJbzQWGb)CiVWaks?x-YCSXAZ?Li=-HighI!g1-vir0`C;>U!h}3}A3aGxtad%B9SQf z>Dge>g=c-rQnH)^LfgBu!N`TnCUWkE8qwI8l?83GI7Sm}{aIVfrZC43Ozd|@59`V6 zO2=s<)Kv`2ob^CJ!dxis%EZEU#3SAuI&L21Ll3C9tO@50qJC);fMKr%B}cfXg-*}? zB?dito^+0qbxg@2vs~+K5`$}yzdu*=#pqsPYIJ=0Nge%s4MPPi%+r$C3h|7!Yj96GK2PURnjl(XX?M`>Q9-)bi>{8Hv9N&A5e^n*_odAN4~t?@b4M&} z_vPNhpVFV*UXRW8GUBvd{?FU^9Fq#$6>&Xp%@TVY<1v@z2d{tf^eI!^?@(r}Bq{&O zTeHv-8v9yOS&6u-#}${K{JM#b@a`^qb#U_;mGfJHjls%y4(mkkl_XYddiso8K_Hj` z76d(r_ACCh%KS72jadN0NAq8JPLFWtbyUZ3Dn5pe>qkBiO?#A=ym-3$c>{ho8pq%E zWt!9Lk9k8*D*fEnQ56fjb#aA6@4DAP+fzt|Ih-IkHE!GAdC7s7b&@VmRGG^FJ$D5; zxgJT57(8_-KM26{q2jKfa@WY@h!u83gTeiXH7R+?BTgZ+>Tn}ve#q;+PBe1W6R?D~ zlnt~xA1qH!%1iDPfvhTEyPvt)&-pRJ!6^oI;D{Oct)so3q(c5r3U-V{U4ep4>1h1- zOgqOgB{FHivH1)~8-(FeGX^`X(P z{R-i=$g8k?{L7pik!I4_M<=G0AMsesz-M_069NZ2Rlqg|Z@p`UX(x4zRn*h&+RD4S z*z=KGag5n-JAj)wuViOJ-&2BvqjCheOG47%n|Xh$fE=NhP$!uX zbz`EGSS$5x;^$deS&7va?Y9#-*x401joomLdpqnfjdf!tAI^0@9Thc#t8{UKSMof! zgAN7xo`(Igg2(xt_r!B^9(08qi$3=!CWriP;&r$uI8^G%>eS}UxpSWevj;>KT)A-J zU%>{&HR}e3Gr+7icZcG>8zYSe4co(V9F8A2n(Xk)FCUzKuzX!)-jmm9(W`=jf(>cT z>JM(defRDsI9E+HCMjTLkL9-|a8jgrkD+~(b$)klNI(!^4WRb`Js5waq^F-5Hf-3b z>(|FfRNO`{F1?U6LC0%TnRwZ~0pO1rF^4ZIavt|_d<^IP!#U}XgyC(Bx7u0!-rF?A z>aOsiapBG-6~DRY+q4IN?Cb+v`<0$N zQmn(j8W$J0#HGa1O)1&TWk12`SbHqh;FwrACvMhz8$Xr-%`t#yV<=dXWXaYd`-kiD9Ra2zdr12i9?z(PATMf(wjVQ)>iTBhVUwuZaM>4`spZ2D1QW zNejye6Am+aP~G4O>NSR02y;vGn~EnNVsvcC095&o^iplLmZR2WW-UXECMv3*Y8Snln@JQ1Q0<|7{VV z#*-TF=G^wkHWd#Q@3(p1y8lz-NsTvk`&0SfTBqu#)~Wibc$<3rQ}KLjo$4>OPSxMi z{D(7k7sn|THGcuLg!;la!Y9N-ej-_-jiBGV|1Qoh z)#C#=1MIVX0c~^CM)-(i3BL(S@Q6A=<+Zo8?T_%LrKDE-h;XCrO>A?*4Tt+go_5rettTJ__$zs4TC&CHs$Xlh1=S zo%aZT<@qVEy`}r_w`*7Rwv%_wCw#AIJAbeKlg9$G&i7>B|BL=3pWxS&WZvsheJA@* zY;P*1_G#(+Kf(*YEG5lU?6T@qf2nn9pXTw~X^2b$b!pn@Z)$QQPZMhbxYo{r;cu zkBXOQr&4)x)b`ryvV2F!!uNXptIc0BU!L#Kf5-p2|BdN8iXHWQN{%}!Q}^eFs#ERA zsyDXpE!qF3@V%w_-&DT0ME{%8_m<{=Q~OT!AFiaTelAa(j~eQHN7X~bNgQ9KU(in?LR7`7&P`g z=$7DnmH%kXkB}OJW~w_POii7juW0R0bFP0uwr!f)Z?e6r7&OOzfP6P5V`4%A_;G6~m437g zHK31|wbEMSApIyfjFa@E;E=+&O2Y=fv?-;!Rn)ACa;qrZIEW9sODXIwrLen{q7QZA zkgp3VA5t?&3n1k}T1)!;KV`9DC-}_>_>X5>Q)>j8G6HbSgvQtr4LEkH>zEAL- zu>Tipq?^GH$FK1L;$*{&#+h}ES7XZ6dpkhfp#*mHe9qO?waK1Opl1N^KLV2D5mDc5 zK#qM=Vke&2Ae%(|5d8}L)%^*bO-&mEKlOQRL)XbMYQU`Vxdg7LUM6#!0j_2Y!Tu zSWAQEPosFFjLHZP;>p4)tF5{4lh?!`yo5gp4|&ZC!i?H#%4ENqV*f$*WUXHzFd`lq z6VWb@l4Y9;KU!}E632l& zKGEKk_{p|VnOM_~u*h1oj$~xvB-#)q>ujq1pRkFpQv??BHH+Z4bo>Y(S}%$+88f*| z_$RBax#N#8)wTwPz%P%I{c6npN1pv}ZEwY2d8bLNQR6O;M{cjJ+}QgM*?vRgNB0olD}IEX^8BsAo?lVpT;Do*o5?E6!Vb5C zTT40r$ihst$-(YeU+hSpyzdeE5v^~$sq$o9xB5xd(_ZI@T1YOll^Edw?;r#1S+Qyp$SeXkth;|bupq`0N{TphVzg9pHRYI z=s)rstD*{3RJn>WtEg@jHLIdrNKxFR@s!T)BE^*wXEaZX4KoL3;{W;JELdqxwMGD* zlhO4>2y;VSC(*SEuhlRVfO0ksXqSq=Rt(U#)Ng-(f4R?!>pQ+gx~hE2uPp|I@Ab7& zn>?YnzV@m2iS?}$xW0G$gdeq0YJ3R!Z}p$hL;XH9dXGx}4m7e)$dbzqWuJJLg}y~c ze5aQDPK#`lTy7})Kg#5HQbZd;iC8q0ee}+h&`r>q-lI08{hHp3%6kvmkoE~( zHGPv0#e|R}mm4bngl>7?#3S1zmmAtXfrCnsO>!pq-)f(%vp(fk`<36jYKZs~u_VWz z+(wjT(dM*IUK`t(*MC`llWoHogf^x9`r1a=i0wr9Lf+Q3m5DxxevR#hvj4TVW!WeD zRG0F%*siiK9e*P|b+Jd5`BvLi_R+l$F<$>#>W6fFZG!gEJ&-gGUxCH(YwiAj>?eI} z0Dns1YB0D2jM=~$=`@3x3$vsEKJh4kYuQTCI<~5Wo>Q=3X2VQ8r{K_GrIAv7_a`b0 z)SrCJ)l^2Z^7_~1Tv}UyVjN0Pq!ZyGXl?z8?`g{#S0g<&^(W5(MfR!xv!J&Ag#Tph z1a5-XWS{6SYkq2d`V)Gnv@ZC`u_kPyHX_#rKiMwP57DY~`4`VikWR!W_an+gf1)px vHI}#k5wcVo5)y*8y8vc3wJ)k8`?X}$7ah_Kn$R;(zCt~-GL&alJ}>=0A=}t% diff --git a/RustTools/Assets/创意工坊.svg b/RustTools/Assets/创意工坊.svg deleted file mode 100644 index 4b69d28..0000000 --- a/RustTools/Assets/创意工坊.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/RustTools/Editor/EditorWin.xaml b/RustTools/Editor/EditorWin.xaml index aae4a2d..066989e 100644 --- a/RustTools/Editor/EditorWin.xaml +++ b/RustTools/Editor/EditorWin.xaml @@ -73,6 +73,7 @@ Grid.Column="0" Margin="16,0,0,0" /> + - + + + + + + + + + + + + + + + + + + + + + + diff --git a/RustTools/Editor/EditorWin.xaml.cs b/RustTools/Editor/EditorWin.xaml.cs index bdb5812..a13d964 100644 --- a/RustTools/Editor/EditorWin.xaml.cs +++ b/RustTools/Editor/EditorWin.xaml.cs @@ -3,27 +3,14 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection.Metadata; -using System.Runtime.InteropServices; + using Microsoft.UI; -using Microsoft.UI.Text; -using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Documents; using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Media.Imaging; using RustTools.muqing; -using Windows.ApplicationModel.Core; using Windows.ApplicationModel.DataTransfer; -using Windows.Foundation; -using Windows.Graphics.Imaging; -using Windows.Storage.Pickers; -using Windows.Storage; -using Windows.UI.Core; -using Windows.UI.Core.Preview; -using Windows.UI.Popups; -using Windows.UI.WindowManagement; using WinRT.Interop; namespace RustTools.Editor; /// @@ -31,9 +18,10 @@ namespace RustTools.Editor; /// public sealed partial class EditorWin : WindowEx { + + private readonly ObservableCollection lineNumberList = new(); //Ŀ¼б public ObservableCollection DataSource=new (); - private Microsoft.UI.Windowing.AppWindow? app; public EditorWin() { InitializeComponent(); @@ -45,7 +33,8 @@ public sealed partial class EditorWin : WindowEx gj.UpdateTitleBar(this, frame.ActualTheme); page.RequestedTheme = frame.ActualTheme; } - + //new CodeEditorControl(); + //new Editor. //WindowManager.Get(this).IsMinimizable = false; //app = GetAppWindowForCurrentWindow(); //app.Closing += OnClosing; @@ -56,14 +45,38 @@ public sealed partial class EditorWin : WindowEx TitleText.Text = directoryInfo.Name; Closed += EditorWin_Closed; var v = wj.dqwb("D:\\steam\\steamapps\\common\\Rusted Warfare\\mods\\units\\Ͻ0.90.2\\ʴ߹͹\\ָ\\corrode_command.ini"); - //CodeEditor.Document.SetText(TextSetOptions.None,v); - //EditorView.Editor.SetText(v); - //CodeEditorControl.HighlightingLanguage. + editor.Document.SetText(Microsoft.UI.Text.TextSetOptions.None,v); + // ȡһ + //listboxtext + gj.sc(editor.Document.Selection.CharacterFormat.Size); + TextLine(); + } + + + + private void editor_TextChanged(object sender, RoutedEventArgs e) + { + TextLine(); + + } + public void TextLine() + { + lineNumberList.Clear(); + editor.Document.GetText(Microsoft.UI.Text.TextGetOptions.NoHidden, out var a); + var lineCount = a.Split(new[] { "\r\n", "\n", "\r" }, StringSplitOptions.None).Length; + if (lineCount < 1) + { + return; + } + for (var i = 1; i <= lineCount; i++) + { + lineNumberList.Add((i).ToString()); + } } //ûûб - private bool IsSave = false; + private bool IsSave = true; private ContentDialog? ClosedDialog; private async void EditorWin_Closed(object sender, WindowEventArgs e) { @@ -211,5 +224,4 @@ public sealed partial class EditorWin : WindowEx { sender.TabItems.Remove(args.Tab); } - } diff --git a/RustTools/RustTools.csproj b/RustTools/RustTools.csproj index 6c32035..b0f56cc 100644 --- a/RustTools/RustTools.csproj +++ b/RustTools/RustTools.csproj @@ -6,6 +6,7 @@ RustTools x64 x86;x64;arm64 + true true win10-x86;win10-x64;win10-arm64 enable @@ -28,14 +29,11 @@ True Never D:\RustTools + - - - - @@ -48,15 +46,19 @@ + + Always - + + + + - \ No newline at end of file diff --git a/TextControlBox/Enums/LineEnding.cs b/TextControlBox/Enums/LineEnding.cs new file mode 100644 index 0000000..3cf0dbd --- /dev/null +++ b/TextControlBox/Enums/LineEnding.cs @@ -0,0 +1,28 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the three default line endings: LF (Line Feed), CRLF (Carriage Return + Line Feed), and CR (Carriage Return). + /// + /// + /// The LineEnding enum represents the different line ending formats that can be used in the textbox. + /// The enum defines three values: LF, CRLF, and CR, corresponding to the different line ending formats. + /// - LF: Represents the Line Feed character '\n' used for line breaks in Unix-based systems. + /// - CRLF: Represents the Carriage Return + Line Feed sequence '\r\n' used for line breaks in Windows-based systems. + /// - CR: Represents the Carriage Return character '\r' used for line breaks in older Macintosh systems. + /// + public enum LineEnding + { + /// + /// Line Feed ('\n') + /// + LF, + /// + /// Carriage Return + Line Feed ('\r\n') + /// + CRLF, + /// + /// Carriage Return ('\r') + /// + CR + } +} \ No newline at end of file diff --git a/TextControlBox/Enums/LineMoveDirection.cs b/TextControlBox/Enums/LineMoveDirection.cs new file mode 100644 index 0000000..b6b5372 --- /dev/null +++ b/TextControlBox/Enums/LineMoveDirection.cs @@ -0,0 +1,7 @@ +namespace TextControlBoxNS +{ + internal enum LineMoveDirection + { + Up, Down + } +} diff --git a/TextControlBox/Enums/SearchResult.cs b/TextControlBox/Enums/SearchResult.cs new file mode 100644 index 0000000..5dea46c --- /dev/null +++ b/TextControlBox/Enums/SearchResult.cs @@ -0,0 +1,39 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the result of a search operation in the textbox. + /// + public enum SearchResult + { + /// + /// The target text was found during the search operation. + /// + Found, + + /// + /// The target text was not found during the search operation. + /// + NotFound, + + /// + /// The search input provided for the search operation was invalid or empty. + /// + InvalidInput, + + /// + /// The search operation reached the beginning of the text without finding the target text. + /// + ReachedBegin, + + /// + /// The search operation reached the end of the text without finding the target text. + /// + ReachedEnd, + + /// + /// The search operation was attempted, but the search was not started. + /// + SearchNotOpened + } + +} diff --git a/TextControlBox/Extensions/ColorExtension.cs b/TextControlBox/Extensions/ColorExtension.cs new file mode 100644 index 0000000..44f18f6 --- /dev/null +++ b/TextControlBox/Extensions/ColorExtension.cs @@ -0,0 +1,13 @@ +using Windows.UI; + +namespace TextControlBoxNS.Extensions +{ + internal static class ColorExtension + { + public static Windows.UI.Color ToMediaColor(this System.Drawing.Color drawingColor) + { + return Windows.UI.Color.FromArgb(drawingColor.A, drawingColor.R, drawingColor.G, drawingColor.B); + } + public static string ToHex(this Color c) => $"#{c.R:X2}{c.G:X2}{c.B:X2}"; + } +} diff --git a/TextControlBox/Extensions/IntExtension.cs b/TextControlBox/Extensions/IntExtension.cs new file mode 100644 index 0000000..fe59a96 --- /dev/null +++ b/TextControlBox/Extensions/IntExtension.cs @@ -0,0 +1,10 @@ +namespace TextControlBoxNS.Extensions +{ + internal static class IntExtension + { + public static bool IsInRange(this int value, int start, int count) + { + return value >= start && value <= start + count; + } + } +} diff --git a/TextControlBox/Extensions/ListExtension.cs b/TextControlBox/Extensions/ListExtension.cs new file mode 100644 index 0000000..44d1b7c --- /dev/null +++ b/TextControlBox/Extensions/ListExtension.cs @@ -0,0 +1,137 @@ +using Collections.Pooled; +using System; +using System.Collections.Generic; +using System.Linq; +using TextControlBoxNS.Helper; + +namespace TextControlBoxNS.Extensions +{ + internal static class ListExtension + { + private static int CurrentLineIndex = 0; + + public static string GetLineText(this PooledList list, int index) + { + if (list.Count == 0) + return ""; + + if (index == -1 && list.Count > 0) + return list[list.Count - 1]; + + index = index >= list.Count ? list.Count - 1 : index > 0 ? index : 0; + return list[index]; + } + + public static int GetLineLength(this PooledList list, int index) + { + return GetLineText(list, index).Length; + } + + public static void AddLine(this PooledList list, string content = "") + { + list.Add(content); + } + public static void SetLineText(this PooledList list, int line, string text) + { + if (line == -1) + line = list.Count - 1; + + line = Math.Clamp(line, 0, list.Count - 1); + + list[line] = text; + } + public static string GetCurrentLineText(this PooledList list) + { + return list[CurrentLineIndex < list.Count ? CurrentLineIndex : list.Count - 1 < 0 ? 0 : list.Count - 1]; + } + public static void SetCurrentLineText(this PooledList list, string text) + { + list[CurrentLineIndex < list.Count ? CurrentLineIndex : list.Count - 1] = text; + } + public static int CurrentLineLength(this PooledList list) + { + return GetCurrentLineText(list).Length; + } + public static void UpdateCurrentLine(this PooledList _, int currentLine) + { + CurrentLineIndex = currentLine; + } + public static void String_AddToEnd(this PooledList list, int line, string add) + { + list[line] = list[line] + add; + } + public static void InsertOrAdd(this PooledList list, int index, string lineText) + { + if (index >= list.Count || index == -1) + list.Add(lineText); + else + list.Insert(index, lineText); + } + public static void InsertOrAddRange(this PooledList list, IEnumerable lines, int index) + { + if (index >= list.Count) + list.AddRange(lines); + else + list.InsertRange(index < 0 ? 0 : index, lines); + } + public static void InsertNewLine(this PooledList list, int index, string content = "") + { + list.InsertOrAdd(index, content); + } + public static void DeleteAt(this PooledList list, int index) + { + if (index >= list.Count) + index = list.Count - 1 < 0 ? list.Count - 1 : 0; + + list.RemoveAt(index); + list.TrimExcess(); + } + private static IEnumerable GetLines_Small(this PooledList totalLines, int start, int count) + { + var res = ListHelper.CheckValues(totalLines, start, count); + + for (int i = 0; i < res.Count; i++) + { + yield return totalLines[i + res.Index]; + } + } + + public static IEnumerable GetLines(this PooledList totalLines, int start, int count) + { + //use different algorithm for small amount of lines: + if (start + count < 400) + { + return GetLines_Small(totalLines, start, count); + } + + return totalLines.Skip(start).Take(count); + } + + public static string GetString(this IEnumerable lines, string NewLineCharacter) + { + return string.Join(NewLineCharacter, lines); + } + + public static void Safe_RemoveRange(this PooledList totalLines, int index, int count) + { + var res = ListHelper.CheckValues(totalLines, index, count); + totalLines.RemoveRange(res.Index, res.Count); + totalLines.TrimExcess(); + + //clear up the memory of the list when more than 1mio items are removed + if (res.Count > 1_000_000) + ListHelper.GCList(totalLines); + } + public static string[] GetLines(this string[] lines, int start, int count) + { + return lines.Skip(start).Take(count).ToArray(); + } + + public static void SwapLines(this PooledList lines, int originalindex, int newindex) + { + string oldLine = lines.GetLineText(originalindex); + lines.SetLineText(originalindex, lines.GetLineText(newindex)); + lines.SetLineText(newindex, oldLine); + } + } +} diff --git a/TextControlBox/Extensions/PointExtension.cs b/TextControlBox/Extensions/PointExtension.cs new file mode 100644 index 0000000..e0ed0c4 --- /dev/null +++ b/TextControlBox/Extensions/PointExtension.cs @@ -0,0 +1,16 @@ +using Windows.Foundation; + +namespace TextControlBoxNS.Extensions +{ + internal static class PointExtension + { + public static Point Subtract(this Point point, double subtractX, double subtractY) + { + return new Point(point.X - subtractX, point.Y - subtractY); + } + public static Point Subtract(this Point point, Point subtract) + { + return new Point(point.X - subtract.X, point.Y - subtract.Y); + } + } +} diff --git a/TextControlBox/Extensions/StringExtension.cs b/TextControlBox/Extensions/StringExtension.cs new file mode 100644 index 0000000..03e4c07 --- /dev/null +++ b/TextControlBox/Extensions/StringExtension.cs @@ -0,0 +1,63 @@ +using System; +using System.Text.RegularExpressions; +using TextControlBoxNS.Helper; + +namespace TextControlBoxNS.Extensions +{ + internal static class StringExtension + { + public static string RemoveFirstOccurence(this string value, string removeString) + { + int index = value.IndexOf(removeString, StringComparison.Ordinal); + return index < 0 ? value : value.Remove(index, removeString.Length); + } + + public static string AddToEnd(this string text, string add) + { + return text + add; + } + public static string AddToStart(this string text, string add) + { + return add + text; + } + public static string AddText(this string text, string add, int position) + { + if (position < 0) + position = 0; + + if (position >= text.Length || text.Length <= 0) + return text + add; + else + return text.Insert(position, add); + } + public static string SafeRemove(this string text, int start, int count = -1) + { + if (start >= text.Length || start < 0) + return text; + + if (count <= -1) + return text.Remove(start); + else + return text.Remove(start, count); + } + public static bool Contains(this string text, SearchParameter parameter) + { + if (parameter.WholeWord) + return Regex.IsMatch(text, parameter.SearchExpression, RegexOptions.Compiled); + + if (parameter.MatchCase) + return text.Contains(parameter.Word, StringComparison.Ordinal); + else + return text.Contains(parameter.Word, StringComparison.OrdinalIgnoreCase); + } + public static string Safe_Substring(this string text, int index, int count = -1) + { + if (index >= text.Length) + return ""; + else if (count == -1) + return text.Substring(index); + else + return text.Substring(index, count); + } + } +} diff --git a/TextControlBox/Helper/CanvasHelper.cs b/TextControlBox/Helper/CanvasHelper.cs new file mode 100644 index 0000000..a6a35cb --- /dev/null +++ b/TextControlBox/Helper/CanvasHelper.cs @@ -0,0 +1,41 @@ +using Microsoft.Graphics.Canvas.UI.Xaml; +using Windows.UI.Core; + +namespace TextControlBoxNS.Helper +{ + internal class CanvasHelper + { + public CanvasControl Canvas_Selection = null; + public CanvasControl Canvas_Linenumber = null; + public CanvasControl Canvas_Text = null; + public CanvasControl Canvas_Cursor = null; + + public CanvasHelper(CanvasControl canvas_selection, CanvasControl canvas_linenumber, CanvasControl canvas_text, CanvasControl canvas_cursor) + { + this.Canvas_Text = canvas_text; + this.Canvas_Linenumber = canvas_linenumber; + this.Canvas_Cursor = canvas_cursor; + this.Canvas_Selection = canvas_selection; + } + + public void UpdateCursor() + { + Canvas_Cursor.Invalidate(); + } + public void UpdateText() + { + //TODO: Utils.ChangeCursor(CoreCursorType.IBeam); + Canvas_Text.Invalidate(); + } + public void UpdateSelection() + { + Canvas_Selection.Invalidate(); + } + public void UpdateAll() + { + UpdateText(); + UpdateSelection(); + UpdateCursor(); + } + } +} diff --git a/TextControlBox/Helper/FlyoutHelper.cs b/TextControlBox/Helper/FlyoutHelper.cs new file mode 100644 index 0000000..b7f3768 --- /dev/null +++ b/TextControlBox/Helper/FlyoutHelper.cs @@ -0,0 +1,41 @@ +using Microsoft.UI.Xaml.Controls; +using System; + +namespace TextControlBoxNS.Helper +{ + internal class FlyoutHelper + { + public MenuFlyout MenuFlyout; + + public FlyoutHelper(TextControlBox sender) + { + CreateFlyout(sender); + } + + public void CreateFlyout(TextControlBox sender) + { + MenuFlyout = new MenuFlyout(); + MenuFlyout.Items.Add(CreateItem(() => { sender.Copy(); }, "Copy", Symbol.Copy, "Ctrl + C")); + MenuFlyout.Items.Add(CreateItem(() => { sender.Paste(); }, "Paste", Symbol.Paste, "Ctrl + V")); + MenuFlyout.Items.Add(CreateItem(() => { sender.Cut(); }, "Cut", Symbol.Cut, "Ctrl + X")); + MenuFlyout.Items.Add(new MenuFlyoutSeparator()); + MenuFlyout.Items.Add(CreateItem(() => { sender.Undo(); }, "Undo", Symbol.Undo, "Ctrl + Z")); + MenuFlyout.Items.Add(CreateItem(() => { sender.Redo(); }, "Redo", Symbol.Redo, "Ctrl + Y")); + } + + public MenuFlyoutItem CreateItem(Action action, string text, Symbol icon, string key) + { + var item = new MenuFlyoutItem + { + Text = text, + KeyboardAcceleratorTextOverride = key, + Icon = new SymbolIcon { Symbol = icon } + }; + item.Click += delegate + { + action(); + }; + return item; + } + } +} diff --git a/TextControlBox/Helper/InputHandlerControl.cs b/TextControlBox/Helper/InputHandlerControl.cs new file mode 100644 index 0000000..1f8be55 --- /dev/null +++ b/TextControlBox/Helper/InputHandlerControl.cs @@ -0,0 +1,13 @@ +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; + +namespace TextControlBoxNS.Helper +{ + internal class InputHandlerControl : TextBox + { + protected override void OnKeyDown(KeyRoutedEventArgs e) + { + return; + } + } +} diff --git a/TextControlBox/Helper/ListHelper.cs b/TextControlBox/Helper/ListHelper.cs new file mode 100644 index 0000000..a2f35f1 --- /dev/null +++ b/TextControlBox/Helper/ListHelper.cs @@ -0,0 +1,75 @@ +using Collections.Pooled; +using System; +using System.Linq; + +namespace TextControlBoxNS.Helper +{ + internal class ListHelper + { + public struct ValueResult + { + public ValueResult(int index, int count) + { + this.Index = index; + this.Count = count; + } + public int Index; + public int Count; + } + public static ValueResult CheckValues(PooledList totalLines, int index, int count) + { + if (index >= totalLines.Count) + { + index = totalLines.Count - 1 < 0 ? 0 : totalLines.Count - 1; + count = 0; + } + if (index + count >= totalLines.Count) + { + int difference = totalLines.Count - index; + if (difference >= 0) + count = difference; + } + + if (count < 0) + count = 0; + if (index < 0) + index = 0; + + return new ValueResult(index, count); + } + + public static void GCList(PooledList totalLines) + { + int id = GC.GetGeneration(totalLines); + GC.Collect(id, GCCollectionMode.Forced); + } + + public static void Clear(PooledList totalLines, bool addNewLine = false) + { + totalLines.Clear(); + GCList(totalLines); + + if (addNewLine) + totalLines.Add(""); + } + + public static string GetLinesAsString(PooledList lines, string newLineCharacter) + { + return string.Join(newLineCharacter, lines); + } + public static string[] GetLinesFromString(string content, string newLineCharacter) + { + return content.Split(newLineCharacter); + } + public static string[] CreateLines(string[] lines, int start, string beginning, string end) + { + if (start > 0) + lines = lines.Skip(start).ToArray(); + + lines[0] = beginning + lines[0]; + if (lines.Length - 1 > 0) + lines[lines.Length - 1] = lines[lines.Length - 1] + end; + return lines; + } + } +} \ No newline at end of file diff --git a/TextControlBox/Helper/SearchHelper.cs b/TextControlBox/Helper/SearchHelper.cs new file mode 100644 index 0000000..1e1267e --- /dev/null +++ b/TextControlBox/Helper/SearchHelper.cs @@ -0,0 +1,218 @@ +using Collections.Pooled; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using TextControlBoxNS.Extensions; +using TextControlBoxNS.Text; + +namespace TextControlBoxNS.Helper +{ + internal class SearchHelper + { + public int CurrentSearchLine = 0; + public int CurrentSearchArrayIndex = 0; + public int OldSearchArrayIndex = 0; + public int[] MatchingSearchLines = null; + public bool IsSearchOpen = false; + public SearchParameter SearchParameter = null; + public MatchCollection CurrentLineMatches = null; + private int RegexIndexInLine = 0; + + private int CheckIndexValue(int i) + { + return i >= MatchingSearchLines.Length ? MatchingSearchLines.Length - 1 : i < 0 ? 0 : i; + } + + public InternSearchResult FindNext(PooledList totalLines, CursorPosition cursorPosition) + { + if (IsSearchOpen && MatchingSearchLines != null && MatchingSearchLines.Length > 0) + { + CurrentSearchLine = cursorPosition.LineNumber; + int indexInList = Array.IndexOf(MatchingSearchLines, CurrentSearchLine); + //When in a line without a match search for the next line with a match + if (indexInList == -1) + { + for (int i = 0; i < MatchingSearchLines.Length; i++) + { + if (MatchingSearchLines[i] > CurrentSearchLine) + { + CurrentSearchArrayIndex = i - 1 < 0 ? 0 : i - 1; + CurrentSearchLine = MatchingSearchLines[CurrentSearchArrayIndex]; + break; + } + } + } + else + { + CurrentSearchArrayIndex = indexInList; + CurrentSearchLine = MatchingSearchLines[CurrentSearchArrayIndex]; + if (OldSearchArrayIndex != CurrentSearchArrayIndex) + { + OldSearchArrayIndex = CurrentSearchArrayIndex; + CurrentLineMatches = null; + } + } + + //Search went through all matches in the current line: + if (CurrentLineMatches == null || RegexIndexInLine >= CurrentLineMatches.Count) + { + RegexIndexInLine = 0; + //back at start + if (CurrentSearchLine < MatchingSearchLines[MatchingSearchLines.Length - 1]) + { + CurrentSearchArrayIndex++; + CurrentSearchLine = cursorPosition.LineNumber = MatchingSearchLines[CurrentSearchArrayIndex]; + CurrentLineMatches = Regex.Matches(totalLines[CurrentSearchLine], SearchParameter.SearchExpression); + } + else + return new InternSearchResult(SearchResult.ReachedEnd, null); + } + + RegexIndexInLine = Math.Clamp(RegexIndexInLine, 0, CurrentLineMatches.Count - 1); + + RegexIndexInLine++; + if (RegexIndexInLine > CurrentLineMatches.Count || RegexIndexInLine < 0) + return new InternSearchResult(SearchResult.NotFound, null); + + return new InternSearchResult(SearchResult.Found, new TextSelection( + new CursorPosition(CurrentLineMatches[RegexIndexInLine - 1].Index, cursorPosition.LineNumber), + new CursorPosition(CurrentLineMatches[RegexIndexInLine - 1].Index + CurrentLineMatches[RegexIndexInLine - 1].Length, cursorPosition.LineNumber))); + } + return new InternSearchResult(SearchResult.NotFound, null); + } + public InternSearchResult FindPrevious(PooledList totalLines, CursorPosition cursorPosition) + { + if (IsSearchOpen && MatchingSearchLines != null) + { + //Find the next linnenumber with a match if the line is not in the array of matching lines + CurrentSearchLine = cursorPosition.LineNumber; + int indexInList = Array.IndexOf(MatchingSearchLines, CurrentSearchLine); + if (indexInList == -1) + { + //Find the first line with matches which is smaller than the current line: + var lines = MatchingSearchLines.Where(x => x < CurrentSearchLine); + if (lines.Count() < 1) + { + return new InternSearchResult(SearchResult.ReachedBegin, null); + } + + CurrentSearchArrayIndex = Array.IndexOf(MatchingSearchLines, lines.Last()); + CurrentSearchLine = MatchingSearchLines[CurrentSearchArrayIndex]; + CurrentLineMatches = null; + } + else + { + CurrentSearchArrayIndex = indexInList; + CurrentSearchLine = MatchingSearchLines[CurrentSearchArrayIndex]; + + if (OldSearchArrayIndex != CurrentSearchArrayIndex) + { + OldSearchArrayIndex = CurrentSearchArrayIndex; + CurrentLineMatches = null; + } + } + + //Search went through all matches in the current line: + if (CurrentLineMatches == null || RegexIndexInLine < 0) + { + //back at start + if (CurrentSearchLine == MatchingSearchLines[0]) + { + return new InternSearchResult(SearchResult.ReachedBegin, null); + } + if (CurrentSearchLine < MatchingSearchLines[MatchingSearchLines.Length - 1]) + { + CurrentSearchLine = cursorPosition.LineNumber = MatchingSearchLines[CheckIndexValue(CurrentSearchArrayIndex - 1)]; + CurrentLineMatches = Regex.Matches(totalLines[CurrentSearchLine], SearchParameter.SearchExpression); + RegexIndexInLine = CurrentLineMatches.Count - 1; + CurrentSearchArrayIndex--; + } + } + + if (CurrentLineMatches == null) + return new InternSearchResult(SearchResult.NotFound, null); + + RegexIndexInLine = Math.Clamp(RegexIndexInLine, 0, CurrentLineMatches.Count - 1); + + //RegexIndexInLine--; + if (RegexIndexInLine >= CurrentLineMatches.Count || RegexIndexInLine < 0) + return new InternSearchResult(SearchResult.NotFound, null); + + return new InternSearchResult(SearchResult.Found, new TextSelection( + new CursorPosition(CurrentLineMatches[RegexIndexInLine].Index, cursorPosition.LineNumber), + new CursorPosition(CurrentLineMatches[RegexIndexInLine].Index + CurrentLineMatches[RegexIndexInLine--].Length, cursorPosition.LineNumber))); + } + return new InternSearchResult(SearchResult.NotFound, null); + } + + public void UpdateSearchLines(PooledList totalLines) + { + MatchingSearchLines = FindIndexes(totalLines); + } + + public SearchResult BeginSearch(PooledList totalLines, string word, bool matchCase, bool wholeWord) + { + SearchParameter = new SearchParameter(word, wholeWord, matchCase); + UpdateSearchLines(totalLines); + + if (word == "" || word == null) + return SearchResult.InvalidInput; + + //A result was found + if (MatchingSearchLines.Length > 0) + { + IsSearchOpen = true; + } + + return MatchingSearchLines.Length > 0 ? SearchResult.Found : SearchResult.NotFound; + } + public void EndSearch() + { + IsSearchOpen = false; + MatchingSearchLines = null; + } + + private int[] FindIndexes(PooledList totalLines) + { + List results = new List(); + for (int i = 0; i < totalLines.Count; i++) + { + if (totalLines[i].Contains(SearchParameter)) + results.Add(i); + }; + return results.ToArray(); + } + } + internal class SearchParameter + { + public SearchParameter(string word, bool wholeWord = false, bool matchCase = false) + { + this.Word = word; + this.WholeWord = wholeWord; + this.MatchCase = matchCase; + + if (wholeWord) + SearchExpression += @"\b" + (matchCase ? "" : "(?i)") + Regex.Escape(word) + @"\b"; + else + SearchExpression += (matchCase ? "" : "(?i)") + Regex.Escape(word); + } + + public bool WholeWord { get; set; } + public bool MatchCase { get; set; } + public string Word { get; set; } + public string SearchExpression { get; set; } = ""; + } + + internal struct InternSearchResult + { + public InternSearchResult(SearchResult result, TextSelection selection) + { + this.Result = result; + this.Selection = selection; + } + + public TextSelection Selection; + public SearchResult Result; + } +} \ No newline at end of file diff --git a/TextControlBox/Helper/TabSpaceHelper.cs b/TextControlBox/Helper/TabSpaceHelper.cs new file mode 100644 index 0000000..32fda63 --- /dev/null +++ b/TextControlBox/Helper/TabSpaceHelper.cs @@ -0,0 +1,74 @@ +using Collections.Pooled; +using System; + +namespace TextControlBoxNS.Helper +{ + internal class TabSpaceHelper + { + private int _NumberOfSpaces = 4; + private string OldSpaces = " "; + + public int NumberOfSpaces + { + get => _NumberOfSpaces; + set + { + if (value != _NumberOfSpaces) + { + OldSpaces = Spaces; + _NumberOfSpaces = value; + Spaces = new string(' ', _NumberOfSpaces); + } + } + } + public bool UseSpacesInsteadTabs = false; + public string TabCharacter { get => UseSpacesInsteadTabs ? Spaces : Tab; } + private string Spaces = " "; + private string Tab = "\t"; + + public void UpdateNumberOfSpaces(PooledList totalLines) + { + ReplaceSpacesToSpaces(totalLines); + } + + public void UpdateTabs(PooledList totalLines) + { + if (UseSpacesInsteadTabs) + ReplaceTabsToSpaces(totalLines); + else + ReplaceSpacesToTabs(totalLines); + } + public string UpdateTabs(string input) + { + if (UseSpacesInsteadTabs) + return Replace(input, Tab, Spaces); + return Replace(input, Spaces, Tab); + } + + private void ReplaceSpacesToSpaces(PooledList totalLines) + { + for (int i = 0; i < totalLines.Count; i++) + { + totalLines[i] = Replace(totalLines[i], OldSpaces, Spaces); + } + } + private void ReplaceSpacesToTabs(PooledList TotalLines) + { + for (int i = 0; i < TotalLines.Count; i++) + { + TotalLines[i] = Replace(TotalLines[i], Spaces, Tab); + } + } + private void ReplaceTabsToSpaces(PooledList totalLines) + { + for (int i = 0; i < totalLines.Count; i++) + { + totalLines[i] = Replace(totalLines[i], "\t", Spaces); + } + } + public string Replace(string input, string find, string replace) + { + return input.Replace(find, replace, StringComparison.OrdinalIgnoreCase); + } + } +} diff --git a/TextControlBox/Helper/TextLayoutHelper.cs b/TextControlBox/Helper/TextLayoutHelper.cs new file mode 100644 index 0000000..0718cb7 --- /dev/null +++ b/TextControlBox/Helper/TextLayoutHelper.cs @@ -0,0 +1,64 @@ +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.UI.Xaml.Media; +using Windows.Foundation; + +namespace TextControlBoxNS.Helper +{ + internal class TextLayoutHelper + { + public static CanvasTextLayout CreateTextResource(ICanvasResourceCreatorWithDpi resourceCreator, CanvasTextLayout textLayout, CanvasTextFormat textFormat, string text, Size targetSize) + { + if (textLayout != null) + textLayout.Dispose(); + + textLayout = CreateTextLayout(resourceCreator, textFormat, text, targetSize); + textLayout.Options = CanvasDrawTextOptions.EnableColorFont; + return textLayout; + } + public static CanvasTextFormat CreateCanvasTextFormat(float zoomedFontSize, FontFamily fontFamily) + { + return CreateCanvasTextFormat(zoomedFontSize, zoomedFontSize + 2, fontFamily); + } + + public static CanvasTextFormat CreateCanvasTextFormat(float zoomedFontSize, float lineSpacing, FontFamily fontFamily) + { + CanvasTextFormat textFormat = new CanvasTextFormat() + { + FontSize = zoomedFontSize, + HorizontalAlignment = CanvasHorizontalAlignment.Left, + VerticalAlignment = CanvasVerticalAlignment.Top, + WordWrapping = CanvasWordWrapping.NoWrap, + LineSpacing = lineSpacing, + }; + textFormat.IncrementalTabStop = zoomedFontSize * 3; //default 137px + textFormat.FontFamily = fontFamily.Source; + textFormat.TrimmingGranularity = CanvasTextTrimmingGranularity.None; + textFormat.TrimmingSign = CanvasTrimmingSign.None; + return textFormat; + } + public static CanvasTextLayout CreateTextLayout(ICanvasResourceCreator resourceCreator, CanvasTextFormat textFormat, string text, Size canvasSize) + { + return new CanvasTextLayout(resourceCreator, text, textFormat, (float)canvasSize.Width, (float)canvasSize.Height); + } + public static CanvasTextLayout CreateTextLayout(ICanvasResourceCreator resourceCreator, CanvasTextFormat textFormat, string text, float width, float height) + { + return new CanvasTextLayout(resourceCreator, text, textFormat, width, height); + } + public static CanvasTextFormat CreateLinenumberTextFormat(float fontSize, FontFamily fontFamily) + { + CanvasTextFormat textFormat = new CanvasTextFormat() + { + FontSize = fontSize, + HorizontalAlignment = CanvasHorizontalAlignment.Right, + VerticalAlignment = CanvasVerticalAlignment.Top, + WordWrapping = CanvasWordWrapping.NoWrap, + LineSpacing = fontSize + 2, + }; + textFormat.FontFamily = fontFamily.Source; + textFormat.TrimmingGranularity = CanvasTextTrimmingGranularity.None; + textFormat.TrimmingSign = CanvasTrimmingSign.None; + return textFormat; + } + } +} diff --git a/TextControlBox/Helper/Utils.cs b/TextControlBox/Helper/Utils.cs new file mode 100644 index 0000000..3d1d05d --- /dev/null +++ b/TextControlBox/Helper/Utils.cs @@ -0,0 +1,160 @@ +using Collections.Pooled; +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.UI.Xaml; +using System; +using System.Diagnostics; +using System.Threading.Tasks; +using TextControlBoxNS.Extensions; +using Windows.Foundation; +using Windows.System; +using Windows.UI.Core; +using Windows.UI.Popups; + +namespace TextControlBoxNS.Helper +{ + internal class Utils + { + public static Size MeasureTextSize(CanvasDevice device, string text, CanvasTextFormat textFormat, float limitedToWidth = 0.0f, float limitedToHeight = 0.0f) + { + CanvasTextLayout layout = new CanvasTextLayout(device, text, textFormat, limitedToWidth, limitedToHeight); + return new Size(layout.DrawBounds.Width, layout.DrawBounds.Height); + } + + public static Size MeasureLineLenght(CanvasDevice device, string text, CanvasTextFormat textFormat) + { + if (text.Length == 0) + return new Size(0, 0); + + //If the text starts with a tab or a whitespace, replace it with the last character of the line, to + //get the actual width of the line, because tabs and whitespaces at the beginning are not counted to the lenght + //Do the same for the end + double placeholderWidth = 0; + if (text.StartsWith('\t') || text.StartsWith(' ')) + { + text = text.Insert(0, "|"); + placeholderWidth += MeasureTextSize(device, "|", textFormat).Width; + } + if (text.EndsWith('\t') || text.EndsWith(' ')) + { + text = text += "|"; + placeholderWidth += MeasureTextSize(device, "|", textFormat).Width; + } + + CanvasTextLayout layout = new CanvasTextLayout(device, text, textFormat, 0, 0); + return new Size(layout.DrawBounds.Width - placeholderWidth, layout.DrawBounds.Height); + } + + //Get the longest line in the textbox + public static int GetLongestLineIndex(PooledList totalLines) + { + int longestIndex = 0; + int oldLenght = 0; + for (int i = 0; i < totalLines.Count; i++) + { + var lenght = totalLines[i].Length; + if (lenght > oldLenght) + { + longestIndex = i; + oldLenght = lenght; + } + } + return longestIndex; + } + public static int GetLongestLineLength(string text) + { + var splitted = text.Split("\n"); + int oldLenght = 0; + for (int i = 0; i < splitted.Length; i++) + { + var lenght = splitted[i].Length; + if (lenght > oldLenght) + { + oldLenght = lenght; + } + } + return oldLenght; + } + + public static bool CursorPositionsAreEqual(CursorPosition first, CursorPosition second) + { + return first.LineNumber == second.LineNumber && first.CharacterPosition == second.CharacterPosition; + } + + public static string[] SplitAt(string text, int index) + { + string first = index < text.Length ? text.SafeRemove(index) : text; + string second = index < text.Length ? text.Safe_Substring(index) : ""; + return new string[] { first, second }; + } + + public static int CountCharacters(PooledList totalLines) + { + int count = 0; + for (int i = 0; i < totalLines.Count; i++) + { + count += totalLines[i].Length + 1; + } + return count - 1; + } + public static bool IsKeyPressed(VirtualKey key) + { + return Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(key).HasFlag(CoreVirtualKeyStates.Down); + } + public static async Task IsOverTextLimit(int textLength) + { + if (textLength > 100000000) + { + await new MessageDialog("Current textlimit is 100 million characters, but your file has " + textLength + " characters").ShowAsync(); + return true; + } + return false; + } + public static void Benchmark(Action action, string text) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + action.Invoke(); + sw.Stop(); + + Debug.WriteLine(text + " took " + sw.ElapsedMilliseconds + "::" + sw.ElapsedTicks); + } + + public static ApplicationTheme ConvertTheme(ElementTheme theme) + { + switch (theme) + { + case ElementTheme.Light: return ApplicationTheme.Light; + case ElementTheme.Dark: return ApplicationTheme.Dark; + case ElementTheme.Default: + var defaultTheme = new Windows.UI.ViewManagement.UISettings(); + return defaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString() == "#FF000000" + ? ApplicationTheme.Dark : ApplicationTheme.Light; + + default: return ApplicationTheme.Light; + } + } + + public static Point GetTextboxstartingPoint(UIElement relativeTo) + { + return relativeTo.TransformToVisual(Window.Current.Content).TransformPoint(new Point(0, 0)); + } + + public static int CountLines(string text, string newLineCharacter) + { + return (text.Length - text.Replace(newLineCharacter, "").Length) / newLineCharacter.Length + 1; + } + + public static Rect CreateRect(Rect rect, float marginLeft = 0, float marginTop = 0) + { + return new Rect( + new Point( + Math.Floor(rect.Left + marginLeft),//X + Math.Floor(rect.Top + marginTop)), //Y + new Point( + Math.Ceiling(rect.Right + marginLeft), //Width + Math.Ceiling(rect.Bottom + marginTop))); //Height + } + + } +} diff --git a/TextControlBox/Languages/Languages.cs b/TextControlBox/Languages/Languages.cs new file mode 100644 index 0000000..87a2e87 --- /dev/null +++ b/TextControlBox/Languages/Languages.cs @@ -0,0 +1,511 @@ +namespace TextControlBoxNS.Languages +{ + internal class Batch : CodeLanguage + { + public Batch() + { + this.Name = "Batch"; + this.Author = "Julius Kirsch"; + this.Filter = new string[1] { ".bat" }; + this.Description = "Syntax highlighting for Batch language"; + this.Highlights = new SyntaxHighlights[] + { + new SyntaxHighlights("\\b([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?\\b", "#dd00dd", "#ff00ff"), + new SyntaxHighlights("(?i)(set|echo|for|pushd|popd|pause|exit|cd|if|else|goto|del)\\s", "#dd00dd", "#dd00dd"), + new SyntaxHighlights("(:.*)", "#00C000", "#ffff00"), + new SyntaxHighlights("(\\\".+?\\\"|\\'.+?\\')", "#00C000", "#ffff00"), + new SyntaxHighlights("(@|%)", "#dd0077", "#dd0077"), + new SyntaxHighlights("(\\*)", "#dd0077", "#dd0077"), + new SyntaxHighlights("((?i)rem.*)", "#888888", "#888888"), + }; + } + } + internal class ConfigFile : CodeLanguage + { + public ConfigFile() + { + this.Name = "ConfigFile"; + this.Author = "Finn Freitag"; + this.Filter = new string[1] { ".ini" }; + this.Description = "Syntax highlighting for configuration files"; + this.AutoPairingPair = new AutoPairingPair[] + { + new AutoPairingPair("[", "]") + }; + this.Highlights = new SyntaxHighlights[] + { + new SyntaxHighlights("[\\[\\]]", "#0000FF", "#0000FF"), + new SyntaxHighlights("\\[[\\t\\s]*(\\w+)[\\t\\s]*\\]", "#9900FF", "#9900FF"), + new SyntaxHighlights("(\\w+)\\=", "#DDDD00", "#DDDD00"), + new SyntaxHighlights("\\=(.+)", "#EE0000", "#EE0000"), + new SyntaxHighlights(";.*", "#888888", "#888888"), + }; + } + } + internal class Cpp : CodeLanguage + { + public Cpp() + { + this.Name = "C++"; + this.Author = "Julius Kirsch"; + this.Filter = new string[6] { ".cpp", ".cxx", ".cc", ".hpp", ".h", ".c" }; + this.Description = "Syntax highlighting for C++ language"; + this.AutoPairingPair = new AutoPairingPair[5] + { + new AutoPairingPair("{", "}"), + new AutoPairingPair("[", "]"), + new AutoPairingPair("(", ")"), + new AutoPairingPair("\""), + new AutoPairingPair("\'") + }; + this.Highlights = new SyntaxHighlights[] + { + new SyntaxHighlights("\\b([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?\\b", "#dd00dd", "#00ff00"), + new SyntaxHighlights("(?!\\/]+)[^>]*>", "#969696", "#0099ff"), + new SyntaxHighlights("<+[/]+[a-zA-Z0-9:?\\-_]+>", "#969696", "#0099ff"), + new SyntaxHighlights("<[a-zA-Z0-9:?\\-]+?.*\\/>", "#969696", "#0099ff"), + new SyntaxHighlights("\"[^\\n]*?\"", "#00CA00", "#00FF00"), + new SyntaxHighlights("'[^\\n]*?'", "#00CA00", "#00FF00"), + new SyntaxHighlights("[0-9]+(px|rem|em|vh|vw|px|pt|pc|in|mm|cm|deg|%)", "#ff00ff", "#dd00dd"), + new SyntaxHighlights("", "#888888", "#888888"), + }; + } + } + internal class Java : CodeLanguage + { + public Java() + { + this.Name = "Java"; + this.Author = "Julius Kirsch"; + this.Filter = new string[2] { ".java", ".class" }; + this.Description = "Syntax highlighting for Java language"; + this.AutoPairingPair = new AutoPairingPair[5] + { + new AutoPairingPair("{", "}"), + new AutoPairingPair("[", "]"), + new AutoPairingPair("(", ")"), + new AutoPairingPair("\""), + new AutoPairingPair("\'") + }; + this.Highlights = new SyntaxHighlights[] + { + new SyntaxHighlights("\\b([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?\\b", "#ff00ff", "#ff00ff"), + new SyntaxHighlights("(?|\\<|\\?|&|\\||\\~|\\^)", "#77FF77", "#77FF77"), + new SyntaxHighlights("\\b([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?\\b", "#ff00ff", "#ff00ff"), + new SyntaxHighlights("(?", "#FF0000", "#FF0000"), + new SyntaxHighlights("(?|\\<|\\?|&|\\||\\~|\\^)", "#77FF77", "#77FF77"), + new SyntaxHighlights("\\$\\w+", "#440044", "#FFBBFF"), + new SyntaxHighlights("\"[^\\n]*?\"", "#ff5500", "#00FF00"), + new SyntaxHighlights("\\'[^\\n]*?\\'", "#ff5500", "#00FF00"), + new SyntaxHighlights("\"/[^\\n]*/i{0,1}\"", "#ff5500", "#00FF00"), + new SyntaxHighlights("/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/", "#888888", "#646464"), + new SyntaxHighlights("\\/\\/.*", "#888888", "#646464"), + }; + } + } + internal class QSharp : CodeLanguage + { + public QSharp() + { + this.Name = "QSharp"; + this.Author = "Finn Freitag"; + this.Filter = new string[1] { ".qs" }; + this.Description = "Syntax highlighting for QSharp language"; + this.AutoPairingPair = new AutoPairingPair[5] + { + new AutoPairingPair("{", "}"), + new AutoPairingPair("[", "]"), + new AutoPairingPair("(", ")"), + new AutoPairingPair("\""), + new AutoPairingPair("\'") + }; + + this.Highlights = new SyntaxHighlights[] + { + new SyntaxHighlights("\\W", "#BB0000", "#BB0000"), + new SyntaxHighlights("\\/\\/.*", "#888888", "#646464"), + new SyntaxHighlights("\\b(namespace|open|operation|using|let|H|M|Reset|return)\\b", "#0066bb", "#00ffff"), + new SyntaxHighlights("\\b(Qubit|Result)\\b", "#00bb66", "#00ff00"), + }; + } + } + internal class XML : CodeLanguage + { + public XML() + { + this.Name = "XML"; + this.Author = "Julius Kirsch"; + this.Filter = new string[2] { ".xml", ".xaml" }; + this.Description = "Syntax highlighting for Xml language"; + this.Highlights = new SyntaxHighlights[] + { + new SyntaxHighlights("\\b([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?\\b", "#dd00dd", "#ff00ff"), + new SyntaxHighlights("<([^ >!\\/]+)[^>]*>", "#969696", "#0099ff"), + new SyntaxHighlights("<+[/]+[a-zA-Z0-9:?\\-_]+>", "#969696", "#0099ff"), + new SyntaxHighlights("<[a-zA-Z0-9:?\\-]+?.*\\/>", "#969696", "#0099ff"), + new SyntaxHighlights("[-A-Za-z_]+\\=", "#00CA00", "#Ff0000"), + new SyntaxHighlights("\"[^\\n]*?\"", "#00CA00", "#00FF00"), + new SyntaxHighlights("'[^\\n]*?'", "#00CA00", "#00FF00"), + new SyntaxHighlights("", "#888888", "#888888"), + }; + } + } + internal class Python : CodeLanguage + { + public Python() + { + this.Name = "Python"; + this.Author = "Julius Kirsch"; + this.Filter = new string[1] { ".py" }; + this.Description = "Syntax highlighting for Python language"; + this.AutoPairingPair = new AutoPairingPair[6] + { + new AutoPairingPair("{", "}"), + new AutoPairingPair("[", "]"), + new AutoPairingPair("(", ")"), + new AutoPairingPair("`", "`"), + new AutoPairingPair("\""), + new AutoPairingPair("\'") + }; + + this.Highlights = new SyntaxHighlights[] + { + new SyntaxHighlights("\\b([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?\\b", "#dd00dd", "#ff00ff"), + new SyntaxHighlights("\\b(and|as|assert|break|class|continue|def|del|elif|else|except|False|finally|for|from|global|if|import|in|is|lambda|None|nonlocal|not|or|pass|raise|return|True|try|while|with|yield)\\b", "#aa00cc", "#cc00ff"), + new SyntaxHighlights("(?~\"'`\\-\\+|\\^\\!_]", "#FF0000", "#FF0000"), + new SyntaxHighlights("#", "#0000FF", "#0000FF"), + new SyntaxHighlights("\\*.*\\*", "#000000", "#FFFFFF", false, true), + new SyntaxHighlights("_.*_", "#000000", "#FFFFFF", false, true), + new SyntaxHighlights("\\*\\*.*\\*\\*", "#000000", "#FFFFFF", true), + new SyntaxHighlights("__.*__", "#000000", "#FFFFFF", true), + new SyntaxHighlights("\\d+\\.", "#00FF00", "#00FF00"), + new SyntaxHighlights("[\\[\\]\\(\\)]", "#FFFF00", "#FFFF00") + }; + } + } + internal class CSS : CodeLanguage + { + public CSS() + { + this.Name = "CSS"; + this.Author = "Julius Kirsch"; + this.Filter = new string[2] { ".css", ".scss" }; + this.Description = "Syntax highlighting for CSS language"; + this.AutoPairingPair = new AutoPairingPair[5] + { + new AutoPairingPair("{", "}"), + new AutoPairingPair("[", "]"), + new AutoPairingPair("(", ")"), + new AutoPairingPair("\""), + new AutoPairingPair("\'") + }; + this.Highlights = new SyntaxHighlights[] + { + new SyntaxHighlights("[a-zA-Z-]+.*;", "#ff5500", "#00ffff"),//properties + new SyntaxHighlights("\\b([a-zA-Z_-][a-zA-Z0-9_-]*)(?=\\()", "#bb00bb", "#00ff99"),//functions + new SyntaxHighlights(":[a-z].*(?={)", "#0033ff", "#fffd00"),//pseudo classes/elements + new SyntaxHighlights("(.|#|^).*\\s*{", "#227700", "#44ff00"),//classname + new SyntaxHighlights("(?<=\\d)(?:px|%|em|rem|in|cm|mm|pt|pc|ex|ch|vw|vh|vmin|vmax|ms|s)", "#cc0000", "#ff0000"),//units + new SyntaxHighlights("\\b-?\\d+(?:\\.\\d+)?", "#0000ff", "#cc00ff"),//numbers + new SyntaxHighlights("@([^ ]+)", "#8800ff", "#ff0000"),//first word after the @ + new SyntaxHighlights("#[0-9A-Fa-f]{1,8}\\b", "#00bb55", "#cc00ff"),//hexadecimal + new SyntaxHighlights("(\".+?\"|\'.+?\')", "#00aaff", "#ff8800"),//strings + new SyntaxHighlights("(;|:|{|}|,)", "#777777", "#bbbbbb"),//special characters + new SyntaxHighlights("\\/\\*(.|\\n)*?\\*\\/", "#555555", "#888888"),//comments + }; + } + } +} diff --git a/TextControlBox/Models/AutoPairingPair.cs b/TextControlBox/Models/AutoPairingPair.cs new file mode 100644 index 0000000..3b05596 --- /dev/null +++ b/TextControlBox/Models/AutoPairingPair.cs @@ -0,0 +1,45 @@ +namespace TextControlBoxNS +{ + /// + /// Represents a pair of characters used for auto-pairing in text. + /// + public class AutoPairingPair + { + /// + /// Initializes a new instance of the AutoPairingPair class with the same value for both the opening and closing characters. + /// + /// The character value to be used for both opening and closing. + public AutoPairingPair(string value) + { + this.Value = this.Pair = value; + } + + /// + /// Initializes a new instance of the AutoPairingPair class with different values for the opening and closing characters. + /// + /// The character value to be used as the opening character. + /// The character value to be used as the closing character. + public AutoPairingPair(string value, string pair) + { + this.Value = value; + this.Pair = pair; + } + + /// + /// Checks if the provided input contains the opening character of the pair. + /// + /// The input string to check for the opening character. + /// True if the input contains the opening character; otherwise, false. + public bool Matches(string input) => input.Contains(this.Value); + + /// + /// Gets or sets the character value used for the opening part of the auto-pairing pair. + /// + public string Value { get; set; } + + /// + /// Gets or sets the character value used for the closing part of the auto-pairing pair. + /// + public string Pair { get; set; } + } +} diff --git a/TextControlBox/Models/CodeFontStyle.cs b/TextControlBox/Models/CodeFontStyle.cs new file mode 100644 index 0000000..af85aad --- /dev/null +++ b/TextControlBox/Models/CodeFontStyle.cs @@ -0,0 +1,37 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the font style settings for a code element in the text. + /// + public class CodeFontStyle + { + /// + /// Initializes a new instance of the CodeFontStyle class with the specified font style settings. + /// + /// true if the code element should be displayed with an underline; otherwise, false. + /// true if the code element should be displayed in italic font; otherwise, false. + /// true if the code element should be displayed in bold font; otherwise, false. + public CodeFontStyle(bool underlined, bool italic, bool bold) + { + this.Italic = italic; + this.Bold = bold; + this.Underlined = underlined; + } + + /// + /// Gets or sets a value indicating whether the code element should be displayed with an underline. + /// + public bool Underlined { get; set; } + + /// + /// Gets or sets a value indicating whether the code element should be displayed in bold font. + /// + public bool Bold { get; set; } + + /// + /// Gets or sets a value indicating whether the code element should be displayed in italic font. + /// + public bool Italic { get; set; } + } + +} diff --git a/TextControlBox/Models/CodeLanguage.cs b/TextControlBox/Models/CodeLanguage.cs new file mode 100644 index 0000000..dcb98df --- /dev/null +++ b/TextControlBox/Models/CodeLanguage.cs @@ -0,0 +1,39 @@ +namespace TextControlBoxNS +{ + /// + /// Represents a code language configuration used for syntax highlighting and auto-pairing in the text content. + /// + public class CodeLanguage + { + /// + /// Gets or sets the name of the code language. + /// + public string Name { get; set; } + + /// + /// Gets or sets the description of the code language. + /// + public string Description { get; set; } + + /// + /// Gets or sets an array of file filters for the code language. + /// + public string[] Filter { get; set; } + + /// + /// Gets or sets the author of the code language definition. + /// + public string Author { get; set; } + + /// + /// Gets or sets an array of syntax highlights for the code language. + /// + public SyntaxHighlights[] Highlights { get; set; } + + /// + /// Gets or sets an array of auto-pairing pairs for the code language. + /// + public AutoPairingPair[] AutoPairingPair { get; set; } + } + +} diff --git a/TextControlBox/Models/CodeLanguageId.cs b/TextControlBox/Models/CodeLanguageId.cs new file mode 100644 index 0000000..2a148be --- /dev/null +++ b/TextControlBox/Models/CodeLanguageId.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TextControlBoxNS.Languages; + +namespace TextControlBoxNS +{ + /// + /// Represents the unique identifiers for different code languages used for syntax highlighting. + /// + public enum CodeLanguageId + { + INI, + /// + /// Identifier for Batch code language. + /// + Batch, + + /// + /// Identifier for C++ code language. + /// + Cpp, + + /// + /// Identifier for C# code language. + /// + CSharp, + + /// + /// Identifier for configuration file code language. + /// + ConfigFile, + + /// + /// Identifier for CSS code language. + /// + CSS, + + /// + /// Identifier for CSV code language. + /// + CSV, + + /// + /// Identifier for GCode code language. + /// + GCode, + + /// + /// Identifier for HexFile code language. + /// + HexFile, + + /// + /// Identifier for HTML code language. + /// + Html, + + /// + /// Identifier for Java code language. + /// + Java, + + /// + /// Identifier for JavaScript code language. + /// + Javascript, + + /// + /// Identifier for JSON code language. + /// + Json, + + /// + /// Identifier for LaTeX code language. + /// + Latex, + + /// + /// Identifier for Markdown code language. + /// + Markdown, + + /// + /// Identifier for PHP code language. + /// + PHP, + + /// + /// Identifier for Python code language. + /// + Python, + + /// + /// Identifier for Q# code language. + /// + QSharp, + + /// + /// Identifier for TOML code language. + /// + TOML, + + /// + /// Identifier for XML code language. + /// + XML, + + /// + /// Identifier for no code language. + /// + None, + } +} diff --git a/TextControlBox/Models/CursorPosition.cs b/TextControlBox/Models/CursorPosition.cs new file mode 100644 index 0000000..659e9fc --- /dev/null +++ b/TextControlBox/Models/CursorPosition.cs @@ -0,0 +1,51 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the position of the cursor in the textbox. + /// + /// + /// The CursorPosition class stores the position of the cursor within the textbox. + /// It consists of two properties: CharacterPosition and LineNumber. + /// The CharacterPosition property indicates the index of the cursor within the current line (zero-based index). + /// The LineNumber property represents the line number on which the cursor is currently positioned (zero-based index). + /// + public class CursorPosition + { + internal CursorPosition(int characterPosition = 0, int lineNumber = 0) + { + this.CharacterPosition = characterPosition; + this.LineNumber = lineNumber; + } + internal CursorPosition(CursorPosition currentCursorPosition) + { + if (currentCursorPosition == null) + return; + + this.CharacterPosition = currentCursorPosition.CharacterPosition; + this.LineNumber = currentCursorPosition.LineNumber; + } + /// + /// Gets the character position of the cursor within the current line. + /// + public int CharacterPosition { get; internal set; } = 0; + /// + /// Gets the line number in which the cursor is currently positioned. + /// + public int LineNumber { get; internal set; } = 0; + + internal void AddToCharacterPos(int add) + { + CharacterPosition += add; + } + internal void SubtractFromCharacterPos(int subtract) + { + CharacterPosition -= subtract; + if (CharacterPosition < 0) + CharacterPosition = 0; + } + internal static CursorPosition ChangeLineNumber(CursorPosition currentCursorPosition, int lineNumber) + { + return new CursorPosition(currentCursorPosition.CharacterPosition, lineNumber); + } + } +} diff --git a/TextControlBox/Models/CursorSize.cs b/TextControlBox/Models/CursorSize.cs new file mode 100644 index 0000000..9f3b7ec --- /dev/null +++ b/TextControlBox/Models/CursorSize.cs @@ -0,0 +1,43 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the size of the cursor in the textbox. + /// + public class CursorSize + { + /// + /// Creates a new instance of the CursorSize class + /// + /// The width of the cursor + /// The height of the cursor + /// The x-offset from the actual cursor position + /// The y-offset from the actual cursor position + public CursorSize(float width = 0, float height = 0, float offsetX = 0, float offsetY = 0) + { + this.Width = width; + this.Height = height; + this.OffsetX = offsetX; + this.OffsetY = offsetY; + } + + /// + /// The width of the cursor + /// + public float Width { get; private set; } + + /// + /// The height of the cursor + /// + public float Height { get; private set; } + + /// + /// The left/right offset from the actual cursor position + /// + public float OffsetX { get; private set; } + + /// + /// The top/bottom offset from the actual cursor position + /// + public float OffsetY { get; private set; } + } +} diff --git a/TextControlBox/Models/JsonCodeLanguage.cs b/TextControlBox/Models/JsonCodeLanguage.cs new file mode 100644 index 0000000..2b25d71 --- /dev/null +++ b/TextControlBox/Models/JsonCodeLanguage.cs @@ -0,0 +1,11 @@ +namespace TextControlBoxNS +{ + internal class JsonCodeLanguage + { + public string Name { get; set; } + public string Description { get; set; } + public string Filter { get; set; } + public string Author { get; set; } + public SyntaxHighlights[] Highlights; + } +} diff --git a/TextControlBox/Models/JsonLoadResult.cs b/TextControlBox/Models/JsonLoadResult.cs new file mode 100644 index 0000000..5ba519a --- /dev/null +++ b/TextControlBox/Models/JsonLoadResult.cs @@ -0,0 +1,29 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the result of a JSON load operation for a code language in the textbox. + /// + public class JsonLoadResult + { + /// + /// Initializes a new instance of the JsonLoadResult class with the specified loading status and CodeLanguage. + /// + /// true if the loading operation succeeded; otherwise, false. + /// The CodeLanguage loaded from the JSON data. + public JsonLoadResult(bool succeed, CodeLanguage codeLanguage) + { + this.Succeed = succeed; + this.CodeLanguage = codeLanguage; + } + + /// + /// Gets or sets a value indicating whether the loading operation succeeded. + /// + public bool Succeed { get; set; } + + /// + /// Gets or sets the CodeLanguage that was loaded from the JSON data. + /// + public CodeLanguage CodeLanguage { get; set; } + } +} diff --git a/TextControlBox/Models/ScrollBarPosition.cs b/TextControlBox/Models/ScrollBarPosition.cs new file mode 100644 index 0000000..8f67eb0 --- /dev/null +++ b/TextControlBox/Models/ScrollBarPosition.cs @@ -0,0 +1,40 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the position of a scrollbar, containing the horizontal and vertical scroll positions. + /// + public class ScrollBarPosition + { + /// + /// Initializes a new instance of the ScrollBarPosition class with the provided values. + /// + /// The existing ScrollBarPosition object from which to copy the values. + + public ScrollBarPosition(ScrollBarPosition scrollBarPosition) + { + this.ValueX = scrollBarPosition.ValueX; + this.ValueY = scrollBarPosition.ValueY; + } + + /// + /// Creates a new instance of the ScrollBarPosition class + /// + /// The horizontal amount scrolled + /// The vertical amount scrolled + public ScrollBarPosition(double valueX = 0, double valueY = 0) + { + this.ValueX = valueX; + this.ValueY = valueY; + } + + /// + /// The amount scrolled horizontally + /// + public double ValueX { get; set; } + + /// + /// The amount scrolled vertically + /// + public double ValueY { get; set; } + } +} diff --git a/TextControlBox/Models/SelectionChangedEventHandler.cs b/TextControlBox/Models/SelectionChangedEventHandler.cs new file mode 100644 index 0000000..04c5361 --- /dev/null +++ b/TextControlBox/Models/SelectionChangedEventHandler.cs @@ -0,0 +1,28 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the class that will be returned by the SelectionChanged event of the TextControlBox. + /// + public class SelectionChangedEventHandler + { + /// + /// Represents the position of the cursor within the current line. + /// + public int CharacterPositionInLine { get; set; } + + /// + /// Represents the line number where the cursor is currently located. + /// + public int LineNumber { get; set; } + + /// + /// Represents the starting index of the selection. + /// + public int SelectionStartIndex { get; set; } + + /// + /// Represents the length of the selection. + /// + public int SelectionLength { get; set; } + } +} diff --git a/TextControlBox/Models/SyntaxHighlights.cs b/TextControlBox/Models/SyntaxHighlights.cs new file mode 100644 index 0000000..33c5dab --- /dev/null +++ b/TextControlBox/Models/SyntaxHighlights.cs @@ -0,0 +1,71 @@ +using System.Drawing; +using TextControlBoxNS.Extensions; + +namespace TextControlBoxNS +{ + /// + /// Represents a syntax highlight definition for a specific pattern in the text. + /// + public class SyntaxHighlights + { + private readonly ColorConverter ColorConverter = new ColorConverter(); + + /// + /// Initializes a new instance of the SyntaxHighlights class with the specified pattern, colors, and font styles. + /// + /// The pattern to be highlighted in the text content. + /// The color representation for the pattern in the light theme (e.g., "#RRGGBB" format). + /// The color representation for the pattern in the dark theme (e.g., "#RRGGBB" format). + /// true if the pattern should be displayed in bold font; otherwise, false. + /// true if the pattern should be displayed in italic font; otherwise, false. + /// true if the pattern should be displayed with an underline; otherwise, false. + public SyntaxHighlights(string pattern, string colorLight, string colorDark, bool bold = false, bool italic = false, bool underlined = false) + { + this.Pattern = pattern; + this.ColorDark = colorDark; + this.ColorLight = colorLight; + + if (underlined || italic || bold) + this.CodeStyle = new CodeFontStyle(underlined, italic, bold); + } + + /// + /// Gets or sets the font style for the pattern. + /// + public CodeFontStyle CodeStyle { get; set; } = null; + + /// + /// Gets or sets the pattern to be highlighted in the text content. + /// + public string Pattern { get; set; } + + /// + /// Gets the color representation for the pattern in the dark theme. + /// + public Windows.UI.Color ColorDark_Clr { get; private set; } + + /// + /// Gets the color representation for the pattern in the light theme. + /// + public Windows.UI.Color ColorLight_Clr { get; private set; } + + /// + /// Sets the color representation for the pattern in the dark theme. + /// + /// The color representation for the pattern in the dark theme (e.g., "#RRGGBB" format). + public string ColorDark + { + set => ColorDark_Clr = ((Color)ColorConverter.ConvertFromString(value)).ToMediaColor(); + } + + /// + /// Sets the color representation for the pattern in the light theme. + /// + /// The color representation for the pattern in the light theme (e.g., "#RRGGBB" format). + public string ColorLight + { + set => ColorLight_Clr = ((Color)ColorConverter.ConvertFromString(value)).ToMediaColor(); + } + } + +} diff --git a/TextControlBox/Models/TextControlBoxDesign.cs b/TextControlBox/Models/TextControlBoxDesign.cs new file mode 100644 index 0000000..bd78bde --- /dev/null +++ b/TextControlBox/Models/TextControlBoxDesign.cs @@ -0,0 +1,89 @@ +using Microsoft.UI.Xaml.Media; +using Windows.UI; + +namespace TextControlBoxNS +{ + /// + /// Represents the design settings for the textbox. + /// + public class TextControlBoxDesign + { + /// + /// Create an instance of the TextControlBoxDesign from a given design + /// + /// The design to create a new instance from + public TextControlBoxDesign(TextControlBoxDesign design) + { + this.Background = design.Background; + this.TextColor = design.TextColor; + this.SelectionColor = design.SelectionColor; + this.CursorColor = design.CursorColor; + this.LineHighlighterColor = design.LineHighlighterColor; + this.LineNumberColor = design.LineNumberColor; + this.LineNumberBackground = design.LineNumberBackground; + } + + /// + /// Create a new instance of the TextControlBoxDesign class + /// + /// The background color of the textbox + /// The color of the text + /// The color of the selection + /// The color of the cursor + /// The color of the linehighlighter + /// The color of the linenumber + /// The background color of the linenumbers + /// The color of the search highlights + public TextControlBoxDesign(Brush background, Color textColor, Color selectionColor, Color cursorColor, Color lineHighlighterColor, Color lineNumberColor, Color lineNumberBackground, Color searchHighlightColor) + { + this.Background = background; + this.TextColor = textColor; + this.SelectionColor = selectionColor; + this.CursorColor = cursorColor; + this.LineHighlighterColor = lineHighlighterColor; + this.LineNumberColor = lineNumberColor; + this.LineNumberBackground = lineNumberBackground; + this.SearchHighlightColor = searchHighlightColor; + } + + /// + /// Gets or sets the background color of the textbox. + /// + public Brush Background { get; set; } + + /// + /// Gets or sets the text color of the textbox. + /// + public Color TextColor { get; set; } + + /// + /// Gets or sets the color of the selected text in the textbox. + /// + public Color SelectionColor { get; set; } + + /// + /// Gets or sets the color of the cursor in the textbox. + /// + public Color CursorColor { get; set; } + + /// + /// Gets or sets the color of the line highlighter in the textbox. + /// + public Color LineHighlighterColor { get; set; } + + /// + /// Gets or sets the color of the line numbers in the textbox. + /// + public Color LineNumberColor { get; set; } + + /// + /// Gets or sets the background color of the line numbers in the textbox. + /// + public Color LineNumberBackground { get; set; } + + /// + /// Gets or sets the color used to highlight search results in the textbox. + /// + public Color SearchHighlightColor { get; set; } + } +} diff --git a/TextControlBox/Models/TextSelection.cs b/TextControlBox/Models/TextSelection.cs new file mode 100644 index 0000000..391e761 --- /dev/null +++ b/TextControlBox/Models/TextSelection.cs @@ -0,0 +1,52 @@ +namespace TextControlBoxNS.Text +{ + internal class TextSelection + { + public TextSelection() + { + Index = 0; + Length = 0; + StartPosition = null; + EndPosition = null; + } + public TextSelection(int index = 0, int length = 0, CursorPosition startPosition = null, CursorPosition endPosition = null) + { + Index = index; + Length = length; + StartPosition = startPosition; + EndPosition = endPosition; + } + public TextSelection(CursorPosition startPosition = null, CursorPosition endPosition = null) + { + StartPosition = startPosition; + EndPosition = endPosition; + } + public TextSelection(TextSelection textSelection) + { + StartPosition = new CursorPosition(textSelection.StartPosition); + EndPosition = new CursorPosition(textSelection.EndPosition); + Index = textSelection.Index; + Length = textSelection.Length; + } + + public int Index { get; set; } + public int Length { get; set; } + + public CursorPosition StartPosition { get; set; } + public CursorPosition EndPosition { get; set; } + + public bool IsLineInSelection(int line) + { + if (this.StartPosition != null && this.EndPosition != null) + { + if (this.StartPosition.LineNumber > this.EndPosition.LineNumber) + return this.StartPosition.LineNumber < line && this.EndPosition.LineNumber > line; + else if (this.StartPosition.LineNumber == this.EndPosition.LineNumber) + return this.StartPosition.LineNumber != line; + else + return this.StartPosition.LineNumber > line && this.EndPosition.LineNumber < line; + } + return false; + } + } +} diff --git a/TextControlBox/Models/TextSelectionPosition.cs b/TextControlBox/Models/TextSelectionPosition.cs new file mode 100644 index 0000000..6b843da --- /dev/null +++ b/TextControlBox/Models/TextSelectionPosition.cs @@ -0,0 +1,29 @@ +namespace TextControlBoxNS +{ + /// + /// Represents the position and length of a text selection in the textbox. + /// + public class TextSelectionPosition + { + /// + /// Initializes a new instance of the TextSelectionPosition class with the specified index and length. + /// + /// The start index of the text selection. + /// The length of the text selection. + public TextSelectionPosition(int index = 0, int length = 0) + { + this.Index = index; + this.Length = length; + } + + /// + /// Gets or sets the start index of the text selection. + /// + public int Index { get; set; } + + /// + /// Gets or sets the length of the text selection. + /// + public int Length { get; set; } + } +} diff --git a/TextControlBox/Models/UndoRedoItem.cs b/TextControlBox/Models/UndoRedoItem.cs new file mode 100644 index 0000000..5ccde81 --- /dev/null +++ b/TextControlBox/Models/UndoRedoItem.cs @@ -0,0 +1,14 @@ +using TextControlBoxNS.Text; + +namespace TextControlBoxNS.Models +{ + internal struct UndoRedoItem + { + public int StartLine { get; set; } + public string UndoText { get; set; } + public string RedoText { get; set; } + public int UndoCount { get; set; } + public int RedoCount { get; set; } + public TextSelection Selection { get; set; } + } +} diff --git a/TextControlBox/Renderer/CursorRenderer.cs b/TextControlBox/Renderer/CursorRenderer.cs new file mode 100644 index 0000000..c0e8434 --- /dev/null +++ b/TextControlBox/Renderer/CursorRenderer.cs @@ -0,0 +1,52 @@ +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.Graphics.Canvas.UI.Xaml; +using System; +using System.Numerics; +using Windows.Foundation; + +namespace TextControlBoxNS.Renderer +{ + internal class CursorRenderer + { + public static int GetCursorLineFromPoint(Point point, float singleLineHeight, int numberOfRenderedLines, int numberOfStartLine) + { + //Calculate the relative linenumber, where the pointer was pressed at + int linenumber = (int)(point.Y / singleLineHeight); + linenumber += numberOfStartLine; + return Math.Clamp(linenumber, 0, numberOfStartLine + numberOfRenderedLines - 1); + } + public static int GetCharacterPositionFromPoint(string currentLine, CanvasTextLayout textLayout, Point cursorPosition, float marginLeft) + { + if (currentLine == null || textLayout == null) + return 0; + + textLayout.HitTest( + (float)cursorPosition.X - marginLeft, 0, + out var textLayoutRegion); + return textLayoutRegion.CharacterIndex; + } + + //Return the position in pixels of the cursor in the current line + public static float GetCursorPositionInLine(CanvasTextLayout currentLineTextLayout, CursorPosition cursorPosition, float xOffset) + { + if (currentLineTextLayout == null) + return 0; + + return currentLineTextLayout.GetCaretPosition(cursorPosition.CharacterPosition < 0 ? 0 : cursorPosition.CharacterPosition, false).X + xOffset; + } + + //Return the cursor Width + public static void RenderCursor(CanvasTextLayout textLayout, int characterPosition, float xOffset, float y, float fontSize, CursorSize customSize, CanvasDrawEventArgs args, CanvasSolidColorBrush cursorColorBrush) + { + if (textLayout == null) + return; + + Vector2 vector = textLayout.GetCaretPosition(characterPosition < 0 ? 0 : characterPosition, false); + if (customSize == null) + args.DrawingSession.FillRectangle(vector.X + xOffset, y, 1, fontSize, cursorColorBrush); + else + args.DrawingSession.FillRectangle(vector.X + xOffset + customSize.OffsetX, y + customSize.OffsetY, (float)customSize.Width, (float)customSize.Height, cursorColorBrush); + } + } +} diff --git a/TextControlBox/Renderer/LineHighlighterRenderer.cs b/TextControlBox/Renderer/LineHighlighterRenderer.cs new file mode 100644 index 0000000..ffb729c --- /dev/null +++ b/TextControlBox/Renderer/LineHighlighterRenderer.cs @@ -0,0 +1,17 @@ +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.Graphics.Canvas.UI.Xaml; + +namespace TextControlBoxNS.Renderer +{ + internal class LineHighlighterRenderer + { + public static void Render(float canvasWidth, CanvasTextLayout textLayout, float y, float fontSize, CanvasDrawEventArgs args, CanvasSolidColorBrush backgroundBrush) + { + if (textLayout == null) + return; + + args.DrawingSession.FillRectangle(0, y, canvasWidth, fontSize, backgroundBrush); + } + } +} diff --git a/TextControlBox/Renderer/SearchHighlightsRenderer.cs b/TextControlBox/Renderer/SearchHighlightsRenderer.cs new file mode 100644 index 0000000..f3c137c --- /dev/null +++ b/TextControlBox/Renderer/SearchHighlightsRenderer.cs @@ -0,0 +1,47 @@ +using Microsoft.Graphics.Canvas.Text; +using Microsoft.Graphics.Canvas.UI.Xaml; +using System; +using System.Text.RegularExpressions; +using TextControlBoxNS.Helper; +using Windows.UI; + +namespace TextControlBoxNS.Renderer +{ + internal class SearchHighlightsRenderer + { + public static void RenderHighlights( + CanvasDrawEventArgs args, + CanvasTextLayout drawnTextLayout, + string renderedText, + int[] possibleLines, + string searchRegex, + float scrollOffsetX, + float offsetTop, + Color searchHighlightColor) + { + if (searchRegex == null || possibleLines == null || possibleLines.Length == 0) + return; + + MatchCollection matches; + try + { + matches = Regex.Matches(renderedText, searchRegex); + } + catch (ArgumentException) + { + return; + } + for (int j = 0; j < matches.Count; j++) + { + var match = matches[j]; + + var layoutRegion = drawnTextLayout.GetCharacterRegions(match.Index, match.Length); + if (layoutRegion.Length > 0) + { + args.DrawingSession.FillRectangle(Utils.CreateRect(layoutRegion[0].LayoutBounds, scrollOffsetX, offsetTop), searchHighlightColor); + } + } + return; + } + } +} diff --git a/TextControlBox/Renderer/SelectionRenderer.cs b/TextControlBox/Renderer/SelectionRenderer.cs new file mode 100644 index 0000000..d7c59fd --- /dev/null +++ b/TextControlBox/Renderer/SelectionRenderer.cs @@ -0,0 +1,209 @@ +using Microsoft.Graphics.Canvas.Text; +using Microsoft.Graphics.Canvas.UI.Xaml; +using System; +using System.Collections.Generic; +using System.Linq; +using TextControlBoxNS.Helper; +using TextControlBoxNS.Text; +using Windows.Foundation; +using Windows.UI; + +namespace TextControlBoxNS.Renderer +{ + internal class SelectionRenderer + { + public bool HasSelection = false; + public bool IsSelecting = false; + public bool IsSelectingOverLinenumbers = false; + public CursorPosition SelectionStartPosition = null; + public CursorPosition SelectionEndPosition = null; + public int SelectionLength = 0; + public int SelectionStart = 0; + + + //Draw the actual selection and return the cursorposition. Return -1 if no selection was drawn + public TextSelection DrawSelection( + CanvasTextLayout textLayout, + IEnumerable renderedLines, + CanvasDrawEventArgs args, + float marginLeft, + float marginTop, + int unrenderedLinesToRenderStart, + int numberOfRenderedLines, + float fontSize, + Color selectionColor + ) + { + if (HasSelection && SelectionEndPosition != null && SelectionStartPosition != null) + { + int selStartIndex = 0; + int selEndIndex = 0; + int characterPosStart = SelectionStartPosition.CharacterPosition; + int characterPosEnd = SelectionEndPosition.CharacterPosition; + + //Render the selection on position 0 if the user scrolled the start away + if (SelectionEndPosition.LineNumber < SelectionStartPosition.LineNumber) + { + if (SelectionEndPosition.LineNumber < unrenderedLinesToRenderStart) + characterPosEnd = 0; + if (SelectionStartPosition.LineNumber < unrenderedLinesToRenderStart + 1) + characterPosStart = 0; + } + else if (SelectionEndPosition.LineNumber == SelectionStartPosition.LineNumber) + { + if (SelectionStartPosition.LineNumber < unrenderedLinesToRenderStart) + characterPosStart = 0; + if (SelectionEndPosition.LineNumber < unrenderedLinesToRenderStart) + characterPosEnd = 0; + } + else + { + if (SelectionStartPosition.LineNumber < unrenderedLinesToRenderStart) + characterPosStart = 0; + if (SelectionEndPosition.LineNumber < unrenderedLinesToRenderStart + 1) + characterPosEnd = 0; + } + + if (SelectionStartPosition.LineNumber == SelectionEndPosition.LineNumber) + { + int lenghtToLine = 0; + for (int i = 0; i < SelectionStartPosition.LineNumber - unrenderedLinesToRenderStart; i++) + { + if (i < numberOfRenderedLines) + { + lenghtToLine += renderedLines.ElementAt(i).Length + 1; + } + } + + selStartIndex = characterPosStart + lenghtToLine; + selEndIndex = characterPosEnd + lenghtToLine; + } + else + { + for (int i = 0; i < SelectionStartPosition.LineNumber - unrenderedLinesToRenderStart; i++) + { + if (i >= numberOfRenderedLines) //Out of range of the List (do nothing) + break; + selStartIndex += renderedLines.ElementAt(i).Length + 1; + } + selStartIndex += characterPosStart; + + for (int i = 0; i < SelectionEndPosition.LineNumber - unrenderedLinesToRenderStart; i++) + { + if (i >= numberOfRenderedLines) //Out of range of the List (do nothing) + break; + + selEndIndex += renderedLines.ElementAt(i).Length + 1; + } + selEndIndex += characterPosEnd; + } + + SelectionStart = Math.Min(selStartIndex, selEndIndex); + + if (SelectionStart < 0) + SelectionStart = 0; + if (SelectionLength < 0) + SelectionLength = 0; + + if (selEndIndex > selStartIndex) + SelectionLength = selEndIndex - selStartIndex; + else + SelectionLength = selStartIndex - selEndIndex; + + CanvasTextLayoutRegion[] descriptions = textLayout.GetCharacterRegions(SelectionStart, SelectionLength); + for (int i = 0; i < descriptions.Length; i++) + { + //Change the width if selection in an emty line or starts at a line end + if (descriptions[i].LayoutBounds.Width == 0 && descriptions.Length > 1) + { + var bounds = descriptions[i].LayoutBounds; + descriptions[i].LayoutBounds = new Rect { Width = fontSize / 4, Height = bounds.Height, X = bounds.X, Y = bounds.Y }; + } + + args.DrawingSession.FillRectangle(Utils.CreateRect(descriptions[i].LayoutBounds, marginLeft, marginTop), selectionColor); + } + return new TextSelection(SelectionStart, SelectionLength, new CursorPosition(SelectionStartPosition), new CursorPosition(SelectionEndPosition)); + } + return null; + } + + //returns whether the pointer is over a selection + public bool PointerIsOverSelection(Point pointerPosition, TextSelection selection, CanvasTextLayout textLayout) + { + if (textLayout == null || selection == null) + return false; + + CanvasTextLayoutRegion[] regions = textLayout.GetCharacterRegions(selection.Index, selection.Length); + for (int i = 0; i < regions.Length; i++) + { + if (regions[i].LayoutBounds.Contains(pointerPosition)) + return true; + } + return false; + } + + public bool CursorIsInSelection(CursorPosition cursorPosition, TextSelection textSelection) + { + if (textSelection == null) + return false; + + textSelection = Selection.OrderTextSelection(textSelection); + + //Cursorposition is smaller than the start of selection + if (textSelection.StartPosition.LineNumber > cursorPosition.LineNumber) + return false; + + //Selectionend is smaller than Cursorposition -> not in selection + if (textSelection.EndPosition.LineNumber < cursorPosition.LineNumber) + return false; + + //Selection-start line equals Cursor line: + if (cursorPosition.LineNumber == textSelection.StartPosition.LineNumber) + return cursorPosition.CharacterPosition > textSelection.StartPosition.CharacterPosition; + + //Selection-end line equals Cursor line + else if (cursorPosition.LineNumber == textSelection.EndPosition.LineNumber) + return cursorPosition.CharacterPosition < textSelection.EndPosition.CharacterPosition; + return true; + } + + //Clear the selection + public void ClearSelection() + { + HasSelection = false; + IsSelecting = false; + SelectionEndPosition = null; + SelectionStartPosition = null; + } + + public void SetSelection(TextSelection selection) + { + if (selection == null) + return; + + SetSelection(selection.StartPosition, selection.EndPosition); + } + public void SetSelection(CursorPosition startPosition, CursorPosition endPosition) + { + IsSelecting = true; + SelectionStartPosition = startPosition; + SelectionEndPosition = endPosition; + IsSelecting = false; + HasSelection = true; + } + public void SetSelectionStart(CursorPosition startPosition) + { + IsSelecting = true; + SelectionStartPosition = startPosition; + IsSelecting = false; + HasSelection = true; + } + public void SetSelectionEnd(CursorPosition endPosition) + { + IsSelecting = true; + SelectionEndPosition = endPosition; + IsSelecting = false; + HasSelection = true; + } + } +} \ No newline at end of file diff --git a/TextControlBox/Renderer/SyntaxHighlightingRenderer.cs b/TextControlBox/Renderer/SyntaxHighlightingRenderer.cs new file mode 100644 index 0000000..809d0db --- /dev/null +++ b/TextControlBox/Renderer/SyntaxHighlightingRenderer.cs @@ -0,0 +1,73 @@ +using Microsoft.Graphics.Canvas.Text; +using Microsoft.UI.Xaml; +using Newtonsoft.Json; +using System; +using System.Text.RegularExpressions; +using Windows.UI.Text; +using Windows.UI.Xaml; + +namespace TextControlBoxNS.Renderer +{ + internal class SyntaxHighlightingRenderer + { + public static FontWeight BoldFont = new FontWeight { Weight = 600 }; + public static FontStyle ItalicFont = FontStyle.Italic; + + public static void UpdateSyntaxHighlighting(CanvasTextLayout drawnTextLayout, ApplicationTheme theme, CodeLanguage codeLanguage, bool syntaxHighlighting, string renderedText) + { + if (codeLanguage == null || !syntaxHighlighting) + return; + + var highlights = codeLanguage.Highlights; + for (int i = 0; i < highlights.Length; i++) + { + var matches = Regex.Matches(renderedText, highlights[i].Pattern, RegexOptions.Compiled); + var highlight = highlights[i]; + var color = theme == ApplicationTheme.Light ? highlight.ColorLight_Clr : highlight.ColorDark_Clr; + + for (int j = 0; j < matches.Count; j++) + { + var match = matches[j]; + int index = match.Index; + int length = match.Length; + drawnTextLayout.SetColor(index, length, color); + if (highlight.CodeStyle != null) + { + if (highlight.CodeStyle.Italic) + drawnTextLayout.SetFontStyle(index, length, ItalicFont); + if (highlight.CodeStyle.Bold) + drawnTextLayout.SetFontWeight(index, length, BoldFont); + if (highlight.CodeStyle.Underlined) + drawnTextLayout.SetUnderline(index, length, true); + } + } + } + } + + public static JsonLoadResult GetCodeLanguageFromJson(string json) + { + try + { + var jsonCodeLanguage = JsonConvert.DeserializeObject(json); + //Apply the filter as an array + var codelanguage = new CodeLanguage + { + Author = jsonCodeLanguage.Author, + Description = jsonCodeLanguage.Description, + Highlights = jsonCodeLanguage.Highlights, + Name = jsonCodeLanguage.Name, + Filter = jsonCodeLanguage.Filter.Split("|", StringSplitOptions.RemoveEmptyEntries), + }; + return new JsonLoadResult(true, codelanguage); + } + catch (JsonReaderException) + { + return new JsonLoadResult(false, null); + } + catch (JsonSerializationException) + { + return new JsonLoadResult(false, null); + } + } + } +} diff --git a/TextControlBox/Text/AutoPairing.cs b/TextControlBox/Text/AutoPairing.cs new file mode 100644 index 0000000..c3a9314 --- /dev/null +++ b/TextControlBox/Text/AutoPairing.cs @@ -0,0 +1,38 @@ +using System.Linq; + +namespace TextControlBoxNS.Text +{ + internal class AutoPairing + { + public static (string text, int length) AutoPair(TextControlBox textbox, string inputtext) + { + if (!textbox.DoAutoPairing || inputtext.Length != 1 || textbox.CodeLanguage == null || textbox.CodeLanguage.AutoPairingPair == null) + return (inputtext, inputtext.Length); + + var res = textbox.CodeLanguage.AutoPairingPair.Where(x => x.Matches(inputtext)); + if (res.Count() == 0) + return (inputtext, inputtext.Length); + + if (res.ElementAt(0) is AutoPairingPair pair) + return (inputtext + pair.Pair, inputtext.Length); + return (inputtext, inputtext.Length); + } + + public static string AutoPairSelection(TextControlBox textbox, string inputtext) + { + if (!textbox.DoAutoPairing || inputtext.Length != 1 || textbox.CodeLanguage == null || textbox.CodeLanguage.AutoPairingPair == null) + return inputtext; + + var res = textbox.CodeLanguage.AutoPairingPair.Where(x => x.Value.Equals(inputtext)); + if (res.Count() == 0) + return inputtext; + + if (res.ElementAt(0) is AutoPairingPair pair) + { + textbox.SurroundSelectionWith(inputtext, pair.Pair); + return null; + } + return inputtext; + } + } +} diff --git a/TextControlBox/Text/Cursor.cs b/TextControlBox/Text/Cursor.cs new file mode 100644 index 0000000..a78cff5 --- /dev/null +++ b/TextControlBox/Text/Cursor.cs @@ -0,0 +1,170 @@ +using Collections.Pooled; +using System; +using TextControlBoxNS.Extensions; +using TextControlBoxNS.Helper; + +namespace TextControlBoxNS.Text +{ + internal class Cursor + { + private static int CheckIndex(string str, int index) => Math.Clamp(index, 0, str.Length - 1); + public static int CursorPositionToIndex(PooledList totalLines, CursorPosition cursorPosition) + { + int cursorIndex = cursorPosition.CharacterPosition; + int lineNumber = cursorPosition.LineNumber < totalLines.Count ? cursorIndex : totalLines.Count - 1; + for (int i = 0; i < lineNumber; i++) + { + cursorIndex += totalLines.GetLineLength(i) + 1; + } + return cursorIndex; + } + public static bool Equals(CursorPosition curPos1, CursorPosition curPos2) + { + if (curPos1 == null || curPos2 == null) + return false; + + if (curPos1.LineNumber == curPos2.LineNumber) + return curPos1.CharacterPosition == curPos2.CharacterPosition; + return false; + } + + //Calculate the number of characters from the cursorposition to the next character or digit to the left and to the right + public static int CalculateStepsToMoveLeft2(string currentLine, int cursorCharPosition) + { + if (currentLine.Length == 0) + return 0; + + int stepsToMove = 0; + for (int i = cursorCharPosition - 1; i >= 0; i--) + { + char currentCharacter = currentLine[CheckIndex(currentLine, i)]; + if (char.IsLetterOrDigit(currentCharacter) || currentCharacter == '_') + stepsToMove++; + else if (i == cursorCharPosition - 1 && char.IsWhiteSpace(currentCharacter)) + return 0; + else + break; + } + return stepsToMove; + } + public static int CalculateStepsToMoveRight2(string currentLine, int cursorCharPosition) + { + if (currentLine.Length == 0) + return 0; + + int stepsToMove = 0; + for (int i = cursorCharPosition; i < currentLine.Length; i++) + { + char currentCharacter = currentLine[CheckIndex(currentLine, i)]; + if (char.IsLetterOrDigit(currentCharacter) || currentCharacter == '_') + stepsToMove++; + else if (i == cursorCharPosition && char.IsWhiteSpace(currentCharacter)) + return 0; + else + break; + } + return stepsToMove; + } + + //Calculates how many characters the cursor needs to move if control is pressed + //Returns 1 when control is not pressed + public static int CalculateStepsToMoveLeft(string currentLine, int cursorCharPosition) + { + if (!Utils.IsKeyPressed(Windows.System.VirtualKey.Control)) + return 1; + + int stepsToMove = 0; + for (int i = cursorCharPosition - 1; i >= 0; i--) + { + char CurrentCharacter = currentLine[CheckIndex(currentLine, i)]; + if (char.IsLetterOrDigit(CurrentCharacter) || CurrentCharacter == '_') + stepsToMove++; + else if (i == cursorCharPosition - 1 && char.IsWhiteSpace(CurrentCharacter)) + stepsToMove++; + else + break; + } + //If it ignores the ControlKey return the real value of stepsToMove otherwise + //return 1 if stepsToMove is 0 + return stepsToMove == 0 ? 1 : stepsToMove; + } + public static int CalculateStepsToMoveRight(string currentLine, int cursorCharPosition) + { + if (!Utils.IsKeyPressed(Windows.System.VirtualKey.Control)) + return 1; + + int stepsToMove = 0; + for (int i = cursorCharPosition; i < currentLine.Length; i++) + { + char CurrentCharacter = currentLine[CheckIndex(currentLine, i)]; + if (char.IsLetterOrDigit(CurrentCharacter) || CurrentCharacter == '_') + stepsToMove++; + else if (i == cursorCharPosition && char.IsWhiteSpace(CurrentCharacter)) + stepsToMove++; + else + break; + } + //If it ignores the ControlKey return the real value of stepsToMove otherwise + //return 1 if stepsToMove is 0 + return stepsToMove == 0 ? 1 : stepsToMove; + } + + //Move cursor: + public static void MoveLeft(CursorPosition currentCursorPosition, PooledList totalLines, string currentLine) + { + if (currentCursorPosition.LineNumber < 0) + return; + + int currentLineLength = totalLines.GetLineLength(currentCursorPosition.LineNumber); + if (currentCursorPosition.CharacterPosition == 0 && currentCursorPosition.LineNumber > 0) + { + currentCursorPosition.CharacterPosition = totalLines.GetLineLength(currentCursorPosition.LineNumber - 1); + currentCursorPosition.LineNumber -= 1; + } + else if (currentCursorPosition.CharacterPosition > currentLineLength) + currentCursorPosition.CharacterPosition = currentLineLength - 1; + else if (currentCursorPosition.CharacterPosition > 0) + currentCursorPosition.CharacterPosition -= CalculateStepsToMoveLeft(currentLine, currentCursorPosition.CharacterPosition); + } + public static void MoveRight(CursorPosition currentCursorPosition, PooledList totalLines, string currentLine) + { + int lineLength = totalLines.GetLineLength(currentCursorPosition.LineNumber); + + if (currentCursorPosition.LineNumber > totalLines.Count - 1) + return; + + if (currentCursorPosition.CharacterPosition == lineLength && currentCursorPosition.LineNumber < totalLines.Count - 1) + { + currentCursorPosition.CharacterPosition = 0; + currentCursorPosition.LineNumber += 1; + } + else if (currentCursorPosition.CharacterPosition < lineLength) + currentCursorPosition.CharacterPosition += CalculateStepsToMoveRight(currentLine, currentCursorPosition.CharacterPosition); + + if (currentCursorPosition.CharacterPosition > lineLength) + currentCursorPosition.CharacterPosition = lineLength; + } + public static CursorPosition MoveDown(CursorPosition currentCursorPosition, int totalLinesLength) + { + CursorPosition returnValue = new CursorPosition(currentCursorPosition); + if (currentCursorPosition.LineNumber < totalLinesLength - 1) + returnValue = CursorPosition.ChangeLineNumber(currentCursorPosition, currentCursorPosition.LineNumber + 1); + return returnValue; + } + public static CursorPosition MoveUp(CursorPosition currentCursorPosition) + { + CursorPosition returnValue = new CursorPosition(currentCursorPosition); + if (currentCursorPosition.LineNumber > 0) + returnValue = CursorPosition.ChangeLineNumber(returnValue, currentCursorPosition.LineNumber - 1); + return returnValue; + } + public static void MoveToLineEnd(CursorPosition cursorPosition, string currentLine) + { + cursorPosition.CharacterPosition = currentLine.Length; + } + public static void MoveToLineStart(CursorPosition cursorPosition) + { + cursorPosition.CharacterPosition = 0; + } + } +} \ No newline at end of file diff --git a/TextControlBox/Text/LineEndings.cs b/TextControlBox/Text/LineEndings.cs new file mode 100644 index 0000000..1ffe627 --- /dev/null +++ b/TextControlBox/Text/LineEndings.cs @@ -0,0 +1,31 @@ +using System; +using System.Text.RegularExpressions; + +namespace TextControlBoxNS.Text +{ + internal class LineEndings + { + public static string LineEndingToString(LineEnding lineEnding) + { + return + lineEnding == LineEnding.LF ? "\n" : + lineEnding == LineEnding.CRLF ? "\r\n" : + "\r"; + } + public static LineEnding FindLineEnding(string text) + { + if (text.IndexOf("\r\n", StringComparison.Ordinal) > -1) + return LineEnding.CRLF; + else if (text.IndexOf("\n", StringComparison.Ordinal) > -1) + return LineEnding.LF; + else if (text.IndexOf("\r", StringComparison.Ordinal) > -1) + return LineEnding.CR; + return LineEnding.CRLF; + } + public static string CleanLineEndings(string text, LineEnding lineEnding) + { + return Regex.Replace(text, "(\r\n|\r|\n)", LineEndingToString(lineEnding)); + } + } + +} diff --git a/TextControlBox/Text/MoveLine.cs b/TextControlBox/Text/MoveLine.cs new file mode 100644 index 0000000..c9050bd --- /dev/null +++ b/TextControlBox/Text/MoveLine.cs @@ -0,0 +1,35 @@ +using Collections.Pooled; + +namespace TextControlBoxNS.Text +{ + internal class MoveLine + { + public static void Move(PooledList totalLines, TextSelection selection, CursorPosition cursorposition, UndoRedo undoredo, string newLineCharacter, LineMoveDirection direction) + { + if (selection != null) + return; + + //move down: + if (direction == LineMoveDirection.Down) + { + if (cursorposition.LineNumber >= totalLines.Count - 1) + return; + + undoredo.RecordUndoAction(() => + { + Selection.MoveLinesDown(totalLines, selection, cursorposition); + }, totalLines, cursorposition.LineNumber, 2, 2, newLineCharacter, cursorposition); + return; + } + + //move up: + if (cursorposition.LineNumber <= 0) + return; + + undoredo.RecordUndoAction(() => + { + Selection.MoveLinesUp(totalLines, selection, cursorposition); + }, totalLines, cursorposition.LineNumber - 1, 2, 2, newLineCharacter, cursorposition); + } + } +} diff --git a/TextControlBox/Text/Selection.cs b/TextControlBox/Text/Selection.cs new file mode 100644 index 0000000..1022aae --- /dev/null +++ b/TextControlBox/Text/Selection.cs @@ -0,0 +1,527 @@ +using Collections.Pooled; +using System; +using System.Linq; +using System.Text; +using TextControlBoxNS.Extensions; +using TextControlBoxNS.Helper; +using TextControlBoxNS.Renderer; + +namespace TextControlBoxNS.Text +{ + internal class Selection + { + public static bool Equals(TextSelection sel1, TextSelection sel2) + { + if (sel1 == null || sel2 == null) + return false; + + return Cursor.Equals(sel1.StartPosition, sel2.StartPosition) && + Cursor.Equals(sel1.EndPosition, sel2.EndPosition); + } + + //Order the selection that StartPosition is always smaller than EndPosition + public static TextSelection OrderTextSelection(TextSelection selection) + { + if (selection == null) + return selection; + + int startLine = Math.Min(selection.StartPosition.LineNumber, selection.EndPosition.LineNumber); + int endLine = Math.Max(selection.StartPosition.LineNumber, selection.EndPosition.LineNumber); + int startPosition; + int endPosition; + if (startLine == endLine) + { + startPosition = Math.Min(selection.StartPosition.CharacterPosition, selection.EndPosition.CharacterPosition); + endPosition = Math.Max(selection.StartPosition.CharacterPosition, selection.EndPosition.CharacterPosition); + } + else + { + if (selection.StartPosition.LineNumber < selection.EndPosition.LineNumber) + { + endPosition = selection.EndPosition.CharacterPosition; + startPosition = selection.StartPosition.CharacterPosition; + } + else + { + endPosition = selection.StartPosition.CharacterPosition; + startPosition = selection.EndPosition.CharacterPosition; + } + } + + return new TextSelection(selection.Index, selection.Length, new CursorPosition(startPosition, startLine), new CursorPosition(endPosition, endLine)); + } + + public static bool WholeTextSelected(TextSelection selection, PooledList totalLines) + { + if (selection == null) + return false; + + var sel = OrderTextSelection(selection); + return Utils.CursorPositionsAreEqual(sel.StartPosition, new CursorPosition(0, 0)) && + Utils.CursorPositionsAreEqual(sel.EndPosition, new CursorPosition(totalLines.GetLineLength(-1), totalLines.Count - 1)); + } + + //returns whether the selection starts at character zero and ends + public static bool WholeLinesAreSelected(TextSelection selection, PooledList totalLines) + { + if (selection == null) + return false; + + var sel = OrderTextSelection(selection); + return Utils.CursorPositionsAreEqual(sel.StartPosition, new CursorPosition(0, sel.StartPosition.LineNumber)) && + Utils.CursorPositionsAreEqual(sel.EndPosition, new CursorPosition(totalLines.GetLineText(sel.EndPosition.LineNumber).Length, sel.EndPosition.LineNumber)); + } + + public static CursorPosition GetMax(CursorPosition pos1, CursorPosition pos2) + { + if (pos1.LineNumber == pos2.LineNumber) + return pos1.CharacterPosition > pos2.CharacterPosition ? pos1 : pos2; + return pos1.LineNumber > pos2.LineNumber ? pos1 : pos2; + } + public static CursorPosition GetMin(CursorPosition pos1, CursorPosition pos2) + { + if (pos1.LineNumber == pos2.LineNumber) + return pos1.CharacterPosition > pos2.CharacterPosition ? pos2 : pos1; + return pos1.LineNumber > pos2.LineNumber ? pos2 : pos1; + } + public static CursorPosition GetMin(TextSelection selection) + { + return GetMin(selection.StartPosition, selection.EndPosition); + } + public static CursorPosition GetMax(TextSelection selection) + { + return GetMax(selection.StartPosition, selection.EndPosition); + } + + public static CursorPosition InsertText(TextSelection selection, CursorPosition cursorPosition, PooledList totalLines, string text, string newLineCharacter) + { + if (selection != null) + return Replace(selection, totalLines, text, newLineCharacter); + + string curLine = totalLines.GetLineText(cursorPosition.LineNumber); + + string[] lines = text.Split(newLineCharacter); + + //Singleline + if (lines.Length == 1 && text != string.Empty) + { + text = text.Replace("\r", string.Empty).Replace("\n", string.Empty); + totalLines.SetLineText(-1, totalLines.GetLineText(-1).AddText(text, cursorPosition.CharacterPosition)); + cursorPosition.AddToCharacterPos(text.Length); + return cursorPosition; + } + + //Multiline: + int curPos = cursorPosition.CharacterPosition; + if (curPos > curLine.Length) + curPos = curLine.Length; + + //GEt the text in front of the cursor + string textInFrontOfCursor = curLine.Substring(0, curPos < 0 ? 0 : curPos); + //Get the text behind the cursor + string textBehindCursor = curLine.SafeRemove(0, curPos < 0 ? 0 : curPos); + + totalLines.DeleteAt(cursorPosition.LineNumber); + totalLines.InsertOrAddRange(ListHelper.CreateLines(lines, 0, textInFrontOfCursor, textBehindCursor), cursorPosition.LineNumber); + + return new CursorPosition(cursorPosition.CharacterPosition + lines.Length > 0 ? lines[lines.Length - 1].Length : 0, cursorPosition.LineNumber + lines.Length - 1); + } + + public static CursorPosition Replace(TextSelection selection, PooledList totalLines, string text, string newLineCharacter) + { + //Just delete the text if the string is emty + if (text == "") + return Remove(selection, totalLines); + + selection = OrderTextSelection(selection); + int startLine = selection.StartPosition.LineNumber; + int endLine = selection.EndPosition.LineNumber; + int startPosition = selection.StartPosition.CharacterPosition; + int endPosition = selection.EndPosition.CharacterPosition; + + string[] lines = text.Split(newLineCharacter); + string start_Line = totalLines.GetLineText(startLine); + + //Selection is singleline and text to paste is also singleline + if (startLine == endLine && lines.Length == 1) + { + start_Line = + (startPosition == 0 && endPosition == totalLines.GetLineLength(endLine)) ? + "" : + start_Line.SafeRemove(startPosition, endPosition - startPosition + ); + + totalLines.SetLineText(startLine, start_Line.AddText(text, startPosition)); + + return new CursorPosition(startPosition + text.Length, selection.StartPosition.LineNumber); + } + else if (startLine == endLine && lines.Length > 1 && (startPosition != 0 && endPosition != start_Line.Length)) + { + string textTo = start_Line == "" ? "" : startPosition >= start_Line.Length ? start_Line : start_Line.Safe_Substring(0, startPosition); + string textFrom = start_Line == "" ? "" : endPosition >= start_Line.Length ? start_Line : start_Line.Safe_Substring(endPosition); + + totalLines.SetLineText(startLine, (textTo + lines[0])); + totalLines.InsertOrAddRange(ListHelper.CreateLines(lines, 1, "", textFrom), startLine + 1); + + return new CursorPosition(endPosition + text.Length, startLine + lines.Length - 1); + } + else if (WholeTextSelected(selection, totalLines)) + { + if (lines.Length < totalLines.Count) + { + ListHelper.Clear(totalLines); + totalLines.InsertOrAddRange(lines, 0); + } + else + ReplaceLines(totalLines, 0, totalLines.Count, lines); + + return new CursorPosition(totalLines.GetLineLength(-1), totalLines.Count - 1); + } + else + { + string end_Line = totalLines.GetLineText(endLine); + + //All lines are selected from start to finish + if (startPosition == 0 && endPosition == end_Line.Length) + { + totalLines.Safe_RemoveRange(startLine, endLine - startLine + 1); + totalLines.InsertOrAddRange(lines, startLine); + } + //Only the startline is completely selected + else if (startPosition == 0 && endPosition != end_Line.Length) + { + totalLines.SetLineText(endLine, end_Line.Substring(endPosition).AddToStart(lines[lines.Length - 1])); + + totalLines.Safe_RemoveRange(startLine, endLine - startLine); + totalLines.InsertOrAddRange(lines.Take(lines.Length - 1), startLine); + } + //Only the endline is completely selected + else if (startPosition != 0 && endPosition == end_Line.Length) + { + totalLines.SetLineText(startLine, start_Line.SafeRemove(startPosition).AddToEnd(lines[0])); + + totalLines.Safe_RemoveRange(startLine + 1, endLine - startLine); + totalLines.InsertOrAddRange(lines.Skip(1), startLine + 1); + } + else + { + //Delete the selected parts + start_Line = start_Line.SafeRemove(startPosition); + end_Line = end_Line.Safe_Substring(endPosition); + + //Only one line to insert + if (lines.Length == 1) + { + totalLines.SetLineText(startLine, start_Line.AddToEnd(lines[0] + end_Line)); + totalLines.Safe_RemoveRange(startLine + 1, endLine - startLine < 0 ? 0 : endLine - startLine); + } + else + { + totalLines.SetLineText(startLine, start_Line.AddToEnd(lines[0])); + totalLines.SetLineText(endLine, end_Line.AddToStart(lines[lines.Length - 1])); + + totalLines.Safe_RemoveRange(startLine + 1, endLine - startLine - 1 < 0 ? 0 : endLine - startLine - 1); + if (lines.Length > 2) + totalLines.InsertOrAddRange(lines.GetLines(1, lines.Length - 2), startLine + 1); + } + } + return new CursorPosition(start_Line.Length + end_Line.Length - 1, startLine + lines.Length - 1); + } + } + + public static CursorPosition Remove(TextSelection selection, PooledList totalLines) + { + selection = OrderTextSelection(selection); + int startLine = selection.StartPosition.LineNumber; + int endLine = selection.EndPosition.LineNumber; + int startPosition = selection.StartPosition.CharacterPosition; + int endPosition = selection.EndPosition.CharacterPosition; + + string start_Line = totalLines.GetLineText(startLine); + string end_Line = totalLines.GetLineText(endLine); + + if (startLine == endLine) + { + totalLines.SetLineText(startLine, + (startPosition == 0 && endPosition == end_Line.Length ? + "" : + start_Line.SafeRemove(startPosition, endPosition - startPosition)) + ); + } + else if (WholeTextSelected(selection, totalLines)) + { + ListHelper.Clear(totalLines, true); + return new CursorPosition(0, totalLines.Count - 1); + } + else + { + //Whole lines are selected from start to finish + if (startPosition == 0 && endPosition == end_Line.Length) + { + totalLines.Safe_RemoveRange(startLine, endLine - startLine + 1); + } + //Only the startline is completely selected + else if (startPosition == 0 && endPosition != end_Line.Length) + { + totalLines.SetLineText(endLine, end_Line.Safe_Substring(endPosition)); + totalLines.Safe_RemoveRange(startLine, endLine - startLine); + } + //Only the endline is completely selected + else if (startPosition != 0 && endPosition == end_Line.Length) + { + totalLines.SetLineText(startLine, start_Line.SafeRemove(startPosition)); + totalLines.Safe_RemoveRange(startLine + 1, endLine - startLine); + } + //Both startline and endline are not completely selected + else + { + totalLines.SetLineText(startLine, start_Line.SafeRemove(startPosition) + end_Line.Safe_Substring(endPosition)); + totalLines.Safe_RemoveRange(startLine + 1, endLine - startLine); + } + } + + if (totalLines.Count == 0) + totalLines.AddLine(); + + return new CursorPosition(startPosition, startLine); + } + + public static TextSelectionPosition GetIndexOfSelection(PooledList totalLines, TextSelection selection) + { + var sel = OrderTextSelection(selection); + int startIndex = Cursor.CursorPositionToIndex(totalLines, sel.StartPosition); + int endIndex = Cursor.CursorPositionToIndex(totalLines, sel.EndPosition); + + if (endIndex > startIndex) + return new TextSelectionPosition(Math.Min(startIndex, endIndex), endIndex - startIndex); + else + return new TextSelectionPosition(Math.Min(startIndex, endIndex), startIndex - endIndex); + } + + public static TextSelection GetSelectionFromPosition(PooledList totalLines, int startPosition, int length, int numberOfCharacters) + { + TextSelection returnValue = new TextSelection(); + + if (startPosition + length > numberOfCharacters) + { + if (startPosition > numberOfCharacters) + { + startPosition = numberOfCharacters; + length = 0; + } + else + length = numberOfCharacters - startPosition; + } + + void GetIndexInLine(int currentIndex, int currentTotalLength) + { + int position = Math.Abs(currentTotalLength - startPosition); + + returnValue.StartPosition = + new CursorPosition(position, currentIndex); + + if (length == 0) + returnValue.EndPosition = new CursorPosition(returnValue.StartPosition); + else + { + int lengthCount = 0; + for (int i = currentIndex; i < totalLines.Count; i++) + { + int lineLength = totalLines[i].Length + 1; + if (lengthCount + lineLength > length) + { + returnValue.EndPosition = new CursorPosition(Math.Abs(lengthCount - length) + position, i); + break; + } + lengthCount += lineLength; + } + } + } + + //Get the Length + int totalLength = 0; + for (int i = 0; i < totalLines.Count; i++) + { + int lineLength = totalLines[i].Length + 1; + if (totalLength + lineLength > startPosition) + { + GetIndexInLine(i, totalLength); + break; + } + + totalLength += lineLength; + } + return returnValue; + } + + public static string GetSelectedText(PooledList totalLines, TextSelection textSelection, int currentLineIndex, string newLineCharacter) + { + //return the current line, if no text is selected: + if (textSelection == null) + return totalLines.GetLineText(currentLineIndex) + newLineCharacter; + + int startLine = Math.Min(textSelection.StartPosition.LineNumber, textSelection.EndPosition.LineNumber); + int endLine = Math.Max(textSelection.StartPosition.LineNumber, textSelection.EndPosition.LineNumber); + int endIndex = Math.Max(textSelection.StartPosition.CharacterPosition, textSelection.EndPosition.CharacterPosition); + int startIndex = Math.Min(textSelection.StartPosition.CharacterPosition, textSelection.EndPosition.CharacterPosition); + + StringBuilder stringBuilder = new StringBuilder(); + + if (startLine == endLine) //Singleline + { + string line = totalLines.GetLineText(startLine < totalLines.Count ? startLine : totalLines.Count - 1); + + if (startIndex == 0 && endIndex != line.Length) + stringBuilder.Append(line.SafeRemove(endIndex)); + else if (endIndex == line.Length && startIndex != 0) + stringBuilder.Append(line.Safe_Substring(startIndex)); + else if (startIndex == 0 && endIndex == line.Length) + stringBuilder.Append(line); + else stringBuilder.Append(line.SafeRemove(endIndex).Substring(startIndex)); + } + else if (WholeTextSelected(textSelection, totalLines)) + { + stringBuilder.Append(ListHelper.GetLinesAsString(totalLines, newLineCharacter)); + } + else //Multiline + { + //StartLine + stringBuilder.Append(totalLines.GetLineText(startLine).Substring(startIndex) + newLineCharacter); + + //Other lines + if (endLine - startLine > 1) + stringBuilder.Append(totalLines.GetLines(startLine + 1, endLine - startLine - 1).GetString(newLineCharacter) + newLineCharacter); + + //Endline + string currentLine = totalLines.GetLineText(endLine); + + stringBuilder.Append(endIndex >= currentLine.Length ? currentLine : currentLine.SafeRemove(endIndex)); + } + return stringBuilder.ToString(); + } + + /// + /// Replaces the lines in TotalLines, starting by Start replacing Count number of items, with the string in SplittedText + /// All lines that can be replaced get replaced all lines that are needed additionally get added + /// + /// + /// + /// + /// + public static void ReplaceLines(PooledList totalLines, int start, int count, string[] splittedText) + { + if (splittedText.Length == 0) + { + totalLines.Safe_RemoveRange(start, count); + return; + } + + //Same line-length -> check for any differences in the individual lines + if (count == splittedText.Length) + { + for (int i = 0; i < count; i++) + { + if (!totalLines.GetLineText(i).Equals(splittedText[i], StringComparison.Ordinal)) + { + totalLines.SetLineText(start + i, splittedText[i]); + } + } + } + //Delete items from start to count; Insert splittedText at start + else if (count > splittedText.Length) + { + for (int i = 0; i < count; i++) + { + if (i < splittedText.Length) + { + totalLines.SetLineText(start + i, splittedText[i]); + } + else + { + totalLines.Safe_RemoveRange(start + i, count - i); + break; + } + } + } + //Replace all items from start - count with existing (add more if out of range) + else //SplittedText.Length > Count: + { + for (int i = 0; i < splittedText.Length; i++) + { + //replace all possible lines + if (i < count) + { + totalLines.SetLineText(start + i, splittedText[i]); + } + else //Add new lines + { + totalLines.InsertOrAddRange(splittedText.Skip(start + i), start + i); + break; + } + } + } + } + + public static bool MoveLinesUp(PooledList totalLines, TextSelection selection, CursorPosition cursorposition) + { + //Move single line + if (selection != null) + return false; + + if (cursorposition.LineNumber > 0) + { + totalLines.SwapLines(cursorposition.LineNumber, cursorposition.LineNumber - 1); + cursorposition.LineNumber -= 1; + return true; + } + return false; + } + public static bool MoveLinesDown(PooledList totalLines, TextSelection selection, CursorPosition cursorposition) + { + //Move single line + if (selection != null || selection.StartPosition.LineNumber != selection.EndPosition.LineNumber) + return false; + + if (cursorposition.LineNumber < totalLines.Count) + { + totalLines.SwapLines(cursorposition.LineNumber, cursorposition.LineNumber + 1); + cursorposition.LineNumber += 1; + return true; + } + return false; + } + public static void ClearSelectionIfNeeded(TextControlBox textbox, SelectionRenderer selectionrenderer) + { + //If the selection is visible, but is not getting set, clear the selection + if (selectionrenderer.HasSelection && !selectionrenderer.IsSelecting) + { + textbox.ClearSelection(); + } + } + + + public static bool SelectionIsNull(SelectionRenderer selectionrenderer, TextSelection selection) + { + if (selection == null) + return true; + return selectionrenderer.SelectionStartPosition == null || selectionrenderer.SelectionEndPosition == null; + } + public static void SelectSingleWord(CanvasHelper canvashelper, SelectionRenderer selectionrenderer, CursorPosition cursorPosition, string currentLine) + { + int characterpos = cursorPosition.CharacterPosition; + //Update variables + selectionrenderer.SelectionStartPosition = + new CursorPosition(characterpos - Cursor.CalculateStepsToMoveLeft2(currentLine, characterpos), cursorPosition.LineNumber); + + selectionrenderer.SelectionEndPosition = + new CursorPosition(characterpos + Cursor.CalculateStepsToMoveRight2(currentLine, characterpos), cursorPosition.LineNumber); + + cursorPosition.CharacterPosition = selectionrenderer.SelectionEndPosition.CharacterPosition; + selectionrenderer.HasSelection = true; + + //Render it + canvashelper.UpdateSelection(); + canvashelper.UpdateCursor(); + } + } +} \ No newline at end of file diff --git a/TextControlBox/Text/StringManager.cs b/TextControlBox/Text/StringManager.cs new file mode 100644 index 0000000..32de0b4 --- /dev/null +++ b/TextControlBox/Text/StringManager.cs @@ -0,0 +1,20 @@ +using TextControlBoxNS.Helper; + +namespace TextControlBoxNS.Text +{ + internal class StringManager + { + private TabSpaceHelper tabSpaceHelper; + public LineEnding lineEnding; + + public StringManager(TabSpaceHelper tabSpaceHelper) + { + this.tabSpaceHelper = tabSpaceHelper; + } + public string CleanUpString(string input) + { + //Fix tabs and lineendings + return tabSpaceHelper.UpdateTabs(LineEndings.CleanLineEndings(input, lineEnding)); + } + } +} diff --git a/TextControlBox/Text/TabKey.cs b/TextControlBox/Text/TabKey.cs new file mode 100644 index 0000000..1911296 --- /dev/null +++ b/TextControlBox/Text/TabKey.cs @@ -0,0 +1,92 @@ +using Collections.Pooled; +using TextControlBoxNS.Extensions; + +namespace TextControlBoxNS.Text +{ + internal class TabKey + { + public static TextSelection MoveTabBack(PooledList totalLines, TextSelection textSelection, CursorPosition cursorPosition, string tabCharacter, string newLineCharacter, UndoRedo undoRedo) + { + if (textSelection == null) + { + string line = totalLines.GetLineText(cursorPosition.LineNumber); + if (line.Contains(tabCharacter, System.StringComparison.Ordinal) && cursorPosition.CharacterPosition > 0) + cursorPosition.SubtractFromCharacterPos(tabCharacter.Length); + + undoRedo.RecordUndoAction(() => + { + totalLines.SetLineText(cursorPosition.LineNumber, line.RemoveFirstOccurence(tabCharacter)); + }, totalLines, cursorPosition.LineNumber, 1, 1, newLineCharacter); + + return new TextSelection(cursorPosition, null); + } + + textSelection = Selection.OrderTextSelection(textSelection); + int selectedLinesCount = textSelection.EndPosition.LineNumber - textSelection.StartPosition.LineNumber; + + TextSelection tempSel = new TextSelection(textSelection); + tempSel.StartPosition.CharacterPosition = 0; + tempSel.EndPosition.CharacterPosition = totalLines.GetLineText(textSelection.EndPosition.LineNumber).Length + tabCharacter.Length; + + undoRedo.RecordUndoAction(() => + { + for (int i = 0; i < selectedLinesCount + 1; i++) + { + int lineIndex = i + textSelection.StartPosition.LineNumber; + string currentLine = totalLines.GetLineText(lineIndex); + + if (i == 0 && currentLine.Contains(tabCharacter, System.StringComparison.Ordinal) && cursorPosition.CharacterPosition > 0) + textSelection.StartPosition.CharacterPosition -= tabCharacter.Length; + else if (i == selectedLinesCount && currentLine.Contains(tabCharacter, System.StringComparison.Ordinal)) + { + textSelection.EndPosition.CharacterPosition -= tabCharacter.Length; + } + + totalLines.SetLineText(lineIndex, currentLine.RemoveFirstOccurence(tabCharacter)); + } + }, totalLines, tempSel, selectedLinesCount, newLineCharacter); + + return new TextSelection(new CursorPosition(textSelection.StartPosition), new CursorPosition(textSelection.EndPosition)); + } + + public static TextSelection MoveTab(PooledList totalLines, TextSelection textSelection, CursorPosition cursorPosition, string tabCharacter, string newLineCharacter, UndoRedo undoRedo) + { + if (textSelection == null) + { + string line = totalLines.GetLineText(cursorPosition.LineNumber); + + undoRedo.RecordUndoAction(() => + { + totalLines.SetLineText(cursorPosition.LineNumber, line.AddText(tabCharacter, cursorPosition.CharacterPosition)); + }, totalLines, cursorPosition.LineNumber, 1, 1, newLineCharacter); + + cursorPosition.AddToCharacterPos(tabCharacter.Length); + return new TextSelection(cursorPosition, null); + } + + textSelection = Selection.OrderTextSelection(textSelection); + int selectedLinesCount = textSelection.EndPosition.LineNumber - textSelection.StartPosition.LineNumber; + + if (textSelection.StartPosition.LineNumber == textSelection.EndPosition.LineNumber) //Singleline + textSelection.StartPosition = Selection.Replace(textSelection, totalLines, tabCharacter, newLineCharacter); + else + { + TextSelection tempSel = new TextSelection(textSelection); + tempSel.StartPosition.CharacterPosition = 0; + tempSel.EndPosition.CharacterPosition = totalLines.GetLineText(textSelection.EndPosition.LineNumber).Length + tabCharacter.Length; + + textSelection.EndPosition.CharacterPosition += tabCharacter.Length; + textSelection.StartPosition.CharacterPosition += tabCharacter.Length; + + undoRedo.RecordUndoAction(() => + { + for (int i = textSelection.StartPosition.LineNumber; i < selectedLinesCount + textSelection.StartPosition.LineNumber + 1; i++) + { + totalLines.SetLineText(i, totalLines.GetLineText(i).AddToStart(tabCharacter)); + } + }, totalLines, tempSel, selectedLinesCount + 1, newLineCharacter); + } + return new TextSelection(new CursorPosition(textSelection.StartPosition), new CursorPosition(textSelection.EndPosition)); + } + } +} \ No newline at end of file diff --git a/TextControlBox/Text/UndoRedo.cs b/TextControlBox/Text/UndoRedo.cs new file mode 100644 index 0000000..834c8e1 --- /dev/null +++ b/TextControlBox/Text/UndoRedo.cs @@ -0,0 +1,176 @@ +using Collections.Pooled; +using System; +using System.Collections.Generic; +using TextControlBoxNS.Extensions; +using TextControlBoxNS.Helper; +using TextControlBoxNS.Models; + +namespace TextControlBoxNS.Text +{ + internal class UndoRedo + { + private Stack UndoStack = new Stack(); + private Stack RedoStack = new Stack(); + + private bool HasRedone = false; + + private void RecordRedo(UndoRedoItem item) + { + RedoStack.Push(item); + } + private void RecordUndo(UndoRedoItem item) + { + UndoStack.Push(item); + } + + private void AddUndoItem(TextSelection selection, int startLine, string undoText, string redoText, int undoCount, int redoCount) + { + UndoStack.Push(new UndoRedoItem + { + RedoText = redoText, + UndoText = undoText, + Selection = selection, + StartLine = startLine, + UndoCount = undoCount, + RedoCount = redoCount, + }); + } + + private void RecordSingleLine(Action action, PooledList totalLines, int startline) + { + var lineBefore = totalLines.GetLineText(startline); + action.Invoke(); + var lineAfter = totalLines.GetLineText(startline); + AddUndoItem(null, startline, lineBefore, lineAfter, 1, 1); + } + + public void RecordUndoAction(Action action, PooledList totalLines, int startline, int undocount, int redoCount, string newLineCharacter, CursorPosition cursorposition = null) + { + if (undocount == redoCount && redoCount == 1) + { + RecordSingleLine(action, totalLines, startline); + return; + } + + var linesBefore = totalLines.GetLines(startline, undocount).GetString(newLineCharacter); + action.Invoke(); + var linesAfter = totalLines.GetLines(startline, redoCount).GetString(newLineCharacter); + + AddUndoItem(cursorposition == null ? null : new TextSelection(new CursorPosition(cursorposition), null), startline, linesBefore, linesAfter, undocount, redoCount); + } + public void RecordUndoAction(Action action, PooledList totalLines, TextSelection selection, int numberOfAddedLines, string newLineCharacter) + { + var orderedSel = Selection.OrderTextSelection(selection); + if (orderedSel.StartPosition.LineNumber == orderedSel.EndPosition.LineNumber && orderedSel.StartPosition.LineNumber == 1) + { + RecordSingleLine(action, totalLines, orderedSel.StartPosition.LineNumber); + return; + } + + int numberOfRemovedLines = orderedSel.EndPosition.LineNumber - orderedSel.StartPosition.LineNumber + 1; + + if (numberOfAddedLines == 0 && !Selection.WholeLinesAreSelected(selection, totalLines) || + orderedSel.StartPosition.LineNumber == orderedSel.EndPosition.LineNumber && orderedSel.Length == totalLines.GetLineLength(orderedSel.StartPosition.LineNumber)) + numberOfAddedLines += 1; + + var linesBefore = totalLines.GetLines(orderedSel.StartPosition.LineNumber, numberOfRemovedLines).GetString(newLineCharacter); + action.Invoke(); + var linesAfter = totalLines.GetLines(orderedSel.StartPosition.LineNumber, numberOfAddedLines).GetString(newLineCharacter); + + AddUndoItem( + selection, + orderedSel.StartPosition.LineNumber, + linesBefore, + linesAfter, + numberOfRemovedLines, + numberOfAddedLines + ); + } + + public TextSelection Undo(PooledList totalLines, StringManager stringManager, string newLineCharacter) + { + if (UndoStack.Count < 1) + return null; + + if (HasRedone) + { + HasRedone = false; + while (RedoStack.Count > 0) + { + var redoItem = RedoStack.Pop(); + redoItem.UndoText = redoItem.RedoText = null; + } + } + + UndoRedoItem item = UndoStack.Pop(); + RecordRedo(item); + + //Faster for singleline + if (item.UndoCount == 1 && item.RedoCount == 1) + { + totalLines.SetLineText(item.StartLine, stringManager.CleanUpString(item.UndoText)); + } + else + { + totalLines.Safe_RemoveRange(item.StartLine, item.RedoCount); + if (item.UndoCount > 0) + totalLines.InsertOrAddRange(ListHelper.GetLinesFromString(stringManager.CleanUpString(item.UndoText), newLineCharacter), item.StartLine); + } + + return item.Selection; + } + + public TextSelection Redo(PooledList totalLines, StringManager stringmanager, string newLineCharacter) + { + if (RedoStack.Count < 1) + return null; + + UndoRedoItem item = RedoStack.Pop(); + RecordUndo(item); + HasRedone = true; + + //Faster for singleline + if (item.UndoCount == 1 && item.RedoCount == 1) + { + totalLines.SetLineText(item.StartLine, stringmanager.CleanUpString(item.RedoText)); + } + else + { + totalLines.Safe_RemoveRange(item.StartLine, item.UndoCount); + if (item.RedoCount > 0) + totalLines.InsertOrAddRange(ListHelper.GetLinesFromString(stringmanager.CleanUpString(item.RedoText), newLineCharacter), item.StartLine); + } + return null; + } + + /// + /// Clears all the items in the undo and redo stack + /// + public void ClearAll() + { + UndoStack.Clear(); + RedoStack.Clear(); + UndoStack.TrimExcess(); + RedoStack.TrimExcess(); + + GC.Collect(GC.GetGeneration(UndoStack), GCCollectionMode.Optimized); + GC.Collect(GC.GetGeneration(RedoStack), GCCollectionMode.Optimized); + } + + public void NullAll() + { + UndoStack = null; + RedoStack = null; + } + + /// + /// Gets if the undo stack contains actions + /// + public bool CanUndo { get => UndoStack.Count > 0; } + + /// + /// Gets if the redo stack contains actions + /// + public bool CanRedo { get => RedoStack.Count > 0; } + } +} diff --git a/TextControlBox/TextControlBox.csproj b/TextControlBox/TextControlBox.csproj new file mode 100644 index 0000000..cae3401 --- /dev/null +++ b/TextControlBox/TextControlBox.csproj @@ -0,0 +1,32 @@ + + + net6.0-windows10.0.19041.0 + 10.0.17763.0 + TextControlBoxNS + win10-x86;win10-x64;win10-arm64 + true + True + + False + TextControlBox.WinUI.JuliusKirsch + TextControlBox WinUI + 1.0.0 + Julius Kirsch + TextControlBox WinUI + A textbox for WinUI3 with syntax highlighting, line numbering, and support for a large amount of text + Julius Kirsch + https://github.com/FrozenAssassine/TextControlBox-WinUI + https://github.com/FrozenAssassine/TextControlBox-WinUI + TextControlBox; Textbox; WinUI; C#; SyntaxHighlighting; LineNumbers + Migrated from UWP to WinUI. + Icon1.png + + + + + + + + + + diff --git a/TextControlBox/TextControlBox.xaml b/TextControlBox/TextControlBox.xaml new file mode 100644 index 0000000..aa97f92 --- /dev/null +++ b/TextControlBox/TextControlBox.xaml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TextControlBox/TextControlBox.xaml.cs b/TextControlBox/TextControlBox.xaml.cs new file mode 100644 index 0000000..9a63db4 --- /dev/null +++ b/TextControlBox/TextControlBox.xaml.cs @@ -0,0 +1,2674 @@ +using Collections.Pooled; +using Microsoft.Graphics.Canvas; +using Microsoft.Graphics.Canvas.Brushes; +using Microsoft.Graphics.Canvas.Text; +using Microsoft.Graphics.Canvas.UI.Xaml; +using Microsoft.UI.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using TextControlBoxNS.Extensions; +using TextControlBoxNS.Helper; +using TextControlBoxNS.Languages; +using TextControlBoxNS.Renderer; +using TextControlBoxNS.Text; +using Windows.ApplicationModel.DataTransfer; +using Windows.Foundation; +using Windows.System; +using Color = Windows.UI.Color; + +namespace TextControlBoxNS +{ + public partial class TextControlBox : UserControl + { + private CursorSize _CursorSize = null; + private FontFamily _FontFamily = new FontFamily("Consolas"); + private bool UseDefaultDesign = true; + private TextControlBoxDesign _Design { get; set; } + private string NewLineCharacter = "\r\n"; + private bool _ShowLineNumbers = true; + private CodeLanguage _CodeLanguage = null; + private LineEnding _LineEnding = LineEnding.CRLF; + private bool _ShowLineHighlighter = true; + private int _FontSize = 18; + private int _ZoomFactor = 100; //% + private double _HorizontalScrollSensitivity = 1; + private double _VerticalScrollSensitivity = 1; + private int DefaultVerticalScrollSensitivity = 4; + private float SingleLineHeight { get => TextFormat == null ? 0 : TextFormat.LineSpacing; } + private float ZoomedFontSize = 0; + private int MaxFontsize = 125; + private int MinFontSize = 3; + private int OldZoomFactor = 0; + private int NumberOfStartLine = 0; + private int LongestLineLength = 0; + private int LongestLineIndex = 0; + private float OldHorizontalScrollValue = 0; + private float _SpaceBetweenLineNumberAndText = 30; + private ElementTheme _RequestedTheme = ElementTheme.Default; + private ApplicationTheme _AppTheme = ApplicationTheme.Light; + private TextControlBoxDesign LightDesign = new TextControlBoxDesign( + new SolidColorBrush(Color.FromArgb(0, 255, 255, 255)), + Color.FromArgb(255, 50, 50, 50), + Color.FromArgb(100, 0, 100, 255), + Color.FromArgb(255, 0, 0, 0), + Color.FromArgb(50, 200, 200, 200), + Color.FromArgb(255, 180, 180, 180), + Color.FromArgb(0, 0, 0, 0), + Color.FromArgb(100, 200, 120, 0) + ); + private TextControlBoxDesign DarkDesign = new TextControlBoxDesign( + new SolidColorBrush(Color.FromArgb(0, 30, 30, 30)), + Color.FromArgb(255, 255, 255, 255), + Color.FromArgb(100, 0, 100, 255), + Color.FromArgb(255, 255, 255, 255), + Color.FromArgb(50, 100, 100, 100), + Color.FromArgb(255, 100, 100, 100), + Color.FromArgb(0, 0, 0, 0), + Color.FromArgb(100, 160, 80, 0) + ); + + //Colors: + CanvasSolidColorBrush TextColorBrush; + CanvasSolidColorBrush CursorColorBrush; + CanvasSolidColorBrush LineNumberColorBrush; + CanvasSolidColorBrush LineHighlighterBrush; + + bool ColorResourcesCreated = false; + bool NeedsTextFormatUpdate = false; + bool DragDropSelection = false; + bool HasFocus = true; + bool NeedsUpdateTextLayout = false; + bool NeedsRecalculateLongestLineIndex = true; + + CanvasTextFormat TextFormat = null; + CanvasTextLayout DrawnTextLayout = null; + CanvasTextLayout LineNumberTextLayout = null; + CanvasTextFormat LineNumberTextFormat = null; + + string RenderedText = ""; + string LineNumberTextToRender = ""; + string OldRenderedText = null; + string OldLineNumberTextToRender = ""; + //Handle double and triple -clicks: + int PointerClickCount = 0; + DispatcherTimer PointerClickTimer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 200) }; + + Point? OldTouchPosition = null; + + //CursorPosition + CursorPosition _CursorPosition = new CursorPosition(0, 0); + CursorPosition OldCursorPosition = null; + CanvasTextLayout CurrentLineTextLayout = null; + TextSelection TextSelection = null; + TextSelection OldTextSelection = null; + + //Store the lines in Lists + private PooledList TotalLines = new PooledList(0); + private IEnumerable RenderedLines; + private int NumberOfRenderedLines = 0; + + private string CurrentLine { get => TotalLines.GetCurrentLineText(); set => TotalLines.SetCurrentLineText(value); } + StringBuilder LineNumberContent = new StringBuilder(); + + //Classes + private readonly SelectionRenderer selectionrenderer; + private readonly UndoRedo undoRedo = new UndoRedo(); + private readonly FlyoutHelper flyoutHelper; + private readonly TabSpaceHelper tabSpaceHelper = new TabSpaceHelper(); + private readonly StringManager stringManager; + private readonly SearchHelper searchHelper = new SearchHelper(); + private readonly CanvasHelper canvasHelper; + + /// + /// Initializes a new instance of the TextControlBox class. + /// + public TextControlBox() + { + this.InitializeComponent(); + + //Classes & Variables: + selectionrenderer = new SelectionRenderer(); + flyoutHelper = new FlyoutHelper(this); + stringManager = new StringManager(tabSpaceHelper); + canvasHelper = new CanvasHelper(Canvas_Selection, Canvas_LineNumber, Canvas_Text, Canvas_Cursor); + + //set default values + RequestedTheme = ElementTheme.Default; + LineEnding = LineEnding.CRLF; + + InitialiseOnStart(); + SetFocus(); + } + + private void ChangeCursor(InputSystemCursorShape cursor) + { + this.ProtectedCursor = InputSystemCursor.Create(cursor); + } + + #region Update functions + private void UpdateZoom() + { + ZoomedFontSize = Math.Clamp(_FontSize * (float)_ZoomFactor / 100, MinFontSize, MaxFontsize); + _ZoomFactor = Math.Clamp(_ZoomFactor, 4, 400); + + if (_ZoomFactor != OldZoomFactor) + { + NeedsUpdateTextLayout = true; + OldZoomFactor = _ZoomFactor; + ZoomChanged?.Invoke(this, _ZoomFactor); + } + + NeedsTextFormatUpdate = true; + + ScrollLineIntoView(CursorPosition.LineNumber); + NeedsUpdateLineNumbers(); + canvasHelper.UpdateAll(); + } + + private void NeedsUpdateLineNumbers() + { + this.OldLineNumberTextToRender = ""; + } + private void UpdateCurrentLineTextLayout() + { + CurrentLineTextLayout = + CursorPosition.LineNumber < TotalLines.Count ? + TextLayoutHelper.CreateTextLayout( + Canvas_Text, + TextFormat, + TotalLines.GetLineText(CursorPosition.LineNumber) + "|", + Canvas_Text.Size) : + null; + } + private void UpdateCursorVariable(Point point) + { + //Apply an offset to the cursorposition + point = point.Subtract(-(SingleLineHeight / 4), SingleLineHeight / 4); + + CursorPosition.LineNumber = CursorRenderer.GetCursorLineFromPoint(point, SingleLineHeight, NumberOfRenderedLines, NumberOfStartLine); + + UpdateCurrentLineTextLayout(); + CursorPosition.CharacterPosition = CursorRenderer.GetCharacterPositionFromPoint(TotalLines.GetCurrentLineText(), CurrentLineTextLayout, point, (float)-HorizontalScroll); + } + private void UpdateCurrentLine() + { + TotalLines.UpdateCurrentLine(CursorPosition.LineNumber); + } + private void CheckRecalculateLongestLine(string text) + { + if (Utils.GetLongestLineLength(text) > LongestLineLength) + { + NeedsRecalculateLongestLineIndex = true; + } + } + #endregion + + #region Textediting + private void DeleteSelection() + { + if (TextSelection == null) + return; + + //line gets deleted -> recalculate the longest line: + if (TextSelection.IsLineInSelection(LongestLineIndex)) + NeedsRecalculateLongestLineIndex = true; + + undoRedo.RecordUndoAction(() => + { + CursorPosition = Selection.Remove(TextSelection, TotalLines); + ClearSelection(); + + }, TotalLines, TextSelection, 0, NewLineCharacter); + + canvasHelper.UpdateSelection(); + canvasHelper.UpdateCursor(); + } + private void AddCharacter(string text, bool ignoreSelection = false) + { + if (IsReadonly) + return; + + if (ignoreSelection) + ClearSelection(); + + int splittedTextLength = text.Contains(NewLineCharacter, StringComparison.Ordinal) ? Utils.CountLines(text, NewLineCharacter) : 1; + + if (TextSelection == null && splittedTextLength == 1) + { + var res = AutoPairing.AutoPair(this, text); + text = res.text; + + undoRedo.RecordUndoAction(() => + { + var characterPos = GetCurPosInLine(); + + if (characterPos > TotalLines.CurrentLineLength() - 1) + CurrentLine = CurrentLine.AddToEnd(text); + else + CurrentLine = CurrentLine.AddText(text, characterPos); + CursorPosition.CharacterPosition = res.length + characterPos; + + }, TotalLines, CursorPosition.LineNumber, 1, 1, NewLineCharacter); + + if (TotalLines.GetCurrentLineText().Length > LongestLineLength) + { + LongestLineIndex = CursorPosition.LineNumber; + } + } + else if (TextSelection == null && splittedTextLength > 1) + { + CheckRecalculateLongestLine(text); + undoRedo.RecordUndoAction(() => + { + CursorPosition = Selection.InsertText(TextSelection, CursorPosition, TotalLines, text, NewLineCharacter); + }, TotalLines, CursorPosition.LineNumber, 1, splittedTextLength, NewLineCharacter); + } + else if (text.Length == 0) //delete selection + { + DeleteSelection(); + } + else if (TextSelection != null) + { + text = AutoPairing.AutoPairSelection(this, text); + if (text == null) + return; + + CheckRecalculateLongestLine(text); + undoRedo.RecordUndoAction(() => + { + CursorPosition = Selection.Replace(TextSelection, TotalLines, text, NewLineCharacter); + + ClearSelection(); + canvasHelper.UpdateSelection(); + }, TotalLines, TextSelection, splittedTextLength, NewLineCharacter); + } + + ScrollLineToCenter(CursorPosition.LineNumber); + canvasHelper.UpdateText(); + canvasHelper.UpdateCursor(); + Internal_TextChanged(); + } + private void RemoveText(bool controlIsPressed = false) + { + UpdateCurrentLine(); + + if (IsReadonly) + return; + + if (TextSelection != null) + DeleteSelection(); + else + { + string curLine = CurrentLine; + var charPos = GetCurPosInLine(); + var stepsToMove = controlIsPressed ? Cursor.CalculateStepsToMoveLeft(CurrentLine, charPos) : 1; + + if (charPos - stepsToMove >= 0) + { + if (CursorPosition.LineNumber == LongestLineIndex) + NeedsRecalculateLongestLineIndex = true; + + undoRedo.RecordUndoAction(() => + { + CurrentLine = curLine.SafeRemove(charPos - stepsToMove, stepsToMove); + CursorPosition.CharacterPosition -= stepsToMove; + + }, TotalLines, CursorPosition.LineNumber, 1, 1, NewLineCharacter); + } + else if (charPos - stepsToMove < 0) //remove lines + { + if (CursorPosition.LineNumber <= 0) + return; + + if (CursorPosition.LineNumber == LongestLineIndex) + NeedsRecalculateLongestLineIndex = true; + + undoRedo.RecordUndoAction(() => + { + int curpos = TotalLines.GetLineLength(CursorPosition.LineNumber - 1); + + //line still has text: + if (curLine.Length > 0) + TotalLines.String_AddToEnd(CursorPosition.LineNumber - 1, curLine); + + TotalLines.DeleteAt(CursorPosition.LineNumber); + + //update the cursorposition + CursorPosition.LineNumber -= 1; + CursorPosition.CharacterPosition = curpos; + + }, TotalLines, CursorPosition.LineNumber - 1, 3, 2, NewLineCharacter); + } + } + + UpdateScrollToShowCursor(); + canvasHelper.UpdateText(); + canvasHelper.UpdateCursor(); + Internal_TextChanged(); + } + private void DeleteText(bool controlIsPressed = false, bool shiftIsPressed = false) + { + UpdateCurrentLine(); + string curLine = CurrentLine; + + if (IsReadonly) + return; + + //Shift + delete: + if (shiftIsPressed && TextSelection == null) + DeleteLine(CursorPosition.LineNumber); + else if (TextSelection != null) + DeleteSelection(); + else + { + int characterPos = GetCurPosInLine(); + //delete lines if cursor is at position 0 and the line is emty OR the cursor is at the end of a line and the line has content + if (characterPos == curLine.Length) + { + string lineToAdd = CursorPosition.LineNumber + 1 < TotalLines.Count ? TotalLines.GetLineText(CursorPosition.LineNumber + 1) : null; + if (lineToAdd != null) + { + if (CursorPosition.LineNumber == LongestLineIndex) + NeedsRecalculateLongestLineIndex = true; + + undoRedo.RecordUndoAction(() => + { + int curpos = TotalLines.GetLineLength(CursorPosition.LineNumber); + CurrentLine += lineToAdd; + TotalLines.DeleteAt(CursorPosition.LineNumber + 1); + + //update the cursorposition + CursorPosition.CharacterPosition = curpos; + + }, TotalLines, CursorPosition.LineNumber, 2, 1, NewLineCharacter); + } + } + //delete text in line + else if (TotalLines.Count > CursorPosition.LineNumber) + { + int stepsToMove = controlIsPressed ? Cursor.CalculateStepsToMoveRight(curLine, characterPos) : 1; + + if (CursorPosition.LineNumber == LongestLineIndex) + NeedsRecalculateLongestLineIndex = true; + + undoRedo.RecordUndoAction(() => + { + CurrentLine = curLine.SafeRemove(characterPos, stepsToMove); + }, TotalLines, CursorPosition.LineNumber, 1, 1, NewLineCharacter); + } + } + + UpdateScrollToShowCursor(); + canvasHelper.UpdateText(); + canvasHelper.UpdateCursor(); + Internal_TextChanged(); + } + private void AddNewLine() + { + if (IsReadonly) + return; + + if (TotalLines.Count == 0) + { + TotalLines.AddLine(); + return; + } + + CursorPosition startLinePos = new CursorPosition(TextSelection == null ? CursorPosition.ChangeLineNumber(CursorPosition, CursorPosition.LineNumber) : Selection.GetMin(TextSelection)); + + //If the whole text is selected + if (Selection.WholeTextSelected(TextSelection, TotalLines)) + { + undoRedo.RecordUndoAction(() => + { + ListHelper.Clear(TotalLines, true); + TotalLines.InsertNewLine(-1); + CursorPosition = new CursorPosition(0, 1); + }, TotalLines, 0, TotalLines.Count, 2, NewLineCharacter); + ForceClearSelection(); + canvasHelper.UpdateAll(); + Internal_TextChanged(); + return; + } + + if (TextSelection == null) //No selection + { + string startLine = TotalLines.GetLineText(startLinePos.LineNumber); + + undoRedo.RecordUndoAction(() => + { + string[] splittedLine = Utils.SplitAt(TotalLines.GetLineText(startLinePos.LineNumber), startLinePos.CharacterPosition); + + TotalLines.SetLineText(startLinePos.LineNumber, splittedLine[1]); + TotalLines.InsertOrAdd(startLinePos.LineNumber, splittedLine[0]); + + }, TotalLines, startLinePos.LineNumber, 1, 2, NewLineCharacter); + } + else //Any kind of selection + { + int remove = 2; + if (TextSelection.StartPosition.LineNumber == TextSelection.EndPosition.LineNumber) + { + //line is selected completely: remove = 1 + if (Selection.GetMax(TextSelection.StartPosition, TextSelection.EndPosition).CharacterPosition == TotalLines.GetLineLength(CursorPosition.LineNumber) && + Selection.GetMin(TextSelection.StartPosition, TextSelection.EndPosition).CharacterPosition == 0) + { + remove = 1; + } + } + + undoRedo.RecordUndoAction(() => + { + CursorPosition = Selection.Replace(TextSelection, TotalLines, NewLineCharacter, NewLineCharacter); + }, TotalLines, TextSelection, remove, NewLineCharacter); + } + + ClearSelection(); + CursorPosition.LineNumber += 1; + CursorPosition.CharacterPosition = 0; + + if (TextSelection == null && CursorPosition.LineNumber == NumberOfRenderedLines + NumberOfStartLine) + ScrollOneLineDown(); + else + UpdateScrollToShowCursor(); + + canvasHelper.UpdateAll(); + Internal_TextChanged(); + } + #endregion + + #region Random functions + private void InitialiseOnStart() + { + UpdateZoom(); + if (TotalLines.Count == 0) + { + TotalLines.AddLine(); + } + } + private void ForceClearSelection() + { + selectionrenderer.ClearSelection(); + TextSelection = null; + canvasHelper.UpdateSelection(); + } + private void StartSelectionIfNeeded() + { + if (Selection.SelectionIsNull(selectionrenderer, TextSelection)) + { + selectionrenderer.SelectionStartPosition = selectionrenderer.SelectionEndPosition = new CursorPosition(CursorPosition.CharacterPosition, CursorPosition.LineNumber); + TextSelection = new TextSelection(selectionrenderer.SelectionStartPosition, selectionrenderer.SelectionEndPosition); + } + } + private void DoDragDropSelection() + { + if (TextSelection == null || IsReadonly) + return; + + //Position to insert is selection start or selection end -> no need to drag + if (Cursor.Equals(TextSelection.StartPosition, CursorPosition) || Cursor.Equals(TextSelection.EndPosition, CursorPosition)) + { + ChangeCursor(InputSystemCursorShape.IBeam); + DragDropSelection = false; + return; + } + + string textToInsert = SelectedText; + CursorPosition curpos = new CursorPosition(CursorPosition); + + //Delete the selection + RemoveText(); + + CursorPosition = curpos; + + AddCharacter(textToInsert, false); + + ChangeCursor(InputSystemCursorShape.IBeam); + DragDropSelection = false; + canvasHelper.UpdateAll(); + } + private void EndDragDropSelection(bool clearSelectedText = true) + { + DragDropSelection = false; + if (clearSelectedText) + ClearSelection(); + + ChangeCursor(InputSystemCursorShape.IBeam); + selectionrenderer.IsSelecting = false; + canvasHelper.UpdateCursor(); + } + private bool DragDropOverSelection(Point curPos) + { + bool res = selectionrenderer.CursorIsInSelection(CursorPosition, TextSelection) || + selectionrenderer.PointerIsOverSelection(curPos, TextSelection, DrawnTextLayout); + + ChangeCursor(res ? InputSystemCursorShape.UniversalNo : InputSystemCursorShape.IBeam); + + return res; + } + private void UpdateScrollToShowCursor(bool update = true) + { + if (NumberOfStartLine + NumberOfRenderedLines <= CursorPosition.LineNumber) + VerticalScrollbar.Value = (CursorPosition.LineNumber - NumberOfRenderedLines + 1) * SingleLineHeight / DefaultVerticalScrollSensitivity; + else if (NumberOfStartLine > CursorPosition.LineNumber) + VerticalScrollbar.Value = (CursorPosition.LineNumber - 1) * SingleLineHeight / DefaultVerticalScrollSensitivity; + + if (update) + canvasHelper.UpdateAll(); + } + private int GetCurPosInLine() + { + int curLineLength = CurrentLine.Length; + + if (CursorPosition.CharacterPosition > curLineLength) + return curLineLength; + return CursorPosition.CharacterPosition; + } + private void ScrollIntoViewHorizontal() + { + float curPosInLine = CursorRenderer.GetCursorPositionInLine(CurrentLineTextLayout, CursorPosition, 0); + if (curPosInLine == OldHorizontalScrollValue) + return; + + HorizontalScrollbar.Value = curPosInLine - (Canvas_Text.ActualWidth - 10); + OldHorizontalScrollValue = curPosInLine; + } + private void SetFocus() + { + if (!HasFocus) + GotFocus?.Invoke(this); + HasFocus = true; + + canvasHelper.UpdateCursor(); + inputHandler.Focus(FocusState.Programmatic); + ChangeCursor(InputSystemCursorShape.IBeam); + } + private void RemoveFocus() + { + if (HasFocus) + LostFocus?.Invoke(this); + canvasHelper.UpdateCursor(); + + HasFocus = false; + ChangeCursor(InputSystemCursorShape.Arrow); + } + private void CreateColorResources(ICanvasResourceCreatorWithDpi resourceCreator) + { + if (ColorResourcesCreated) + return; + + Canvas_LineNumber.ClearColor = _Design.LineNumberBackground; + MainGrid.Background = _Design.Background; + TextColorBrush = new CanvasSolidColorBrush(resourceCreator, _Design.TextColor); + CursorColorBrush = new CanvasSolidColorBrush(resourceCreator, _Design.CursorColor); + LineNumberColorBrush = new CanvasSolidColorBrush(resourceCreator, _Design.LineNumberColor); + LineHighlighterBrush = new CanvasSolidColorBrush(resourceCreator, _Design.LineHighlighterColor); + ColorResourcesCreated = true; + } + private void UpdateWhenScrolled() + { + //only update when a line was scrolled + if ((int)(VerticalScrollbar.Value / SingleLineHeight) != NumberOfStartLine) + { + canvasHelper.UpdateAll(); + } + } + private bool OutOfRenderedArea(int line) + { + //Check whether the current line is outside the bounds of the visible area + return line < NumberOfStartLine || line >= NumberOfStartLine + NumberOfRenderedLines; + } + + //Trys running the code and clears the memory if OutOfMemoryException gets thrown + private async void Safe_Paste(bool handleException = true) + { + try + { + DataPackageView dataPackageView = Clipboard.GetContent(); + if (dataPackageView.Contains(StandardDataFormats.Text)) + { + string text = null; + try + { + text = await dataPackageView.GetTextAsync(); + } + catch (Exception ex) //When longer holding Ctrl + V the clipboard may throw an exception: + { + Debug.WriteLine("Clipboard exception: " + ex.Message); + return; + } + + if (await Utils.IsOverTextLimit(text.Length)) + return; + + AddCharacter(stringManager.CleanUpString(text)); + } + } + catch (OutOfMemoryException) + { + if (handleException) + { + CleanUp(); + Safe_Paste(false); + return; + } + throw new OutOfMemoryException(); + } + } + private string Safe_Gettext(bool handleException = true) + { + try + { + return TotalLines.GetString(NewLineCharacter); + } + catch (OutOfMemoryException) + { + if (handleException) + { + CleanUp(); + return Safe_Gettext(false); + } + throw new OutOfMemoryException(); + } + } + private void Safe_Cut(bool handleException = true) + { + try + { + DataPackage dataPackage = new DataPackage(); + dataPackage.SetText(SelectedText); + if (TextSelection == null) + DeleteLine(CursorPosition.LineNumber); //Delete the line + else + DeleteText(); //Delete the selected text + + dataPackage.RequestedOperation = DataPackageOperation.Move; + Clipboard.SetContent(dataPackage); + ClearSelection(); + } + catch (OutOfMemoryException) + { + if (handleException) + { + CleanUp(); + Safe_Cut(false); + return; + } + throw new OutOfMemoryException(); + } + } + private void Safe_Copy(bool handleException = true) + { + try + { + DataPackage dataPackage = new DataPackage(); + dataPackage.SetText(SelectedText); + dataPackage.RequestedOperation = DataPackageOperation.Copy; + Clipboard.SetContent(dataPackage); + } + catch (OutOfMemoryException) + { + if (handleException) + { + CleanUp(); + Safe_Copy(false); + return; + } + throw new OutOfMemoryException(); + } + } + private void Safe_LoadLines(IEnumerable lines, LineEnding lineEnding = LineEnding.CRLF, bool HandleException = true) + { + try + { + selectionrenderer.ClearSelection(); + undoRedo.ClearAll(); + + ListHelper.Clear(TotalLines); + TotalLines.AddRange(lines); + + this.LineEnding = lineEnding; + + NeedsRecalculateLongestLineIndex = true; + canvasHelper.UpdateAll(); + } + catch (OutOfMemoryException) + { + if (HandleException) + { + CleanUp(); + Safe_LoadLines(lines, lineEnding, false); + return; + } + throw new OutOfMemoryException(); + } + } + private async void Safe_LoadText(string text, bool handleException = true) + { + try + { + if (await Utils.IsOverTextLimit(text.Length)) + return; + + //Get the LineEnding + LineEnding = LineEndings.FindLineEnding(text); + + selectionrenderer.ClearSelection(); + undoRedo.ClearAll(); + + NeedsRecalculateLongestLineIndex = true; + + if (text.Length == 0) + ListHelper.Clear(TotalLines, true); + else + Selection.ReplaceLines(TotalLines, 0, TotalLines.Count, stringManager.CleanUpString(text).Split(NewLineCharacter)); + + canvasHelper.UpdateAll(); + } + catch (OutOfMemoryException) + { + if (handleException) + { + CleanUp(); + Safe_LoadText(text, false); + return; + } + throw new OutOfMemoryException(); + } + } + private async void Safe_SetText(string text, bool handleException = true) + { + try + { + if (await Utils.IsOverTextLimit(text.Length)) + return; + + selectionrenderer.ClearSelection(); + NeedsRecalculateLongestLineIndex = true; + undoRedo.RecordUndoAction(() => + { + Selection.ReplaceLines(TotalLines, 0, TotalLines.Count, stringManager.CleanUpString(text).Split(NewLineCharacter)); + if (text.Length == 0) //Create a new line when the text gets cleared + { + TotalLines.AddLine(); + } + }, TotalLines, 0, TotalLines.Count, Utils.CountLines(text, NewLineCharacter), NewLineCharacter); + + canvasHelper.UpdateAll(); + } + catch (OutOfMemoryException) + { + if (handleException) + { + CleanUp(); + Safe_SetText(text, false); + return; + } + throw new OutOfMemoryException(); + } + } + private void CleanUp() + { + Debug.WriteLine("Collect GC"); + ListHelper.GCList(TotalLines); + } + private void PointerReleasedAction(Point point) + { + OldTouchPosition = null; + selectionrenderer.IsSelectingOverLinenumbers = false; + + //End text drag/drop -> insert text at cursorposition + if (DragDropSelection && !DragDropOverSelection(point)) + DoDragDropSelection(); + else if (DragDropSelection) + EndDragDropSelection(); + + if (selectionrenderer.IsSelecting) + { + this.Focus(FocusState.Programmatic); + selectionrenderer.HasSelection = true; + } + + selectionrenderer.IsSelecting = false; + } + private void PointerMovedAction(Point point) + { + if (selectionrenderer.IsSelecting) + { + double canvasWidth = Math.Round(this.ActualWidth, 2); + double canvasHeight = Math.Round(this.ActualHeight, 2); + double curPosX = Math.Round(point.X, 2); + double curPosY = Math.Round(point.Y, 2); + + if (curPosY > canvasHeight - 50) + { + VerticalScrollbar.Value += (curPosY > canvasHeight + 30 ? 20 : (canvasHeight - curPosY) / 180); + UpdateWhenScrolled(); + } + else if (curPosY < 50) + { + VerticalScrollbar.Value += curPosY < -30 ? -20 : -(50 - curPosY) / 20; + UpdateWhenScrolled(); + } + + //Horizontal + if (curPosX > canvasWidth - 100) + { + ScrollIntoViewHorizontal(); + canvasHelper.UpdateAll(); + } + else if (curPosX < 100) + { + ScrollIntoViewHorizontal(); + canvasHelper.UpdateAll(); + } + } + + //Drag drop text -> move the cursor to get the insertion point + if (DragDropSelection) + { + DragDropOverSelection(point); + UpdateCursorVariable(point); + canvasHelper.UpdateCursor(); + } + if (selectionrenderer.IsSelecting && !DragDropSelection) + { + //selection started over the linenumbers: + if (selectionrenderer.IsSelectingOverLinenumbers) + { + Point pointerPos = point; + pointerPos.Y += SingleLineHeight; //add one more line + + //When the selection reaches the end of the textbox select the last line completely + if (CursorPosition.LineNumber == TotalLines.Count - 1) + { + pointerPos.Y -= SingleLineHeight; //add one more line + pointerPos.X = Utils.MeasureLineLenght(CanvasDevice.GetSharedDevice(), TotalLines.GetLineText(-1), TextFormat).Width + 10; + } + UpdateCursorVariable(pointerPos); + } + else //Default selection + UpdateCursorVariable(point); + + //Update: + canvasHelper.UpdateCursor(); + selectionrenderer.SelectionEndPosition = new CursorPosition(CursorPosition.CharacterPosition, CursorPosition.LineNumber); + canvasHelper.UpdateSelection(); + } + } + private bool CheckTouchInput(PointerPoint point) + { + if (point.PointerDeviceType == PointerDeviceType.Touch || point.PointerDeviceType == PointerDeviceType.Pen) + { + //Get the touch start position: + if (!OldTouchPosition.HasValue) + return true; + + //GEt the dragged offset: + double scrollX = OldTouchPosition.Value.X - point.Position.X; + double scrollY = OldTouchPosition.Value.Y - point.Position.Y; + VerticalScrollbar.Value += scrollY > 2 ? 2 : scrollY < -2 ? -2 : scrollY; + HorizontalScrollbar.Value += scrollX > 2 ? 2 : scrollX < -2 ? -2 : scrollX; + canvasHelper.UpdateAll(); + return true; + } + return false; + } + private bool CheckTouchInput_Click(PointerPoint point) + { + if (point.PointerDeviceType == PointerDeviceType.Touch || point.PointerDeviceType == PointerDeviceType.Pen) + { + OldTouchPosition = point.Position; + return true; + } + return false; + } + + + #endregion + + #region Events + //Handle keyinputs + private void InputHandler_TextChanged(object sender, TextChangedEventArgs e) + { + if (IsReadonly || inputHandler.Text == "\t") + return; + + //Prevent key-entering if control key is pressed + var ctrl = Utils.IsKeyPressed(VirtualKey.Control); + var menu = Utils.IsKeyPressed(VirtualKey.Menu); + if (ctrl && !menu || menu && !ctrl) + return; + + AddCharacter(inputHandler.Text); + inputHandler.Text = ""; + } + private void InputHandler_KeyDown(object sender, KeyRoutedEventArgs e) + { + if (e.Key == VirtualKey.Tab) + { + TextSelection selection; + if (Utils.IsKeyPressed(VirtualKey.Shift)) + selection = TabKey.MoveTabBack(TotalLines, TextSelection, CursorPosition, tabSpaceHelper.TabCharacter, NewLineCharacter, undoRedo); + else + selection = TabKey.MoveTab(TotalLines, TextSelection, CursorPosition, tabSpaceHelper.TabCharacter, NewLineCharacter, undoRedo); + + if (selection != null) + { + if (selection.EndPosition == null) + { + CursorPosition = selection.StartPosition; + } + else + { + selectionrenderer.SetSelection(selection); + CursorPosition = selection.EndPosition; + } + } + canvasHelper.UpdateAll(); + + //mark as handled to not change focus + e.Handled = true; + } + if (!HasFocus) + return; + + var ctrl = Utils.IsKeyPressed(VirtualKey.Control); + var shift = Utils.IsKeyPressed(VirtualKey.Shift); + var menu = Utils.IsKeyPressed(VirtualKey.Menu); + if (ctrl && !shift && !menu) + { + switch (e.Key) + { + case VirtualKey.Up: + ScrollOneLineUp(); + break; + case VirtualKey.Down: + ScrollOneLineDown(); + break; + case VirtualKey.V: + Paste(); + break; + case VirtualKey.Z: + Undo(); + break; + case VirtualKey.Y: + Redo(); + break; + case VirtualKey.C: + Copy(); + break; + case VirtualKey.X: + Cut(); + break; + case VirtualKey.A: + SelectAll(); + break; + case VirtualKey.W: + Selection.SelectSingleWord(canvasHelper, selectionrenderer, CursorPosition, CurrentLine); + break; + } + + if (e.Key != VirtualKey.Left && e.Key != VirtualKey.Right && e.Key != VirtualKey.Back && e.Key != VirtualKey.Delete) + return; + } + + if (menu) + { + if (e.Key == VirtualKey.Down || e.Key == VirtualKey.Up) + { + MoveLine.Move( + TotalLines, + TextSelection, + CursorPosition, + undoRedo, + NewLineCharacter, + e.Key == VirtualKey.Down ? LineMoveDirection.Down : LineMoveDirection.Up + ); + + if (e.Key == VirtualKey.Down) + ScrollOneLineDown(); + else if (e.Key == VirtualKey.Up) + ScrollOneLineUp(); + + ForceClearSelection(); + canvasHelper.UpdateAll(); + return; + } + } + + switch (e.Key) + { + case VirtualKey.Enter: + AddNewLine(); + break; + case VirtualKey.Back: + RemoveText(ctrl); + break; + case VirtualKey.Delete: + DeleteText(ctrl, shift); + break; + case VirtualKey.Left: + { + if (shift) + { + StartSelectionIfNeeded(); + Cursor.MoveLeft(CursorPosition, TotalLines, CurrentLine); + selectionrenderer.SetSelectionEnd(CursorPosition); + } + else + { + //Move the cursor to the start of the selection + if (selectionrenderer.HasSelection && TextSelection != null) + CursorPosition = Selection.GetMin(TextSelection); + else + Cursor.MoveLeft(CursorPosition, TotalLines, CurrentLine); + + Selection.ClearSelectionIfNeeded(this, selectionrenderer); + } + + UpdateScrollToShowCursor(); + canvasHelper.UpdateText(); + canvasHelper.UpdateCursor(); + canvasHelper.UpdateSelection(); + break; + } + case VirtualKey.Right: + { + if (shift) + { + StartSelectionIfNeeded(); + Cursor.MoveRight(CursorPosition, TotalLines, CurrentLine); + selectionrenderer.SetSelectionEnd(CursorPosition); + } + else + { + //Move the cursor to the end of the selection + if (selectionrenderer.HasSelection && TextSelection != null) + CursorPosition = Selection.GetMax(TextSelection); + else + Cursor.MoveRight(CursorPosition, TotalLines, TotalLines.GetCurrentLineText()); + + Selection.ClearSelectionIfNeeded(this, selectionrenderer); + } + + UpdateScrollToShowCursor(false); + canvasHelper.UpdateAll(); + break; + } + case VirtualKey.Down: + { + if (shift) + { + StartSelectionIfNeeded(); + selectionrenderer.IsSelecting = true; + CursorPosition = selectionrenderer.SelectionEndPosition = Cursor.MoveDown(selectionrenderer.SelectionEndPosition, TotalLines.Count); + selectionrenderer.IsSelecting = false; + } + else + { + Selection.ClearSelectionIfNeeded(this, selectionrenderer); + CursorPosition = Cursor.MoveDown(CursorPosition, TotalLines.Count); + } + + UpdateScrollToShowCursor(false); + canvasHelper.UpdateAll(); + break; + } + case VirtualKey.Up: + { + if (shift) + { + StartSelectionIfNeeded(); + selectionrenderer.IsSelecting = true; + CursorPosition = selectionrenderer.SelectionEndPosition = Cursor.MoveUp(selectionrenderer.SelectionEndPosition); + selectionrenderer.IsSelecting = false; + } + else + { + Selection.ClearSelectionIfNeeded(this, selectionrenderer); + CursorPosition = Cursor.MoveUp(CursorPosition); + } + + UpdateScrollToShowCursor(false); + canvasHelper.UpdateAll(); + break; + } + case VirtualKey.Escape: + { + EndDragDropSelection(); + ClearSelection(); + break; + } + case VirtualKey.PageUp: + ScrollPageUp(); + break; + case VirtualKey.PageDown: + ScrollPageDown(); + break; + case VirtualKey.End: + { + if (shift) + { + selectionrenderer.HasSelection = true; + + if (selectionrenderer.SelectionStartPosition == null) + selectionrenderer.SelectionStartPosition = new CursorPosition(CursorPosition); + + Cursor.MoveToLineEnd(CursorPosition, CurrentLine); + selectionrenderer.SelectionEndPosition = CursorPosition; + canvasHelper.UpdateSelection(); + canvasHelper.UpdateCursor(); + } + else + { + Cursor.MoveToLineEnd(CursorPosition, CurrentLine); + canvasHelper.UpdateCursor(); + canvasHelper.UpdateText(); + } + break; + } + case VirtualKey.Home: + { + if (shift) + { + selectionrenderer.HasSelection = true; + + if (selectionrenderer.SelectionStartPosition == null) + selectionrenderer.SelectionStartPosition = new CursorPosition(CursorPosition); + Cursor.MoveToLineStart(CursorPosition); + selectionrenderer.SelectionEndPosition = CursorPosition; + + canvasHelper.UpdateSelection(); + canvasHelper.UpdateCursor(); + } + else + { + Cursor.MoveToLineStart(CursorPosition); + canvasHelper.UpdateCursor(); + canvasHelper.UpdateText(); + } + break; + } + } + } + //Pointer-events: + + //Need both the Canvas event and the CoreWindow event, because: + //AppWindows does not handle CoreWindow events + //Without coreWindow the selection outside of the window would not work + + private void Canvas_Selection_PointerReleased(object sender, PointerRoutedEventArgs e) + { + Canvas_Selection.ReleasePointerCapture(e.Pointer); + + PointerReleasedAction(e.GetCurrentPoint(Canvas_Selection).Position); + } + private void Canvas_Selection_PointerMoved(object sender, PointerRoutedEventArgs e) + { + if (!HasFocus) + return; + + var point = e.GetCurrentPoint(Canvas_Selection); + + if (CheckTouchInput(point)) + return; + + if (point.Properties.IsLeftButtonPressed) + { + selectionrenderer.IsSelecting = true; + } + PointerMovedAction(point.Position); + + } + private void Canvas_Selection_PointerPressed(object sender, PointerRoutedEventArgs e) + { + Canvas_Selection.CapturePointer(e.Pointer); + selectionrenderer.IsSelectingOverLinenumbers = false; + + var point = e.GetCurrentPoint(Canvas_Selection); + if (CheckTouchInput_Click(point)) + return; + + Point pointerPosition = point.Position; + bool leftButtonPressed = point.Properties.IsLeftButtonPressed; + bool ightButtonPressed = point.Properties.IsRightButtonPressed; + + if (leftButtonPressed && !Utils.IsKeyPressed(VirtualKey.Shift)) + PointerClickCount++; + + if (PointerClickCount == 3) + { + SelectLine(CursorPosition.LineNumber); + PointerClickCount = 0; + return; + } + else if (PointerClickCount == 2) + { + UpdateCursorVariable(pointerPosition); + Selection.SelectSingleWord(canvasHelper, selectionrenderer, CursorPosition, CurrentLine); + } + else + { + //TODO: Show the on screen keyboard if no physical keyboard is attached + + //Show the contextflyout + if (ightButtonPressed) + { + if (!selectionrenderer.PointerIsOverSelection(pointerPosition, TextSelection, DrawnTextLayout)) + { + ForceClearSelection(); + UpdateCursorVariable(pointerPosition); + } + + if (!ContextFlyoutDisabled && ContextFlyout != null) + { + ContextFlyout.ShowAt(sender as FrameworkElement, new FlyoutShowOptions { Position = pointerPosition }); + } + } + + //Shift + click = set selection + if (Utils.IsKeyPressed(VirtualKey.Shift) && leftButtonPressed) + { + if (selectionrenderer.SelectionStartPosition == null) + selectionrenderer.SetSelectionStart(new CursorPosition(CursorPosition)); + + UpdateCursorVariable(pointerPosition); + + selectionrenderer.SetSelectionEnd(new CursorPosition(CursorPosition)); + canvasHelper.UpdateSelection(); + canvasHelper.UpdateCursor(); + return; + } + + if (leftButtonPressed) + { + UpdateCursorVariable(pointerPosition); + + //Text drag/drop + if (TextSelection != null) + { + if (selectionrenderer.PointerIsOverSelection(pointerPosition, TextSelection, DrawnTextLayout) && !DragDropSelection) + { + PointerClickCount = 0; + DragDropSelection = true; + + return; + } + //End the selection by pressing on it + if (DragDropSelection && DragDropOverSelection(pointerPosition)) + { + EndDragDropSelection(true); + } + } + + //Clear the selection when pressing anywhere + if (selectionrenderer.HasSelection) + { + ForceClearSelection(); + selectionrenderer.SelectionStartPosition = new CursorPosition(CursorPosition); + } + else + { + selectionrenderer.SetSelectionStart(new CursorPosition(CursorPosition)); + selectionrenderer.IsSelecting = true; + } + } + canvasHelper.UpdateCursor(); + } + + PointerClickTimer.Start(); + PointerClickTimer.Tick += (s, t) => + { + PointerClickTimer.Stop(); + PointerClickCount = 0; + }; + } + private void Canvas_Selection_PointerWheelChanged(object sender, PointerRoutedEventArgs e) + { + var delta = e.GetCurrentPoint(Canvas_Selection).Properties.MouseWheelDelta; + bool needsUpdate = false; + //Zoom using mousewheel + if (Utils.IsKeyPressed(VirtualKey.Control)) + { + _ZoomFactor += delta / 20; + UpdateZoom(); + return; + } + //Scroll horizontal using mousewheel + else if (Utils.IsKeyPressed(VirtualKey.Shift)) + { + HorizontalScrollbar.Value -= delta * HorizontalScrollSensitivity; + needsUpdate = true; + } + //Scroll horizontal using touchpad + else if (e.GetCurrentPoint(Canvas_Selection).Properties.IsHorizontalMouseWheel) + { + HorizontalScrollbar.Value += delta * HorizontalScrollSensitivity; + needsUpdate = true; + } + //Scroll vertical using mousewheel + else + { + VerticalScrollbar.Value -= (delta * VerticalScrollSensitivity) / DefaultVerticalScrollSensitivity; + //Only update when a line was scrolled + if ((int)(VerticalScrollbar.Value / SingleLineHeight * DefaultVerticalScrollSensitivity) != NumberOfStartLine) + { + needsUpdate = true; + } + } + + if (selectionrenderer.IsSelecting) + { + UpdateCursorVariable(e.GetCurrentPoint(Canvas_Selection).Position); + canvasHelper.UpdateCursor(); + + selectionrenderer.SelectionEndPosition = new CursorPosition(CursorPosition.CharacterPosition, CursorPosition.LineNumber); + needsUpdate = true; + } + if (needsUpdate) + canvasHelper.UpdateAll(); + } + private void Canvas_LineNumber_PointerPressed(object sender, PointerRoutedEventArgs e) + { + Canvas_Selection.CapturePointer(e.Pointer); + + var point = e.GetCurrentPoint(Canvas_Selection); + if (CheckTouchInput_Click(point)) + return; + + //Select the line where the cursor is over + SelectLine(CursorRenderer.GetCursorLineFromPoint(point.Position, SingleLineHeight, NumberOfRenderedLines, NumberOfStartLine)); + + selectionrenderer.IsSelecting = true; + selectionrenderer.IsSelectingOverLinenumbers = true; + } + //Change the cursor when entering/leaving the control + private void UserControl_PointerEntered(object sender, PointerRoutedEventArgs e) + { + ChangeCursor(InputSystemCursorShape.IBeam); + } + private void UserControl_PointerExited(object sender, PointerRoutedEventArgs e) + { + ChangeCursor(InputSystemCursorShape.Arrow); + } + //Scrolling + private void VerticalScrollbar_Loaded(object sender, RoutedEventArgs e) + { + VerticalScrollbar.Maximum = ((TotalLines.Count + 1) * SingleLineHeight - Scroll.ActualHeight) / DefaultVerticalScrollSensitivity; + VerticalScrollbar.ViewportSize = this.ActualHeight; + } + private void HorizontalScrollbar_Scroll(object sender, ScrollEventArgs e) + { + canvasHelper.UpdateAll(); + } + private void VerticalScrollbar_Scroll(object sender, ScrollEventArgs e) + { + //only update when a line was scrolled + if ((int)(VerticalScrollbar.Value / SingleLineHeight * DefaultVerticalScrollSensitivity) != NumberOfStartLine) + { + canvasHelper.UpdateAll(); + } + } + //Canvas event + private void Canvas_Text_Draw(CanvasControl sender, CanvasDrawEventArgs args) + { + //Create resources and layouts: + if (NeedsTextFormatUpdate || TextFormat == null || LineNumberTextFormat == null) + { + if (_ShowLineNumbers) + LineNumberTextFormat = TextLayoutHelper.CreateLinenumberTextFormat(ZoomedFontSize, FontFamily); + TextFormat = TextLayoutHelper.CreateCanvasTextFormat(ZoomedFontSize, FontFamily); + } + + CreateColorResources(args.DrawingSession); + + //Measure textposition and apply the value to the scrollbar + VerticalScrollbar.Maximum = ((TotalLines.Count + 1) * SingleLineHeight - Scroll.ActualHeight) / DefaultVerticalScrollSensitivity; + VerticalScrollbar.ViewportSize = sender.ActualHeight; + + //Calculate number of lines that needs to be rendered + NumberOfRenderedLines = (int)(sender.ActualHeight / SingleLineHeight); + NumberOfStartLine = (int)((VerticalScrollbar.Value * DefaultVerticalScrollSensitivity) / SingleLineHeight); + + //Get all the lines, that need to be rendered, from the list + NumberOfRenderedLines = NumberOfRenderedLines + NumberOfStartLine > TotalLines.Count ? TotalLines.Count : NumberOfRenderedLines; + + RenderedLines = TotalLines.GetLines(NumberOfStartLine, NumberOfRenderedLines); + RenderedText = RenderedLines.GetString("\n"); + + if (_ShowLineNumbers) + { + for (int i = 0; i < NumberOfRenderedLines; i++) + { + LineNumberContent.AppendLine((i + 1 + NumberOfStartLine).ToString()); + } + LineNumberTextToRender = LineNumberContent.ToString(); + LineNumberContent.Clear(); + } + + //Get the longest line in the text: + if (NeedsRecalculateLongestLineIndex) + { + NeedsRecalculateLongestLineIndex = false; + LongestLineIndex = Utils.GetLongestLineIndex(TotalLines); + } + + string longestLineText = TotalLines.GetLineText(LongestLineIndex); + LongestLineLength = longestLineText.Length; + Size lineLength = Utils.MeasureLineLenght(CanvasDevice.GetSharedDevice(), longestLineText, TextFormat); + + //Measure horizontal Width of longest line and apply to scrollbar + HorizontalScrollbar.Maximum = (lineLength.Width <= sender.ActualWidth ? 0 : lineLength.Width - sender.ActualWidth + 50); + HorizontalScrollbar.ViewportSize = sender.ActualWidth; + ScrollIntoViewHorizontal(); + + //Create the textlayout --> apply the Syntaxhighlighting --> render it: + + //Only update the textformat when the text changes: + if (OldRenderedText != RenderedText || NeedsUpdateTextLayout) + { + NeedsUpdateTextLayout = false; + OldRenderedText = RenderedText; + + DrawnTextLayout = TextLayoutHelper.CreateTextResource(sender, DrawnTextLayout, TextFormat, RenderedText, new Size { Height = sender.Size.Height, Width = this.ActualWidth }); + SyntaxHighlightingRenderer.UpdateSyntaxHighlighting(DrawnTextLayout, _AppTheme, _CodeLanguage, SyntaxHighlighting, RenderedText); + + } + + //render the search highlights + if (SearchIsOpen) + SearchHighlightsRenderer.RenderHighlights(args, DrawnTextLayout, RenderedText, searchHelper.MatchingSearchLines, searchHelper.SearchParameter.SearchExpression, (float)-HorizontalScroll, SingleLineHeight / DefaultVerticalScrollSensitivity, _Design.SearchHighlightColor); + + args.DrawingSession.DrawTextLayout(DrawnTextLayout, (float)-HorizontalScroll, SingleLineHeight, TextColorBrush); + + //Only update when old text != new text, to reduce updates when scrolling + if (OldLineNumberTextToRender == null || LineNumberTextToRender == null || !OldLineNumberTextToRender.Equals(LineNumberTextToRender, StringComparison.OrdinalIgnoreCase)) + { + Canvas_LineNumber.Invalidate(); + } + } + private void Canvas_Selection_Draw(CanvasControl sender, CanvasDrawEventArgs args) + { + if (selectionrenderer.SelectionStartPosition != null && selectionrenderer.SelectionEndPosition != null) + { + selectionrenderer.HasSelection = + !(selectionrenderer.SelectionStartPosition.LineNumber == selectionrenderer.SelectionEndPosition.LineNumber && + selectionrenderer.SelectionStartPosition.CharacterPosition == selectionrenderer.SelectionEndPosition.CharacterPosition); + } + else + selectionrenderer.HasSelection = false; + + if (selectionrenderer.HasSelection) + { + TextSelection = selectionrenderer.DrawSelection(DrawnTextLayout, RenderedLines, args, (float)-HorizontalScroll, SingleLineHeight / DefaultVerticalScrollSensitivity, NumberOfStartLine, NumberOfRenderedLines, ZoomedFontSize, _Design.SelectionColor); + } + + if (TextSelection != null && !Selection.Equals(OldTextSelection, TextSelection)) + { + //Update the variables + OldTextSelection = new TextSelection(TextSelection); + Internal_CursorChanged(); + } + } + private void Canvas_Cursor_Draw(CanvasControl sender, CanvasDrawEventArgs args) + { + UpdateCurrentLine(); + if (DrawnTextLayout == null || !HasFocus) + return; + + int currentLineLength = CurrentLine.Length; + if (CursorPosition.LineNumber >= TotalLines.Count) + { + CursorPosition.LineNumber = TotalLines.Count - 1; + CursorPosition.CharacterPosition = currentLineLength; + } + + //Calculate the distance to the top for the cursorposition and render the cursor + float renderPosY = (float)((CursorPosition.LineNumber - NumberOfStartLine) * SingleLineHeight) + SingleLineHeight / DefaultVerticalScrollSensitivity; + + //Out of display-region: + if (renderPosY > NumberOfRenderedLines * SingleLineHeight || renderPosY < 0) + return; + + UpdateCurrentLineTextLayout(); + + int characterPos = CursorPosition.CharacterPosition; + if (characterPos > currentLineLength) + characterPos = currentLineLength; + + CursorRenderer.RenderCursor( + CurrentLineTextLayout, + characterPos, + (float)-HorizontalScroll, + renderPosY, ZoomedFontSize, + CursorSize, + args, + CursorColorBrush); + + + if (_ShowLineHighlighter && Selection.SelectionIsNull(selectionrenderer, TextSelection)) + LineHighlighterRenderer.Render((float)sender.ActualWidth, CurrentLineTextLayout, renderPosY, ZoomedFontSize, args, LineHighlighterBrush); + + if (!Cursor.Equals(CursorPosition, OldCursorPosition)) + { + OldCursorPosition = new CursorPosition(CursorPosition); + Internal_CursorChanged(); + } + } + private void Canvas_LineNumber_Draw(CanvasControl sender, CanvasDrawEventArgs args) + { + if (_ShowLineNumbers) + { + if (LineNumberTextToRender == null || LineNumberTextToRender.Length == 0) + return; + + //Calculate the linenumbers + float lineNumberWidth = (float)Utils.MeasureTextSize(CanvasDevice.GetSharedDevice(), (TotalLines.Count).ToString(), LineNumberTextFormat).Width; + Canvas_LineNumber.Width = lineNumberWidth + 10 + SpaceBetweenLineNumberAndText; + } + else + { + Canvas_LineNumber.Width = SpaceBetweenLineNumberAndText; + LineNumberTextToRender = null; + return; + } + + float posX = (float)sender.Size.Width - SpaceBetweenLineNumberAndText; + if (posX < 0) + posX = 0; + + OldLineNumberTextToRender = LineNumberTextToRender; + LineNumberTextLayout = TextLayoutHelper.CreateTextLayout(sender, LineNumberTextFormat, LineNumberTextToRender, posX, (float)sender.Size.Height); + args.DrawingSession.DrawTextLayout(LineNumberTextLayout, 10, SingleLineHeight, LineNumberColorBrush); + } + //Internal events: + private void Internal_TextChanged() + { + //update the possible lines if the search is open + if (searchHelper.IsSearchOpen) + searchHelper.UpdateSearchLines(TotalLines); + + TextChanged?.Invoke(this); + } + private void Internal_CursorChanged() + { + SelectionChangedEventHandler args = new SelectionChangedEventHandler + { + CharacterPositionInLine = GetCurPosInLine() + 1, + LineNumber = CursorPosition.LineNumber, + }; + if (selectionrenderer.SelectionStartPosition != null && selectionrenderer.SelectionEndPosition != null) + { + var sel = Selection.GetIndexOfSelection(TotalLines, new TextSelection(selectionrenderer.SelectionStartPosition, selectionrenderer.SelectionEndPosition)); + args.SelectionLength = sel.Length; + args.SelectionStartIndex = sel.Index; + } + else + { + args.SelectionLength = 0; + args.SelectionStartIndex = Cursor.CursorPositionToIndex(TotalLines, new CursorPosition { CharacterPosition = GetCurPosInLine(), LineNumber = CursorPosition.LineNumber }); + } + SelectionChanged?.Invoke(this, args); + } + //Focus: + private void UserControl_LosingFocus(UIElement sender, LosingFocusEventArgs args) + { + //Prevent the focus switching to the RootScrollViewer when double clicking. + //It was the only way, I could think of. + //https://stackoverflow.com/questions/74802534/double-tap-on-uwp-usercontrol-removes-focus + if (args.NewFocusedElement is ScrollViewer sv && sv.Content is Border) + { + args.TryCancel(); + } + } + private void UserControl_Tapped(object sender, TappedRoutedEventArgs e) + { + this.Focus(FocusState.Programmatic); + } + private void UserControl_GotFocus(object sender, RoutedEventArgs e) + { + SetFocus(); + } + private void UserControl_LostFocus(object sender, RoutedEventArgs e) + { + RemoveFocus(); + } + //Cursor: + private void Canvas_LineNumber_PointerEntered(object sender, PointerRoutedEventArgs e) + { + ChangeCursor(InputSystemCursorShape.Arrow); + } + private void Canvas_LineNumber_PointerExited(object sender, PointerRoutedEventArgs e) + { + ChangeCursor(InputSystemCursorShape.IBeam); + } + private void Scrollbar_PointerExited(object sender, PointerRoutedEventArgs e) + { + ChangeCursor(InputSystemCursorShape.IBeam); + } + private void Scrollbar_PointerEntered(object sender, PointerRoutedEventArgs e) + { + ChangeCursor(InputSystemCursorShape.Arrow); + } + //Drag Drop text + private async void UserControl_Drop(object sender, DragEventArgs e) + { + if (IsReadonly) + return; + + if (e.DataView.Contains(StandardDataFormats.Text)) + { + AddCharacter(stringManager.CleanUpString(await e.DataView.GetTextAsync()), true); + } + } + private void UserControl_DragOver(object sender, DragEventArgs e) + { + if (selectionrenderer.IsSelecting || IsReadonly || !e.DataView.Contains(StandardDataFormats.Text)) + return; + + var deferral = e.GetDeferral(); + + e.AcceptedOperation = DataPackageOperation.Copy; + e.DragUIOverride.IsGlyphVisible = false; + e.DragUIOverride.IsContentVisible = false; + deferral.Complete(); + + UpdateCursorVariable(e.GetPosition(Canvas_Text)); + canvasHelper.UpdateCursor(); + } + #endregion + + #region Public functions and properties + + /// + /// Selects the entire line specified by its index. + /// + /// The index of the line to select. + public void SelectLine(int line) + { + selectionrenderer.SetSelection(new CursorPosition(0, line), new CursorPosition(TotalLines.GetLineLength(line), line)); + CursorPosition = selectionrenderer.SelectionEndPosition; + + canvasHelper.UpdateSelection(); + canvasHelper.UpdateCursor(); + } + + /// + /// Moves the cursor to the beginning of the specified line by its index. + /// + /// The index of the line to navigate to. + public void GoToLine(int line) + { + if (line >= TotalLines.Count || line < 0) + return; + + selectionrenderer.SelectionEndPosition = null; + CursorPosition = selectionrenderer.SelectionStartPosition = new CursorPosition(0, line); + + ScrollLineIntoView(line); + this.Focus(FocusState.Programmatic); + + canvasHelper.UpdateAll(); + } + + /// + /// Loads the specified text into the textbox, resetting all text and undo history. + /// + /// The text to load into the textbox. + public void LoadText(string text) + { + Safe_LoadText(text); + } + + /// + /// Sets the text content of the textbox, recording an undo action. + /// + /// The new text content to set in the textbox. + public void SetText(string text) + { + Safe_SetText(text); + } + + /// + /// Loads the specified lines into the textbox, resetting all content and undo history. + /// + /// An enumerable containing the lines to load into the textbox. + /// The line ending format used in the loaded lines (default is CRLF). + public void LoadLines(IEnumerable lines, LineEnding lineEnding = LineEnding.CRLF) + { + Safe_LoadLines(lines, lineEnding); + } + + /// + /// Pastes the contents of the clipboard at the current cursor position. + /// + public void Paste() + { + Safe_Paste(); + } + + /// + /// Copies the currently selected text to the clipboard. + /// + public void Copy() + { + Safe_Copy(); + } + + /// + /// Cuts the currently selected text and copies it to the clipboard. + /// + public void Cut() + { + Safe_Cut(); + } + + /// + /// Gets the entire text content of the textbox. + /// + /// The complete text content of the textbox as a string. + + public string GetText() + { + return Safe_Gettext(); + } + + /// + /// Sets the text selection in the textbox starting from the specified index and with the given length. + /// + /// The index of the first character of the selection. + /// The length of the selection in number of characters. + public void SetSelection(int start, int length) + { + var result = Selection.GetSelectionFromPosition(TotalLines, start, length, CharacterCount); + if (result != null) + { + selectionrenderer.SetSelection(result.StartPosition, result.EndPosition); + if (result.EndPosition != null) + CursorPosition = result.EndPosition; + } + + canvasHelper.UpdateSelection(); + canvasHelper.UpdateCursor(); + } + + /// + /// Selects all the text in the textbox. + /// + public void SelectAll() + { + //No selection can be shown + if (TotalLines.Count == 1 && TotalLines[0].Length == 0) + return; + + selectionrenderer.SetSelection(new CursorPosition(0, 0), new CursorPosition(TotalLines.GetLineLength(-1), TotalLines.Count - 1)); + CursorPosition = selectionrenderer.SelectionEndPosition; + canvasHelper.UpdateSelection(); + canvasHelper.UpdateCursor(); + } + + /// + /// Clears the current text selection in the textbox. + /// + public void ClearSelection() + { + ForceClearSelection(); + } + + /// + /// Undoes the last action in the textbox. + /// + public void Undo() + { + if (IsReadonly || !undoRedo.CanUndo) + return; + + //Do the Undo + ChangeCursor(InputSystemCursorShape.Wait); + var sel = undoRedo.Undo(TotalLines, stringManager, NewLineCharacter); + Internal_TextChanged(); + ChangeCursor(InputSystemCursorShape.IBeam); + + NeedsRecalculateLongestLineIndex = true; + + if (sel != null) + { + //only set cursorposition + if (sel.StartPosition != null && sel.EndPosition == null) + { + CursorPosition = sel.StartPosition; + canvasHelper.UpdateAll(); + return; + } + + selectionrenderer.SetSelection(sel); + CursorPosition = sel.EndPosition; + } + else + ForceClearSelection(); + canvasHelper.UpdateAll(); + } + + /// + /// Redoes the last undone action in the textbox. + /// + public void Redo() + { + if (IsReadonly || !undoRedo.CanRedo) + return; + + //Do the Redo + ChangeCursor(InputSystemCursorShape.Wait); + var sel = undoRedo.Redo(TotalLines, stringManager, NewLineCharacter); + Internal_TextChanged(); + ChangeCursor(InputSystemCursorShape.IBeam); + + NeedsRecalculateLongestLineIndex = true; + + if (sel != null) + { + //only set cursorposition + if (sel.StartPosition != null && sel.EndPosition == null) + { + CursorPosition = sel.StartPosition; + canvasHelper.UpdateAll(); + return; + } + + selectionrenderer.SetSelection(sel); + CursorPosition = sel.EndPosition; + } + else + ForceClearSelection(); + canvasHelper.UpdateAll(); + } + + /// + /// Scrolls the specified line to the center of the textbox if it is out of the rendered region. + /// + /// The index of the line to center. + public void ScrollLineToCenter(int line) + { + if (OutOfRenderedArea(line)) + ScrollLineIntoView(line); + } + + /// + /// Scrolls the text one line up. + /// + public void ScrollOneLineUp() + { + VerticalScrollbar.Value -= SingleLineHeight / DefaultVerticalScrollSensitivity; + canvasHelper.UpdateAll(); + } + + /// + /// Scrolls the text one line down. + /// + public void ScrollOneLineDown() + { + VerticalScrollbar.Value += SingleLineHeight / DefaultVerticalScrollSensitivity; + canvasHelper.UpdateAll(); + } + + /// + /// Forces the specified line to be scrolled into view, centering it vertically within the textbox. + /// + /// The index of the line to center. + public void ScrollLineIntoView(int line) + { + VerticalScrollbar.Value = (line - NumberOfRenderedLines / 2) * SingleLineHeight / DefaultVerticalScrollSensitivity; + canvasHelper.UpdateAll(); + } + + /// + /// Scrolls the first line of the visible text into view. + /// + public void ScrollTopIntoView() + { + VerticalScrollbar.Value = (CursorPosition.LineNumber - 1) * SingleLineHeight / DefaultVerticalScrollSensitivity; + canvasHelper.UpdateAll(); + } + + /// + /// Scrolls the last visible line of the visible text into view. + /// + public void ScrollBottomIntoView() + { + VerticalScrollbar.Value = (CursorPosition.LineNumber - NumberOfRenderedLines + 1) * SingleLineHeight / DefaultVerticalScrollSensitivity; + canvasHelper.UpdateAll(); + } + + /// + /// Scrolls one page up, simulating the behavior of the page up key. + /// + public void ScrollPageUp() + { + CursorPosition.LineNumber -= NumberOfRenderedLines; + if (CursorPosition.LineNumber < 0) + CursorPosition.LineNumber = 0; + + VerticalScrollbar.Value -= NumberOfRenderedLines * SingleLineHeight / DefaultVerticalScrollSensitivity; + canvasHelper.UpdateAll(); + } + + /// + /// Scrolls one page down, simulating the behavior of the page down key. + /// + public void ScrollPageDown() + { + CursorPosition.LineNumber += NumberOfRenderedLines; + if (CursorPosition.LineNumber > TotalLines.Count - 1) + CursorPosition.LineNumber = TotalLines.Count - 1; + VerticalScrollbar.Value += NumberOfRenderedLines * SingleLineHeight / DefaultVerticalScrollSensitivity; + canvasHelper.UpdateAll(); + } + + /// + /// Gets the content of the line specified by the index + /// + /// The index to get the content from + /// The text from the line specified by the index + public string GetLineText(int line) + { + return TotalLines.GetLineText(line); + } + + /// + /// Gets the text of multiple lines, starting from the specified line index. + /// + /// The index of the line to start with. + /// The number of lines to retrieve. + /// The concatenated text from the specified lines. + public string GetLinesText(int startLine, int length) + { + if (startLine + length >= TotalLines.Count) + return TotalLines.GetString(NewLineCharacter); + + return TotalLines.GetLines(startLine, length).GetString(NewLineCharacter); + } + + /// + /// Sets the content of the line specified by the index. The first line has the index 0. + /// + /// The index of the line to change the content. + /// The text to set for the specified line. + /// Returns true if the text was changed successfully, and false if the index was out of range. + public bool SetLineText(int line, string text) + { + if (line >= TotalLines.Count || line < 0) + return false; + + if (text.Length > LongestLineLength) + LongestLineIndex = line; + + undoRedo.RecordUndoAction(() => + { + TotalLines.SetLineText(line, stringManager.CleanUpString(text)); + }, TotalLines, line, 1, 1, NewLineCharacter); + canvasHelper.UpdateText(); + return true; + } + + /// + /// Deletes the line from the textbox + /// + /// The line to delete + /// Returns true if the line was deleted successfully and false if not + public bool DeleteLine(int line) + { + if (line >= TotalLines.Count || line < 0) + return false; + + if (line == LongestLineIndex) + NeedsRecalculateLongestLineIndex = true; + + undoRedo.RecordUndoAction(() => + { + TotalLines.RemoveAt(line); + }, TotalLines, line, 2, 1, NewLineCharacter); + + if (TotalLines.Count == 0) + { + TotalLines.AddLine(); + } + + canvasHelper.UpdateText(); + return true; + } + + /// + /// Adds a new line with the text specified + /// + /// The position to insert the line to + /// The text to put in the new line + /// Returns true if the line was added successfully and false if not + public bool AddLine(int line, string text) + { + if (line > TotalLines.Count || line < 0) + return false; + + if (text.Length > LongestLineLength) + LongestLineIndex = line; + + undoRedo.RecordUndoAction(() => + { + TotalLines.InsertOrAdd(line, stringManager.CleanUpString(text)); + + }, TotalLines, line, 1, 2, NewLineCharacter); + + canvasHelper.UpdateText(); + return true; + } + + /// + /// Surrounds the selection with the text specified by the text + /// + /// The text to surround the selection with + public void SurroundSelectionWith(string text) + { + text = stringManager.CleanUpString(text); + SurroundSelectionWith(text, text); + } + + /// + /// Surround the selection with individual text for the left and right side. + /// + /// The text for the left side + /// The text for the right side + public void SurroundSelectionWith(string text1, string text2) + { + if (!Selection.SelectionIsNull(selectionrenderer, TextSelection)) + { + AddCharacter(stringManager.CleanUpString(text1) + SelectedText + stringManager.CleanUpString(text2)); + } + } + + /// + /// Duplicates the line specified by the index into the next line + /// + /// The index of the line to duplicate + public void DuplicateLine(int line) + { + undoRedo.RecordUndoAction(() => + { + TotalLines.InsertOrAdd(line, TotalLines.GetLineText(line)); + CursorPosition.LineNumber += 1; + }, TotalLines, line, 1, 2, NewLineCharacter); + + if (OutOfRenderedArea(line)) + ScrollBottomIntoView(); + + canvasHelper.UpdateText(); + canvasHelper.UpdateCursor(); + } + /// + /// Duplicates the line at the current cursor position + /// + public void DuplicateLine() + { + DuplicateLine(CursorPosition.LineNumber); + } + + /// + /// Replaces all occurences in the text with another word + /// + /// The word to search for + /// The word to replace with + /// Search with case sensitivity + /// Search for whole words + /// Found when everything was replaced and not found when nothing was replaced + public SearchResult ReplaceAll(string word, string replaceWord, bool matchCase, bool wholeWord) + { + if (word.Length == 0 || replaceWord.Length == 0) + return SearchResult.InvalidInput; + + SearchParameter searchParameter = new SearchParameter(word, wholeWord, matchCase); + + bool isFound = false; + undoRedo.RecordUndoAction(() => + { + for (int i = 0; i < TotalLines.Count; i++) + { + if (TotalLines[i].Contains(searchParameter)) + { + isFound = true; + SetLineText(i, Regex.Replace(TotalLines[i], searchParameter.SearchExpression, replaceWord)); + } + } + }, TotalLines, 0, TotalLines.Count, TotalLines.Count, NewLineCharacter); + canvasHelper.UpdateText(); + return isFound ? SearchResult.Found : SearchResult.NotFound; + } + + /// + /// Searches for the next occurence. Call this after BeginSearch + /// + /// SearchResult.Found if the word was found + public SearchResult FindNext() + { + if (!searchHelper.IsSearchOpen) + return SearchResult.SearchNotOpened; + + var res = searchHelper.FindNext(TotalLines, CursorPosition); + if (res.Selection != null) + { + selectionrenderer.SetSelection(res.Selection); + ScrollLineIntoView(CursorPosition.LineNumber); + canvasHelper.UpdateText(); + canvasHelper.UpdateSelection(); + } + return res.Result; + } + + /// + /// Searches for the previous occurence. Call this after BeginSearch + /// + /// SearchResult.Found if the word was found + public SearchResult FindPrevious() + { + if (!searchHelper.IsSearchOpen) + return SearchResult.SearchNotOpened; + + var res = searchHelper.FindPrevious(TotalLines, CursorPosition); + if (res.Selection != null) + { + selectionrenderer.SetSelection(res.Selection); + ScrollLineIntoView(CursorPosition.LineNumber); + canvasHelper.UpdateText(); + canvasHelper.UpdateSelection(); + } + return res.Result; + } + + /// + /// Begins a search for the specified word in the textbox content. + /// + /// The word to search for in the textbox. + /// A flag indicating whether to perform a whole-word search. + /// A flag indicating whether the search should be case-sensitive. + /// A SearchResult enum representing the result of the search. + public SearchResult BeginSearch(string word, bool wholeWord, bool matchCase) + { + var res = searchHelper.BeginSearch(TotalLines, word, wholeWord, matchCase); + canvasHelper.UpdateText(); + return res; + } + + /// + /// Ends the search and removes the highlights + /// + public void EndSearch() + { + searchHelper.EndSearch(); + canvasHelper.UpdateText(); + } + + /// + /// Unloads the textbox and releases all resources. + /// Do not use the textbox afterwards. + /// + public void Unload() + { + //Unsubscribe from events: + inputHandler.PreviewKeyDown -= InputHandler_KeyDown; + inputHandler.TextChanged -= InputHandler_TextChanged; + + //Dispose and null larger objects + TotalLines.Dispose(); + RenderedLines = null; + LineNumberTextToRender = RenderedText = null; + LineNumberContent = null; + undoRedo.NullAll(); + } + + /// + /// Clears the undo and redo history of the textbox. + /// + /// + /// The ClearUndoRedoHistory method removes all the stored undo and redo actions, effectively resetting the history of the textbox. + /// + public void ClearUndoRedoHistory() + { + undoRedo.ClearAll(); + } + + /// + /// Gets the current cursor position in the textbox. + /// + /// The current cursor position represented by a Point object (X, Y). + public Point GetCursorPosition() + { + return new Point + { + Y = (float)((CursorPosition.LineNumber - NumberOfStartLine) * SingleLineHeight) + SingleLineHeight / DefaultVerticalScrollSensitivity, + X = CursorRenderer.GetCursorPositionInLine(CurrentLineTextLayout, CursorPosition, 0) + }; + } + + /// + /// Selects the CodeLanguage based on the specified identifier. + /// + /// The identifier of the CodeLanguage to select. + public void SelectCodeLanguage(CodeLanguageId languageId) + { + if (CodeLanguages.TryGetValue(languageId, out CodeLanguage codelanguage)) + CodeLanguage = codelanguage; + } + + /// + /// Gets or sets a value indicating whether syntax highlighting is enabled in the textbox. + /// + public bool SyntaxHighlighting { get; set; } = true; + + /// + /// Gets or sets the code language to use for the syntaxhighlighting and autopairing. + /// + public CodeLanguage CodeLanguage + { + get => _CodeLanguage; + set + { + _CodeLanguage = value; + NeedsUpdateTextLayout = true; //set to true to force update the textlayout + canvasHelper.UpdateText(); + } + } + + /// + /// Gets or sets the line ending style used in the textbox. + /// + /// + /// The LineEnding property represents the line ending style for the text. + /// Possible values are LineEnding.CRLF (Carriage Return + Line Feed), LineEnding.LF (Line Feed), or LineEnding.CR (Carriage Return). + /// + public LineEnding LineEnding + { + get => _LineEnding; + set + { + NewLineCharacter = LineEndings.LineEndingToString(value); + stringManager.lineEnding = value; + _LineEnding = value; + } + } + + /// + /// Gets or sets the space between the line number and the text in the textbox. + /// + public float SpaceBetweenLineNumberAndText { get => _SpaceBetweenLineNumberAndText; set { _SpaceBetweenLineNumberAndText = value; NeedsUpdateLineNumbers(); canvasHelper.UpdateAll(); } } + + /// + /// Gets or sets the current cursor position in the textbox. + /// + /// + /// The cursor position is represented by a object, which includes the character position within the text and the line number. + /// + public CursorPosition CursorPosition + { + get => _CursorPosition; + set { _CursorPosition = new CursorPosition(value.CharacterPosition, value.LineNumber); canvasHelper.UpdateCursor(); } + } + + /// + /// Gets or sets the font family used for displaying text in the textbox. + /// + public new FontFamily FontFamily { get => _FontFamily; set { _FontFamily = value; NeedsTextFormatUpdate = true; canvasHelper.UpdateAll(); } } + + /// + /// Gets or sets the font size used for displaying text in the textbox. + /// + public new int FontSize { get => _FontSize; set { _FontSize = value; UpdateZoom(); } } + + /// + /// Gets the actual rendered size of the font in pixels. + /// + public float RenderedFontSize => ZoomedFontSize; + + /// + /// Gets or sets the text displayed in the textbox. + /// + public string Text { get => GetText(); set { SetText(value); } } + + /// + /// Gets or sets the requested theme for the textbox. + /// + public new ElementTheme RequestedTheme + { + get => _RequestedTheme; + set + { + _RequestedTheme = value; + _AppTheme = Utils.ConvertTheme(value); + + if (UseDefaultDesign) + _Design = _AppTheme == ApplicationTheme.Light ? LightDesign : DarkDesign; + + this.Background = _Design.Background; + ColorResourcesCreated = false; + NeedsUpdateTextLayout = true; + canvasHelper.UpdateAll(); + } + } + + /// + /// Gets or sets the custom design for the textbox. + /// + /// + /// Settings this null will use the default design + /// + public TextControlBoxDesign Design + { + get => UseDefaultDesign ? null : _Design; + set + { + _Design = value != null ? value : _AppTheme == ApplicationTheme.Dark ? DarkDesign : LightDesign; + UseDefaultDesign = value == null; + + this.Background = _Design.Background; + ColorResourcesCreated = false; + canvasHelper.UpdateAll(); + } + } + + /// + /// Gets or sets a value indicating whether line numbers should be displayed in the textbox. + /// + public bool ShowLineNumbers + { + get => _ShowLineNumbers; + set + { + _ShowLineNumbers = value; + NeedsUpdateTextLayout = true; + NeedsUpdateLineNumbers(); + canvasHelper.UpdateAll(); + } + } + + /// + /// Gets or sets a value indicating whether the line highlighter should be shown in the custom textbox. + /// + public bool ShowLineHighlighter + { + get => _ShowLineHighlighter; + set { _ShowLineHighlighter = value; canvasHelper.UpdateCursor(); } + } + + /// + /// Gets or sets the zoom factor in percent for the text. + /// + public int ZoomFactor { get => _ZoomFactor; set { _ZoomFactor = value; UpdateZoom(); } } //% + + /// + /// Gets or sets a value indicating whether the textbox is in readonly mode. + /// + public bool IsReadonly { get; set; } //TODO + + /// + /// Gets or sets the size of the cursor in the textbox. + /// + public CursorSize CursorSize { get => _CursorSize; set { _CursorSize = value; canvasHelper.UpdateCursor(); } } + + /// + /// Gets or sets the context menu flyout associated with the textbox. + /// + /// + /// Setting the value to null will show the default flyout. + /// + public new MenuFlyout ContextFlyout + { + get { return flyoutHelper.MenuFlyout; } + set + { + if (value == null) //Use the builtin flyout + { + flyoutHelper.CreateFlyout(this); + } + else //Use a custom flyout + { + flyoutHelper.MenuFlyout = value; + } + } + } + + /// + /// Gets or sets a value indicating whether the context flyout is disabled for the textbox. + /// + public bool ContextFlyoutDisabled { get; set; } + + /// + /// Gets or sets the starting index of the selected text in the textbox. + /// + public int SelectionStart { get => selectionrenderer.SelectionStart; set { SetSelection(value, SelectionLength); } } + + /// + /// Gets or sets the length of the selected text in the textbox. + /// + public int SelectionLength { get => selectionrenderer.SelectionLength; set { SetSelection(SelectionStart, value); } } + + /// + /// Gets or sets the text that is currently selected in the textbox. + /// + public string SelectedText + { + get + { + if (TextSelection != null && Selection.WholeTextSelected(TextSelection, TotalLines)) + return GetText(); + return Selection.GetSelectedText(TotalLines, TextSelection, CursorPosition.LineNumber, NewLineCharacter); + } + set => AddCharacter(stringManager.CleanUpString(value)); + } + + /// + /// Gets the number of lines in the textbox. + /// + public int NumberOfLines { get => TotalLines.Count; } + + /// + /// Gets the index of the current line where the cursor is positioned in the textbox. + /// + public int CurrentLineIndex { get => CursorPosition.LineNumber; } + + /// + /// Gets or sets the position of the scrollbars in the textbox. + /// + public ScrollBarPosition ScrollBarPosition + { + get => new ScrollBarPosition(HorizontalScrollbar.Value, VerticalScroll); + set { HorizontalScrollbar.Value = value.ValueX; VerticalScroll = value.ValueY; } + } + + /// + /// Gets the total number of characters in the textbox. + /// + public int CharacterCount => Utils.CountCharacters(TotalLines); + + /// + /// Gets or sets the sensitivity of vertical scrolling in the textbox. + /// + public double VerticalScrollSensitivity { get => _VerticalScrollSensitivity; set => _VerticalScrollSensitivity = value < 1 ? 1 : value; } + + /// + /// Gets or sets the sensitivity of horizontal scrolling in the textbox. + /// + public double HorizontalScrollSensitivity { get => _HorizontalScrollSensitivity; set => _HorizontalScrollSensitivity = value < 1 ? 1 : value; } + + /// + /// Gets or sets the vertical scroll position in the textbox. + /// + public double VerticalScroll { get => VerticalScrollbar.Value; set { VerticalScrollbar.Value = value < 0 ? 0 : value; canvasHelper.UpdateAll(); } } + + /// + /// Gets or sets the horizontal scroll position in the textbox. + /// + public double HorizontalScroll { get => HorizontalScrollbar.Value; set { HorizontalScrollbar.Value = value < 0 ? 0 : value; canvasHelper.UpdateAll(); } } + + /// + /// Gets or sets the corner radius for the textbox. + /// + public new CornerRadius CornerRadius { get => MainGrid.CornerRadius; set => MainGrid.CornerRadius = value; } + + /// + /// Gets or sets a value indicating whether to use spaces instead of tabs for indentation in the textbox. + /// + public bool UseSpacesInsteadTabs { get => tabSpaceHelper.UseSpacesInsteadTabs; set { tabSpaceHelper.UseSpacesInsteadTabs = value; tabSpaceHelper.UpdateTabs(TotalLines); canvasHelper.UpdateAll(); } } + + /// + /// Gets or sets the number of spaces used for a single tab in the textbox. + /// + public int NumberOfSpacesForTab { get => tabSpaceHelper.NumberOfSpaces; set { tabSpaceHelper.NumberOfSpaces = value; tabSpaceHelper.UpdateNumberOfSpaces(TotalLines); canvasHelper.UpdateAll(); } } + + /// + /// Gets whether the search is currently active + /// + public bool SearchIsOpen => searchHelper.IsSearchOpen; + + /// + /// Gets an enumerable collection of all the lines in the textbox. + /// + /// + /// Use this property to access all the lines of text in the textbox. You can use this collection to save the lines to a file using functions like FileIO.WriteLinesAsync. + /// Utilizing this property for saving will significantly improve RAM usage during the saving process. + /// + public IEnumerable Lines => TotalLines; + + /// + /// Gets or sets a value indicating whether auto-pairing is enabled. + /// + /// + /// Auto-pairing automatically pairs opening and closing symbols, such as brackets or quotation marks. + /// + public bool DoAutoPairing { get; set; } = true; + + #endregion + + #region Public events + + /// + /// Represents a delegate used for handling the text changed event in the TextControlBox. + /// + /// The instance of the TextControlBox that raised the event. + public delegate void TextChangedEvent(TextControlBox sender); + /// + /// Occurs when the text is changed in the TextControlBox. + /// + public event TextChangedEvent TextChanged; + + /// + /// Represents a delegate used for handling the selection changed event in the TextControlBox. + /// + /// The instance of the TextControlBox that raised the event. + /// The event arguments providing information about the selection change. + public delegate void SelectionChangedEvent(TextControlBox sender, SelectionChangedEventHandler args); + + /// + /// Occurs when the selection is changed in the TextControlBox. + /// + public event SelectionChangedEvent SelectionChanged; + + /// + /// Represents a delegate used for handling the zoom changed event in the TextControlBox. + /// + /// The instance of the TextControlBox that raised the event. + /// The new zoom factor value indicating the scale of the content. + public delegate void ZoomChangedEvent(TextControlBox sender, int zoomFactor); + + /// + /// Occurs when the zoom factor is changed in the TextControlBox. + /// + public event ZoomChangedEvent ZoomChanged; + + /// + /// Represents a delegate used for handling the got focus event in the TextControlBox. + /// + /// The instance of the TextControlBox that received focus. + public delegate void GotFocusEvent(TextControlBox sender); + + /// + /// Occurs when the TextControlBox receives focus. + /// + public new event GotFocusEvent GotFocus; + + /// + /// Represents a delegate used for handling the lost focus event in the TextControlBox. + /// + /// The instance of the TextControlBox that lost focus. + public delegate void LostFocusEvent(TextControlBox sender); + + /// + /// Occurs when the TextControlBox loses focus. + /// + public new event LostFocusEvent LostFocus; + #endregion + + #region Static functions + //static functions + /// + /// Gets a dictionary containing the CodeLanguages indexed by their respective identifiers. + /// + /// + /// The CodeLanguage dictionary provides a collection of predefined CodeLanguage objects, where each object is associated with a unique identifier (language name). + /// The dictionary is case-insensitive, and it allows quick access to the CodeLanguage objects based on their identifier. + /// + public static Dictionary CodeLanguages => new() + { + { CodeLanguageId.INI, new INI() }, + { CodeLanguageId.Batch, new Batch() }, + { CodeLanguageId.Cpp, new Cpp() }, + { CodeLanguageId.CSharp, new CSharp() }, + { CodeLanguageId.ConfigFile, new ConfigFile() }, + { CodeLanguageId.CSS, new CSS() }, + { CodeLanguageId.CSV, new CSV() }, + { CodeLanguageId.GCode, new GCode() }, + { CodeLanguageId.HexFile, new HexFile() }, + { CodeLanguageId.Html, new Html() }, + { CodeLanguageId.Java, new Java() }, + { CodeLanguageId.Javascript, new Javascript() }, + { CodeLanguageId.Json, new Json() }, + { CodeLanguageId.Latex, new LaTex() }, + { CodeLanguageId.Markdown, new Markdown() }, + { CodeLanguageId.PHP, new PHP() }, + { CodeLanguageId.Python, new Python() }, + { CodeLanguageId.QSharp, new QSharp() }, + { CodeLanguageId.TOML, new TOML() }, + { CodeLanguageId.XML, new XML() }, + { CodeLanguageId.None, null }, + }; + + /// + /// Retrieves a CodeLanguage object based on the specified identifier. + /// + /// The identifier of the CodeLanguage to retrieve. + /// The CodeLanguage object corresponding to the provided identifier, or null if not found. + public static CodeLanguage GetCodeLanguageFromId(CodeLanguageId languageId) + { + if (CodeLanguages.TryGetValue(languageId, out CodeLanguage codelanguage)) + return codelanguage; + return null; + } + + /// + /// Retrieves a CodeLanguage object from a JSON representation. + /// + /// The JSON string representing the CodeLanguage object. + /// The deserialized CodeLanguage object obtained from the provided JSON, or null if the JSON is invalid or does not represent a valid CodeLanguage. + public static JsonLoadResult GetCodeLanguageFromJson(string Json) + { + return SyntaxHighlightingRenderer.GetCodeLanguageFromJson(Json); + } + + #endregion + } +} \ No newline at end of file diff --git a/UseWinUI3.txt b/UseWinUI3.txt deleted file mode 100644 index f32a580..0000000 --- a/UseWinUI3.txt +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/WinUIEditor/CodeEditorControl.cpp b/WinUIEditor/CodeEditorControl.cpp deleted file mode 100644 index 6d31b5e..0000000 --- a/WinUIEditor/CodeEditorControl.cpp +++ /dev/null @@ -1,336 +0,0 @@ -#include "pch.h" -#include "CodeEditorControl.h" -#if __has_include("CodeEditorControl.g.cpp") -#include "CodeEditorControl.g.cpp" -#endif -#include "Helpers.h" - -using namespace ::WinUIEditor; -using namespace winrt; -using namespace Windows::UI::Core; -using namespace Windows::Foundation; -using namespace Windows::System; -using namespace DUD; -using namespace DUX; -using namespace DUX::Controls; -using namespace DUX::Input; - -using namespace winrt; - -namespace winrt::WinUIEditor::implementation -{ - CodeEditorControl::CodeEditorControl() - { - DefaultStyleKey(winrt::box_value(L"WinUIEditor.CodeEditorControl")); - - _editor = make_self(); - _call = _editor->Call(); - SetScintilla(_call); - SetLexilla(CreateLexer); - Initialize(); - _editor->DpiChanged({ this, &CodeEditorControl::Editor_DpiChanged }); - _editor->InternalNotifyMessageReceived.add({ this, &CodeEditorControl::Editor_NotifyMessageReceived }); - - Loaded({ this, &CodeEditorControl::OnLoaded }); - Unloaded({ this, &CodeEditorControl::OnUnloaded }); - GettingFocus({ this, &CodeEditorControl::OnGettingFocus }); - -#ifndef WINUI3 - if (_hasFcu) - { -#endif - _dispatcherQueue = DUD::DispatcherQueue::GetForCurrentThread(); -#ifndef WINUI3 - } -#endif - } - - static constexpr CodeEditorTheme XamlToCodeEditorTheme(ElementTheme theme) - { - return static_cast(theme); - } - - static constexpr ElementTheme CodeEditorToXamlTheme(CodeEditorTheme theme) - { - return static_cast(theme); - } - - void CodeEditorControl::OnApplyTemplate() - { - __super::OnApplyTemplate(); - -#ifndef WINUI3 - if (_hasFcu) - { -#endif - UpdateColors(XamlToCodeEditorTheme(ActualTheme())); -#ifndef WINUI3 - } - else - { - UpdateColors(XamlToCodeEditorTheme(LegacyActualTheme())); - } -#endif - - if (const auto presenter{ GetTemplateChild(L"EditorContainer").try_as() }) - { - presenter.Content(_editor.as()); - } - } - - void CodeEditorControl::OnKeyDown(KeyRoutedEventArgs const &e) - { - __super::OnKeyDown(e); - - const auto modifiers{ GetKeyModifiersForCurrentThread() }; // Todo: Can we avoid calling this every time? - - if ((modifiers & VirtualKeyModifiers::Control) == VirtualKeyModifiers::Control) - { - switch (e.Key()) - { - case VirtualKey::F2: // Todo: make customizable - { - if (_call->Focus()) - { - ChangeAllOccurrences(); - e.Handled(true); - } - } - break; - } - } - } - - void CodeEditorControl::OnLoaded(IInspectable const &sender, DUX::RoutedEventArgs const &args) - { -#ifndef WINUI3 - _isLoaded = true; -#endif - - if (!IsLoadedCompat()) - { - return; - } - -#ifndef WINUI3 - if (_hasFcu) - { -#endif - UpdateColors(XamlToCodeEditorTheme(ActualTheme())); - _actualThemeChangedRevoker = ActualThemeChanged(auto_revoke, { this, &CodeEditorControl::OnActualThemeChanged }); -#ifndef WINUI3 - } - else - { - UpdateColors(XamlToCodeEditorTheme(LegacyActualTheme())); - // Todo: Add fallback for ActualThemeChanged - } -#endif - } - - void CodeEditorControl::OnUnloaded(IInspectable const &sender, DUX::RoutedEventArgs const &args) - { -#ifndef WINUI3 - _isLoaded = false; -#endif - - if (IsLoadedCompat()) - { - return; - } - -#ifndef WINUI3 - if (_hasFcu) - { -#endif - _actualThemeChangedRevoker.revoke(); -#ifndef WINUI3 - } - else - { - // Todo: Add fallback - } -#endif - } - - bool CodeEditorControl::IsLoadedCompat() - { -#ifndef WINUI3 - if (_hasIsLoaded) - { -#endif - return IsLoaded(); -#ifndef WINUI3 - } - else - { - return _isLoaded; - } -#endif - } - - void CodeEditorControl::OnGettingFocus(IInspectable const &sender, GettingFocusEventArgs const &e) - { - if (e.NewFocusedElement() == *this && ( -#ifndef WINUI3 - !_has1803 || -#endif - !e.TrySetNewFocusedElement(*_editor))) - { - const auto focusState{ e.FocusState() }; -#ifndef WINUI3 - if (_hasFcu) - { -#endif - _dispatcherQueue.TryEnqueue([this, focusState]() - { - _editor->Focus(focusState); - }); -#ifndef WINUI3 - } - else - { - Dispatcher().RunAsync(CoreDispatcherPriority::Normal, [this, focusState]() - { - _editor->Focus(focusState); - }); - } -#endif - e.Handled(true); - } - } - - int64_t CodeEditorControl::SendMessage(ScintillaMessage const &message, uint64_t wParam, int64_t lParam) - { - return _editor->PublicWndProc(static_cast(message), wParam, lParam); - } - - WinUIEditor::Editor CodeEditorControl::Editor() - { - return _editor->Editor(); - } - - void CodeEditorControl::OnActualThemeChanged(IInspectable const &sender, IInspectable const &e) - { - UpdateColors(XamlToCodeEditorTheme(ActualTheme())); - } - - void CodeEditorControl::Editor_DpiChanged(IInspectable const &sender, double value) - { - UpdateDpi(value); - } - - void CodeEditorControl::Editor_NotifyMessageReceived(IInspectable const &sender, int64_t value) - { - ProcessNotification(reinterpret_cast(value)); - } - - hstring CodeEditorControl::HighlightingLanguage() - { - return hstring{ CodeEditorHandler::HighlightingLanguage() }; - } - - void CodeEditorControl::HighlightingLanguage(hstring const &value) - { - CodeEditorHandler::HighlightingLanguage(value); - } - - event_token CodeEditorControl::DefaultColorsChanged(EventHandler const &handler) - { - return _defaultColorsChangedEvent.add(handler); - } - - void CodeEditorControl::DefaultColorsChanged(event_token const &token) noexcept - { - _defaultColorsChangedEvent.remove(token); - } - - event_token CodeEditorControl::SyntaxHighlightingApplied(EventHandler const &handler) - { - return _syntaxHighlightingAppliedEvent.add(handler); - } - - void CodeEditorControl::SyntaxHighlightingApplied(event_token const &token) noexcept - { - _syntaxHighlightingAppliedEvent.remove(token); - } - - void CodeEditorControl::ApplyDefaultsToDocument() - { - ChangeDocumentDefaults(); - UpdateZoom(); - } - - void CodeEditorControl::ResetLexer() - { - SetLexer(); - } - -#ifndef WINUI3 - DUX::ElementTheme CodeEditorControl::LegacyActualTheme() - { - // Todo: Fully implement - const auto requestedTheme{ RequestedTheme() }; - if (requestedTheme == ElementTheme::Default) - { - return Application::Current().RequestedTheme() == ApplicationTheme::Dark - ? ElementTheme::Dark - : ElementTheme::Light; - } - else - { - return requestedTheme; - } - } -#endif - - void CodeEditorControl::StyleSetFore(int style, Scintilla::ColourAlpha color) - { - _editor->StyleSetForeTransparent(style, Scintilla::Internal::ColourRGBA{ color }); - } - - void CodeEditorControl::StyleSetBack(int style, Scintilla::ColourAlpha color) - { - _editor->StyleSetBackTransparent(style, Scintilla::Internal::ColourRGBA{ color }); - } - - void CodeEditorControl::InvalidateStyleRedraw() - { - _editor->InvalidateStyleRedraw(); - } - - void CodeEditorControl::StyleClearCustom() - { - _editor->StyleClearCustom(); - } - - void CodeEditorControl::SetFoldMarginColor(bool useSetting, Scintilla::ColourAlpha back) - { - _editor->SetFoldMarginColorTransparent(useSetting, Scintilla::Internal::ColourRGBA{ back }); - } - - void CodeEditorControl::SetFoldMarginHiColor(bool useSetting, Scintilla::ColourAlpha fore) - { - _editor->SetFoldMarginHiColorTransparent(useSetting, Scintilla::Internal::ColourRGBA{ fore }); - } - - void CodeEditorControl::DefaultColorsChanged(CodeEditorTheme theme) - { - _defaultColorsChangedEvent(*this, CodeEditorToXamlTheme(theme)); - } - - void CodeEditorControl::SyntaxHighlightingApplied(CodeEditorTheme theme) - { - _syntaxHighlightingAppliedEvent(*this, CodeEditorToXamlTheme(theme)); - } - - event_token CodeEditorControl::NotifyMessageReceived(EventHandler const &handler) - { - return _editor->NotifyMessageReceived(handler); - } - - void CodeEditorControl::NotifyMessageReceived(event_token const &token) noexcept - { - _editor->NotifyMessageReceived(token); - } -} diff --git a/WinUIEditor/CodeEditorControl.h b/WinUIEditor/CodeEditorControl.h deleted file mode 100644 index 7b7d320..0000000 --- a/WinUIEditor/CodeEditorControl.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include "CodeEditorControl.g.h" - -#include "CodeEditorHandler.h" -#include "EditorBaseControl.h" - -namespace winrt::WinUIEditor::implementation -{ - struct CodeEditorControl : CodeEditorControlT, ::WinUIEditor::CodeEditorHandler - { - CodeEditorControl(); - int64_t SendMessage(ScintillaMessage const &message, uint64_t wParam, int64_t lParam); - WinUIEditor::Editor Editor(); - void OnApplyTemplate(); - void OnKeyDown(DUX::Input::KeyRoutedEventArgs const &e); - - hstring HighlightingLanguage(); - void HighlightingLanguage(hstring const &value); - - event_token NotifyMessageReceived(Windows::Foundation::EventHandler const &handler); - void NotifyMessageReceived(event_token const &token) noexcept; - - event_token DefaultColorsChanged(Windows::Foundation::EventHandler const &handler); - void DefaultColorsChanged(event_token const &token) noexcept; - - event_token SyntaxHighlightingApplied(Windows::Foundation::EventHandler const &handler); - void SyntaxHighlightingApplied(event_token const &token) noexcept; - - void ApplyDefaultsToDocument(); - void ResetLexer(); - - private: - com_ptr _editor{ nullptr }; - std::shared_ptr _call{ nullptr }; - event> _notifyMessageReceived; - - event> _defaultColorsChangedEvent; - event> _syntaxHighlightingAppliedEvent; - DUD::DispatcherQueue _dispatcherQueue{ nullptr }; -#ifndef WINUI3 - bool _hasFcu{ Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 5) }; // Todo: Make static - bool _has1803{ Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 6) }; // Todo: Make static - bool _hasIsLoaded{ Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.FrameworkElement", L"IsLoaded") }; // Todo: Make static - bool _isLoaded{ false }; -#endif - void OnLoaded(Windows::Foundation::IInspectable const &sender, DUX::RoutedEventArgs const &args); - void OnUnloaded(Windows::Foundation::IInspectable const &sender, DUX::RoutedEventArgs const &args); - bool IsLoadedCompat(); - void OnGettingFocus(Windows::Foundation::IInspectable const &sender, DUX::Input::GettingFocusEventArgs const &e); - DUX::FrameworkElement::ActualThemeChanged_revoker _actualThemeChangedRevoker{}; - void OnActualThemeChanged(Windows::Foundation::IInspectable const &sender, Windows::Foundation::IInspectable const &e); - void Editor_DpiChanged(Windows::Foundation::IInspectable const &sender, double value); - void Editor_NotifyMessageReceived(Windows::Foundation::IInspectable const &sender, int64_t value); -#ifndef WINUI3 - DUX::ElementTheme LegacyActualTheme(); -#endif - void StyleSetFore(int style, Scintilla::ColourAlpha color) override; - void StyleSetBack(int style, Scintilla::ColourAlpha color) override; - void InvalidateStyleRedraw() override; - void StyleClearCustom() override; - void SetFoldMarginColor(bool useSetting, Scintilla::ColourAlpha back) override; - void SetFoldMarginHiColor(bool useSetting, Scintilla::ColourAlpha fore) override; - - void DefaultColorsChanged(::WinUIEditor::CodeEditorTheme theme) override; - void SyntaxHighlightingApplied(::WinUIEditor::CodeEditorTheme theme) override; - }; -} - -namespace winrt::WinUIEditor::factory_implementation -{ - struct CodeEditorControl : CodeEditorControlT - { - }; -} diff --git a/WinUIEditor/CodeEditorControl.idl b/WinUIEditor/CodeEditorControl.idl deleted file mode 100644 index 6f8b3cf..0000000 --- a/WinUIEditor/CodeEditorControl.idl +++ /dev/null @@ -1,19 +0,0 @@ -#include "Defines.idl" -import "EditorWrapper.idl"; -import "IEditorAccess.idl"; - -namespace WinUIEditor -{ - [default_interface] - [webhosthidden] - runtimeclass CodeEditorControl : DUX.Controls.Control, IEditorAccess - { - CodeEditorControl(); - Editor Editor { get; }; - String HighlightingLanguage { get; set; }; - event Windows.Foundation.EventHandler DefaultColorsChanged; - event Windows.Foundation.EventHandler SyntaxHighlightingApplied; - void ApplyDefaultsToDocument(); - void ResetLexer(); - } -} diff --git a/WinUIEditor/CodeEditorHandler.SciEdit.cpp b/WinUIEditor/CodeEditorHandler.SciEdit.cpp deleted file mode 100644 index a19e41c..0000000 --- a/WinUIEditor/CodeEditorHandler.SciEdit.cpp +++ /dev/null @@ -1,669 +0,0 @@ -// This file includes code derived from SciTEBase.cxx and StyleWriter.cxx -// Copyright 1998-2011 by Neil Hodgson -// The scintilla\License.txt file describes the conditions under which this software may be distributed. - -// Notable changes: -// Modifications to StyleAndWords: -// - Added constructor that is not string-based -// - Changed functions (IsSingleChar, IsCharacter, Includes) to support multiple characters for indent blocks -// Modifications to TextReader -// - Removed InternalIsLeadByte -// - Removed IsLeadByte (header) - -#include "CodeEditorHandler.h" -#include -#include "SciLexer.h" - -using namespace WinUIEditor::Internal; -using namespace Scintilla; - -namespace WinUIEditor -{ - static constexpr bool IsBrace(char ch) noexcept - { - return ch == '[' || ch == ']' || ch == '(' || ch == ')' || ch == '{' || ch == '}'; - } - - static constexpr bool IsAlphabetic(int ch) noexcept - { - return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z')); - } - - static int IntegerFromString(const std::string &val, int defaultValue) - { - try - { - if (val.length()) - { - return std::stoi(val); - } - } - catch (std::logic_error &) - { - // Ignore bad values, either non-numeric or out of range numeric - } - return defaultValue; - } - - static std::set SetFromString(std::string_view text, char separator) - { - std::set result; - - while (!text.empty()) - { - const size_t after = text.find_first_of(separator); - const std::string_view symbol(text.substr(0, after)); - if (!symbol.empty()) - { - result.emplace(symbol); - } - if (after == std::string_view::npos) - { - break; - } - text.remove_prefix(after + 1); - } - return result; - } - - - StyleAndWords::StyleAndWords() noexcept - { - }; - - // Set of words separated by spaces. First is style number, rest are symbols. - // [symbol]* - StyleAndWords::StyleAndWords(const std::string &definition) - { - styleNumber = IntegerFromString(definition, 0); - - std::string_view symbols(definition); - - // Remove initial style number - const size_t endNumber = symbols.find_first_of(' '); - if (endNumber == std::string::npos) - { - return; - } - symbols.remove_prefix(endNumber + 1); - - words = SetFromString(symbols, ' '); - } - - StyleAndWords::StyleAndWords(int style, const std::set &words) - { - styleNumber = style; - this->words = words; - } - - bool StyleAndWords::IsEmpty() const noexcept - { - return words.empty(); - } - - // WinUI modified - bool StyleAndWords::IsSingleChar() const noexcept - { - //if (words.size() != 1) - if (words.size() == 0) - { - return false; - } - const std::string &first = *words.begin(); - return first.length() == 1; - } - - // WinUI modified - bool StyleAndWords::IsCharacter(char ch) const noexcept - { - //if (words.size() != 1) - if (words.size() == 0) - { - return false; - } - for (std::string word : words) - { - if (word.size() == 1 && ch == word[0]) - { - return true; - } - } - return false; - //const std::string &first = *words.begin(); - //return (first.length() == 1) && (ch == first[0]); - } - - int StyleAndWords::Style() const noexcept - { - return styleNumber; - } - - // WinUI modified - bool StyleAndWords::Includes(const std::string &value) const - { - if (words.empty()) - { - return false; - } - const std::string &first = *words.begin(); - if (first.empty()) - { - return false; - } - if (IsAlphabetic(first[0])) - { - return words.count(value) != 0; - } - // Set of individual characters. Only one character allowed for now - //const char ch = first[0]; - //return value.find(ch) != std::string::npos; - for (std::string ch : words) - { - if (ch.size() == 1 && value.find(ch[0]) != std::string::npos) - { - return true; - } - } - return false; - } - - TextReader::TextReader(ScintillaCall &sc_) noexcept : - startPos(extremePosition), - endPos(0), - codePage(0), - sc(sc_), - lenDoc(-1) - { - buf[0] = 0; - } - - void TextReader::Fill(Position position) - { - if (lenDoc == -1) - lenDoc = sc.Length(); - startPos = position - slopSize; - if (startPos + bufferSize > lenDoc) - startPos = lenDoc - bufferSize; - if (startPos < 0) - startPos = 0; - endPos = startPos + bufferSize; - if (endPos > lenDoc) - endPos = lenDoc; - sc.SetTarget(Span(startPos, endPos)); - sc.TargetText(buf); - } - - bool TextReader::Match(Position pos, const char *s) - { - for (int i = 0; *s; i++) - { - if (*s != SafeGetCharAt(pos + i)) - return false; - s++; - } - return true; - } - - int TextReader::StyleAt(Position position) - { - return sc.UnsignedStyleAt(position); - } - - Line TextReader::GetLine(Position position) - { - return sc.LineFromPosition(position); - } - - Position TextReader::LineStart(Line line) - { - return sc.LineStart(line); - } - - FoldLevel TextReader::LevelAt(Line line) - { - return sc.FoldLevel(line); - } - - Position TextReader::Length() - { - if (lenDoc == -1) - lenDoc = sc.Length(); - return lenDoc; - } - - int TextReader::GetLineState(Line line) - { - return sc.LineState(line); - } - - /** - * Find if there is a brace next to the caret, checking before caret first, then - * after caret. If brace found also find its matching brace. - * @return @c true if inside a bracket pair. - */ - bool CodeEditorHandler::SciFindMatchingBracePosition(Position &braceAtCaret, Position &braceOpposite, bool sloppy) - { - // Config - const auto bracesStyle{ 0 }; - const int lexLanguage{ _call->Lexer() }; - - bool isInside = false; - - const int mainSel = _call->MainSelection(); - if (_call->SelectionNCaretVirtualSpace(mainSel) > 0) - return false; - - const int bracesStyleCheck = bracesStyle; - Position caretPos = _call->CurrentPos(); - braceAtCaret = -1; - braceOpposite = -1; - char charBefore = '\0'; - int styleBefore = 0; - const Position lengthDoc = _call->Length(); - TextReader acc(*_call); - if ((lengthDoc > 0) && (caretPos > 0)) - { - // Check to ensure not matching brace that is part of a multibyte character - if (_call->PositionBefore(caretPos) == (caretPos - 1)) - { - charBefore = acc[caretPos - 1]; - styleBefore = acc.StyleAt(caretPos - 1); - } - } - // Priority goes to character before caret - if (charBefore && IsBrace(charBefore) && - ((styleBefore == bracesStyleCheck) || (!bracesStyle))) - { - braceAtCaret = caretPos - 1; - } - bool colonMode = false; - if ((lexLanguage == SCLEX_PYTHON) && - (':' == charBefore) && (SCE_P_OPERATOR == styleBefore)) - { - braceAtCaret = caretPos - 1; - colonMode = true; - } - bool isAfter = true; - if (lengthDoc > 0 && sloppy && (braceAtCaret < 0) && (caretPos < lengthDoc)) - { - // No brace found so check other side - // Check to ensure not matching brace that is part of a multibyte character - if (_call->PositionAfter(caretPos) == (caretPos + 1)) - { - const char charAfter = acc[caretPos]; - const int styleAfter = acc.StyleAt(caretPos); - if (charAfter && IsBrace(charAfter) && ((styleAfter == bracesStyleCheck) || (!bracesStyle))) - { - braceAtCaret = caretPos; - isAfter = false; - } - if ((lexLanguage == SCLEX_PYTHON) && - (':' == charAfter) && (SCE_P_OPERATOR == styleAfter)) - { - braceAtCaret = caretPos; - colonMode = true; - } - } - } - if (braceAtCaret >= 0) - { - if (colonMode) - { - const Line lineStart = _call->LineFromPosition(braceAtCaret); - const Line lineMaxSubord = _call->LastChild(lineStart, static_cast(-1)); - braceOpposite = _call->LineEnd(lineMaxSubord); - } - else - { - braceOpposite = _call->BraceMatch(braceAtCaret, 0); - } - if (braceOpposite > braceAtCaret) - { - isInside = isAfter; - } - else - { - isInside = !isAfter; - } - } - return isInside; - } - - void CodeEditorHandler::SciBraceMatch() - { - // Config - const auto bracesCheck{ true }; - const auto bracesSloppy{ true }; - - if (!bracesCheck) - return; - Position braceAtCaret = -1; - Position braceOpposite = -1; - SciFindMatchingBracePosition(braceAtCaret, braceOpposite, bracesSloppy); - if ((braceAtCaret != -1) && (braceOpposite == -1)) - { - //_call->BraceBadLight(braceAtCaret); - _call->BraceBadLight(-1); - _call->SetHighlightGuide(0); - } - else - { - char chBrace = 0; - if (braceAtCaret >= 0) - chBrace = _call->CharacterAt(braceAtCaret); - _call->BraceHighlight(braceAtCaret, braceOpposite); - Position columnAtCaret = _call->Column(braceAtCaret); - Position columnOpposite = _call->Column(braceOpposite); - if (chBrace == ':') - { - const Line lineStart = _call->LineFromPosition(braceAtCaret); - const Position indentPos = _call->LineIndentPosition(lineStart); - const Position indentPosNext = _call->LineIndentPosition(lineStart + 1); - columnAtCaret = _call->Column(indentPos); - const Position columnAtCaretNext = _call->Column(indentPosNext); - const int indentSize = _call->Indent(); - if (columnAtCaretNext - indentSize > 1) - columnAtCaret = columnAtCaretNext - indentSize; - if (columnOpposite == 0) // If the final line of the structure is empty - columnOpposite = columnAtCaret; - } - else - { - if (_call->LineFromPosition(braceAtCaret) == _call->LineFromPosition(braceOpposite)) - { - // Avoid attempting to draw a highlight guide - columnAtCaret = 0; - columnOpposite = 0; - } - } - - // Todo: has rendering issues - //if (props.GetInt("highlight.indentation.guides")) - //_call->SetHighlightGuide(std::min(columnAtCaret, columnOpposite)); - } - } - - Line CodeEditorHandler::SciGetCurrentLineNumber() - { - return _call->LineFromPosition( - _call->CurrentPos()); - } - - int CodeEditorHandler::SciGetLineIndentation(Line line) - { - return _call->LineIndentation(line); - } - - Position CodeEditorHandler::SciGetLineIndentPosition(Line line) - { - return _call->LineIndentPosition(line); - } - - std::vector CodeEditorHandler::SciGetLinePartsInStyle(Line line, const StyleAndWords &saw) - { - std::vector sv; - TextReader acc(*_call); - std::string s; - const bool separateCharacters = saw.IsSingleChar(); - const Position thisLineStart = _call->LineStart(line); - const Position nextLineStart = _call->LineStart(line + 1); - for (Position pos = thisLineStart; pos < nextLineStart; pos++) - { - if (acc.StyleAt(pos) == saw.Style()) - { - if (separateCharacters) - { - // Add one character at a time, even if there is an adjacent character in the same style - if (s.length() > 0) - { - sv.push_back(s); - } - s = ""; - } - s += acc[pos]; - } - else if (s.length() > 0) - { - sv.push_back(s); - s = ""; - } - } - if (s.length() > 0) - { - sv.push_back(s); - } - return sv; - } - - IndentationStatus CodeEditorHandler::SciGetIndentState(Line line) - { - // C like language indentation defined by braces and keywords - IndentationStatus indentState = IndentationStatus::none; - const std::vector controlIndents = SciGetLinePartsInStyle(line, _sciStatementIndent); - for (const std::string &sIndent : controlIndents) - { - if (_sciStatementIndent.Includes(sIndent)) - indentState = IndentationStatus::keyWordStart; - } - const std::vector controlEnds = SciGetLinePartsInStyle(line, _sciStatementEnd); - for (const std::string &sEnd : controlEnds) - { - if (_sciStatementEnd.Includes(sEnd)) - indentState = IndentationStatus::none; - } - // Braces override keywords - const std::vector controlBlocks = SciGetLinePartsInStyle(line, _sciBlockEnd); - for (const std::string &sBlock : controlBlocks) - { - if (_sciBlockEnd.Includes(sBlock)) - indentState = IndentationStatus::blockEnd; - if (_sciBlockStart.Includes(sBlock)) - indentState = IndentationStatus::blockStart; - } - return indentState; - } - - int CodeEditorHandler::SciIndentOfBlock(Line line) - { - if (line < 0) - return 0; - const int indentSize = _call->Indent(); - int indentBlock = SciGetLineIndentation(line); - Line backLine = line; - IndentationStatus indentState = IndentationStatus::none; - if (_sciStatementIndent.IsEmpty() && _sciBlockStart.IsEmpty() && _sciBlockEnd.IsEmpty()) - indentState = IndentationStatus::blockStart; // Don't bother searching backwards - - Line lineLimit = line - _sciStatementLookback; - if (lineLimit < 0) - lineLimit = 0; - while ((backLine >= lineLimit) && (indentState == IndentationStatus::none)) - { - indentState = SciGetIndentState(backLine); - if (indentState != IndentationStatus::none) - { - indentBlock = SciGetLineIndentation(backLine); - if (indentState == IndentationStatus::blockStart) - { - if (!_sciIndentOpening) - indentBlock += indentSize; - } - if (indentState == IndentationStatus::blockEnd) - { - if (_sciIndentClosing) - indentBlock -= indentSize; - if (indentBlock < 0) - indentBlock = 0; - } - if ((indentState == IndentationStatus::keyWordStart) && (backLine == line)) - indentBlock += indentSize; - } - backLine--; - } - return indentBlock; - } - - Span CodeEditorHandler::SciGetSelection() - { - return _call->SelectionSpan(); - } - - void CodeEditorHandler::SciSetSelection(Position anchor, Position currentPos) - { - _call->SetSel(anchor, currentPos); - } - - void CodeEditorHandler::SciSetLineIndentation(Line line, int indent) - { - if (indent < 0) - return; - const Span rangeStart = SciGetSelection(); - Span range = rangeStart; - const Position posBefore = SciGetLineIndentPosition(line); - _call->SetLineIndentation(line, indent); - const Position posAfter = SciGetLineIndentPosition(line); - const Position posDifference = posAfter - posBefore; - if (posAfter > posBefore) - { - // Move selection on - if (range.start >= posBefore) - { - range.start += posDifference; - } - if (range.end >= posBefore) - { - range.end += posDifference; - } - } - else if (posAfter < posBefore) - { - // Move selection back - if (range.start >= posAfter) - { - if (range.start >= posBefore) - range.start += posDifference; - else - range.start = posAfter; - } - if (range.end >= posAfter) - { - if (range.end >= posBefore) - range.end += posDifference; - else - range.end = posAfter; - } - } - if (!(rangeStart == range)) - { - SciSetSelection(range.start, range.end); - } - } - - bool CodeEditorHandler::SciRangeIsAllWhitespace(Position start, Position end) - { - TextReader acc(*_call); - for (Position i = start; i < end; i++) - { - if ((acc[i] != ' ') && (acc[i] != '\t')) - return false; - } - return true; - } - - void CodeEditorHandler::SciAutomaticIndentation(char ch) - { - const Span range = _call->SelectionSpan(); - const Position selStart = range.start; - const Line curLine = SciGetCurrentLineNumber(); - const Position thisLineStart = _call->LineStart(curLine); - const int indentSize = _call->Indent(); - int indentBlock = SciIndentOfBlock(curLine - 1); - - if ((_call->Lexer() == SCLEX_PYTHON) && - /*(props.GetInt("indent.python.colon") == 1)*/ true) - { - const EndOfLine eolMode = _call->EOLMode(); - const int eolChar = (eolMode == EndOfLine::Cr ? '\r' : '\n'); - const int eolChars = (eolMode == EndOfLine::CrLf ? 2 : 1); - const Position prevLineStart = _call->LineStart(curLine - 1); - const Position prevIndentPos = SciGetLineIndentPosition(curLine - 1); - const int indentExisting = SciGetLineIndentation(curLine); - - if (ch == eolChar) - { - // Find last noncomment, nonwhitespace character on previous line - char character = '\0'; - int style = 0; - for (Position p = selStart - eolChars - 1; p > prevLineStart; p--) - { - style = _call->UnsignedStyleAt(p); - if (style != SCE_P_DEFAULT && style != SCE_P_COMMENTLINE && - style != SCE_P_COMMENTBLOCK) - { - character = _call->CharacterAt(p); - break; - } - } - indentBlock = SciGetLineIndentation(curLine - 1); - if (style == SCE_P_OPERATOR && character == ':') - { - SciSetLineIndentation(curLine, indentBlock + indentSize); - } - else if (selStart == prevIndentPos + eolChars) - { - // Preserve the indentation of preexisting text beyond the caret - SciSetLineIndentation(curLine, indentBlock + indentExisting); - } - else - { - SciSetLineIndentation(curLine, indentBlock); - } - } - return; - } - - if (_sciBlockEnd.IsCharacter(ch)) - { // Dedent maybe - if (!_sciIndentClosing) - { - if (SciRangeIsAllWhitespace(thisLineStart, selStart - 1)) - { - SciSetLineIndentation(curLine, indentBlock - indentSize); - } - } - } - else if (!_sciBlockEnd.IsSingleChar() && (ch == ' ')) - { // Dedent maybe - if (!_sciIndentClosing && (SciGetIndentState(curLine) == IndentationStatus::blockEnd)) {} - } - else if (_sciBlockStart.IsCharacter(ch)) - { - // Dedent maybe if first on line and previous line was starting keyword - if (!_sciIndentOpening && (SciGetIndentState(curLine - 1) == IndentationStatus::keyWordStart)) - { - if (SciRangeIsAllWhitespace(thisLineStart, selStart - 1)) - { - SciSetLineIndentation(curLine, indentBlock - indentSize); - } - } - } - else if ((ch == '\r' || ch == '\n') && (selStart == thisLineStart)) - { - if (!_sciIndentClosing && !_sciBlockEnd.IsSingleChar()) - { // Dedent previous line maybe - const std::vector controlWords = SciGetLinePartsInStyle(curLine - 1, _sciBlockEnd); - if (!controlWords.empty()) - { - if (_sciBlockEnd.Includes(controlWords[0])) - { - // Check if first keyword on line is an ender - SciSetLineIndentation(curLine - 1, SciIndentOfBlock(curLine - 2) - indentSize); - // Recalculate as may have changed previous line - indentBlock = SciIndentOfBlock(curLine - 1); - } - } - } - SciSetLineIndentation(curLine, indentBlock); - } - } -} diff --git a/WinUIEditor/CodeEditorHandler.SciEdit.h b/WinUIEditor/CodeEditorHandler.SciEdit.h deleted file mode 100644 index 10ea8c1..0000000 --- a/WinUIEditor/CodeEditorHandler.SciEdit.h +++ /dev/null @@ -1,91 +0,0 @@ -// This file includes code derived from SciTEBase.h and StyleWriter.h -// Copyright 1998-2011 by Neil Hodgson -// The scintilla\License.txt file describes the conditions under which this software may be distributed. - -#pragma once - -namespace WinUIEditor::Internal -{ - enum class IndentationStatus - { - none, // no effect on indentation - blockStart, // indentation block begin such as "{" or VB "function" - blockEnd, // indentation end indicator such as "}" or VB "end" - keyWordStart, // Keywords that cause indentation - }; - - class StyleAndWords - { - int styleNumber = 0; - std::set words; - public: - StyleAndWords() noexcept; - explicit StyleAndWords(const std::string &definition); - StyleAndWords(int style, const std::set &words); - [[nodiscard]] bool IsEmpty() const noexcept; - [[nodiscard]] bool IsSingleChar() const noexcept; - [[nodiscard]] bool IsCharacter(char ch) const noexcept; - [[nodiscard]] int Style() const noexcept; - [[nodiscard]] bool Includes(const std::string &value) const; - }; - - // Read only access to a document, its styles and other data - class TextReader - { - protected: - static constexpr Scintilla::Position extremePosition = INTPTR_MAX; - /** @a bufferSize is a trade off between time taken to copy the characters - * and retrieval overhead. - * @a slopSize positions the buffer before the desired position - * in case there is some backtracking. */ - static constexpr Scintilla::Position bufferSize = 4000; - static constexpr Scintilla::Position slopSize = bufferSize / 8; - char buf[bufferSize + 1]; - Scintilla::Position startPos; - Scintilla::Position endPos; - int codePage; - - Scintilla::ScintillaCall ≻ - Scintilla::Position lenDoc; - - void Fill(Scintilla::Position position); - public: - explicit TextReader(Scintilla::ScintillaCall &sc_) noexcept; - // Deleted so TextReader objects can not be copied. - TextReader(const TextReader &source) = delete; - TextReader &operator=(const TextReader &) = delete; - char operator[](Scintilla::Position position) - { - if (position < startPos || position >= endPos) - { - Fill(position); - } - return buf[position - startPos]; - } - /** Safe version of operator[], returning a defined value for invalid position. */ - char SafeGetCharAt(Scintilla::Position position, char chDefault = ' ') - { - if (position < startPos || position >= endPos) - { - Fill(position); - if (position < startPos || position >= endPos) - { - // Position is outside range of document - return chDefault; - } - } - return buf[position - startPos]; - } - void SetCodePage(int codePage_) noexcept - { - codePage = codePage_; - } - bool Match(Scintilla::Position pos, const char *s); - int StyleAt(Scintilla::Position position); - Scintilla::Line GetLine(Scintilla::Position position); - Scintilla::Position LineStart(Scintilla::Line line); - Scintilla::FoldLevel LevelAt(Scintilla::Line line); - Scintilla::Position Length(); - int GetLineState(Scintilla::Line line); - }; -} diff --git a/WinUIEditor/CodeEditorHandler.SyntaxHighlighting.cpp b/WinUIEditor/CodeEditorHandler.SyntaxHighlighting.cpp deleted file mode 100644 index 3929a91..0000000 --- a/WinUIEditor/CodeEditorHandler.SyntaxHighlighting.cpp +++ /dev/null @@ -1,395 +0,0 @@ -#include "CodeEditorHandler.h" -#include "SciLexer.h" -#include "TextMateScope.h" -#include "DarkPlus.h" -#include "LightPlus.h" - -using namespace Scintilla; - -namespace WinUIEditor -{ - static constexpr auto WINUI_SCE_HJ_KEYWORD2{ 53 }; - - void CodeEditorHandler::SetLexer() - { - if (_highlightingLanguage == L"cpp") - { - const auto lexer{ _createLexer("cpp") }; - lexer->PropertySet("fold", "1"); - _call->SetILexer(lexer); - // This list of keywords from SciTe (cpp.properties) - _call->SetKeyWords(0, - "alignas alignof and and_eq asm audit auto axiom bitand bitor bool " - "char char8_t char16_t char32_t class compl concept " - "const consteval constexpr const_cast " - "decltype default delete double dynamic_cast enum explicit export extern false final float " - "friend import inline int long module mutable namespace new noexcept not not_eq nullptr " - "operator or or_eq override private protected public " - "register reinterpret_cast requires " - "short signed sizeof static static_assert static_cast struct " - "template this thread_local true typedef typeid typename union unsigned using " - "virtual void volatile wchar_t xor xor_eq"); - _call->SetKeyWords(1, - "break case catch co_await co_return co_yield continue do else for goto if return switch throw try while"); - _call->SetKeyWords(2, - "a addindex addtogroup anchor arg attention" - "author b brief bug c class code date def defgroup deprecated dontinclude" - "e em endcode endhtmlonly endif endlatexonly endlink endverbatim enum example exception" - "f$ f[ f] file fn hideinitializer htmlinclude htmlonly" - "if image include ingroup internal invariant interface latexonly li line link" - "mainpage name namespace nosubgrouping note overload" - "p page par param param[in] param[out]" - "post pre ref relates remarks return retval" - "sa section see showinitializer since skip skipline struct subsection" - "test throw throws todo typedef union until" - "var verbatim verbinclude version warning weakgroup $ @ \\ & < > # { }"); - SetLanguageIndentMode( - SCE_C_WORD2, { "case", "default", "do", "else", "for", "if", "while", }, - SCE_C_OPERATOR, { ";", }, - SCE_C_OPERATOR, { "{", }, - SCE_C_OPERATOR, { "}", }); - } - else if (_highlightingLanguage == L"csharp") - { - const auto lexer{ _createLexer("cpp") }; - lexer->PropertySet("fold", "1"); - _call->SetILexer(lexer); - // This list of keywords from SciTe (cpp.properties) and https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ - _call->SetKeyWords(0, - "abstract as ascending async await base bool by byte char checked " - "class const decimal default delegate descending double enum " - "equals event explicit extern false fixed float from get group " - "implicit in int interface internal into is join lock let long nameof namespace new nint null " - "object on operator orderby out override params partial private protected public " - "readonly ref sbyte sealed select set short sizeof stackalloc static " - "string struct this true typeof uint ulong" - "unchecked unsafe ushort var virtual void volatile where"); - _call->SetKeyWords(1, - "break case catch continue do else finally for foreach goto if return switch throw try using while yield"); - // XML document comments from https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/documentation-comments#d31-general - _call->SetKeyWords(2, - "c code example exception include list para param paramref permission remarks returns see seealso summary typeparam typeparamref value"); - SetLanguageIndentMode( - SCE_C_WORD2, { "case", "default", "do", "else", "for", "foreach", "if", "using", "while", }, - SCE_C_OPERATOR, { ";", }, - SCE_C_OPERATOR, { "{", }, - SCE_C_OPERATOR, { "}", }); - } - else if (_highlightingLanguage == L"javascript") - { - const auto lexer{ _createLexer("cpp") }; - lexer->PropertySet("fold", "1"); - _call->SetILexer(lexer); - SetJavaScriptDefaults(0, 1, SCE_C_WORD2, SCE_C_OPERATOR); - } - else if (_highlightingLanguage == L"json") - { - const auto lexer{ _createLexer("json") }; - lexer->PropertySet("fold", "1"); - lexer->PropertySet("lexer.json.allow.comments", "1"); - lexer->PropertySet("lexer.json.escape.sequence", "1"); - _call->SetILexer(lexer); - // This list of keywords from SciTe (json.properties) - _call->SetKeyWords(0, "false true null"); - _call->SetKeyWords(1, - "@id @context @type @value @language @container @list @set @reverse @index @base @vocab @graph"); - SetLanguageIndentMode( - 0, { }, - 0, { }, - SCE_JSON_OPERATOR, { "{", "[", }, - SCE_JSON_OPERATOR, { "}", "]", }); - } - else if (_highlightingLanguage == L"xml" || _highlightingLanguage == L"html") - { - const auto lexer{ _createLexer(_highlightingLanguage == L"xml" ? "xml" : "hypertext") }; - lexer->PropertySet("fold", "1"); - lexer->PropertySet("fold.html", "1"); - lexer->PropertySet("winuiedit.style.tag.brackets.as.tag.end", "1"); - _call->SetILexer(lexer); - if (_highlightingLanguage == L"html") - { - _call->SetKeyWords(5, "ELEMENT DOCTYPE doctype ATTLIST ENTITY NOTATION"); - - SetJavaScriptDefaults(1, 6, WINUI_SCE_HJ_KEYWORD2, SCE_HJ_SYMBOLS); - } - else - { - SetLanguageIndentMode(0, { }, 0, { }, 0, { }, 0, { }); - } - } - else if (_highlightingLanguage == L"plaintext") - { - _call->SetILexer(_createLexer("null")); - SetLanguageIndentMode(0, { }, 0, { }, 0, { }, 0, { }); - } - else - { - _call->SetILexer(nullptr); - SetLanguageIndentMode(0, { }, 0, { }, 0, { }, 0, { }); - } - if (_highlightingLanguage == L"cpp" || _highlightingLanguage == L"csharp" || _highlightingLanguage == L"javascript") - { - _call->SetKeyWords(5, "todo toDo Todo ToDo TODO fixme fixMe Fixme FixMe FIXME"); - } - } - - void CodeEditorHandler::SetJavaScriptDefaults(int wordList1, int wordList2, int indentKeywordStyle, int symbolStyle) - { - // This list of keywords from MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords - // Note additional words like undefined - _call->SetKeyWords(wordList1, - "class const debugger delete export extends false function in instanceof " - "new null super this true typeof var void let static enum implements " - "interface private protected public arguments async get of set Infinity NaN undefined"); - _call->SetKeyWords(wordList2, - "break case catch continue default do else finally for if import return " - "switch throw try while with yield await package as from"); - SetLanguageIndentMode( - indentKeywordStyle, { "case", "default", "do", "else", "for", "if", "while", }, - symbolStyle, { ";", }, - symbolStyle, { "{", "[" }, - symbolStyle, { "}", "]" }); - } - - void CodeEditorHandler::UpdateLanguageStyles() - { - if (_highlightingLanguage == L"cpp" || _highlightingLanguage == L"csharp" || _highlightingLanguage == L"javascript") - { - switch (_theme) - { - case CodeEditorTheme::Dark: - StyleSetFore(static_cast(StylesCommon::Default), DarkPlusEditorForeground); - StyleClearCustom(); - - StyleSetFore(static_cast(StylesCommon::BraceLight), DarkPlusEditorForeground); - - StyleSetFore(SCE_C_COMMENT, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_C_COMMENTLINE, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_C_COMMENTDOC, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_C_NUMBER, DarkPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_C_WORD, DarkPlus2(Scope::Keyword)); - StyleSetFore(SCE_C_STRING, DarkPlus2(Scope::String)); - StyleSetFore(SCE_C_CHARACTER, DarkPlus2(Scope::String)); - StyleSetFore(SCE_C_UUID, DarkPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_C_PREPROCESSOR, DarkPlus2(Scope::MetaPreprocessor)); - StyleSetFore(SCE_C_OPERATOR, DarkPlus2(Scope::KeywordOperator)); - if (_highlightingLanguage != L"cpp") - { - StyleSetFore(SCE_C_IDENTIFIER, DarkPlus2(Scope::Variable)); - } - StyleSetFore(SCE_C_STRINGEOL, DarkPlus2(Scope::String)); - StyleSetFore(SCE_C_VERBATIM, DarkPlus2(Scope::String)); - StyleSetFore(SCE_C_REGEX, DarkPlus2(Scope::StringRegexp)); - StyleSetFore(SCE_C_COMMENTLINEDOC, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_C_WORD2, DarkPlus2(Scope::KeywordControl)); - StyleSetFore(SCE_C_COMMENTDOCKEYWORD, DarkPlus2(Scope::Keyword)); - StyleSetFore(SCE_C_COMMENTDOCKEYWORDERROR, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_C_GLOBALCLASS, DarkPlus2(Scope::EntityNameType)); - StyleSetFore(SCE_C_STRINGRAW, DarkPlus2(Scope::String)); - StyleSetFore(SCE_C_TRIPLEVERBATIM, DarkPlus2(Scope::String)); - StyleSetFore(SCE_C_HASHQUOTEDSTRING, DarkPlus2(Scope::String)); - StyleSetFore(SCE_C_PREPROCESSORCOMMENT, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_C_PREPROCESSORCOMMENTDOC, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_C_USERLITERAL, DarkPlus2(Scope::KeywordOtherUnit)); - StyleSetFore(SCE_C_TASKMARKER, DarkPlus2(Scope::Comment)); - _call->StyleSetItalic(SCE_C_TASKMARKER, true); - _call->StyleSetBold(SCE_C_TASKMARKER, true); - StyleSetFore(SCE_C_ESCAPESEQUENCE, DarkPlus2(Scope::ConstantCharacterEscape)); - break; - - case CodeEditorTheme::Light: - StyleSetFore(static_cast(StylesCommon::Default), LightPlusEditorForeground); - StyleClearCustom(); - - StyleSetFore(static_cast(StylesCommon::BraceLight), LightPlusEditorForeground); - - StyleSetFore(SCE_C_COMMENT, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_C_COMMENTLINE, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_C_COMMENTDOC, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_C_NUMBER, LightPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_C_WORD, LightPlus2(Scope::Keyword)); - StyleSetFore(SCE_C_STRING, LightPlus2(Scope::String)); - StyleSetFore(SCE_C_CHARACTER, LightPlus2(Scope::String)); - StyleSetFore(SCE_C_UUID, LightPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_C_PREPROCESSOR, LightPlus2(Scope::MetaPreprocessor)); - StyleSetFore(SCE_C_OPERATOR, LightPlus2(Scope::KeywordOperator)); - if (_highlightingLanguage != L"cpp") - { - StyleSetFore(SCE_C_IDENTIFIER, LightPlus2(Scope::Variable)); - } - StyleSetFore(SCE_C_STRINGEOL, LightPlus2(Scope::String)); - StyleSetFore(SCE_C_VERBATIM, LightPlus2(Scope::String)); - StyleSetFore(SCE_C_REGEX, LightPlus2(Scope::StringRegexp)); - StyleSetFore(SCE_C_COMMENTLINEDOC, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_C_WORD2, LightPlus2(Scope::KeywordControl)); - StyleSetFore(SCE_C_COMMENTDOCKEYWORD, LightPlus2(Scope::Keyword)); - StyleSetFore(SCE_C_COMMENTDOCKEYWORDERROR, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_C_GLOBALCLASS, LightPlus2(Scope::EntityNameType)); - StyleSetFore(SCE_C_STRINGRAW, LightPlus2(Scope::String)); - StyleSetFore(SCE_C_TRIPLEVERBATIM, LightPlus2(Scope::String)); - StyleSetFore(SCE_C_HASHQUOTEDSTRING, LightPlus2(Scope::String)); - StyleSetFore(SCE_C_PREPROCESSORCOMMENT, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_C_PREPROCESSORCOMMENTDOC, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_C_USERLITERAL, LightPlus2(Scope::KeywordOtherUnit)); - StyleSetFore(SCE_C_TASKMARKER, LightPlus2(Scope::Comment)); - _call->StyleSetItalic(SCE_C_TASKMARKER, true); - _call->StyleSetBold(SCE_C_TASKMARKER, true); - StyleSetFore(SCE_C_ESCAPESEQUENCE, LightPlus2(Scope::ConstantCharacterEscape)); - break; - } - } - else if (_highlightingLanguage == L"json") - { - switch (_theme) - { - case CodeEditorTheme::Dark: - StyleSetFore(static_cast(StylesCommon::Default), DarkPlusEditorForeground); - StyleClearCustom(); - - StyleSetFore(static_cast(StylesCommon::BraceLight), DarkPlusEditorForeground); - - StyleSetFore(SCE_JSON_NUMBER, DarkPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_JSON_STRING, DarkPlus2(Scope::String)); - StyleSetFore(SCE_JSON_STRINGEOL, DarkPlus2(Scope::String)); - StyleSetFore(SCE_JSON_PROPERTYNAME, DarkPlus2(Scope::SupportTypeProperty_NameJson)); - StyleSetFore(SCE_JSON_ESCAPESEQUENCE, DarkPlus2(Scope::ConstantCharacterEscape)); - StyleSetFore(SCE_JSON_LINECOMMENT, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_JSON_BLOCKCOMMENT, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_JSON_OPERATOR, DarkPlus2(Scope::KeywordOperator)); - StyleSetFore(SCE_JSON_URI, DarkPlus2(Scope::String)); - _call->StyleSetUnderline(SCE_JSON_URI, true); - StyleSetFore(SCE_JSON_COMPACTIRI, DarkPlus2(Scope::String)); - StyleSetFore(SCE_JSON_KEYWORD, DarkPlus2(Scope::ConstantLanguage)); - StyleSetFore(SCE_JSON_LDKEYWORD, DarkPlus2(Scope::KeywordControl)); - StyleSetFore(SCE_JSON_ERROR, DarkPlus2(Scope::Invalid)); - break; - - case CodeEditorTheme::Light: - StyleSetFore(static_cast(StylesCommon::Default), LightPlusEditorForeground); - StyleClearCustom(); - - StyleSetFore(static_cast(StylesCommon::BraceLight), LightPlusEditorForeground); - - StyleSetFore(SCE_JSON_NUMBER, LightPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_JSON_STRING, LightPlus2(Scope::String)); - StyleSetFore(SCE_JSON_STRINGEOL, LightPlus2(Scope::String)); - StyleSetFore(SCE_JSON_PROPERTYNAME, LightPlus2(Scope::SupportTypeProperty_NameJson)); - StyleSetFore(SCE_JSON_ESCAPESEQUENCE, LightPlus2(Scope::ConstantCharacterEscape)); - StyleSetFore(SCE_JSON_LINECOMMENT, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_JSON_BLOCKCOMMENT, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_JSON_OPERATOR, LightPlus2(Scope::KeywordOperator)); - StyleSetFore(SCE_JSON_URI, LightPlus2(Scope::String)); - _call->StyleSetUnderline(SCE_JSON_URI, true); - StyleSetFore(SCE_JSON_COMPACTIRI, LightPlus2(Scope::String)); - StyleSetFore(SCE_JSON_KEYWORD, LightPlus2(Scope::ConstantLanguage)); - StyleSetFore(SCE_JSON_LDKEYWORD, LightPlus2(Scope::KeywordControl)); - StyleSetFore(SCE_JSON_ERROR, LightPlus2(Scope::Invalid)); - break; - } - } - else if (_highlightingLanguage == L"xml" || _highlightingLanguage == L"html") - { - const auto isHtml{ _highlightingLanguage == L"html" }; - switch (_theme) - { - case CodeEditorTheme::Dark: - StyleSetFore(static_cast(StylesCommon::Default), DarkPlusEditorForeground); - StyleClearCustom(); - - StyleSetFore(static_cast(StylesCommon::BraceLight), DarkPlusEditorForeground); - - StyleSetFore(SCE_H_TAG, DarkPlus2(Scope::EntityNameTag)); - StyleSetFore(SCE_H_TAGUNKNOWN, DarkPlus2(Scope::EntityNameTag)); - StyleSetFore(SCE_H_ATTRIBUTE, DarkPlus2(Scope::EntityOtherAttribute_Name)); - StyleSetFore(SCE_H_ATTRIBUTEUNKNOWN, DarkPlus2(Scope::EntityOtherAttribute_Name)); - StyleSetFore(SCE_H_NUMBER, DarkPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_H_DOUBLESTRING, DarkPlus2(Scope::String)); - StyleSetFore(SCE_H_SINGLESTRING, DarkPlus2(Scope::String)); - // ... - StyleSetFore(SCE_H_COMMENT, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_H_ENTITY, DarkPlus2(Scope::ConstantCharacter)); - StyleSetFore(SCE_H_TAGEND, DarkPlus2(Scope::PunctuationDefinitionTag)); - StyleSetFore(SCE_H_XMLSTART, DarkPlus2(Scope::PunctuationDefinitionTag)); - StyleSetFore(SCE_H_XMLEND, DarkPlus2(Scope::PunctuationDefinitionTag)); - // ... - StyleSetFore(SCE_H_CDATA, DarkPlus2(Scope::String)); - StyleSetFore(SCE_H_SGML_DEFAULT, DarkPlus2(Scope::PunctuationDefinitionTag)); - StyleSetFore(SCE_H_SGML_COMMAND, DarkPlus2(Scope::EntityNameTag)); - StyleSetFore(SCE_H_SGML_1ST_PARAM, DarkPlus2(Scope::EntityOtherAttribute_Name)); - StyleSetFore(SCE_H_SGML_DOUBLESTRING, DarkPlus2(Scope::String)); - // ... - StyleSetFore(SCE_H_SGML_COMMENT, DarkPlus2(Scope::Comment)); - // ... - if (isHtml) - { - StyleSetFore(SCE_H_VALUE, DarkPlus2(Scope::String)); - - StyleSetFore(SCE_HJ_COMMENT, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_HJ_COMMENTLINE, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_HJ_COMMENTDOC, DarkPlus2(Scope::Comment)); - StyleSetFore(SCE_HJ_NUMBER, DarkPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_HJ_WORD, DarkPlus2(Scope::Variable)); - StyleSetFore(SCE_HJ_KEYWORD, DarkPlus2(Scope::Keyword)); - StyleSetFore(WINUI_SCE_HJ_KEYWORD2, DarkPlus2(Scope::KeywordControl)); - StyleSetFore(SCE_HJ_DOUBLESTRING, DarkPlus2(Scope::String)); - StyleSetFore(SCE_HJ_SINGLESTRING, DarkPlus2(Scope::String)); - StyleSetFore(SCE_HJ_SYMBOLS, DarkPlus2(Scope::KeywordOperator)); - StyleSetFore(SCE_HJ_STRINGEOL, DarkPlus2(Scope::String)); - StyleSetFore(SCE_HJ_REGEX, DarkPlus2(Scope::StringRegexp)); - } - break; - - case CodeEditorTheme::Light: - StyleSetFore(static_cast(StylesCommon::Default), LightPlusEditorForeground); - StyleClearCustom(); - - StyleSetFore(static_cast(StylesCommon::BraceLight), LightPlusEditorForeground); - - StyleSetFore(SCE_H_TAG, LightPlus2(Scope::EntityNameTag)); - StyleSetFore(SCE_H_TAGUNKNOWN, LightPlus2(Scope::EntityNameTag)); - StyleSetFore(SCE_H_ATTRIBUTE, LightPlus2(Scope::EntityOtherAttribute_Name)); - StyleSetFore(SCE_H_ATTRIBUTEUNKNOWN, LightPlus2(Scope::EntityOtherAttribute_Name)); - StyleSetFore(SCE_H_NUMBER, LightPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_H_DOUBLESTRING, isHtml ? LightPlus2(Scope::StringQuotedDoubleHtml) : LightPlus2(Scope::StringQuotedDoubleXml)); - StyleSetFore(SCE_H_SINGLESTRING, isHtml ? LightPlus2(Scope::StringQuotedSingleHtml) : LightPlus2(Scope::StringQuotedSingleXml)); - // ... - StyleSetFore(SCE_H_COMMENT, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_H_ENTITY, LightPlus2(Scope::ConstantCharacter)); - StyleSetFore(SCE_H_TAGEND, LightPlus2(Scope::PunctuationDefinitionTag)); - StyleSetFore(SCE_H_XMLSTART, LightPlus2(Scope::PunctuationDefinitionTag)); - StyleSetFore(SCE_H_XMLEND, LightPlus2(Scope::PunctuationDefinitionTag)); - // ... - StyleSetFore(SCE_H_CDATA, isHtml ? LightPlus2(Scope::String) : LightPlus2(Scope::StringUnquotedCdataXml)); - StyleSetFore(SCE_H_SGML_DEFAULT, LightPlus2(Scope::PunctuationDefinitionTag)); - StyleSetFore(SCE_H_SGML_COMMAND, LightPlus2(Scope::EntityNameTag)); - StyleSetFore(SCE_H_SGML_1ST_PARAM, LightPlus2(Scope::EntityOtherAttribute_Name)); - StyleSetFore(SCE_H_SGML_DOUBLESTRING, LightPlus2(Scope::StringQuotedDoubleHtml)); - // ... - StyleSetFore(SCE_H_SGML_COMMENT, LightPlus2(Scope::Comment)); - // ... - if (isHtml) - { - StyleSetFore(SCE_H_VALUE, LightPlus2(Scope::StringUnquotedHtml)); - - StyleSetFore(SCE_HJ_COMMENT, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_HJ_COMMENTLINE, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_HJ_COMMENTDOC, LightPlus2(Scope::Comment)); - StyleSetFore(SCE_HJ_NUMBER, LightPlus2(Scope::ConstantNumeric)); - StyleSetFore(SCE_HJ_WORD, LightPlus2(Scope::Variable)); - StyleSetFore(SCE_HJ_KEYWORD, LightPlus2(Scope::Keyword)); - StyleSetFore(WINUI_SCE_HJ_KEYWORD2, LightPlus2(Scope::KeywordControl)); - StyleSetFore(SCE_HJ_DOUBLESTRING, LightPlus2(Scope::String)); - StyleSetFore(SCE_HJ_SINGLESTRING, LightPlus2(Scope::String)); - StyleSetFore(SCE_HJ_SYMBOLS, LightPlus2(Scope::KeywordOperator)); - StyleSetFore(SCE_HJ_STRINGEOL, LightPlus2(Scope::String)); - StyleSetFore(SCE_HJ_REGEX, LightPlus2(Scope::StringRegexp)); - } - break; - } - } - else - { - StyleClearCustom(); - } - } -} diff --git a/WinUIEditor/CodeEditorHandler.cpp b/WinUIEditor/CodeEditorHandler.cpp deleted file mode 100644 index 9544f33..0000000 --- a/WinUIEditor/CodeEditorHandler.cpp +++ /dev/null @@ -1,557 +0,0 @@ -#include "CodeEditorHandler.h" -#include -#include "ScintillaMessages.h" - -using namespace Scintilla; - -namespace WinUIEditor -{ - void CodeEditorHandler::SetScintilla(std::shared_ptr call) - { - _call = call; - } - - void CodeEditorHandler::SetLexilla(Lexilla::CreateLexerFn createLexer) - { - _createLexer = createLexer; - } - - void CodeEditorHandler::Initialize() - { - AddKeyboardShortcuts(); - ChangeDefaults(); - ChangeDocumentDefaults(); - } - - void CodeEditorHandler::ChangeDocumentDefaults() - { - _call->SetUseTabs(false); - _call->SetTabWidth(4); - _call->SetIndent(4); // Brace matching and autoindent relies on this - } - - void CodeEditorHandler::UpdateColors(CodeEditorTheme theme) - { - // Todo: Support high contrast mode - - constexpr auto folderForeDark{ IntRGBA(0, 0, 0, 0) }; - constexpr auto folderBackDark{ IntRGBA(0xFF, 0xFF, 0xFF, 148) }; - constexpr auto folderBackHighlightDark{ folderBackDark }; - constexpr auto folderForeLight{ IntRGBA(0xFF, 0xFF, 0xFF, 0) }; - constexpr auto folderBackLight{ IntRGBA(0, 0, 0, 108) }; - constexpr auto folderBackHighlightLight{ folderBackLight }; - - if (_theme != theme) - { - _theme = theme; - - switch (theme) - { - case CodeEditorTheme::Dark: - _call->SetElementColour(Element::Caret, IntRGBA(0xAE, 0xAF, 0xAD)); - _call->SetElementColour(Element::SelectionBack, IntRGBA(0x26, 0x4F, 0x78)); - _call->SetElementColour(Element::SelectionAdditionalBack, IntRGBA(0x26, 0x4F, 0x78)); - _call->SetElementColour(Element::SelectionInactiveBack, IntRGBA(0x3A, 0x3D, 0x41)); - _call->SetElementColour(Element::HiddenLine, IntRGBA(0xFF, 0xFF, 0xFF, 48)); - - MarkerSetColors(Scintilla::MarkerOutline::FolderOpen, folderForeDark, folderBackDark, folderBackHighlightDark); - MarkerSetColors(Scintilla::MarkerOutline::Folder, folderForeDark, folderBackDark, folderBackHighlightDark); - MarkerSetColors(Scintilla::MarkerOutline::FolderSub, folderForeDark, folderBackDark, folderBackHighlightDark); - MarkerSetColors(Scintilla::MarkerOutline::FolderTail, folderForeDark, folderBackDark, folderBackHighlightDark); - MarkerSetColors(Scintilla::MarkerOutline::FolderEnd, folderForeDark, folderBackDark, folderBackHighlightDark); - MarkerSetColors(Scintilla::MarkerOutline::FolderOpenMid, folderForeDark, folderBackDark, folderBackHighlightDark); - MarkerSetColors(Scintilla::MarkerOutline::FolderMidTail, folderForeDark, folderBackDark, folderBackHighlightDark); - - _call->MarkerSetForeTranslucent(static_cast(Scintilla::MarkerOutline::HistoryRevertedToOrigin), IntRGBA(0x35, 0x95, 0xDE)); - _call->MarkerSetBackTranslucent(static_cast(Scintilla::MarkerOutline::HistoryRevertedToOrigin), IntRGBA(0x35, 0x95, 0xDE, 0x00)); - _call->MarkerSetForeTranslucent(static_cast(Scintilla::MarkerOutline::HistorySaved), IntRGBA(0x55, 0xB1, 0x55)); - _call->MarkerSetBackTranslucent(static_cast(Scintilla::MarkerOutline::HistorySaved), IntRGBA(0x55, 0xB1, 0x55)); - _call->MarkerSetForeTranslucent(static_cast(Scintilla::MarkerOutline::HistoryModified), IntRGBA(0xD0, 0xB1, 0x32)); - _call->MarkerSetBackTranslucent(static_cast(Scintilla::MarkerOutline::HistoryModified), IntRGBA(0x27, 0x27, 0x27, 0x00)); - _call->MarkerSetForeTranslucent(static_cast(Scintilla::MarkerOutline::HistoryRevertedToModified), IntRGBA(0x93, 0xB1, 0x44)); - _call->MarkerSetBackTranslucent(static_cast(Scintilla::MarkerOutline::HistoryRevertedToModified), IntRGBA(0x93, 0xB1, 0x44, 0x00)); - break; - - case CodeEditorTheme::Light: - _call->SetElementColour(Element::Caret, IntRGBA(0x00, 0x00, 0x00)); - _call->SetElementColour(Element::SelectionBack, IntRGBA(0xAD, 0xD6, 0xFF)); - _call->SetElementColour(Element::SelectionAdditionalBack, IntRGBA(0xAD, 0xD6, 0xFF)); - _call->SetElementColour(Element::SelectionInactiveBack, IntRGBA(0xE5, 0xEB, 0xF1)); - _call->SetElementColour(Element::HiddenLine, IntRGBA(0x00, 0x00, 0x00, 64)); - - MarkerSetColors(Scintilla::MarkerOutline::FolderOpen, folderForeLight, folderBackLight, folderBackHighlightLight); - MarkerSetColors(Scintilla::MarkerOutline::Folder, folderForeLight, folderBackLight, folderBackHighlightLight); - MarkerSetColors(Scintilla::MarkerOutline::FolderSub, folderForeLight, folderBackLight, folderBackHighlightLight); - MarkerSetColors(Scintilla::MarkerOutline::FolderTail, folderForeLight, folderBackLight, folderBackHighlightLight); - MarkerSetColors(Scintilla::MarkerOutline::FolderEnd, folderForeLight, folderBackLight, folderBackHighlightLight); - MarkerSetColors(Scintilla::MarkerOutline::FolderOpenMid, folderForeLight, folderBackLight, folderBackHighlightLight); - MarkerSetColors(Scintilla::MarkerOutline::FolderMidTail, folderForeLight, folderBackLight, folderBackHighlightLight); - - _call->MarkerSetForeTranslucent(static_cast(Scintilla::MarkerOutline::HistoryRevertedToOrigin), IntRGBA(0x00, 0x78, 0xD4)); - _call->MarkerSetBackTranslucent(static_cast(Scintilla::MarkerOutline::HistoryRevertedToOrigin), IntRGBA(0x00, 0x78, 0xD4, 0x00)); - _call->MarkerSetForeTranslucent(static_cast(Scintilla::MarkerOutline::HistorySaved), IntRGBA(0x10, 0x7C, 0x10)); - _call->MarkerSetBackTranslucent(static_cast(Scintilla::MarkerOutline::HistorySaved), IntRGBA(0x10, 0x7C, 0x10)); - _call->MarkerSetForeTranslucent(static_cast(Scintilla::MarkerOutline::HistoryModified), IntRGBA(0xAE, 0x8C, 0x00)); - _call->MarkerSetBackTranslucent(static_cast(Scintilla::MarkerOutline::HistoryModified), IntRGBA(0xF5, 0xF5, 0xF5, 0x00)); - _call->MarkerSetForeTranslucent(static_cast(Scintilla::MarkerOutline::HistoryRevertedToModified), IntRGBA(0x5F, 0x84, 0x08)); - _call->MarkerSetBackTranslucent(static_cast(Scintilla::MarkerOutline::HistoryRevertedToModified), IntRGBA(0x5F, 0x84, 0x08, 0x00)); - break; - } - - UpdateCaretLineBackColors(true); - - UpdateStyles(); - } - } - - // Duplicated from Helpers.cpp to make portable - // Derived from https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/ComplexInk/cpp/Common/DeviceResources.h - static constexpr int ConvertFromDipToPixelUnit(float val, float dpiAdjustmentRatio, bool rounded = true) - { - float pixelVal = val * dpiAdjustmentRatio; - return static_cast(rounded ? floorf(pixelVal + 0.5f) : pixelVal); // Todo: Test if this is ever necessary - } - - void CodeEditorHandler::UpdateDpi(double value) - { - _dpiScale = value; - _call->SetXCaretPolicy(CaretPolicy::Slop | CaretPolicy::Strict | CaretPolicy::Even, ConvertFromDipToPixelUnit(24, value)); - UpdateZoom(); - } - - void CodeEditorHandler::StyleSetFore(int style, ColourAlpha color) - { - // Overridable to allow users to internally set transparent color - _call->StyleSetFore(style, color); - } - - void CodeEditorHandler::StyleSetBack(int style, ColourAlpha color) - { - // Overridable to allow users to internally set transparent color - _call->StyleSetBack(style, color); - } - - void CodeEditorHandler::InvalidateStyleRedraw() - { - // Overridable to allow users to invalidate after setting all colors - // Not needed if using default StyleSetFore/Back - } - - void CodeEditorHandler::StyleClearCustom() - { - // Less performant way to copy styles - // Overridable when there is access to Scintilla internals - for (size_t i = 0; i < 256; i++) - { - if (i < static_cast(StylesCommon::Default) || i > static_cast(StylesCommon::LastPredefined)) - { - _call->StyleSetFont(i, _call->StyleGetFont(static_cast(StylesCommon::Default)).c_str()); - _call->StyleSetSizeFractional(i, _call->StyleGetSizeFractional(static_cast(StylesCommon::Default))); - _call->StyleSetBold(i, _call->StyleGetBold(static_cast(StylesCommon::Default))); - _call->StyleSetWeight(i, _call->StyleGetWeight(static_cast(StylesCommon::Default))); - _call->StyleSetItalic(i, _call->StyleGetItalic(static_cast(StylesCommon::Default))); - _call->StyleSetUnderline(i, _call->StyleGetUnderline(static_cast(StylesCommon::Default))); - _call->StyleSetFore(i, _call->StyleGetFore(static_cast(StylesCommon::Default))); - _call->StyleSetBack(i, _call->StyleGetBack(static_cast(StylesCommon::Default))); - _call->StyleSetEOLFilled(i, _call->StyleGetEOLFilled(static_cast(StylesCommon::Default))); - _call->StyleSetCharacterSet(i, _call->StyleGetCharacterSet(static_cast(StylesCommon::Default))); - _call->StyleSetCase(i, _call->StyleGetCase(static_cast(StylesCommon::Default))); - _call->StyleSetVisible(i, _call->StyleGetVisible(static_cast(StylesCommon::Default))); - _call->StyleSetChangeable(i, _call->StyleGetChangeable(static_cast(StylesCommon::Default))); - _call->StyleSetHotSpot(i, _call->StyleGetHotSpot(static_cast(StylesCommon::Default))); - _call->StyleSetCheckMonospaced(i, _call->StyleGetCheckMonospaced(static_cast(StylesCommon::Default))); - _call->StyleSetInvisibleRepresentation(i, _call->StyleGetInvisibleRepresentation(static_cast(StylesCommon::Default)).c_str()); - } - } - } - - void CodeEditorHandler::SetFoldMarginColor(bool useSetting, ColourAlpha back) - { - // Implement for transparent folding margin. Not implemented so default is preserved - } - - void CodeEditorHandler::SetFoldMarginHiColor(bool useSetting, ColourAlpha fore) - { - // Implement for transparent folding margin. Not implemented so default is preserved - } - - void CodeEditorHandler::DefaultColorsChanged(CodeEditorTheme theme) - { - // Default event handler - } - - void CodeEditorHandler::SyntaxHighlightingApplied(CodeEditorTheme theme) - { - // Default event handler - } - - void CodeEditorHandler::UpdateStyles() - { - constexpr auto bgDark{ IntRGBA(0x27, 0x27, 0x27, 0x00) }; - constexpr auto bgLight{ IntRGBA(0xF5, 0xF5, 0xF5, 0x00) }; - - switch (_theme) - { - case CodeEditorTheme::Dark: - StyleSetFore(static_cast(StylesCommon::LineNumber), IntRGBA(0x85, 0x85, 0x85)); - StyleSetBack(static_cast(StylesCommon::LineNumber), bgDark); - - StyleSetFore(static_cast(StylesCommon::Default), IntRGBA(0xFF, 0xFF, 0xFF)); - StyleSetBack(static_cast(StylesCommon::Default), bgDark); - - StyleSetFore(static_cast(StylesCommon::BraceLight), IntRGBA(0xFF, 0xFF, 0xFF)); - StyleSetBack(static_cast(StylesCommon::BraceLight), IntRGBA(0x11, 0x3D, 0x6F)); - StyleSetFore(static_cast(StylesCommon::BraceBad), IntRGBA(0xcd, 0x31, 0x31)); - StyleSetBack(static_cast(StylesCommon::BraceBad), bgDark); - - StyleSetFore(static_cast(StylesCommon::IndentGuide), IntRGBA(0xFF, 0xFF, 0xFF, 48)); - StyleSetBack(static_cast(StylesCommon::IndentGuide), bgDark); - - StyleSetFore(static_cast(StylesCommon::ControlChar), IntRGBA(0xFF, 0xFF, 0xFF)); - StyleSetBack(static_cast(StylesCommon::ControlChar), IntRGBA(0x96, 0x00, 0x00)); - - StyleSetFore(static_cast(StylesCommon::FoldDisplayText), IntRGBA(0xB8, 0xC2, 0xCC)); - StyleSetBack(static_cast(StylesCommon::FoldDisplayText), IntRGBA(0x26, 0x33, 0x3F)); - break; - - case CodeEditorTheme::Light: - StyleSetFore(static_cast(StylesCommon::LineNumber), IntRGBA(0x23, 0x78, 0x93)); - StyleSetBack(static_cast(StylesCommon::LineNumber), bgLight); - - StyleSetFore(static_cast(StylesCommon::Default), IntRGBA(0x00, 0x00, 0x00)); - StyleSetBack(static_cast(StylesCommon::Default), bgLight); - - StyleSetFore(static_cast(StylesCommon::BraceLight), IntRGBA(0x00, 0x00, 0x00)); - StyleSetBack(static_cast(StylesCommon::BraceLight), IntRGBA(0xE2, 0xE6, 0xD6)); - StyleSetFore(static_cast(StylesCommon::BraceBad), IntRGBA(0xcd, 0x31, 0x31)); - StyleSetBack(static_cast(StylesCommon::BraceBad), bgLight); - - StyleSetFore(static_cast(StylesCommon::IndentGuide), IntRGBA(0x00, 0x00, 0x00, 64)); - StyleSetBack(static_cast(StylesCommon::IndentGuide), bgLight); - - StyleSetFore(static_cast(StylesCommon::ControlChar), IntRGBA(0xFF, 0xFF, 0xFF)); - StyleSetBack(static_cast(StylesCommon::ControlChar), IntRGBA(0x96, 0x00, 0x00)); - - StyleSetFore(static_cast(StylesCommon::FoldDisplayText), IntRGBA(0x73, 0x79, 0x80)); - StyleSetBack(static_cast(StylesCommon::FoldDisplayText), IntRGBA(0xDC, 0xEA, 0xF5)); - break; - } - - DefaultColorsChanged(_theme); - - UpdateLanguageStyles(); - - SyntaxHighlightingApplied(_theme); - - InvalidateStyleRedraw(); - } - - void CodeEditorHandler::MarkerSetColors(Scintilla::MarkerOutline marker, Scintilla::ColourAlpha fore, Scintilla::ColourAlpha back, Scintilla::ColourAlpha backHighlight) - { - const auto markerNumber{ static_cast(marker) }; - _call->MarkerSetForeTranslucent(markerNumber, fore); - _call->MarkerSetBackTranslucent(markerNumber, back); - _call->MarkerSetBackSelectedTranslucent(markerNumber, backHighlight); - } - - void CodeEditorHandler::UpdateCaretLineBackColors(bool colorsUpdated) - { - const auto hasEmptySelection = _call->SelectionEmpty(); - - if ((_hasEmptySelection != hasEmptySelection) || (hasEmptySelection && colorsUpdated)) - { - _hasEmptySelection = hasEmptySelection; - - if (hasEmptySelection) - { - switch (_theme) - { - case CodeEditorTheme::Dark: - _call->SetElementColour(Element::CaretLineBack, IntRGBA(0xFF, 0xFF, 0xFF, 16)); - break; - - case CodeEditorTheme::Light: - _call->SetElementColour(Element::CaretLineBack, IntRGBA(0x00, 0x00, 0x00, 12)); - break; - } - } - else - { - _call->ResetElementColour(Element::CaretLineBack); - } - } - } - - void CodeEditorHandler::UpdateBraceMatch() - { - SciBraceMatch(); - } - - void CodeEditorHandler::AutoIndent(char ch) - { - SciAutomaticIndentation(ch); - } - - void CodeEditorHandler::SetLanguageIndentMode( - int indentKeywordStyle, const std::set &indentKeywords, - int lineEndStyle, const std::set &lineEndWords, - int blockStartStyle, const std::set &blockStartWords, - int blockEndStyle, const std::set &blockEndWords) - { - _sciStatementIndent = { indentKeywordStyle, { indentKeywords, } }; // Todo: customize. also note using WORD2 for these - _sciStatementEnd = { lineEndStyle, { lineEndWords, } }; - _sciBlockStart = { blockStartStyle, { blockStartWords, } }; - _sciBlockEnd = { blockEndStyle, { blockEndWords, } }; - } - - void CodeEditorHandler::UpdateZoom() - { - const auto size{ _call->StyleGetSizeFractional(static_cast(StylesCommon::Default)) }; - const auto zoom{ static_cast(_call->Zoom()) }; - const auto factor{ static_cast((size + zoom * 100)) / size }; - // Todo: Width 11 hard coded for a digit. Use below for real value: - // _call->TextWidth, static_cast(StylesCommon::LineNumber), reinterpret_cast("9")) - const auto line{ _call->LineCount() }; - const auto width{ 12 + 11 * std::max(3, static_cast(std::floor(std::log10(line) + 1))) }; - _call->SetMarginWidthN(0, ConvertFromDipToPixelUnit(std::floorf(factor * width + 0.5f), _dpiScale)); - _call->SetMarginWidthN(1, ConvertFromDipToPixelUnit(std::floorf(factor * 12 + 0.5f), _dpiScale)); - _call->SetMarginWidthN(2, ConvertFromDipToPixelUnit(std::floorf(factor * 10 + 0.5f), _dpiScale)); - const auto foldMarkerStroke{ ConvertFromDipToPixelUnit(factor * 100.0f, _dpiScale, false) }; - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::FolderOpen), foldMarkerStroke); - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::Folder), foldMarkerStroke); - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::FolderSub), foldMarkerStroke); - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::FolderTail), foldMarkerStroke); - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::FolderEnd), foldMarkerStroke); - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::FolderOpenMid), foldMarkerStroke); - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::FolderMidTail), foldMarkerStroke); - const auto historyMarkerStroke{ foldMarkerStroke }; - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::HistoryRevertedToOrigin), historyMarkerStroke); - // HistorySaved is left at default width (1) because rendering artifacts occur with the solid color + box outline - //_call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::HistorySaved), historyMarkerStroke); - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::HistoryModified), historyMarkerStroke); - _call->MarkerSetStrokeWidth(static_cast(Scintilla::MarkerOutline::HistoryRevertedToModified), historyMarkerStroke); - _call->SetMarginLeft(ConvertFromDipToPixelUnit(std::floorf(factor * 1 + 0.5f), _dpiScale)); - // Todo: Set caret width to be at least the UISettings system caret width - const auto caretWidth{ std::max(1.0f, std::floorf(factor * 2 * _dpiScale)) }; - _call->SetCaretWidth(caretWidth); // Todo: Needs to stop blinking after timeout and respect blink rate - _call->SetCaretLineFrame(caretWidth); - _call->SetExtraDescent(std::floorf(factor * 1.8 * _dpiScale)); - } - - void CodeEditorHandler::AddKeyboardShortcuts() - { - _call->AssignCmdKey(187 + (static_cast(KeyMod::Ctrl) << 16), static_cast(Message::ZoomIn)); // Ctrl+Plus - _call->AssignCmdKey(189 + (static_cast(KeyMod::Ctrl) << 16), static_cast(Message::ZoomOut)); // Ctrl+Minus - _call->AssignCmdKey(48 + (static_cast(KeyMod::Ctrl) << 16), static_cast(Message::SetZoom)); // Ctrl+0 - } - - void CodeEditorHandler::ChangeDefaults() - { - _call->SetMultipleSelection(true); - _call->SetScrollWidth(2000); - _call->SetScrollWidthTracking(true); - _call->SetYCaretPolicy(CaretPolicy::Slop | CaretPolicy::Strict | CaretPolicy::Even, 1); - _call->SetVisiblePolicy(VisiblePolicy::Slop, 0); - _call->SetHScrollBar(true); - _call->SetEndAtLastLine(false); - _call->StyleSetFont(static_cast(StylesCommon::Default), "Cascadia Code"); // Todo: Use font available on Windows 10 - _call->StyleSetSizeFractional(static_cast(StylesCommon::Default), 11 * FontSizeMultiplier); - _call->SetAdditionalSelectionTyping(true); - _call->SetMultiPaste(MultiPaste::Each); - _call->SetLayoutThreads(16); // Todo: Determine performance impact - _call->SetCaretLineVisibleAlways(true); - _call->SetCaretLineLayer(Layer::UnderText); - _call->SetCaretLineHighlightSubLine(true); - _call->SetIndentationGuides(IndentView::LookBoth); - _call->SetMarginMaskN(2, Scintilla::MaskFolders); - _call->SetMarginSensitiveN(2, true); - SetFoldMarginColor(true, IntRGBA(0, 0, 0, 0)); - SetFoldMarginHiColor(true, IntRGBA(0, 0, 0, 0)); - - constexpr auto useCustomChevron{ true }; // Todo: make overridable - constexpr auto chevronMinus{ static_cast(1989) }; - constexpr auto chevronPlus{ static_cast(1990) }; - _call->MarkerDefine(static_cast(MarkerOutline::FolderOpen), useCustomChevron ? chevronMinus : MarkerSymbol::BoxMinus); - _call->MarkerDefine(static_cast(MarkerOutline::Folder), useCustomChevron ? chevronPlus : MarkerSymbol::BoxPlus); - _call->MarkerDefine(static_cast(MarkerOutline::FolderSub), MarkerSymbol::VLine); - _call->MarkerDefine(static_cast(MarkerOutline::FolderTail), MarkerSymbol::LCorner); - _call->MarkerDefine(static_cast(MarkerOutline::FolderEnd), useCustomChevron ? chevronPlus : MarkerSymbol::BoxPlusConnected); - _call->MarkerDefine(static_cast(MarkerOutline::FolderOpenMid), useCustomChevron ? chevronMinus : MarkerSymbol::BoxMinusConnected); - _call->MarkerDefine(static_cast(MarkerOutline::FolderMidTail), MarkerSymbol::TCorner); - _call->MarkerEnableHighlight(false); - - _call->SetDefaultFoldDisplayText(u8"\u00a0\u22ef\u00a0"); // ... nbsp + centered vertically + nbsp - _call->FoldDisplayTextSetStyle(Scintilla::FoldDisplayTextStyle::Standard); - - _call->SetAutomaticFold(static_cast(static_cast(Scintilla::AutomaticFold::Show) | static_cast(Scintilla::AutomaticFold::Click) | static_cast(Scintilla::AutomaticFold::Change))); - } - - // Todo: This code needs to integrate with find and replace - // Todo: This code seems to struggle with rectangular selections and/or multiple carets already existing and/or multiple selections already existing - void CodeEditorHandler::ChangeAllOccurrences() - { - sptr_t start; - sptr_t end; - const auto s{ GetMainSelectedText(true, start, end) }; - if (s.length() == 0) - { - return; - } - const auto length{ end - start }; - - // Drop additional selections and ensure caret is at end of selection - _call->SetSelection(end, start); - - _call->TargetWholeDocument(); - _call->SetSearchFlags(FindOption::MatchCase); - - const auto mainSelection{ _call->MainSelection() }; - const auto bodyLength{ _call->Length() }; - - while (true) - { - const auto match{ _call->SearchInTarget(length, &s[0]) }; - - if (match == -1) - { - break; - } - - const auto targetEnd{ _call->TargetEnd() }; - - if (match != start) - { - // Todo: Add maximum number of carets and notify user if exceeded (VS Code allows 10,000) - // Todo: This method calls a lot of redraws in a loop. You might need to use the lower level API to avoid that - _call->AddSelection(match + length, match); - } - - _call->SetTargetStart(targetEnd); - _call->SetTargetEnd(bodyLength); - } - - _call->SetMainSelection(mainSelection); - } - - std::wstring_view CodeEditorHandler::HighlightingLanguage() - { - return _highlightingLanguage; - } - - void CodeEditorHandler::HighlightingLanguage(std::wstring_view value) - { - if (_highlightingLanguage == value) - { - return; - } - - _highlightingLanguage = value; - - _call->ClearDocumentStyle(); - - SetLexer(); - - UpdateStyles(); - - _call->ColouriseAll(); - } - - void CodeEditorHandler::ProcessNotification(NotificationData *data) - { - if (data->nmhdr.code == Notification::Zoom - || (data->nmhdr.code == Notification::Modified && data->linesAdded)) - { - UpdateZoom(); - } - - if (data->nmhdr.code == Notification::UpdateUI && FlagSet(data->updated, Update::Content | Update::Selection)) - { - UpdateCaretLineBackColors(); - if (_call->Focus()) - { - UpdateBraceMatch(); - } - } - - if (data->nmhdr.code == Notification::FocusOut) - { - _call->BraceBadLight(-1); - } - else if (data->nmhdr.code == Notification::FocusIn) - { - UpdateBraceMatch(); - } - - if (data->nmhdr.code == Notification::CharAdded && data->ch <= 0xFF) - { - const auto sel{ _call->SelectionSpan() }; - - if (sel.start == sel.end && sel.start > 0 - && !_call->CallTipActive() - && !_call->AutoCActive()) - { - AutoIndent(data->ch); - } - } - - if (data->nmhdr.code == Notification::DoubleClick && _call->FoldDisplayTextGetStyle() != FoldDisplayTextStyle::Hidden) - { - const auto lineEndPosition{ _call->LineEndPosition(data->line) }; - if ((data->position == lineEndPosition || data->position == InvalidPosition) - && !_call->FoldExpanded(data->line)) - { - const auto ctrl{ FlagSet(data->modifiers, KeyMod::Ctrl) }; - const auto shift{ FlagSet(data->modifiers, KeyMod::Shift) }; - const auto levelClick{ _call->FoldLevel(data->line) }; - if (LevelIsHeader(levelClick)) - { - if (shift) - { - // Ensure all children visible - _call->ExpandChildren(data->line, levelClick); - } - else if (ctrl) - { - _call->FoldChildren(data->line, FoldAction::Toggle); - } - else - { - // Toggle this line - _call->FoldLine(data->line, FoldAction::Toggle); - } - - // Remove selection from double click - _call->SetEmptySelection(lineEndPosition); - } - } - } - } - - std::string CodeEditorHandler::GetMainSelectedText(bool expandCaretToWord, sptr_t &start, sptr_t &end) - { - // Todo: This code may be problematic for rectangular selections - start = _call->SelectionStart(); - end = _call->SelectionEnd(); - if (expandCaretToWord && start == end) - { - start = _call->WordStartPosition(start, true); - end = _call->WordEndPosition(start, true); - - if (start == end) - { - return ""; - } - } - - const auto length{ end - start }; - std::string s(length, '\0'); - TextRangeFull range - { - { start, end, }, - &s[0], - }; - _call->GetTextRangeFull(&range); - - return s; - } -} diff --git a/WinUIEditor/CodeEditorHandler.h b/WinUIEditor/CodeEditorHandler.h deleted file mode 100644 index 97db0e8..0000000 --- a/WinUIEditor/CodeEditorHandler.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "ScintillaTypes.h" -#include "ScintillaStructures.h" -#include "ScintillaCall.h" -#include "ILexer.h" -#include "Lexilla.h" -#include "CodeEditorHandler.SciEdit.h" - -namespace WinUIEditor -{ - constexpr int IntRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha = 0xff) noexcept - { - return red | (green << 8) | (blue << 16) | (alpha << 24); - } - - enum class CodeEditorTheme - { - Unset, - Light, - Dark, - }; - - struct CodeEditorHandler - { - void SetScintilla(std::shared_ptr call); - void SetLexilla(Lexilla::CreateLexerFn createLexer); - void Initialize(); - void ChangeDocumentDefaults(); - void UpdateColors(CodeEditorTheme theme); - void UpdateDpi(double value); - void UpdateZoom(); - void ChangeAllOccurrences(); - std::wstring_view HighlightingLanguage(); - void HighlightingLanguage(std::wstring_view language); - void ProcessNotification(Scintilla::NotificationData *data); - void SetLexer(); - - protected: - virtual void StyleSetFore(int style, Scintilla::ColourAlpha color); - virtual void StyleSetBack(int style, Scintilla::ColourAlpha color); - virtual void InvalidateStyleRedraw(); - virtual void StyleClearCustom(); - virtual void SetFoldMarginColor(bool useSetting, Scintilla::ColourAlpha back); - virtual void SetFoldMarginHiColor(bool useSetting, Scintilla::ColourAlpha fore); - - virtual void DefaultColorsChanged(CodeEditorTheme theme); - virtual void SyntaxHighlightingApplied(CodeEditorTheme theme); - - private: - std::shared_ptr _call{ nullptr }; - Lexilla::CreateLexerFn _createLexer{ nullptr }; - CodeEditorTheme _theme{ CodeEditorTheme::Unset }; - double _dpiScale; - int8_t _hasEmptySelection{ -1 }; - std::wstring _highlightingLanguage; - - void UpdateStyles(); - void UpdateCaretLineBackColors(bool colorsUpdated = false); - void UpdateBraceMatch(); - void AutoIndent(char ch); - void AddKeyboardShortcuts(); - void ChangeDefaults(); - std::string GetMainSelectedText(bool expandCaretToWord, Scintilla::sptr_t &start, Scintilla::sptr_t &end); - void SetLanguageIndentMode( - int indentKeywordStyle, const std::set &indentKeywords, - int lineEndStyle, const std::set &lineEndWords, - int blockStartStyle, const std::set &blockStartWords, - int blockEndStyle, const std::set &blockEndWords - ); - - void SetJavaScriptDefaults(int wordList1, int wordList2, int indentKeywordStyle, int symbolStyle); - void UpdateLanguageStyles(); - - void MarkerSetColors(Scintilla::MarkerOutline marker, Scintilla::ColourAlpha fore, Scintilla::ColourAlpha back, Scintilla::ColourAlpha backHighlight); - - static constexpr bool _sciIndentOpening{ false }; - static constexpr bool _sciIndentClosing{ false }; - static constexpr int _sciStatementLookback{ 20 }; - Internal::StyleAndWords _sciStatementIndent; - Internal::StyleAndWords _sciStatementEnd; - Internal::StyleAndWords _sciBlockStart; - Internal::StyleAndWords _sciBlockEnd; - bool SciFindMatchingBracePosition(Scintilla::Position &braceAtCaret, Scintilla::Position &braceOpposite, bool sloppy); - void SciBraceMatch(); - Scintilla::Line SciGetCurrentLineNumber(); - int SciIndentOfBlock(Scintilla::Line line); - int SciGetLineIndentation(Scintilla::Line line); - Scintilla::Position SciGetLineIndentPosition(Scintilla::Line line); - void SciSetLineIndentation(Scintilla::Line line, int indent); - Scintilla::Span SciGetSelection(); - std::vector SciGetLinePartsInStyle(Scintilla::Line line, const Internal::StyleAndWords &saw); - void SciSetSelection(Scintilla::Position anchor, Scintilla::Position currentPos); - bool SciRangeIsAllWhitespace(Scintilla::Position start, Scintilla::Position end); - Internal::IndentationStatus SciGetIndentState(Scintilla::Line line); - void SciAutomaticIndentation(char ch); - }; -} diff --git a/WinUIEditor/ControlIncludes.h b/WinUIEditor/ControlIncludes.h deleted file mode 100644 index 50ed875..0000000 --- a/WinUIEditor/ControlIncludes.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -#include "EditorBaseControl.h" -#include "CodeEditorControl.h" diff --git a/WinUIEditor/DarkPlus.h b/WinUIEditor/DarkPlus.h deleted file mode 100644 index 5a4184e..0000000 --- a/WinUIEditor/DarkPlus.h +++ /dev/null @@ -1,213 +0,0 @@ -// Ported from -// https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/dark_plus.json -// https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/dark_vs.json -// under the following license - -/* - MIT License - - Copyright (c) 2015 - present Microsoft Corporation - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -namespace WinUIEditor -{ - constexpr int DarkPlusEditorForeground{ IntRGBA(0xD4, 0xD4, 0xD4) }; - - constexpr int DarkPlus(Scope scope) - { - switch (scope) - { - case Scope::MetaEmbedded: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::SourceGroovyEmbedded: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::String__MetaImageInlineMarkdown: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::VariableLegacyBuiltinPython: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::Header: return IntRGBA(0x00, 0x00, 0x80); - case Scope::Comment: return IntRGBA(0x6A, 0x99, 0x55); - case Scope::ConstantLanguage: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::ConstantNumeric: return IntRGBA(0xB5, 0xCE, 0xA8); - case Scope::VariableOtherEnummember: return IntRGBA(0x4F, 0xC1, 0xFF); - case Scope::KeywordOperatorPlusExponent: return IntRGBA(0xB5, 0xCE, 0xA8); - case Scope::KeywordOperatorMinusExponent: return IntRGBA(0xB5, 0xCE, 0xA8); - case Scope::ConstantRegexp: return IntRGBA(0x64, 0x66, 0x95); - case Scope::EntityNameTag: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::EntityNameTagCss: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::EntityOtherAttribute_Name: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::EntityOtherAttribute_NameClassCss: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::EntityOtherAttribute_NameClassMixinCss: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::EntityOtherAttribute_NameIdCss: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::EntityOtherAttribute_NameParent_SelectorCss: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::EntityOtherAttribute_NamePseudo_ClassCss: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::EntityOtherAttribute_NamePseudo_ElementCss: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::SourceCssLess__EntityOtherAttribute_NameId: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::EntityOtherAttribute_NameScss: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::Invalid: return IntRGBA(0xF4, 0x47, 0x47); - case Scope::MarkupBold: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::MarkupHeading: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::MarkupInserted: return IntRGBA(0xB5, 0xCE, 0xA8); - case Scope::MarkupDeleted: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::MarkupChanged: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::PunctuationDefinitionQuoteBeginMarkdown: return IntRGBA(0x6A, 0x99, 0x55); - case Scope::PunctuationDefinitionListBeginMarkdown: return IntRGBA(0x67, 0x96, 0xE6); - case Scope::MarkupInlineRaw: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::PunctuationDefinitionTag: return IntRGBA(0x80, 0x80, 0x80); - case Scope::MetaPreprocessor: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::EntityNameFunctionPreprocessor: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::MetaPreprocessorString: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::MetaPreprocessorNumeric: return IntRGBA(0xB5, 0xCE, 0xA8); - case Scope::MetaStructureDictionaryKeyPython: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::MetaDiffHeader: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::Storage: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::StorageType: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::StorageModifier: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorNoexcept: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::String: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::MetaEmbeddedAssembly: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::StringTag: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::StringValue: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::StringRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::PunctuationDefinitionTemplate_ExpressionBegin: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::PunctuationDefinitionTemplate_ExpressionEnd: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::PunctuationSectionEmbedded: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::MetaTemplateExpression: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::SupportTypeVendoredProperty_Name: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::SupportTypeProperty_Name: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::VariableCss: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::VariableScss: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::VariableOtherLess: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::SourceCoffeeEmbedded: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::Keyword: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordControl: return IntRGBA(0xC5, 0x86, 0xC0); - case Scope::KeywordOperator: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::KeywordOperatorNew: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorExpression: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorCast: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorSizeof: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorAlignof: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorTypeid: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorAlignas: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorInstanceof: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorLogicalPython: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOperatorWordlike: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::KeywordOtherUnit: return IntRGBA(0xB5, 0xCE, 0xA8); - case Scope::PunctuationSectionEmbeddedBeginPhp: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::PunctuationSectionEmbeddedEndPhp: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::SupportFunctionGit_Rebase: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::ConstantShaGit_Rebase: return IntRGBA(0xB5, 0xCE, 0xA8); - case Scope::StorageModifierImportJava: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::VariableLanguageWildcardJava: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::StorageModifierPackageJava: return IntRGBA(0xD4, 0xD4, 0xD4); - case Scope::VariableLanguage: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::EntityNameFunction: return IntRGBA(0xDC, 0xDC, 0xAA); - case Scope::SupportFunction: return IntRGBA(0xDC, 0xDC, 0xAA); - case Scope::SupportConstantHandlebars: return IntRGBA(0xDC, 0xDC, 0xAA); - case Scope::SourcePowershell__VariableOtherMember: return IntRGBA(0xDC, 0xDC, 0xAA); - case Scope::EntityNameOperatorCustom_Literal: return IntRGBA(0xDC, 0xDC, 0xAA); - case Scope::SupportClass: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::SupportType: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::EntityNameType: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::EntityNameNamespace: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::EntityOtherAttribute: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::EntityNameScope_Resolution: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::EntityNameClass: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeNumericGo: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeByteGo: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeBooleanGo: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeStringGo: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeUintptrGo: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeErrorGo: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeRuneGo: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeCs: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeGenericCs: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeModifierCs: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeVariableCs: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeAnnotationJava: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeGenericJava: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeJava: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeObjectArrayJava: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypePrimitiveArrayJava: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypePrimitiveJava: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeTokenJava: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeGroovy: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeAnnotationGroovy: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeParametersGroovy: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeGenericGroovy: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypeObjectArrayGroovy: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypePrimitiveArrayGroovy: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::StorageTypePrimitiveGroovy: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::MetaTypeCastExpr: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::MetaTypeNewExpr: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::SupportConstantMath: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::SupportConstantDom: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::SupportConstantJson: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::EntityOtherInherited_Class: return IntRGBA(0x4E, 0xC9, 0xB0); - case Scope::SourceCpp__KeywordOperatorNew: return IntRGBA(0xC5, 0x86, 0xC0); - case Scope::KeywordOperatorDelete: return IntRGBA(0xC5, 0x86, 0xC0); - case Scope::KeywordOtherUsing: return IntRGBA(0xC5, 0x86, 0xC0); - case Scope::KeywordOtherDirectiveUsing: return IntRGBA(0xC5, 0x86, 0xC0); - case Scope::KeywordOtherOperator: return IntRGBA(0xC5, 0x86, 0xC0); - case Scope::EntityNameOperator: return IntRGBA(0xC5, 0x86, 0xC0); - case Scope::Variable: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::MetaDefinitionVariableName: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::SupportVariable: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::EntityNameVariable: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::ConstantOtherPlaceholder: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::VariableOtherConstant: return IntRGBA(0x4F, 0xC1, 0xFF); - case Scope::MetaObject_LiteralKey: return IntRGBA(0x9C, 0xDC, 0xFE); - case Scope::SupportConstantProperty_Value: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::SupportConstantFont_Name: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::SupportConstantMedia_Type: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::SupportConstantMedia: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::ConstantOtherColorRgb_Value: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::ConstantOtherRgb_Value: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::SupportConstantColor: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::PunctuationDefinitionGroupRegexp: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::PunctuationDefinitionGroupAssertionRegexp: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::PunctuationDefinitionCharacter_ClassRegexp: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::PunctuationCharacterSetBeginRegexp: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::PunctuationCharacterSetEndRegexp: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::KeywordOperatorNegationRegexp: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::SupportOtherParenthesisRegexp: return IntRGBA(0xCE, 0x91, 0x78); - case Scope::ConstantCharacterCharacter_ClassRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::ConstantOtherCharacter_ClassSetRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::ConstantOtherCharacter_ClassRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::ConstantCharacterSetRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::KeywordOperatorOrRegexp: return IntRGBA(0xDC, 0xDC, 0xAA); - case Scope::KeywordControlAnchorRegexp: return IntRGBA(0xDC, 0xDC, 0xAA); - case Scope::KeywordOperatorQuantifierRegexp: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::ConstantCharacter: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::ConstantOtherOption: return IntRGBA(0x56, 0x9C, 0xD6); - case Scope::ConstantCharacterEscape: return IntRGBA(0xD7, 0xBA, 0x7D); - case Scope::EntityNameLabel: return IntRGBA(0xC8, 0xC8, 0xC8); - } - } - - constexpr int DarkPlus2(Scope scope) - { - switch (scope) - { - case Scope::MetaPreprocessor: return IntRGBA(0x9B, 0x9B, 0x9B); - case Scope::SupportTypeProperty_NameJson: return DarkPlus(Scope::SupportTypeProperty_Name); - default: return DarkPlus(scope); - } - } -} diff --git a/WinUIEditor/Defines.idl b/WinUIEditor/Defines.idl deleted file mode 100644 index ba6fe22..0000000 --- a/WinUIEditor/Defines.idl +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef WINUI3 -#define DUX Microsoft.UI.Xaml -#else -#define DUX Windows.UI.Xaml -#endif diff --git a/WinUIEditor/DummyPage.cpp b/WinUIEditor/DummyPage.cpp deleted file mode 100644 index 47f3a04..0000000 --- a/WinUIEditor/DummyPage.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "pch.h" -#include "DummyPage.h" -#if __has_include("DummyPage.g.cpp") -#include "DummyPage.g.cpp" -#endif - -// Workaround for https://github.com/microsoft/xlang/issues/431 -// Improves compile time when working on headers by including -// them in the DummyPage header instead of pch.h -// because the XAML compiler is not including them itself - -// Not used in Release mode -// Do not include in metadata diff --git a/WinUIEditor/DummyPage.h b/WinUIEditor/DummyPage.h deleted file mode 100644 index 5cf60b9..0000000 --- a/WinUIEditor/DummyPage.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "DummyPage.g.h" - -#include "ControlIncludes.h" - -namespace winrt::WinUIEditor::implementation -{ - struct DummyPage : DummyPageT - { - }; -} - -namespace winrt::WinUIEditor::factory_implementation -{ - struct DummyPage : DummyPageT - { - }; -} diff --git a/WinUIEditor/DummyPage.idl b/WinUIEditor/DummyPage.idl deleted file mode 100644 index f18d16e..0000000 --- a/WinUIEditor/DummyPage.idl +++ /dev/null @@ -1,11 +0,0 @@ -#include "Defines.idl" - -namespace WinUIEditor -{ - [default_interface] - [webhosthidden] - runtimeclass DummyPage : DUX.Controls.Page - { - DummyPage(); - } -} diff --git a/WinUIEditor/DummyPage.xaml b/WinUIEditor/DummyPage.xaml deleted file mode 100644 index 43bbe74..0000000 --- a/WinUIEditor/DummyPage.xaml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/WinUIEditor/EditorBaseControl.cpp b/WinUIEditor/EditorBaseControl.cpp deleted file mode 100644 index 3e329fe..0000000 --- a/WinUIEditor/EditorBaseControl.cpp +++ /dev/null @@ -1,665 +0,0 @@ -#include "pch.h" -#include "EditorBaseControl.h" -#if __has_include("EditorBaseControl.g.cpp") -#include "EditorBaseControl.g.cpp" -#endif -#include "EditorWrapper.h" -#include "Helpers.h" -#include "EditorBaseControlAutomationPeer.h" - -using namespace ::WinUIEditor; -using namespace winrt; -using namespace DUX; -using namespace DUX::Automation::Peers; -using namespace DUX::Controls; -using namespace DUX::Controls::Primitives; -using namespace DUX::Input; -using namespace DUX::Media; -using namespace DUX::Media::Imaging; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::System; -using namespace Windows::Graphics::Display; -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::DataTransfer; - -namespace winrt::WinUIEditor::implementation -{ - // Todo: Something about this control is keeping the WinUI 3 versions from closing. - // Note that making this into a blank control fixes the issue, so it is definitely something here. - EditorBaseControl::EditorBaseControl() - { - DefaultStyleKey(winrt::box_value(L"WinUIEditor.EditorBaseControl")); - - _wrapper = std::make_shared(); - - Loaded({ this, &EditorBaseControl::OnLoaded }); - Unloaded({ this, &EditorBaseControl::OnUnloaded }); - -#ifndef WINUI3 - if (!_hasXamlRoot) - { - _displayInformation = DisplayInformation::GetForCurrentView(); - } -#endif - - _scintilla = make_self(_wrapper); - _call = std::make_shared(); - _call->SetFnPtr(reinterpret_cast(_scintilla->WndProc(Scintilla::Message::GetDirectStatusFunction, 0, 0)), _scintilla->WndProc(Scintilla::Message::GetDirectPointer, 0, 0)); - - _editorWrapper = make(get_strong()); - - _scintilla->SetWndProcTag(*this); - _scintilla->SetWndProc(&EditorBaseControl::WndProc); - -#ifndef WINUI3 - if (_hasFcu) - { -#endif - // Registering the CharacterReceived event causes undesirable behavior with TSF in CoreWindow (normal UWP) - // but is required to get text in classic windows (XAML Islands and WinUI 3) - // Todo: Find more ideal way to do this - // Tried using _tfThreadManager->GetActiveFlags but TF_TMF_IMMERSIVEMODE flag was not accurate - if (IsClassicWindow()) - { - CharacterReceived({ this, &EditorBaseControl::EditorBaseControl_CharacterReceived }); - } -#ifndef WINUI3 - } -#endif - } - - EditorBaseControl::~EditorBaseControl() - { - _scintilla->Finalize(); - } - - WinUIEditor::Editor EditorBaseControl::Editor() - { - return _editorWrapper; - } - - void EditorBaseControl::OnLoaded(IInspectable const &sender, DUX::RoutedEventArgs const &args) - { - // Following pattern from https://github.com/microsoft/microsoft-ui-xaml/blob/a7183df20367bc0e2b8c825430597a5c1e6871b6/dev/WebView2/WebView2.cpp#L1556 - -#ifndef WINUI3 - _isLoaded = true; -#endif - - if (!IsLoadedCompat()) - { - return; - } - -#ifndef WINUI3 - if (_hasXamlRoot) - { -#endif - UpdateDpi(XamlRoot().RasterizationScale()); - _xamlRootChangedRevoker = XamlRoot().Changed(auto_revoke, { this, &EditorBaseControl::XamlRoot_Changed }); -#ifndef WINUI3 - } - else - { - UpdateDpi(_displayInformation.RawPixelsPerViewPixel()); - _dpiChangedRevoker = _displayInformation.DpiChanged(auto_revoke, { this, &EditorBaseControl::DisplayInformation_DpiChanged }); - } -#endif - } - - void EditorBaseControl::OnUnloaded(IInspectable const &sender, DUX::RoutedEventArgs const &args) - { -#ifndef WINUI3 - _isLoaded = false; -#endif - - if (IsLoadedCompat()) - { - return; - } - -#ifndef WINUI3 - if (_hasXamlRoot) - { -#endif - _xamlRootChangedRevoker.revoke(); -#ifndef WINUI3 - } - else - { - _dpiChangedRevoker.revoke(); - } -#endif - - _scintilla->StopTimers(); - } - - bool EditorBaseControl::IsLoadedCompat() - { -#ifndef WINUI3 - if (_hasIsLoaded) - { -#endif - return IsLoaded(); -#ifndef WINUI3 - } - else - { - return _isLoaded; - } -#endif - } - -#ifndef WINUI3 - void EditorBaseControl::DisplayInformation_DpiChanged(DisplayInformation const &sender, IInspectable const &args) - { - UpdateDpi(sender.RawPixelsPerViewPixel()); - } -#endif - - void EditorBaseControl::XamlRoot_Changed(DUX::XamlRoot const &sender, XamlRootChangedEventArgs const &args) - { - UpdateDpi(sender.RasterizationScale()); - } - - void EditorBaseControl::UpdateDpi(float dpiScale) - { - if (_dpiScale != dpiScale) - { - _wrapper->LogicalDpi(dpiScale * 96); - _dpiScale = dpiScale; - _scintilla->DpiChanged(); - _dpiChangedEvent(*this, dpiScale); - } - } - - void EditorBaseControl::AddContextMenuItems(MenuFlyout const &menu) - { - const auto writable{ !static_cast(_scintilla->WndProc(Scintilla::Message::GetReadOnly, 0, 0)) }; - const auto selection{ !static_cast(_scintilla->WndProc(Scintilla::Message::GetSelectionEmpty, 0, 0)) }; - - const MenuFlyoutItem undoItem{}; - undoItem.Text(L"Undo"); // Todo: Localize - undoItem.Icon(SymbolIcon{ Symbol::Undo }); - undoItem.Tag(box_value(ScintillaMessage::Undo)); - undoItem.IsEnabled(_scintilla->WndProc(Scintilla::Message::CanUndo, 0, 0)); - undoItem.Click({ this, &EditorBaseControl::ContextMenuItem_Click }); // Todo: Revoke event handler? - menu.Items().Append(undoItem); - - const MenuFlyoutItem redoItem{}; - redoItem.Text(L"Redo"); - redoItem.Icon(SymbolIcon{ Symbol::Redo }); - redoItem.Tag(box_value(ScintillaMessage::Redo)); - redoItem.IsEnabled(_scintilla->WndProc(Scintilla::Message::CanRedo, 0, 0)); - redoItem.Click({ this, &EditorBaseControl::ContextMenuItem_Click }); - menu.Items().Append(redoItem); - - menu.Items().Append(MenuFlyoutSeparator{}); - - const MenuFlyoutItem cutItem{}; - cutItem.Text(L"Cut"); - cutItem.Icon(SymbolIcon{ Symbol::Cut }); - cutItem.Tag(box_value(ScintillaMessage::Cut)); - cutItem.IsEnabled(writable && selection); - cutItem.Click({ this, &EditorBaseControl::ContextMenuItem_Click }); - menu.Items().Append(cutItem); - - const MenuFlyoutItem copyItem{}; - copyItem.Text(L"Copy"); - copyItem.Icon(SymbolIcon{ Symbol::Copy }); - copyItem.Tag(box_value(ScintillaMessage::Copy)); - copyItem.IsEnabled(selection); - copyItem.Click({ this, &EditorBaseControl::ContextMenuItem_Click }); - menu.Items().Append(copyItem); - - const MenuFlyoutItem pasteItem{}; - pasteItem.Text(L"Paste"); - pasteItem.Icon(SymbolIcon{ Symbol::Paste }); - pasteItem.Tag(box_value(ScintillaMessage::Paste)); - pasteItem.IsEnabled(_scintilla->WndProc(Scintilla::Message::CanPaste, 0, 0)); - pasteItem.Click({ this, &EditorBaseControl::ContextMenuItem_Click }); - menu.Items().Append(pasteItem); - - const MenuFlyoutItem deleteItem{}; - deleteItem.Text(L"Delete"); - deleteItem.Icon(SymbolIcon{ Symbol::Delete }); - deleteItem.Tag(box_value(ScintillaMessage::Clear)); - deleteItem.IsEnabled(writable && selection); - deleteItem.Click({ this, &EditorBaseControl::ContextMenuItem_Click }); - menu.Items().Append(deleteItem); - - menu.Items().Append(MenuFlyoutSeparator{}); - - const MenuFlyoutItem selectAllItem{}; - selectAllItem.Text(L"Select all"); - selectAllItem.Icon(SymbolIcon{ Symbol::SelectAll }); - selectAllItem.Tag(box_value(ScintillaMessage::SelectAll)); - selectAllItem.Click({ this, &EditorBaseControl::ContextMenuItem_Click }); - menu.Items().Append(selectAllItem); - } - - bool EditorBaseControl::ShowContextMenu(UIElement const &targetElement, Point const &point) - { - if (_scintilla->ShouldShowContextMenu(Point{ point.X * _dpiScale, point.Y * _dpiScale })) - { - const MenuFlyout menu{}; - AddContextMenuItems(menu); - menu.ShowAt(targetElement, point); - return true; - } - return false; - } - - bool EditorBaseControl::ShowContextMenuAtCurrentPosition() - { - if (auto imageTarget{ GetTemplateChild(L"ImageTarget").try_as() }) // Todo: Store this - { - const auto pos{ _scintilla->WndProc(Scintilla::Message::GetCurrentPos, 0, 0) }; - return ShowContextMenu(imageTarget, Point{ - _scintilla->WndProc(Scintilla::Message::PointXFromPosition, 0, pos) / _dpiScale, - (_scintilla->WndProc(Scintilla::Message::PointYFromPosition, 0, pos) + _scintilla->WndProc(Scintilla::Message::TextHeight, 0, 0)) / _dpiScale - }); - } - return false; - } - - Scintilla::sptr_t EditorBaseControl::PublicWndProc(Scintilla::Message iMessage, Scintilla::uptr_t wParam, Scintilla::sptr_t lParam) - { - return _scintilla->WndProc(iMessage, wParam, lParam); - } - - int64_t EditorBaseControl::SendMessage(ScintillaMessage const &message, uint64_t wParam, int64_t lParam) - { - return PublicWndProc(static_cast(message), wParam, lParam); - } - - void EditorBaseControl::StyleSetForeTransparent(int style, Scintilla::Internal::ColourRGBA color) - { - _scintilla->StyleSetForeTransparent(style, color); - } - - void EditorBaseControl::StyleSetBackTransparent(int style, Scintilla::Internal::ColourRGBA color) - { - _scintilla->StyleSetBackTransparent(style, color); - } - - void EditorBaseControl::InvalidateStyleRedraw() - { - _scintilla->PublicInvalidateStyleRedraw(); - } - - void EditorBaseControl::StyleClearCustom() - { - _scintilla->StyleClearCustom(); - } - - void EditorBaseControl::SetFoldMarginColorTransparent(bool useSetting, Scintilla::Internal::ColourRGBA back) - { - _scintilla->SetFoldMarginColorTransparent(useSetting, back); - } - - void EditorBaseControl::SetFoldMarginHiColorTransparent(bool useSetting, Scintilla::Internal::ColourRGBA fore) - { - _scintilla->SetFoldMarginHiColorTransparent(useSetting, fore); - } - - void EditorBaseControl::OnApplyTemplate() - { - __super::OnApplyTemplate(); - -#ifndef WINUI3 - if (_hasXamlRoot) - { -#endif - UpdateDpi(XamlRoot().RasterizationScale()); -#ifndef WINUI3 - } - else - { - UpdateDpi(_displayInformation.RawPixelsPerViewPixel()); - } -#endif - - const VirtualSurfaceImageSource virtualSurfaceImageSource{ 0, 0 }; - - _vsisNative = virtualSurfaceImageSource.as<::IVirtualSurfaceImageSourceNative>(); - - _wrapper->VsisNative(_vsisNative); - _wrapper->CreateGraphicsDevices(); - _vsisNative->RegisterForUpdatesNeeded(_scintilla.as<::IVirtualSurfaceUpdatesCallbackNative>().get()); - - // The SurfaceImageSource object's underlying - // ISurfaceImageSourceNativeWithD2D object will contain the completed bitmap. - - const auto horizontalScrollBar{ GetTemplateChild(L"HorizontalScrollBar").try_as() }; - const auto verticalScrollBar{ GetTemplateChild(L"VerticalScrollBar").try_as() }; - if (horizontalScrollBar) - { - _horizontalScrollBarScrollRevoker = horizontalScrollBar.Scroll(auto_revoke, { this, &EditorBaseControl::HorizontalScrollBar_Scroll }); - } - if (verticalScrollBar) - { - _verticalScrollBarScrollRevoker = verticalScrollBar.Scroll(auto_revoke, { this, &EditorBaseControl::VerticalScrollBar_Scroll }); - } - _wrapper->SetScrollBars(horizontalScrollBar, verticalScrollBar); - - if (const auto imageTarget{ GetTemplateChild(L"ImageTarget").try_as() }) - { - _imageTargetSizeChangedRevoker = imageTarget.SizeChanged(auto_revoke, { this, &EditorBaseControl::ImageTarget_SizeChanged }); - _imageTargetPointerMovedRevoker = imageTarget.PointerMoved(auto_revoke, { this, &EditorBaseControl::ImageTarget_PointerMoved }); -#ifndef WINUI3 - _imageTargetPointerCaptureLostRevoker = imageTarget.PointerCaptureLost(auto_revoke, { this, &EditorBaseControl::ImageTarget_PointerCaptureLost }); - _imageTargetPointerEnteredRevoker = imageTarget.PointerEntered(auto_revoke, { this, &EditorBaseControl::ImageTarget_PointerEntered }); -#endif - _imageTargetPointerExitedRevoker = imageTarget.PointerExited(auto_revoke, { this, &EditorBaseControl::ImageTarget_PointerExited }); - _imageTargetPointerWheelChangedRevoker = imageTarget.PointerWheelChanged(auto_revoke, { this, &EditorBaseControl::ImageTarget_PointerWheelChanged }); - _imageTargetDragEnterRevoker = imageTarget.DragEnter(auto_revoke, { this, &EditorBaseControl::ImageTarget_DragEnter }); - _imageTargetDragOverRevoker = imageTarget.DragOver(auto_revoke, { this, &EditorBaseControl::ImageTarget_DragOver }); - _imageTargetDragLeaveRevoker = imageTarget.DragLeave(auto_revoke, { this, &EditorBaseControl::ImageTarget_DragLeave }); - _imageTargetDropRevoker = imageTarget.Drop(auto_revoke, { this, &EditorBaseControl::ImageTarget_Drop }); - - _wrapper->SetMouseCaptureElement(imageTarget); - _imageTargetDragStartingRevoker = imageTarget.DragStarting(auto_revoke, { this, &EditorBaseControl::ImageTarget_DragStarting }); - - _imageTargetContextRequestedRevoker = imageTarget.ContextRequested(auto_revoke, { this, &EditorBaseControl::ImageTarget_ContextRequested }); - - const ImageBrush brush{}; - brush.ImageSource(virtualSurfaceImageSource); - imageTarget.Background(brush); - } - -#ifndef WINUI3 - // Todo: Evaluate if this is an appropriate place to add this event (and other code in this method) - _suspendingRevoker = Application::Current().Suspending(auto_revoke, { this, &EditorBaseControl::Application_Suspending }); -#endif - } - - // Todo: Focus bug: deactive window, click on control, press ctrl+a quickly. result: selection disappears - - void EditorBaseControl::OnGotFocus(RoutedEventArgs const &e) - { - __super::OnGotFocus(e); - - _isFocused = true; - - _scintilla->FocusChanged(true); - } - - void EditorBaseControl::OnLostFocus(RoutedEventArgs const &e) - { - __super::OnLostFocus(e); - - _isFocused = false; - - _scintilla->FocusChanged(false); - } - - void EditorBaseControl::OnPointerPressed(DUX::Input::PointerRoutedEventArgs const &e) - { - __super::OnPointerPressed(e); - - Focus(FocusState::Pointer); - - // The focus state seems to get confused if the following code is placed in ImageTarget_PointerPressed. - // OnPointerReleased is the same for symmetry. ImageTarget_PointerMoved is there to show correct cursor - // when moving the cursor over the scrollbar (UWP). - - if (auto imageTarget{ GetTemplateChild(L"ImageTarget").try_as() }) // Todo: Store this - { - auto point{ e.GetCurrentPoint(imageTarget) }; - auto scaled{ point.Position() }; - switch (point.Properties().PointerUpdateKind()) - { - case DUI::PointerUpdateKind::LeftButtonPressed: - _scintilla->PointerPressed(Point{ scaled.X * _dpiScale, scaled.Y * _dpiScale }, point.Timestamp() / 1000ul, e.KeyModifiers()); - break; - case DUI::PointerUpdateKind::RightButtonPressed: - _scintilla->RightPointerPressed(Point{ scaled.X * _dpiScale, scaled.Y * _dpiScale }, point.Timestamp() / 1000ul, e.KeyModifiers()); - break; - } - // Todo: make sure the loss of precision is not going to realistically cause a problem - } - } - - void EditorBaseControl::OnPointerReleased(DUX::Input::PointerRoutedEventArgs const &e) - { - __super::OnPointerReleased(e); - - if (auto imageTarget{ GetTemplateChild(L"ImageTarget").try_as() }) // Todo: Store this - { - auto point{ e.GetCurrentPoint(imageTarget) }; - auto scaled{ point.Position() }; - switch (point.Properties().PointerUpdateKind()) - { - case DUI::PointerUpdateKind::LeftButtonReleased: - _scintilla->PointerReleased(Point{ scaled.X * _dpiScale, scaled.Y * _dpiScale }, point.Timestamp() / 1000ul, e.KeyModifiers()); - break; - } - } - - e.Handled(true); // Prevents control from losing focus on pointer released - // See https://stackoverflow.com/questions/59392044/uwp-control-to-keep-focus-after-mouse-click - // Alternate approach: call Focus in OnFocusLost - } - - AutomationPeer EditorBaseControl::OnCreateAutomationPeer() - { - return make(*this); - } - - void EditorBaseControl::ImageTarget_PointerMoved(IInspectable const &sender, PointerRoutedEventArgs const &e) - { - if (auto imageTarget{ GetTemplateChild(L"ImageTarget").try_as() }) // Todo: Store this - { - auto point{ e.GetCurrentPoint(imageTarget) }; - auto scaled{ point.Position() }; - auto x{ scaled.X * _dpiScale }; - auto y{ scaled.Y * _dpiScale }; - - _scintilla->PointerMoved(Point{ x, y }, point.Timestamp() / 1000ul, e.KeyModifiers(), point); - } - } - -#ifndef WINUI3 - void EditorBaseControl::ImageTarget_PointerCaptureLost(IInspectable const &sender, PointerRoutedEventArgs const &e) - { - if (!_isPointerOver) - { - // Todo: if you, e.g. hover over a HyperlinkButton when this is called, you will get an arrow instead of the hand you want - winrt::Windows::UI::Core::CoreWindow::GetForCurrentThread().PointerCursor(Windows::UI::Core::CoreCursor{ Windows::UI::Core::CoreCursorType::Arrow, 0 }); - } - } - - void EditorBaseControl::ImageTarget_PointerEntered(IInspectable const &sender, PointerRoutedEventArgs const &e) - { - _isPointerOver = true; - } -#endif - - void EditorBaseControl::ImageTarget_PointerExited(IInspectable const &sender, PointerRoutedEventArgs const &e) - { -#ifndef WINUI3 - _isPointerOver = false; - if (!_wrapper->HaveMouseCapture()) - { - winrt::Windows::UI::Core::CoreWindow::GetForCurrentThread().PointerCursor(Windows::UI::Core::CoreCursor{ Windows::UI::Core::CoreCursorType::Arrow, 0 }); - } -#endif - _scintilla->PointerExited(); - } - - void EditorBaseControl::OnKeyDown(KeyRoutedEventArgs const &e) - { - __super::OnKeyDown(e); - - const auto modifiers{ GetKeyModifiersForCurrentThread() }; - - auto handled = true; - _scintilla->KeyDown(e.Key(), modifiers, e.KeyStatus().IsExtendedKey, &handled); // Todo: Or use VirtualKey? - - if (!handled - && e.Key() == VirtualKey::F10 && (modifiers & VirtualKeyModifiers::Shift) == VirtualKeyModifiers::Shift - && ShowContextMenuAtCurrentPosition()) - { - handled = true; - } - - e.Handled(handled); - } - - void EditorBaseControl::OnKeyUp(KeyRoutedEventArgs const &e) - { - if (e.Key() == VirtualKey::Application) - { - e.Handled(ShowContextMenuAtCurrentPosition()); - } - } - - void EditorBaseControl::EditorBaseControl_CharacterReceived(DUX::UIElement const &sender, CharacterReceivedRoutedEventArgs const &e) - { - if (_isFocused) - { - _scintilla->CharacterReceived(e.Character()); - e.Handled(true); - } - } - - void EditorBaseControl::ImageTarget_SizeChanged(IInspectable const &sender, SizeChangedEventArgs const &args) - { - if (_vsisNative) - { - auto width{ ConvertFromDipToPixelUnit(args.NewSize().Width, _dpiScale) }; - auto height{ ConvertFromDipToPixelUnit(args.NewSize().Height, _dpiScale) }; - _wrapper->Width(width); - _wrapper->Height(height); - _vsisNative->Resize(width, height); - _scintilla->SizeChanged(); - } - } - - void EditorBaseControl::ImageTarget_PointerWheelChanged(IInspectable const &sender, PointerRoutedEventArgs const &e) - { - auto properties{ e.GetCurrentPoint(sender.as()).Properties() }; - _scintilla->PointerWheelChanged(properties.MouseWheelDelta(), properties.IsHorizontalMouseWheel(), e.KeyModifiers()); - } - - void EditorBaseControl::ImageTarget_DragEnter(IInspectable const &sender, DragEventArgs const &e) - { - DataPackageOperation op; - _scintilla->DragEnter(e.DataView(), e.AllowedOperations(), e.Modifiers(), op); - e.AcceptedOperation(op); - e.DragUIOverride().IsContentVisible(false); - e.DragUIOverride().IsCaptionVisible(false); - } - - void EditorBaseControl::ImageTarget_DragOver(IInspectable const &sender, DragEventArgs const &e) - { - auto point{ e.GetPosition(sender.as()) }; - point.X *= _dpiScale; - point.Y *= _dpiScale; - DataPackageOperation op; - _scintilla->DragOver(point, e.AllowedOperations(), e.Modifiers(), op); - e.AcceptedOperation(op); - } - - void EditorBaseControl::ImageTarget_DragLeave(IInspectable const &sender, DragEventArgs const &e) - { - _scintilla->DragLeave(); - } - - void EditorBaseControl::ImageTarget_Drop(IInspectable const &sender, DragEventArgs const &e) - { - auto point{ e.GetPosition(sender.as()) }; - point.X *= _dpiScale; - point.Y *= _dpiScale; - DataPackageOperation op; - _scintilla->Drop(point, e.DataView(), e.AllowedOperations(), e.Modifiers(), op); - e.AcceptedOperation(op); - } - - void EditorBaseControl::ImageTarget_DragStarting(UIElement const &sender, DragStartingEventArgs const &e) - { - e.AllowedOperations(DataPackageOperation::Copy | DataPackageOperation::Move); - e.Data().SetText(winrt::to_hstring(_scintilla->GetDragData())); - e.DragUI().SetContentFromDataPackage(); - } - - void EditorBaseControl::ImageTarget_ContextRequested(UIElement const &sender, ContextRequestedEventArgs const &e) - { - Point point; - if (e.TryGetPosition(sender, point)) - { - e.Handled(ShowContextMenu(sender, point)); - } - else if (const auto frameworkElement{ sender.try_as() }) - { - e.Handled(ShowContextMenuAtCurrentPosition()); - } - } - - void EditorBaseControl::ContextMenuItem_Click(Windows::Foundation::IInspectable const &sender, DUX::RoutedEventArgs const &e) - { - _scintilla->WndProc(static_cast(unbox_value(sender.as().Tag())), 0, 0); - } - - void EditorBaseControl::HorizontalScrollBar_Scroll(IInspectable const &sender, ScrollEventArgs const &e) - { - _scintilla->HorizontalScroll(static_cast(e.ScrollEventType()), static_cast(e.NewValue())); - } - - void EditorBaseControl::VerticalScrollBar_Scroll(IInspectable const &sender, ScrollEventArgs const &e) - { - _scintilla->Scroll(static_cast(e.ScrollEventType()), static_cast(e.NewValue())); - } - - LRESULT EditorBaseControl::WndProc(IInspectable const &tag, UINT msg, WPARAM wParam, LPARAM lParam) - { - if (msg == WM_NOTIFY) - { - const auto data{ reinterpret_cast(lParam) }; - const auto sender{ tag.as() }; - sender->InternalNotifyMessageReceived(*sender, lParam); // CodeEditorControl should receive the notification before user subscriptions - sender->_notifyMessageReceived(*sender, lParam); - sender->_editorWrapper.as()->ProcessEvent(data); - } - - return 0; - } - - event_token EditorBaseControl::DpiChanged(EventHandler const &handler) - { - return _dpiChangedEvent.add(handler); - } - - void EditorBaseControl::DpiChanged(event_token const &token) noexcept - { - _dpiChangedEvent.remove(token); - } - - event_token EditorBaseControl::NotifyMessageReceived(EventHandler const &handler) - { - return _notifyMessageReceived.add(handler); - } - - void EditorBaseControl::NotifyMessageReceived(event_token const &token) noexcept - { - _notifyMessageReceived.remove(token); - } - - float EditorBaseControl::DpiScale() - { - return _dpiScale; - } - -#ifndef WINUI3 - void EditorBaseControl::Application_Suspending(IInspectable const &sender, SuspendingEventArgs const &args) - { - // Required or crashes on resume - // https://learn.microsoft.com/en-us/windows/uwp/gaming/directx-and-xaml-interop - // https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-idxgidevice3-trim - // Todo: Should ClearResources get called too? https://github.com/microsoft/Win2D/blob/master/winrt/lib/drawing/CanvasDevice.cpp#L1040 - _wrapper->TrimDxgiDevice(); - } -#endif -} diff --git a/WinUIEditor/EditorBaseControl.h b/WinUIEditor/EditorBaseControl.h deleted file mode 100644 index 68bb834..0000000 --- a/WinUIEditor/EditorBaseControl.h +++ /dev/null @@ -1,121 +0,0 @@ -#pragma once - -#include "EditorBaseControl.g.h" - -#include "ScintillaWin.h" -#include "ScintillaCall.h" -#include "Wrapper.h" - -namespace winrt::WinUIEditor::implementation -{ - struct EditorBaseControl : EditorBaseControlT - { - EditorBaseControl(); - ~EditorBaseControl(); - - WinUIEditor::Editor Editor(); - std::shared_ptr Call() noexcept { return _call; } - - void OnApplyTemplate(); - void OnGotFocus(DUX::RoutedEventArgs const &e); - void OnLostFocus(DUX::RoutedEventArgs const &e); - void OnKeyDown(DUX::Input::KeyRoutedEventArgs const &e); - void OnKeyUp(DUX::Input::KeyRoutedEventArgs const &e); - void OnPointerPressed(DUX::Input::PointerRoutedEventArgs const &e); - void OnPointerReleased(DUX::Input::PointerRoutedEventArgs const &e); - DUX::Automation::Peers::AutomationPeer OnCreateAutomationPeer(); - - Scintilla::sptr_t PublicWndProc(Scintilla::Message iMessage, Scintilla::uptr_t wParam, Scintilla::sptr_t lParam); - int64_t SendMessage(ScintillaMessage const &message, uint64_t wParam, int64_t lParam); - - void StyleSetForeTransparent(int style, Scintilla::Internal::ColourRGBA color); - void StyleSetBackTransparent(int style, Scintilla::Internal::ColourRGBA color); - void InvalidateStyleRedraw(); - void StyleClearCustom(); - void SetFoldMarginColorTransparent(bool useSetting, Scintilla::Internal::ColourRGBA back); - void SetFoldMarginHiColorTransparent(bool useSetting, Scintilla::Internal::ColourRGBA fore); - - event_token DpiChanged(Windows::Foundation::EventHandler const &handler); - void DpiChanged(event_token const &token) noexcept; - - event_token NotifyMessageReceived(Windows::Foundation::EventHandler const &handler); - void NotifyMessageReceived(event_token const &token) noexcept; - float DpiScale(); - - event> InternalNotifyMessageReceived; - - private: -#ifndef WINUI3 - bool _hasFcu{ Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 5) }; // Todo: Make static - bool _hasXamlRoot{ Windows::Foundation::Metadata::ApiInformation::IsTypePresent(L"Windows.UI.Xaml.XamlRoot") }; // Todo: Make static - bool _hasIsLoaded{ Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.FrameworkElement", L"IsLoaded") }; // Todo: Make static - bool _isPointerOver{ false }; - Windows::Graphics::Display::DisplayInformation _displayInformation{ nullptr }; - bool _isLoaded{ false }; -#endif - bool _isFocused{ false }; - WinUIEditor::Editor _editorWrapper{ nullptr }; - std::shared_ptr _call{ nullptr }; - com_ptr<::Scintilla::Internal::ScintillaWinUI> _scintilla{ nullptr }; - float _dpiScale{ 0 }; - event> _dpiChangedEvent; - event> _notifyMessageReceived; - DUX::FrameworkElement::SizeChanged_revoker _imageTargetSizeChangedRevoker{}; - void ImageTarget_SizeChanged(Windows::Foundation::IInspectable const &sender, DUX::SizeChangedEventArgs const &args); - DUX::UIElement::PointerMoved_revoker _imageTargetPointerMovedRevoker{}; - void ImageTarget_PointerMoved(Windows::Foundation::IInspectable const &sender, DUX::Input::PointerRoutedEventArgs const &e); -#ifndef WINUI3 - DUX::UIElement::PointerCaptureLost_revoker _imageTargetPointerCaptureLostRevoker{}; - void ImageTarget_PointerCaptureLost(Windows::Foundation::IInspectable const &sender, DUX::Input::PointerRoutedEventArgs const &e); - DUX::UIElement::PointerEntered_revoker _imageTargetPointerEnteredRevoker{}; - void ImageTarget_PointerEntered(Windows::Foundation::IInspectable const &sender, DUX::Input::PointerRoutedEventArgs const &e); -#endif - DUX::UIElement::PointerExited_revoker _imageTargetPointerExitedRevoker{}; - void ImageTarget_PointerExited(Windows::Foundation::IInspectable const &sender, DUX::Input::PointerRoutedEventArgs const &e); - DUX::UIElement::PointerWheelChanged_revoker _imageTargetPointerWheelChangedRevoker{}; - void ImageTarget_PointerWheelChanged(Windows::Foundation::IInspectable const &sender, DUX::Input::PointerRoutedEventArgs const &e); - DUX::UIElement::DragEnter_revoker _imageTargetDragEnterRevoker{}; - void ImageTarget_DragEnter(Windows::Foundation::IInspectable const &sender, DUX::DragEventArgs const &e); - DUX::UIElement::DragOver_revoker _imageTargetDragOverRevoker{}; - void ImageTarget_DragOver(Windows::Foundation::IInspectable const &sender, DUX::DragEventArgs const &e); - DUX::UIElement::DragLeave_revoker _imageTargetDragLeaveRevoker{}; - void ImageTarget_DragLeave(Windows::Foundation::IInspectable const &sender, DUX::DragEventArgs const &e); - DUX::UIElement::Drop_revoker _imageTargetDropRevoker{}; - void ImageTarget_Drop(Windows::Foundation::IInspectable const &sender, DUX::DragEventArgs const &e); - DUX::UIElement::DragStarting_revoker _imageTargetDragStartingRevoker{}; - void ImageTarget_DragStarting(DUX::UIElement const &sender, DUX::DragStartingEventArgs const &e); - DUX::UIElement::ContextRequested_revoker _imageTargetContextRequestedRevoker{}; - void ImageTarget_ContextRequested(DUX::UIElement const &sender, DUX::Input::ContextRequestedEventArgs const &e); - void ContextMenuItem_Click(Windows::Foundation::IInspectable const &sender, DUX::RoutedEventArgs const &e); - DUXC::Primitives::ScrollBar::Scroll_revoker _horizontalScrollBarScrollRevoker{}; - void HorizontalScrollBar_Scroll(Windows::Foundation::IInspectable const &sender, DUX::Controls::Primitives::ScrollEventArgs const &e); - DUXC::Primitives::ScrollBar::Scroll_revoker _verticalScrollBarScrollRevoker{}; - void VerticalScrollBar_Scroll(Windows::Foundation::IInspectable const &sender, DUX::Controls::Primitives::ScrollEventArgs const &e); - void EditorBaseControl_CharacterReceived(DUX::UIElement const &sender, DUX::Input::CharacterReceivedRoutedEventArgs const &args); - void OnLoaded(Windows::Foundation::IInspectable const &sender, DUX::RoutedEventArgs const &args); - void OnUnloaded(Windows::Foundation::IInspectable const &sender, DUX::RoutedEventArgs const &args); - bool IsLoadedCompat(); - DUX::XamlRoot::Changed_revoker _xamlRootChangedRevoker{}; - void XamlRoot_Changed(DUX::XamlRoot const &sender, DUX::XamlRootChangedEventArgs const &args); - void UpdateDpi(float dpiScale); - void AddContextMenuItems(DUX::Controls::MenuFlyout const &menu); - bool ShowContextMenu(DUX::UIElement const &targetElement, Windows::Foundation::Point const &point); - bool ShowContextMenuAtCurrentPosition(); - winrt::com_ptr<::IVirtualSurfaceImageSourceNative> _vsisNative; - std::shared_ptr<::WinUIEditor::Wrapper> _wrapper{ nullptr }; - static LRESULT WndProc(Windows::Foundation::IInspectable const &, UINT msg, WPARAM wParam, LPARAM lParam); -#ifndef WINUI3 - Windows::Graphics::Display::DisplayInformation::DpiChanged_revoker _dpiChangedRevoker{}; - void DisplayInformation_DpiChanged(Windows::Graphics::Display::DisplayInformation const &sender, Windows::Foundation::IInspectable const &args); - Windows::UI::Xaml::Application::Suspending_revoker _suspendingRevoker{}; - void Application_Suspending(Windows::Foundation::IInspectable const &sender, Windows::ApplicationModel::SuspendingEventArgs const &args); -#endif - }; -} - -namespace winrt::WinUIEditor::factory_implementation -{ - struct EditorBaseControl : EditorBaseControlT - { - }; -} diff --git a/WinUIEditor/EditorBaseControl.idl b/WinUIEditor/EditorBaseControl.idl deleted file mode 100644 index a502e24..0000000 --- a/WinUIEditor/EditorBaseControl.idl +++ /dev/null @@ -1,15 +0,0 @@ -#include "Defines.idl" -import "EditorWrapper.idl"; -import "IEditorAccess.idl"; - -namespace WinUIEditor -{ - [default_interface] - [webhosthidden] - runtimeclass EditorBaseControl : DUX.Controls.Control, IEditorAccess - { - EditorBaseControl(); - Editor Editor { get; }; - event Windows.Foundation.EventHandler DpiChanged; - } -} diff --git a/WinUIEditor/EditorBaseControlAutomationPeer.cpp b/WinUIEditor/EditorBaseControlAutomationPeer.cpp deleted file mode 100644 index ab142dc..0000000 --- a/WinUIEditor/EditorBaseControlAutomationPeer.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include "pch.h" -#include "EditorBaseControlAutomationPeer.h" -#include "EditorBaseControlAutomationPeer.g.cpp" -#include "TextRangeProvider.h" -#include "Helpers.h" -#include "EditorBaseControl.h" - -using namespace ::WinUIEditor; -using namespace winrt; -using namespace Windows::Foundation; -using namespace DUX::Automation; -using namespace DUX::Automation::Peers; -using namespace DUX::Automation::Provider; -using namespace DUX::Automation::Text; - -namespace winrt::WinUIEditor::implementation -{ - EditorBaseControlAutomationPeer::EditorBaseControlAutomationPeer(WinUIEditor::EditorBaseControl const &owner) : base_type(owner) - { - _updateUIRevoker = owner.Editor().UpdateUI(auto_revoke, { this, &EditorBaseControlAutomationPeer::Editor_UpdateUI }); - } - - void EditorBaseControlAutomationPeer::Editor_UpdateUI(Editor const &sender, UpdateUIEventArgs const &args) - { - // https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp#L133 - // Todo: Maybe we should raise selection changed on Update::Content also - if (static_cast(static_cast(args.Updated()) & Update::Selection)) - { - this->RaiseAutomationEvent(AutomationEvents::TextPatternOnTextSelectionChanged); - } - } - - hstring EditorBaseControlAutomationPeer::GetLocalizedControlTypeCore() - { - // Todo: Localize - // Todo: Make sure this is a good name - return L"code editor"; - } - - IInspectable EditorBaseControlAutomationPeer::GetPatternCore(PatternInterface const &patternInterface) - { - // Todo: Should we forward scroll elements? https://learn.microsoft.com/en-us/windows/apps/design/accessibility/custom-automation-peers#forwarding-patterns-from-sub-elements - switch (patternInterface) - { - case PatternInterface::TextEdit: - case PatternInterface::Text: - case PatternInterface::Text2: - case PatternInterface::Value: - return *this; - default: - return __super::GetPatternCore(patternInterface); - } - } - - hstring EditorBaseControlAutomationPeer::GetClassNameCore() - { - return hstring{ name_of() }; - } - - AutomationControlType EditorBaseControlAutomationPeer::GetAutomationControlTypeCore() - { - return AutomationControlType::Edit; - } - - ITextRangeProvider EditorBaseControlAutomationPeer::DocumentRange() - { - // Todo: Look at how WinUI 2 handles GetImpl in automation peers - const auto editor{ Owner().as().Editor() }; - return make(ProviderFromPeer(*this), editor, 0, editor.Length(), GetBoundingRectangle()); - } - - SupportedTextSelection EditorBaseControlAutomationPeer::SupportedTextSelection() - { - const auto editor{ Owner().as().Editor() }; - return editor.MultipleSelection() ? SupportedTextSelection::Multiple : SupportedTextSelection::Single; - } - - com_array EditorBaseControlAutomationPeer::GetSelection() - { - const auto editor{ Owner().as().Editor() }; - const auto n{ static_cast(editor.Selections()) }; - com_array arr(n, nullptr); - const auto topLeft{ GetBoundingRectangle() }; - for (uint32_t i{ 0 }; i < n; i++) - { - const auto start{ editor.GetSelectionNStart(i) }; - const auto end{ editor.GetSelectionNEnd(i) }; - arr[i] = make(ProviderFromPeer(*this), editor, start, end, topLeft); - } - return arr; // Todo: Trying to retrieve the value of a selection n >= 1 crashes Accessibility Insights - } - - com_array EditorBaseControlAutomationPeer::GetVisibleRanges() - { - // Visual Studio implements this line by line - // Todo: Consider folding and line visible messages - // Todo: Not sure if this is the best method for top line - const auto editor{ Owner().as().Editor() }; - - const auto firstVisibleLine{ editor.FirstVisibleLine() }; - const auto maxLine{ editor.LineCount() - 1 }; - // Todo: LinesOnScreen has no concept of wrapping, so you could end up with many more lines than truly visibly - const auto lastVisibleLine{ std::min(maxLine, firstVisibleLine + editor.LinesOnScreen()) }; - - const auto count{ lastVisibleLine - firstVisibleLine + 1 }; - - com_array arr(count, nullptr); - const auto topLeft{ GetBoundingRectangle() }; - for (int64_t i{ 0 }; i < count; i++) - { - const auto line{ firstVisibleLine + i }; - const auto start{ editor.PositionFromLine(line) }; - const auto end{ editor.GetLineEndPosition(line) }; - arr[i] = make(ProviderFromPeer(*this), editor, start, end, topLeft); - } - return arr; - } - - ITextRangeProvider EditorBaseControlAutomationPeer::RangeFromChild(IRawElementProviderSimple const &childElement) - { - // Todo: Does this need to be implemented? - return nullptr; - } - - ITextRangeProvider EditorBaseControlAutomationPeer::RangeFromPoint(Point const &screenLocation) - { - const auto rect{ GetBoundingRectangle() }; - const Point point{ - screenLocation.X - rect.X, - screenLocation.Y - rect.Y }; - - const auto editor{ Owner().as().Editor() }; - const auto pos{ editor.PositionFromPoint(point.X, point.Y) }; - const auto line{ editor.LineFromPosition(pos) }; - const auto start{ editor.PositionFromLine(line) }; - const auto end{ editor.GetLineEndPosition(line) }; - - return make(ProviderFromPeer(*this), editor, start, end, rect); - } - - ITextRangeProvider EditorBaseControlAutomationPeer::GetActiveComposition() - { - // Todo: implement - throw hresult_not_implemented{}; - } - - ITextRangeProvider EditorBaseControlAutomationPeer::GetConversionTarget() - { - // Todo: implement - throw hresult_not_implemented{}; - } - - ITextRangeProvider EditorBaseControlAutomationPeer::RangeFromAnnotation(IRawElementProviderSimple const &annotationElement) - { - // Todo: implement - throw hresult_not_implemented{}; - } - - ITextRangeProvider EditorBaseControlAutomationPeer::GetCaretRange(bool &isActive) - { - const auto editor{ Owner().as().Editor() }; - - isActive = editor.Focus(); - - const auto pos{ editor.GetSelectionNCaret(editor.MainSelection()) }; - - return make(ProviderFromPeer(*this), editor, pos, pos, GetBoundingRectangle()); - } - - bool EditorBaseControlAutomationPeer::IsReadOnly() - { - const auto editor{ Owner().as().Editor() }; - - return editor.ReadOnly(); - } - - hstring EditorBaseControlAutomationPeer::Value() - { - const auto editor{ Owner().as().Editor() }; - - return editor.GetText(editor.Length()); // Todo: this could potentially be gigabytes of data, so provide a maximum safeguard - } - - void EditorBaseControlAutomationPeer::SetValue(hstring const &value) - { - const auto editor{ Owner().as().Editor() }; - - editor.SetText(value); - } -} diff --git a/WinUIEditor/EditorBaseControlAutomationPeer.h b/WinUIEditor/EditorBaseControlAutomationPeer.h deleted file mode 100644 index 6a7977c..0000000 --- a/WinUIEditor/EditorBaseControlAutomationPeer.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include "EditorBaseControlAutomationPeer.g.h" - -namespace winrt::WinUIEditor::implementation -{ - struct EditorBaseControlAutomationPeer : EditorBaseControlAutomationPeerT - { - EditorBaseControlAutomationPeer(WinUIEditor::EditorBaseControl const &owner); - - hstring GetLocalizedControlTypeCore(); - Windows::Foundation::IInspectable GetPatternCore(DUX::Automation::Peers::PatternInterface const &patternInterface); - hstring GetClassNameCore(); - DUX::Automation::Peers::AutomationControlType GetAutomationControlTypeCore(); - - DUX::Automation::Provider::ITextRangeProvider DocumentRange(); - DUX::Automation::SupportedTextSelection SupportedTextSelection(); - com_array GetSelection(); - com_array GetVisibleRanges(); - DUX::Automation::Provider::ITextRangeProvider RangeFromChild(DUX::Automation::Provider::IRawElementProviderSimple const &childElement); - DUX::Automation::Provider::ITextRangeProvider RangeFromPoint(Windows::Foundation::Point const &screenLocation); - DUX::Automation::Provider::ITextRangeProvider GetActiveComposition(); - DUX::Automation::Provider::ITextRangeProvider GetConversionTarget(); - - DUX::Automation::Provider::ITextRangeProvider RangeFromAnnotation(DUX::Automation::Provider::IRawElementProviderSimple const &annotationElement); - DUX::Automation::Provider::ITextRangeProvider GetCaretRange(bool &isActive); - - bool IsReadOnly(); - hstring Value(); - void SetValue(hstring const &value); - - private: - WinUIEditor::Editor::UpdateUI_revoker _updateUIRevoker{}; - void Editor_UpdateUI(WinUIEditor::Editor const &sender, WinUIEditor::UpdateUIEventArgs const &args); - }; -} - -namespace winrt::WinUIEditor::factory_implementation -{ - struct EditorBaseControlAutomationPeer : EditorBaseControlAutomationPeerT - { - }; -} diff --git a/WinUIEditor/EditorBaseControlAutomationPeer.idl b/WinUIEditor/EditorBaseControlAutomationPeer.idl deleted file mode 100644 index 64e27cd..0000000 --- a/WinUIEditor/EditorBaseControlAutomationPeer.idl +++ /dev/null @@ -1,15 +0,0 @@ -#include "Defines.idl" -import "EditorBaseControl.idl"; - -namespace WinUIEditor -{ - [default_interface] - [webhosthidden] - runtimeclass EditorBaseControlAutomationPeer : DUX.Automation.Peers.FrameworkElementAutomationPeer, - DUX.Automation.Provider.ITextEditProvider, - DUX.Automation.Provider.ITextProvider2, - DUX.Automation.Provider.IValueProvider - { - EditorBaseControlAutomationPeer(EditorBaseControl owner); - } -} diff --git a/WinUIEditor/EditorWrapper.cpp b/WinUIEditor/EditorWrapper.cpp deleted file mode 100644 index 183a3e8..0000000 --- a/WinUIEditor/EditorWrapper.cpp +++ /dev/null @@ -1,8461 +0,0 @@ -#include "pch.h" -#include "EditorBaseControl.h" -#include "EditorWrapper.h" -#include "Editor.g.cpp" - -namespace winrt::WinUIEditor::implementation -{ - StyleNeededEventArgs::StyleNeededEventArgs(int32_t position) - : _position { position } - { - } - - int32_t StyleNeededEventArgs::Position() - { - return _position; - } - - CharAddedEventArgs::CharAddedEventArgs(int32_t ch, int32_t characterSource) - : _ch { ch }, _characterSource { characterSource } - { - } - - int32_t CharAddedEventArgs::Ch() - { - return _ch; - } - - int32_t CharAddedEventArgs::CharacterSource() - { - return _characterSource; - } - - KeyEventArgs::KeyEventArgs(int32_t ch, int32_t modifiers) - : _ch { ch }, _modifiers { modifiers } - { - } - - int32_t KeyEventArgs::Ch() - { - return _ch; - } - - int32_t KeyEventArgs::Modifiers() - { - return _modifiers; - } - - DoubleClickEventArgs::DoubleClickEventArgs(int32_t modifiers, int32_t position, int32_t line) - : _modifiers { modifiers }, _position { position }, _line { line } - { - } - - int32_t DoubleClickEventArgs::Modifiers() - { - return _modifiers; - } - - int32_t DoubleClickEventArgs::Position() - { - return _position; - } - - int32_t DoubleClickEventArgs::Line() - { - return _line; - } - - UpdateUIEventArgs::UpdateUIEventArgs(int32_t updated) - : _updated { updated } - { - } - - int32_t UpdateUIEventArgs::Updated() - { - return _updated; - } - - ModifiedEventArgs::ModifiedEventArgs(int32_t position, int32_t modificationType, const char *text, int32_t length, int32_t linesAdded, int32_t line, int32_t foldLevelNow, int32_t foldLevelPrev, int32_t token, int32_t annotationLinesAdded) - : _position { position }, _modificationType { modificationType }, _textAsPointer { text }, _length { length }, _linesAdded { linesAdded }, _line { line }, _foldLevelNow { foldLevelNow }, _foldLevelPrev { foldLevelPrev }, _token { token }, _annotationLinesAdded { annotationLinesAdded } - { - } - - int32_t ModifiedEventArgs::Position() - { - return _position; - } - - int32_t ModifiedEventArgs::ModificationType() - { - return _modificationType; - } - - Windows::Storage::Streams::IBuffer ModifiedEventArgs::TextAsBuffer() - { - if (!_textAsBuffer) - { - if (_textAsPointer) - { - _textAsBuffer = Windows::Storage::Streams::Buffer{ static_cast(_length) }; - memcpy(_textAsBuffer.data(), _textAsPointer, _length); - _textAsBuffer.Length(_length); - } - else - { - _textAsBuffer = Windows::Storage::Streams::Buffer{ 0u }; - } - } - return _textAsBuffer; - } - - hstring ModifiedEventArgs::Text() - { - if (!_text) - { - _text = _textAsPointer ? to_hstring(std::string_view{ _textAsPointer, static_cast(_length) }) : L""; - } - return _text.GetString(); - } - - int32_t ModifiedEventArgs::Length() - { - return _length; - } - - int32_t ModifiedEventArgs::LinesAdded() - { - return _linesAdded; - } - - int32_t ModifiedEventArgs::Line() - { - return _line; - } - - int32_t ModifiedEventArgs::FoldLevelNow() - { - return _foldLevelNow; - } - - int32_t ModifiedEventArgs::FoldLevelPrev() - { - return _foldLevelPrev; - } - - int32_t ModifiedEventArgs::Token() - { - return _token; - } - - int32_t ModifiedEventArgs::AnnotationLinesAdded() - { - return _annotationLinesAdded; - } - - MacroRecordEventArgs::MacroRecordEventArgs(int32_t message, int32_t wParam, int32_t lParam) - : _message { message }, _wParam { wParam }, _lParam { lParam } - { - } - - int32_t MacroRecordEventArgs::Message() - { - return _message; - } - - int32_t MacroRecordEventArgs::WParam() - { - return _wParam; - } - - int32_t MacroRecordEventArgs::LParam() - { - return _lParam; - } - - MarginClickEventArgs::MarginClickEventArgs(int32_t modifiers, int32_t position, int32_t margin) - : _modifiers { modifiers }, _position { position }, _margin { margin } - { - } - - int32_t MarginClickEventArgs::Modifiers() - { - return _modifiers; - } - - int32_t MarginClickEventArgs::Position() - { - return _position; - } - - int32_t MarginClickEventArgs::Margin() - { - return _margin; - } - - NeedShownEventArgs::NeedShownEventArgs(int32_t position, int32_t length) - : _position { position }, _length { length } - { - } - - int32_t NeedShownEventArgs::Position() - { - return _position; - } - - int32_t NeedShownEventArgs::Length() - { - return _length; - } - - UserListSelectionEventArgs::UserListSelectionEventArgs(int32_t listType, const char *text, int32_t position, int32_t ch, WinUIEditor::CompletionMethods const &listCompletionMethod) - : _listType { listType }, _textAsPointer { text }, _position { position }, _ch { ch }, _listCompletionMethod { listCompletionMethod } - { - } - - int32_t UserListSelectionEventArgs::ListType() - { - return _listType; - } - - Windows::Storage::Streams::IBuffer UserListSelectionEventArgs::TextAsBuffer() - { - if (!_textAsBuffer) - { - if (_textAsPointer) - { - const auto length { strnlen_s(_textAsPointer, std::numeric_limits::max()) }; - _textAsBuffer = Windows::Storage::Streams::Buffer{ static_cast(length) }; - memcpy(_textAsBuffer.data(), _textAsPointer, length); - _textAsBuffer.Length(length); - } - else - { - _textAsBuffer = Windows::Storage::Streams::Buffer{ 0u }; - } - } - return _textAsBuffer; - } - - hstring UserListSelectionEventArgs::Text() - { - if (!_text) - { - _text = _textAsPointer ? to_hstring(_textAsPointer) : L""; - } - return _text.GetString(); - } - - int32_t UserListSelectionEventArgs::Position() - { - return _position; - } - - int32_t UserListSelectionEventArgs::Ch() - { - return _ch; - } - - WinUIEditor::CompletionMethods UserListSelectionEventArgs::ListCompletionMethod() - { - return _listCompletionMethod; - } - - URIDroppedEventArgs::URIDroppedEventArgs(const char *text) - : _textAsPointer { text } - { - } - - Windows::Storage::Streams::IBuffer URIDroppedEventArgs::TextAsBuffer() - { - if (!_textAsBuffer) - { - if (_textAsPointer) - { - const auto length { strnlen_s(_textAsPointer, std::numeric_limits::max()) }; - _textAsBuffer = Windows::Storage::Streams::Buffer{ static_cast(length) }; - memcpy(_textAsBuffer.data(), _textAsPointer, length); - _textAsBuffer.Length(length); - } - else - { - _textAsBuffer = Windows::Storage::Streams::Buffer{ 0u }; - } - } - return _textAsBuffer; - } - - hstring URIDroppedEventArgs::Text() - { - if (!_text) - { - _text = _textAsPointer ? to_hstring(_textAsPointer) : L""; - } - return _text.GetString(); - } - - DwellStartEventArgs::DwellStartEventArgs(int32_t position, int32_t x, int32_t y) - : _position { position }, _x { x }, _y { y } - { - } - - int32_t DwellStartEventArgs::Position() - { - return _position; - } - - int32_t DwellStartEventArgs::X() - { - return _x; - } - - int32_t DwellStartEventArgs::Y() - { - return _y; - } - - DwellEndEventArgs::DwellEndEventArgs(int32_t position, int32_t x, int32_t y) - : _position { position }, _x { x }, _y { y } - { - } - - int32_t DwellEndEventArgs::Position() - { - return _position; - } - - int32_t DwellEndEventArgs::X() - { - return _x; - } - - int32_t DwellEndEventArgs::Y() - { - return _y; - } - - HotSpotClickEventArgs::HotSpotClickEventArgs(int32_t modifiers, int32_t position) - : _modifiers { modifiers }, _position { position } - { - } - - int32_t HotSpotClickEventArgs::Modifiers() - { - return _modifiers; - } - - int32_t HotSpotClickEventArgs::Position() - { - return _position; - } - - HotSpotDoubleClickEventArgs::HotSpotDoubleClickEventArgs(int32_t modifiers, int32_t position) - : _modifiers { modifiers }, _position { position } - { - } - - int32_t HotSpotDoubleClickEventArgs::Modifiers() - { - return _modifiers; - } - - int32_t HotSpotDoubleClickEventArgs::Position() - { - return _position; - } - - CallTipClickEventArgs::CallTipClickEventArgs(int32_t position) - : _position { position } - { - } - - int32_t CallTipClickEventArgs::Position() - { - return _position; - } - - AutoCSelectionEventArgs::AutoCSelectionEventArgs(const char *text, int32_t position, int32_t ch, WinUIEditor::CompletionMethods const &listCompletionMethod) - : _textAsPointer { text }, _position { position }, _ch { ch }, _listCompletionMethod { listCompletionMethod } - { - } - - Windows::Storage::Streams::IBuffer AutoCSelectionEventArgs::TextAsBuffer() - { - if (!_textAsBuffer) - { - if (_textAsPointer) - { - const auto length { strnlen_s(_textAsPointer, std::numeric_limits::max()) }; - _textAsBuffer = Windows::Storage::Streams::Buffer{ static_cast(length) }; - memcpy(_textAsBuffer.data(), _textAsPointer, length); - _textAsBuffer.Length(length); - } - else - { - _textAsBuffer = Windows::Storage::Streams::Buffer{ 0u }; - } - } - return _textAsBuffer; - } - - hstring AutoCSelectionEventArgs::Text() - { - if (!_text) - { - _text = _textAsPointer ? to_hstring(_textAsPointer) : L""; - } - return _text.GetString(); - } - - int32_t AutoCSelectionEventArgs::Position() - { - return _position; - } - - int32_t AutoCSelectionEventArgs::Ch() - { - return _ch; - } - - WinUIEditor::CompletionMethods AutoCSelectionEventArgs::ListCompletionMethod() - { - return _listCompletionMethod; - } - - IndicatorClickEventArgs::IndicatorClickEventArgs(int32_t modifiers, int32_t position) - : _modifiers { modifiers }, _position { position } - { - } - - int32_t IndicatorClickEventArgs::Modifiers() - { - return _modifiers; - } - - int32_t IndicatorClickEventArgs::Position() - { - return _position; - } - - IndicatorReleaseEventArgs::IndicatorReleaseEventArgs(int32_t modifiers, int32_t position) - : _modifiers { modifiers }, _position { position } - { - } - - int32_t IndicatorReleaseEventArgs::Modifiers() - { - return _modifiers; - } - - int32_t IndicatorReleaseEventArgs::Position() - { - return _position; - } - - HotSpotReleaseClickEventArgs::HotSpotReleaseClickEventArgs(int32_t modifiers, int32_t position) - : _modifiers { modifiers }, _position { position } - { - } - - int32_t HotSpotReleaseClickEventArgs::Modifiers() - { - return _modifiers; - } - - int32_t HotSpotReleaseClickEventArgs::Position() - { - return _position; - } - - AutoCCompletedEventArgs::AutoCCompletedEventArgs(const char *text, int32_t position, int32_t ch, WinUIEditor::CompletionMethods const &listCompletionMethod) - : _textAsPointer { text }, _position { position }, _ch { ch }, _listCompletionMethod { listCompletionMethod } - { - } - - Windows::Storage::Streams::IBuffer AutoCCompletedEventArgs::TextAsBuffer() - { - if (!_textAsBuffer) - { - if (_textAsPointer) - { - const auto length { strnlen_s(_textAsPointer, std::numeric_limits::max()) }; - _textAsBuffer = Windows::Storage::Streams::Buffer{ static_cast(length) }; - memcpy(_textAsBuffer.data(), _textAsPointer, length); - _textAsBuffer.Length(length); - } - else - { - _textAsBuffer = Windows::Storage::Streams::Buffer{ 0u }; - } - } - return _textAsBuffer; - } - - hstring AutoCCompletedEventArgs::Text() - { - if (!_text) - { - _text = _textAsPointer ? to_hstring(_textAsPointer) : L""; - } - return _text.GetString(); - } - - int32_t AutoCCompletedEventArgs::Position() - { - return _position; - } - - int32_t AutoCCompletedEventArgs::Ch() - { - return _ch; - } - - WinUIEditor::CompletionMethods AutoCCompletedEventArgs::ListCompletionMethod() - { - return _listCompletionMethod; - } - - MarginRightClickEventArgs::MarginRightClickEventArgs(int32_t modifiers, int32_t position, int32_t margin) - : _modifiers { modifiers }, _position { position }, _margin { margin } - { - } - - int32_t MarginRightClickEventArgs::Modifiers() - { - return _modifiers; - } - - int32_t MarginRightClickEventArgs::Position() - { - return _position; - } - - int32_t MarginRightClickEventArgs::Margin() - { - return _margin; - } - - AutoCSelectionChangeEventArgs::AutoCSelectionChangeEventArgs(int32_t listType, const char *text, int32_t position) - : _listType { listType }, _textAsPointer { text }, _position { position } - { - } - - int32_t AutoCSelectionChangeEventArgs::ListType() - { - return _listType; - } - - Windows::Storage::Streams::IBuffer AutoCSelectionChangeEventArgs::TextAsBuffer() - { - if (!_textAsBuffer) - { - if (_textAsPointer) - { - const auto length { strnlen_s(_textAsPointer, std::numeric_limits::max()) }; - _textAsBuffer = Windows::Storage::Streams::Buffer{ static_cast(length) }; - memcpy(_textAsBuffer.data(), _textAsPointer, length); - _textAsBuffer.Length(length); - } - else - { - _textAsBuffer = Windows::Storage::Streams::Buffer{ 0u }; - } - } - return _textAsBuffer; - } - - hstring AutoCSelectionChangeEventArgs::Text() - { - if (!_text) - { - _text = _textAsPointer ? to_hstring(_textAsPointer) : L""; - } - return _text.GetString(); - } - - int32_t AutoCSelectionChangeEventArgs::Position() - { - return _position; - } - - Editor::Editor(com_ptr const &editor) - : _editor{ editor } - { - } - - void Editor::ProcessEvent(Scintilla::NotificationData *data) - { - switch (static_cast(data->nmhdr.code)) - { - case 2000: // StyleNeeded - { - if (_styleNeededEvent) - { - _styleNeededEvent(*this, *make_self(static_cast(data->position))); - } - } - break; - case 2001: // CharAdded - { - if (_charAddedEvent) - { - _charAddedEvent(*this, *make_self(static_cast(data->ch), static_cast(data->characterSource))); - } - } - break; - case 2002: // SavePointReached - { - if (_savePointReachedEvent) - { - _savePointReachedEvent(*this, *make_self()); - } - } - break; - case 2003: // SavePointLeft - { - if (_savePointLeftEvent) - { - _savePointLeftEvent(*this, *make_self()); - } - } - break; - case 2004: // ModifyAttemptRO - { - if (_modifyAttemptROEvent) - { - _modifyAttemptROEvent(*this, *make_self()); - } - } - break; - case 2005: // Key - { - if (_keyEvent) - { - _keyEvent(*this, *make_self(static_cast(data->ch), static_cast(data->modifiers))); - } - } - break; - case 2006: // DoubleClick - { - if (_doubleClickEvent) - { - _doubleClickEvent(*this, *make_self(static_cast(data->modifiers), static_cast(data->position), static_cast(data->line))); - } - } - break; - case 2007: // UpdateUI - { - if (_updateUIEvent) - { - _updateUIEvent(*this, *make_self(static_cast(data->updated))); - } - } - break; - case 2008: // Modified - { - if (_modifiedEvent) - { - _modifiedEvent(*this, *make_self(static_cast(data->position), static_cast(data->modificationType), data->text, static_cast(data->length), static_cast(data->linesAdded), static_cast(data->line), static_cast(data->foldLevelNow), static_cast(data->foldLevelPrev), static_cast(data->token), static_cast(data->annotationLinesAdded))); - } - } - break; - case 2009: // MacroRecord - { - if (_macroRecordEvent) - { - _macroRecordEvent(*this, *make_self(static_cast(data->message), static_cast(data->wParam), static_cast(data->lParam))); - } - } - break; - case 2010: // MarginClick - { - if (_marginClickEvent) - { - _marginClickEvent(*this, *make_self(static_cast(data->modifiers), static_cast(data->position), static_cast(data->margin))); - } - } - break; - case 2011: // NeedShown - { - if (_needShownEvent) - { - _needShownEvent(*this, *make_self(static_cast(data->position), static_cast(data->length))); - } - } - break; - case 2013: // Painted - { - if (_paintedEvent) - { - _paintedEvent(*this, *make_self()); - } - } - break; - case 2014: // UserListSelection - { - if (_userListSelectionEvent) - { - _userListSelectionEvent(*this, *make_self(static_cast(data->listType), data->text, static_cast(data->position), static_cast(data->ch), static_cast(data->listCompletionMethod))); - } - } - break; - case 2015: // URIDropped - { - if (_uRIDroppedEvent) - { - _uRIDroppedEvent(*this, *make_self(data->text)); - } - } - break; - case 2016: // DwellStart - { - if (_dwellStartEvent) - { - _dwellStartEvent(*this, *make_self(static_cast(data->position), static_cast(data->x), static_cast(data->y))); - } - } - break; - case 2017: // DwellEnd - { - if (_dwellEndEvent) - { - _dwellEndEvent(*this, *make_self(static_cast(data->position), static_cast(data->x), static_cast(data->y))); - } - } - break; - case 2018: // ZoomChanged - { - if (_zoomChangedEvent) - { - _zoomChangedEvent(*this, *make_self()); - } - } - break; - case 2019: // HotSpotClick - { - if (_hotSpotClickEvent) - { - _hotSpotClickEvent(*this, *make_self(static_cast(data->modifiers), static_cast(data->position))); - } - } - break; - case 2020: // HotSpotDoubleClick - { - if (_hotSpotDoubleClickEvent) - { - _hotSpotDoubleClickEvent(*this, *make_self(static_cast(data->modifiers), static_cast(data->position))); - } - } - break; - case 2021: // CallTipClick - { - if (_callTipClickEvent) - { - _callTipClickEvent(*this, *make_self(static_cast(data->position))); - } - } - break; - case 2022: // AutoCSelection - { - if (_autoCSelectionEvent) - { - _autoCSelectionEvent(*this, *make_self(data->text, static_cast(data->position), static_cast(data->ch), static_cast(data->listCompletionMethod))); - } - } - break; - case 2023: // IndicatorClick - { - if (_indicatorClickEvent) - { - _indicatorClickEvent(*this, *make_self(static_cast(data->modifiers), static_cast(data->position))); - } - } - break; - case 2024: // IndicatorRelease - { - if (_indicatorReleaseEvent) - { - _indicatorReleaseEvent(*this, *make_self(static_cast(data->modifiers), static_cast(data->position))); - } - } - break; - case 2025: // AutoCCancelled - { - if (_autoCCancelledEvent) - { - _autoCCancelledEvent(*this, *make_self()); - } - } - break; - case 2026: // AutoCCharDeleted - { - if (_autoCCharDeletedEvent) - { - _autoCCharDeletedEvent(*this, *make_self()); - } - } - break; - case 2027: // HotSpotReleaseClick - { - if (_hotSpotReleaseClickEvent) - { - _hotSpotReleaseClickEvent(*this, *make_self(static_cast(data->modifiers), static_cast(data->position))); - } - } - break; - case 2028: // FocusIn - { - if (_focusInEvent) - { - _focusInEvent(*this, *make_self()); - } - } - break; - case 2029: // FocusOut - { - if (_focusOutEvent) - { - _focusOutEvent(*this, *make_self()); - } - } - break; - case 2030: // AutoCCompleted - { - if (_autoCCompletedEvent) - { - _autoCCompletedEvent(*this, *make_self(data->text, static_cast(data->position), static_cast(data->ch), static_cast(data->listCompletionMethod))); - } - } - break; - case 2031: // MarginRightClick - { - if (_marginRightClickEvent) - { - _marginRightClickEvent(*this, *make_self(static_cast(data->modifiers), static_cast(data->position), static_cast(data->margin))); - } - } - break; - case 2032: // AutoCSelectionChange - { - if (_autoCSelectionChangeEvent) - { - _autoCSelectionChangeEvent(*this, *make_self(static_cast(data->listType), data->text, static_cast(data->position))); - } - } - break; - } - } - - event_token Editor::StyleNeeded(WinUIEditor::StyleNeededHandler const &handler) - { - return _styleNeededEvent.add(handler); - } - - void Editor::StyleNeeded(event_token const &token) - { - _styleNeededEvent.remove(token); - } - - event_token Editor::CharAdded(WinUIEditor::CharAddedHandler const &handler) - { - return _charAddedEvent.add(handler); - } - - void Editor::CharAdded(event_token const &token) - { - _charAddedEvent.remove(token); - } - - event_token Editor::SavePointReached(WinUIEditor::SavePointReachedHandler const &handler) - { - return _savePointReachedEvent.add(handler); - } - - void Editor::SavePointReached(event_token const &token) - { - _savePointReachedEvent.remove(token); - } - - event_token Editor::SavePointLeft(WinUIEditor::SavePointLeftHandler const &handler) - { - return _savePointLeftEvent.add(handler); - } - - void Editor::SavePointLeft(event_token const &token) - { - _savePointLeftEvent.remove(token); - } - - event_token Editor::ModifyAttemptRO(WinUIEditor::ModifyAttemptROHandler const &handler) - { - return _modifyAttemptROEvent.add(handler); - } - - void Editor::ModifyAttemptRO(event_token const &token) - { - _modifyAttemptROEvent.remove(token); - } - - event_token Editor::Key(WinUIEditor::KeyHandler const &handler) - { - return _keyEvent.add(handler); - } - - void Editor::Key(event_token const &token) - { - _keyEvent.remove(token); - } - - event_token Editor::DoubleClick(WinUIEditor::DoubleClickHandler const &handler) - { - return _doubleClickEvent.add(handler); - } - - void Editor::DoubleClick(event_token const &token) - { - _doubleClickEvent.remove(token); - } - - event_token Editor::UpdateUI(WinUIEditor::UpdateUIHandler const &handler) - { - return _updateUIEvent.add(handler); - } - - void Editor::UpdateUI(event_token const &token) - { - _updateUIEvent.remove(token); - } - - event_token Editor::Modified(WinUIEditor::ModifiedHandler const &handler) - { - return _modifiedEvent.add(handler); - } - - void Editor::Modified(event_token const &token) - { - _modifiedEvent.remove(token); - } - - event_token Editor::MacroRecord(WinUIEditor::MacroRecordHandler const &handler) - { - return _macroRecordEvent.add(handler); - } - - void Editor::MacroRecord(event_token const &token) - { - _macroRecordEvent.remove(token); - } - - event_token Editor::MarginClick(WinUIEditor::MarginClickHandler const &handler) - { - return _marginClickEvent.add(handler); - } - - void Editor::MarginClick(event_token const &token) - { - _marginClickEvent.remove(token); - } - - event_token Editor::NeedShown(WinUIEditor::NeedShownHandler const &handler) - { - return _needShownEvent.add(handler); - } - - void Editor::NeedShown(event_token const &token) - { - _needShownEvent.remove(token); - } - - event_token Editor::Painted(WinUIEditor::PaintedHandler const &handler) - { - return _paintedEvent.add(handler); - } - - void Editor::Painted(event_token const &token) - { - _paintedEvent.remove(token); - } - - event_token Editor::UserListSelection(WinUIEditor::UserListSelectionHandler const &handler) - { - return _userListSelectionEvent.add(handler); - } - - void Editor::UserListSelection(event_token const &token) - { - _userListSelectionEvent.remove(token); - } - - event_token Editor::URIDropped(WinUIEditor::URIDroppedHandler const &handler) - { - return _uRIDroppedEvent.add(handler); - } - - void Editor::URIDropped(event_token const &token) - { - _uRIDroppedEvent.remove(token); - } - - event_token Editor::DwellStart(WinUIEditor::DwellStartHandler const &handler) - { - return _dwellStartEvent.add(handler); - } - - void Editor::DwellStart(event_token const &token) - { - _dwellStartEvent.remove(token); - } - - event_token Editor::DwellEnd(WinUIEditor::DwellEndHandler const &handler) - { - return _dwellEndEvent.add(handler); - } - - void Editor::DwellEnd(event_token const &token) - { - _dwellEndEvent.remove(token); - } - - event_token Editor::ZoomChanged(WinUIEditor::ZoomChangedHandler const &handler) - { - return _zoomChangedEvent.add(handler); - } - - void Editor::ZoomChanged(event_token const &token) - { - _zoomChangedEvent.remove(token); - } - - event_token Editor::HotSpotClick(WinUIEditor::HotSpotClickHandler const &handler) - { - return _hotSpotClickEvent.add(handler); - } - - void Editor::HotSpotClick(event_token const &token) - { - _hotSpotClickEvent.remove(token); - } - - event_token Editor::HotSpotDoubleClick(WinUIEditor::HotSpotDoubleClickHandler const &handler) - { - return _hotSpotDoubleClickEvent.add(handler); - } - - void Editor::HotSpotDoubleClick(event_token const &token) - { - _hotSpotDoubleClickEvent.remove(token); - } - - event_token Editor::CallTipClick(WinUIEditor::CallTipClickHandler const &handler) - { - return _callTipClickEvent.add(handler); - } - - void Editor::CallTipClick(event_token const &token) - { - _callTipClickEvent.remove(token); - } - - event_token Editor::AutoCSelection(WinUIEditor::AutoCSelectionHandler const &handler) - { - return _autoCSelectionEvent.add(handler); - } - - void Editor::AutoCSelection(event_token const &token) - { - _autoCSelectionEvent.remove(token); - } - - event_token Editor::IndicatorClick(WinUIEditor::IndicatorClickHandler const &handler) - { - return _indicatorClickEvent.add(handler); - } - - void Editor::IndicatorClick(event_token const &token) - { - _indicatorClickEvent.remove(token); - } - - event_token Editor::IndicatorRelease(WinUIEditor::IndicatorReleaseHandler const &handler) - { - return _indicatorReleaseEvent.add(handler); - } - - void Editor::IndicatorRelease(event_token const &token) - { - _indicatorReleaseEvent.remove(token); - } - - event_token Editor::AutoCCancelled(WinUIEditor::AutoCCancelledHandler const &handler) - { - return _autoCCancelledEvent.add(handler); - } - - void Editor::AutoCCancelled(event_token const &token) - { - _autoCCancelledEvent.remove(token); - } - - event_token Editor::AutoCCharDeleted(WinUIEditor::AutoCCharDeletedHandler const &handler) - { - return _autoCCharDeletedEvent.add(handler); - } - - void Editor::AutoCCharDeleted(event_token const &token) - { - _autoCCharDeletedEvent.remove(token); - } - - event_token Editor::HotSpotReleaseClick(WinUIEditor::HotSpotReleaseClickHandler const &handler) - { - return _hotSpotReleaseClickEvent.add(handler); - } - - void Editor::HotSpotReleaseClick(event_token const &token) - { - _hotSpotReleaseClickEvent.remove(token); - } - - event_token Editor::FocusIn(WinUIEditor::FocusInHandler const &handler) - { - return _focusInEvent.add(handler); - } - - void Editor::FocusIn(event_token const &token) - { - _focusInEvent.remove(token); - } - - event_token Editor::FocusOut(WinUIEditor::FocusOutHandler const &handler) - { - return _focusOutEvent.add(handler); - } - - void Editor::FocusOut(event_token const &token) - { - _focusOutEvent.remove(token); - } - - event_token Editor::AutoCCompleted(WinUIEditor::AutoCCompletedHandler const &handler) - { - return _autoCCompletedEvent.add(handler); - } - - void Editor::AutoCCompleted(event_token const &token) - { - _autoCCompletedEvent.remove(token); - } - - event_token Editor::MarginRightClick(WinUIEditor::MarginRightClickHandler const &handler) - { - return _marginRightClickEvent.add(handler); - } - - void Editor::MarginRightClick(event_token const &token) - { - _marginRightClickEvent.remove(token); - } - - event_token Editor::AutoCSelectionChange(WinUIEditor::AutoCSelectionChangeHandler const &handler) - { - return _autoCSelectionChangeEvent.add(handler); - } - - void Editor::AutoCSelectionChange(event_token const &token) - { - _autoCSelectionChangeEvent.remove(token); - } - - /** - * Returns the number of bytes in the document. - */ - int64_t Editor::Length() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLength, static_cast(0), static_cast(0))); - } - - /** - * Returns the position of the caret. - */ - int64_t Editor::CurrentPos() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCurrentPos, static_cast(0), static_cast(0))); - } - - /** - * Sets the position of the caret. - */ - void Editor::CurrentPos(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCurrentPos, static_cast(value), static_cast(0)); - } - - /** - * Returns the position of the opposite end of the selection to the caret. - */ - int64_t Editor::Anchor() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAnchor, static_cast(0), static_cast(0))); - } - - /** - * Set the selection anchor to a position. The anchor is the opposite - * end of the selection from the caret. - */ - void Editor::Anchor(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAnchor, static_cast(value), static_cast(0)); - } - - /** - * Is undo history being collected? - */ - bool Editor::UndoCollection() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoCollection, static_cast(0), static_cast(0))); - } - - /** - * Choose between collecting actions into the undo - * history and discarding them. - */ - void Editor::UndoCollection(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetUndoCollection, static_cast(value), static_cast(0)); - } - - /** - * Are white space characters currently visible? - * Returns one of SCWS_* constants. - */ - WinUIEditor::WhiteSpace Editor::ViewWS() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetViewWS, static_cast(0), static_cast(0))); - } - - /** - * Make white space characters invisible, always visible or visible outside indentation. - */ - void Editor::ViewWS(WinUIEditor::WhiteSpace const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetViewWS, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the current tab draw mode. - * Returns one of SCTD_* constants. - */ - WinUIEditor::TabDrawMode Editor::TabDrawMode() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTabDrawMode, static_cast(0), static_cast(0))); - } - - /** - * Set how tabs are drawn when visible. - */ - void Editor::TabDrawMode(WinUIEditor::TabDrawMode const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTabDrawMode, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the position of the last correctly styled character. - */ - int64_t Editor::EndStyled() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetEndStyled, static_cast(0), static_cast(0))); - } - - /** - * Retrieve the current end of line mode - one of CRLF, CR, or LF. - */ - WinUIEditor::EndOfLine Editor::EOLMode() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetEOLMode, static_cast(0), static_cast(0))); - } - - /** - * Set the current end of line mode. - */ - void Editor::EOLMode(WinUIEditor::EndOfLine const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetEOLMode, static_cast(value), static_cast(0)); - } - - /** - * Is drawing done first into a buffer or direct to the screen? - */ - bool Editor::BufferedDraw() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetBufferedDraw, static_cast(0), static_cast(0))); - } - - /** - * If drawing is buffered then each line of text is drawn into a bitmap buffer - * before drawing it to the screen to avoid flicker. - */ - void Editor::BufferedDraw(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetBufferedDraw, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the visible size of a tab. - */ - int32_t Editor::TabWidth() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTabWidth, static_cast(0), static_cast(0))); - } - - /** - * Change the visible size of a tab to be a multiple of the width of a space character. - */ - void Editor::TabWidth(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTabWidth, static_cast(value), static_cast(0)); - } - - /** - * Get the minimum visual width of a tab. - */ - int32_t Editor::TabMinimumWidth() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTabMinimumWidth, static_cast(0), static_cast(0))); - } - - /** - * Set the minimum visual width of a tab. - */ - void Editor::TabMinimumWidth(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTabMinimumWidth, static_cast(value), static_cast(0)); - } - - /** - * Is the IME displayed in a window or inline? - */ - WinUIEditor::IMEInteraction Editor::IMEInteraction() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetIMEInteraction, static_cast(0), static_cast(0))); - } - - /** - * Choose to display the IME in a window or inline. - */ - void Editor::IMEInteraction(WinUIEditor::IMEInteraction const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIMEInteraction, static_cast(value), static_cast(0)); - } - - /** - * How many margins are there?. - */ - int32_t Editor::Margins() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMargins, static_cast(0), static_cast(0))); - } - - /** - * Allocate a non-standard number of margins. - */ - void Editor::Margins(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMargins, static_cast(value), static_cast(0)); - } - - /** - * Get the alpha of the selection. - */ - WinUIEditor::Alpha Editor::SelAlpha() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelAlpha, static_cast(0), static_cast(0))); - } - - /** - * Set the alpha of the selection. - */ - void Editor::SelAlpha(WinUIEditor::Alpha const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelAlpha, static_cast(value), static_cast(0)); - } - - /** - * Is the selection end of line filled? - */ - bool Editor::SelEOLFilled() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelEOLFilled, static_cast(0), static_cast(0))); - } - - /** - * Set the selection to have its end of line filled or not. - */ - void Editor::SelEOLFilled(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelEOLFilled, static_cast(value), static_cast(0)); - } - - /** - * Get the layer for drawing selections - */ - WinUIEditor::Layer Editor::SelectionLayer() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionLayer, static_cast(0), static_cast(0))); - } - - /** - * Set the layer for drawing selections: either opaquely on base layer or translucently over text - */ - void Editor::SelectionLayer(WinUIEditor::Layer const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionLayer, static_cast(value), static_cast(0)); - } - - /** - * Get the layer of the background of the line containing the caret. - */ - WinUIEditor::Layer Editor::CaretLineLayer() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretLineLayer, static_cast(0), static_cast(0))); - } - - /** - * Set the layer of the background of the line containing the caret. - */ - void Editor::CaretLineLayer(WinUIEditor::Layer const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretLineLayer, static_cast(value), static_cast(0)); - } - - /** - * Get only highlighting subline instead of whole line. - */ - bool Editor::CaretLineHighlightSubLine() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretLineHighlightSubLine, static_cast(0), static_cast(0))); - } - - /** - * Set only highlighting subline instead of whole line. - */ - void Editor::CaretLineHighlightSubLine(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretLineHighlightSubLine, static_cast(value), static_cast(0)); - } - - /** - * Get the time in milliseconds that the caret is on and off. - */ - int32_t Editor::CaretPeriod() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretPeriod, static_cast(0), static_cast(0))); - } - - /** - * Get the time in milliseconds that the caret is on and off. 0 = steady on. - */ - void Editor::CaretPeriod(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretPeriod, static_cast(value), static_cast(0)); - } - - /** - * Get the number of characters to have directly indexed categories - */ - int32_t Editor::CharacterCategoryOptimization() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCharacterCategoryOptimization, static_cast(0), static_cast(0))); - } - - /** - * Set the number of characters to have directly indexed categories - */ - void Editor::CharacterCategoryOptimization(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCharacterCategoryOptimization, static_cast(value), static_cast(0)); - } - - /** - * How many undo actions are in the history? - */ - int32_t Editor::UndoActions() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoActions, static_cast(0), static_cast(0))); - } - - /** - * Which action is the save point? - */ - int32_t Editor::UndoSavePoint() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoSavePoint, static_cast(0), static_cast(0))); - } - - /** - * Set action as the save point - */ - void Editor::UndoSavePoint(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetUndoSavePoint, static_cast(value), static_cast(0)); - } - - /** - * Which action is the detach point? - */ - int32_t Editor::UndoDetach() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoDetach, static_cast(0), static_cast(0))); - } - - /** - * Set action as the detach point - */ - void Editor::UndoDetach(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetUndoDetach, static_cast(value), static_cast(0)); - } - - /** - * Which action is the tentative point? - */ - int32_t Editor::UndoTentative() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoTentative, static_cast(0), static_cast(0))); - } - - /** - * Set action as the tentative point - */ - void Editor::UndoTentative(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetUndoTentative, static_cast(value), static_cast(0)); - } - - /** - * Which action is the current point? - */ - int32_t Editor::UndoCurrent() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoCurrent, static_cast(0), static_cast(0))); - } - - /** - * Set action as the current point - */ - void Editor::UndoCurrent(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetUndoCurrent, static_cast(value), static_cast(0)); - } - - /** - * Get the size of the dots used to mark space characters. - */ - int32_t Editor::WhitespaceSize() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWhitespaceSize, static_cast(0), static_cast(0))); - } - - /** - * Set the size of the dots used to mark space characters. - */ - void Editor::WhitespaceSize(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWhitespaceSize, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the last line number that has line state. - */ - int32_t Editor::MaxLineState() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMaxLineState, static_cast(0), static_cast(0))); - } - - /** - * Is the background of the line containing the caret in a different colour? - */ - bool Editor::CaretLineVisible() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretLineVisible, static_cast(0), static_cast(0))); - } - - /** - * Display the background of the line containing the caret in a different colour. - */ - void Editor::CaretLineVisible(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretLineVisible, static_cast(value), static_cast(0)); - } - - /** - * Get the colour of the background of the line containing the caret. - */ - int32_t Editor::CaretLineBack() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretLineBack, static_cast(0), static_cast(0))); - } - - /** - * Set the colour of the background of the line containing the caret. - */ - void Editor::CaretLineBack(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretLineBack, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the caret line frame width. - * Width = 0 means this option is disabled. - */ - int32_t Editor::CaretLineFrame() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretLineFrame, static_cast(0), static_cast(0))); - } - - /** - * Display the caret line framed. - * Set width != 0 to enable this option and width = 0 to disable it. - */ - void Editor::CaretLineFrame(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretLineFrame, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the auto-completion list separator character. - */ - int32_t Editor::AutoCSeparator() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetSeparator, static_cast(0), static_cast(0))); - } - - /** - * Change the separator character in the string setting up an auto-completion list. - * Default is space but can be changed if items contain space. - */ - void Editor::AutoCSeparator(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetSeparator, static_cast(value), static_cast(0)); - } - - /** - * Retrieve whether auto-completion cancelled by backspacing before start. - */ - bool Editor::AutoCCancelAtStart() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetCancelAtStart, static_cast(0), static_cast(0))); - } - - /** - * Should the auto-completion list be cancelled if the user backspaces to a - * position before where the box was created. - */ - void Editor::AutoCCancelAtStart(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetCancelAtStart, static_cast(value), static_cast(0)); - } - - /** - * Retrieve whether a single item auto-completion list automatically choose the item. - */ - bool Editor::AutoCChooseSingle() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetChooseSingle, static_cast(0), static_cast(0))); - } - - /** - * Should a single item auto-completion list automatically choose the item. - */ - void Editor::AutoCChooseSingle(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetChooseSingle, static_cast(value), static_cast(0)); - } - - /** - * Retrieve state of ignore case flag. - */ - bool Editor::AutoCIgnoreCase() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetIgnoreCase, static_cast(0), static_cast(0))); - } - - /** - * Set whether case is significant when performing auto-completion searches. - */ - void Editor::AutoCIgnoreCase(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetIgnoreCase, static_cast(value), static_cast(0)); - } - - /** - * Retrieve whether or not autocompletion is hidden automatically when nothing matches. - */ - bool Editor::AutoCAutoHide() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetAutoHide, static_cast(0), static_cast(0))); - } - - /** - * Set whether or not autocompletion is hidden automatically when nothing matches. - */ - void Editor::AutoCAutoHide(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetAutoHide, static_cast(value), static_cast(0)); - } - - /** - * Retrieve autocompletion options. - */ - WinUIEditor::AutoCompleteOption Editor::AutoCOptions() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetOptions, static_cast(0), static_cast(0))); - } - - /** - * Set autocompletion options. - */ - void Editor::AutoCOptions(WinUIEditor::AutoCompleteOption const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetOptions, static_cast(value), static_cast(0)); - } - - /** - * Retrieve whether or not autocompletion deletes any word characters - * after the inserted text upon completion. - */ - bool Editor::AutoCDropRestOfWord() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetDropRestOfWord, static_cast(0), static_cast(0))); - } - - /** - * Set whether or not autocompletion deletes any word characters - * after the inserted text upon completion. - */ - void Editor::AutoCDropRestOfWord(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetDropRestOfWord, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the auto-completion list type-separator character. - */ - int32_t Editor::AutoCTypeSeparator() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetTypeSeparator, static_cast(0), static_cast(0))); - } - - /** - * Change the type-separator character in the string setting up an auto-completion list. - * Default is '?' but can be changed if items contain '?'. - */ - void Editor::AutoCTypeSeparator(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetTypeSeparator, static_cast(value), static_cast(0)); - } - - /** - * Get the maximum width, in characters, of auto-completion and user lists. - */ - int32_t Editor::AutoCMaxWidth() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetMaxWidth, static_cast(0), static_cast(0))); - } - - /** - * 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. - */ - void Editor::AutoCMaxWidth(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetMaxWidth, static_cast(value), static_cast(0)); - } - - /** - * Set the maximum height, in rows, of auto-completion and user lists. - */ - int32_t Editor::AutoCMaxHeight() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetMaxHeight, static_cast(0), static_cast(0))); - } - - /** - * Set the maximum height, in rows, of auto-completion and user lists. - * The default is 5 rows. - */ - void Editor::AutoCMaxHeight(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetMaxHeight, static_cast(value), static_cast(0)); - } - - /** - * Retrieve indentation size. - */ - int32_t Editor::Indent() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetIndent, static_cast(0), static_cast(0))); - } - - /** - * Set the number of spaces used for one level of indentation. - */ - void Editor::Indent(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIndent, static_cast(value), static_cast(0)); - } - - /** - * Retrieve whether tabs will be used in indentation. - */ - bool Editor::UseTabs() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUseTabs, static_cast(0), static_cast(0))); - } - - /** - * Indentation will only use space characters if useTabs is false, otherwise - * it will use a combination of tabs and spaces. - */ - void Editor::UseTabs(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetUseTabs, static_cast(value), static_cast(0)); - } - - /** - * Is the horizontal scroll bar visible? - */ - bool Editor::HScrollBar() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetHScrollBar, static_cast(0), static_cast(0))); - } - - /** - * Show or hide the horizontal scroll bar. - */ - void Editor::HScrollBar(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetHScrollBar, static_cast(value), static_cast(0)); - } - - /** - * Are the indentation guides visible? - */ - WinUIEditor::IndentView Editor::IndentationGuides() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetIndentationGuides, static_cast(0), static_cast(0))); - } - - /** - * Show or hide indentation guides. - */ - void Editor::IndentationGuides(WinUIEditor::IndentView const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIndentationGuides, static_cast(value), static_cast(0)); - } - - /** - * Get the highlighted indentation guide column. - */ - int64_t Editor::HighlightGuide() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetHighlightGuide, static_cast(0), static_cast(0))); - } - - /** - * Set the highlighted indentation guide column. - * 0 = no highlighted guide. - */ - void Editor::HighlightGuide(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetHighlightGuide, static_cast(value), static_cast(0)); - } - - /** - * Get the code page used to interpret the bytes of the document as characters. - */ - int32_t Editor::CodePage() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCodePage, static_cast(0), static_cast(0))); - } - - /** - * 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. - */ - void Editor::CodePage(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCodePage, static_cast(value), static_cast(0)); - } - - /** - * Get the foreground colour of the caret. - */ - int32_t Editor::CaretFore() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretFore, static_cast(0), static_cast(0))); - } - - /** - * Set the foreground colour of the caret. - */ - void Editor::CaretFore(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretFore, static_cast(value), static_cast(0)); - } - - /** - * In read-only mode? - */ - bool Editor::ReadOnly() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetReadOnly, static_cast(0), static_cast(0))); - } - - /** - * Set to read only or read write. - */ - void Editor::ReadOnly(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetReadOnly, static_cast(value), static_cast(0)); - } - - /** - * Returns the position at the start of the selection. - */ - int64_t Editor::SelectionStart() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionStart, static_cast(0), static_cast(0))); - } - - /** - * Sets the position that starts the selection - this becomes the anchor. - */ - void Editor::SelectionStart(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionStart, static_cast(value), static_cast(0)); - } - - /** - * Returns the position at the end of the selection. - */ - int64_t Editor::SelectionEnd() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionEnd, static_cast(0), static_cast(0))); - } - - /** - * Sets the position that ends the selection - this becomes the caret. - */ - void Editor::SelectionEnd(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionEnd, static_cast(value), static_cast(0)); - } - - /** - * Returns the print magnification. - */ - int32_t Editor::PrintMagnification() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPrintMagnification, static_cast(0), static_cast(0))); - } - - /** - * Sets the print magnification added to the point size of each style for printing. - */ - void Editor::PrintMagnification(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetPrintMagnification, static_cast(value), static_cast(0)); - } - - /** - * Returns the print colour mode. - */ - WinUIEditor::PrintOption Editor::PrintColourMode() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPrintColourMode, static_cast(0), static_cast(0))); - } - - /** - * Modify colours when printing for clearer printed text. - */ - void Editor::PrintColourMode(WinUIEditor::PrintOption const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetPrintColourMode, static_cast(value), static_cast(0)); - } - - /** - * Report change history status. - */ - WinUIEditor::ChangeHistoryOption Editor::ChangeHistory() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetChangeHistory, static_cast(0), static_cast(0))); - } - - /** - * Enable or disable change history. - */ - void Editor::ChangeHistory(WinUIEditor::ChangeHistoryOption const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetChangeHistory, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the display line at the top of the display. - */ - int64_t Editor::FirstVisibleLine() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetFirstVisibleLine, static_cast(0), static_cast(0))); - } - - /** - * Scroll so that a display line is at the top of the display. - */ - void Editor::FirstVisibleLine(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFirstVisibleLine, static_cast(value), static_cast(0)); - } - - /** - * Returns the number of lines in the document. There is always at least one. - */ - int64_t Editor::LineCount() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineCount, static_cast(0), static_cast(0))); - } - - /** - * Returns the size in pixels of the left margin. - */ - int32_t Editor::MarginLeft() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginLeft, static_cast(0), static_cast(0))); - } - - /** - * Sets the size in pixels of the left margin. - */ - void Editor::MarginLeft(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginLeft, static_cast(0), static_cast(value)); - } - - /** - * Returns the size in pixels of the right margin. - */ - int32_t Editor::MarginRight() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginRight, static_cast(0), static_cast(0))); - } - - /** - * Sets the size in pixels of the right margin. - */ - void Editor::MarginRight(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginRight, static_cast(0), static_cast(value)); - } - - /** - * Is the document different from when it was last saved? - */ - bool Editor::Modify() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetModify, static_cast(0), static_cast(0))); - } - - bool Editor::SelectionHidden() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionHidden, static_cast(0), static_cast(0))); - } - - /** - * Retrieve the number of characters in the document. - */ - int64_t Editor::TextLength() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTextLength, static_cast(0), static_cast(0))); - } - - /** - * Retrieve a pointer to a function that processes messages for this Scintilla. - */ - uint64_t Editor::DirectFunction() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetDirectFunction, static_cast(0), static_cast(0))); - } - - /** - * Retrieve a pointer to a function that processes messages for this Scintilla and returns status. - */ - uint64_t Editor::DirectStatusFunction() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetDirectStatusFunction, static_cast(0), static_cast(0))); - } - - /** - * Retrieve a pointer value to use as the first argument when calling - * the function returned by GetDirectFunction. - */ - uint64_t Editor::DirectPointer() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetDirectPointer, static_cast(0), static_cast(0))); - } - - /** - * Returns true if overtype mode is active otherwise false is returned. - */ - bool Editor::Overtype() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetOvertype, static_cast(0), static_cast(0))); - } - - /** - * Set to overtype (true) or insert mode. - */ - void Editor::Overtype(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetOvertype, static_cast(value), static_cast(0)); - } - - /** - * Returns the width of the insert mode caret. - */ - int32_t Editor::CaretWidth() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretWidth, static_cast(0), static_cast(0))); - } - - /** - * Set the width of the insert mode caret. - */ - void Editor::CaretWidth(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretWidth, static_cast(value), static_cast(0)); - } - - /** - * Get the position that starts the target. - */ - int64_t Editor::TargetStart() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTargetStart, static_cast(0), static_cast(0))); - } - - /** - * Sets the position that starts the target which is used for updating the - * document without affecting the scroll position. - */ - void Editor::TargetStart(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTargetStart, static_cast(value), static_cast(0)); - } - - /** - * Get the virtual space of the target start - */ - int64_t Editor::TargetStartVirtualSpace() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTargetStartVirtualSpace, static_cast(0), static_cast(0))); - } - - /** - * Sets the virtual space of the target start - */ - void Editor::TargetStartVirtualSpace(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTargetStartVirtualSpace, static_cast(value), static_cast(0)); - } - - /** - * Get the position that ends the target. - */ - int64_t Editor::TargetEnd() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTargetEnd, static_cast(0), static_cast(0))); - } - - /** - * Sets the position that ends the target which is used for updating the - * document without affecting the scroll position. - */ - void Editor::TargetEnd(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTargetEnd, static_cast(value), static_cast(0)); - } - - /** - * Get the virtual space of the target end - */ - int64_t Editor::TargetEndVirtualSpace() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTargetEndVirtualSpace, static_cast(0), static_cast(0))); - } - - /** - * Sets the virtual space of the target end - */ - void Editor::TargetEndVirtualSpace(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTargetEndVirtualSpace, static_cast(value), static_cast(0)); - } - - /** - * Get the search flags used by SearchInTarget. - */ - WinUIEditor::FindOption Editor::SearchFlags() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSearchFlags, static_cast(0), static_cast(0))); - } - - /** - * Set the search flags used by SearchInTarget. - */ - void Editor::SearchFlags(WinUIEditor::FindOption const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSearchFlags, static_cast(value), static_cast(0)); - } - - /** - * Are all lines visible? - */ - bool Editor::AllLinesVisible() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAllLinesVisible, static_cast(0), static_cast(0))); - } - - /** - * Get the style of fold display text. - */ - WinUIEditor::FoldDisplayTextStyle Editor::FoldDisplayTextStyle() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::FoldDisplayTextGetStyle, static_cast(0), static_cast(0))); - } - - /** - * Set the style of fold display text. - */ - void Editor::FoldDisplayTextStyle(WinUIEditor::FoldDisplayTextStyle const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::FoldDisplayTextSetStyle, static_cast(value), static_cast(0)); - } - - /** - * Get automatic folding behaviours. - */ - WinUIEditor::AutomaticFold Editor::AutomaticFold() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAutomaticFold, static_cast(0), static_cast(0))); - } - - /** - * Set automatic folding behaviours. - */ - void Editor::AutomaticFold(WinUIEditor::AutomaticFold const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAutomaticFold, static_cast(value), static_cast(0)); - } - - /** - * Does a tab pressed when caret is within indentation indent? - */ - bool Editor::TabIndents() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTabIndents, static_cast(0), static_cast(0))); - } - - /** - * Sets whether a tab pressed when caret is within indentation indents. - */ - void Editor::TabIndents(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTabIndents, static_cast(value), static_cast(0)); - } - - /** - * Does a backspace pressed when caret is within indentation unindent? - */ - bool Editor::BackSpaceUnIndents() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetBackSpaceUnIndents, static_cast(0), static_cast(0))); - } - - /** - * Sets whether a backspace pressed when caret is within indentation unindents. - */ - void Editor::BackSpaceUnIndents(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetBackSpaceUnIndents, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the time the mouse must sit still to generate a mouse dwell event. - */ - int32_t Editor::MouseDwellTime() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMouseDwellTime, static_cast(0), static_cast(0))); - } - - /** - * Sets the time the mouse must sit still to generate a mouse dwell event. - */ - void Editor::MouseDwellTime(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMouseDwellTime, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the limits to idle styling. - */ - WinUIEditor::IdleStyling Editor::IdleStyling() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetIdleStyling, static_cast(0), static_cast(0))); - } - - /** - * Sets limits to idle styling. - */ - void Editor::IdleStyling(WinUIEditor::IdleStyling const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIdleStyling, static_cast(value), static_cast(0)); - } - - /** - * Retrieve whether text is word wrapped. - */ - WinUIEditor::Wrap Editor::WrapMode() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWrapMode, static_cast(0), static_cast(0))); - } - - /** - * Sets whether text is word wrapped. - */ - void Editor::WrapMode(WinUIEditor::Wrap const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWrapMode, static_cast(value), static_cast(0)); - } - - /** - * Retrive the display mode of visual flags for wrapped lines. - */ - WinUIEditor::WrapVisualFlag Editor::WrapVisualFlags() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWrapVisualFlags, static_cast(0), static_cast(0))); - } - - /** - * Set the display mode of visual flags for wrapped lines. - */ - void Editor::WrapVisualFlags(WinUIEditor::WrapVisualFlag const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWrapVisualFlags, static_cast(value), static_cast(0)); - } - - /** - * Retrive the location of visual flags for wrapped lines. - */ - WinUIEditor::WrapVisualLocation Editor::WrapVisualFlagsLocation() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWrapVisualFlagsLocation, static_cast(0), static_cast(0))); - } - - /** - * Set the location of visual flags for wrapped lines. - */ - void Editor::WrapVisualFlagsLocation(WinUIEditor::WrapVisualLocation const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWrapVisualFlagsLocation, static_cast(value), static_cast(0)); - } - - /** - * Retrive the start indent for wrapped lines. - */ - int32_t Editor::WrapStartIndent() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWrapStartIndent, static_cast(0), static_cast(0))); - } - - /** - * Set the start indent for wrapped lines. - */ - void Editor::WrapStartIndent(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWrapStartIndent, static_cast(value), static_cast(0)); - } - - /** - * Retrieve how wrapped sublines are placed. Default is fixed. - */ - WinUIEditor::WrapIndentMode Editor::WrapIndentMode() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWrapIndentMode, static_cast(0), static_cast(0))); - } - - /** - * Sets how wrapped sublines are placed. Default is fixed. - */ - void Editor::WrapIndentMode(WinUIEditor::WrapIndentMode const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWrapIndentMode, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the degree of caching of layout information. - */ - WinUIEditor::LineCache Editor::LayoutCache() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLayoutCache, static_cast(0), static_cast(0))); - } - - /** - * Sets the degree of caching of layout information. - */ - void Editor::LayoutCache(WinUIEditor::LineCache const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetLayoutCache, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the document width assumed for scrolling. - */ - int32_t Editor::ScrollWidth() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetScrollWidth, static_cast(0), static_cast(0))); - } - - /** - * Sets the document width assumed for scrolling. - */ - void Editor::ScrollWidth(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetScrollWidth, static_cast(value), static_cast(0)); - } - - /** - * Retrieve whether the scroll width tracks wide lines. - */ - bool Editor::ScrollWidthTracking() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetScrollWidthTracking, static_cast(0), static_cast(0))); - } - - /** - * Sets whether the maximum width line displayed is used to set scroll width. - */ - void Editor::ScrollWidthTracking(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetScrollWidthTracking, static_cast(value), static_cast(0)); - } - - /** - * Retrieve whether the maximum scroll position has the last - * line at the bottom of the view. - */ - bool Editor::EndAtLastLine() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetEndAtLastLine, static_cast(0), static_cast(0))); - } - - /** - * 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. - */ - void Editor::EndAtLastLine(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetEndAtLastLine, static_cast(value), static_cast(0)); - } - - /** - * Is the vertical scroll bar visible? - */ - bool Editor::VScrollBar() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetVScrollBar, static_cast(0), static_cast(0))); - } - - /** - * Show or hide the vertical scroll bar. - */ - void Editor::VScrollBar(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetVScrollBar, static_cast(value), static_cast(0)); - } - - /** - * How many phases is drawing done in? - */ - WinUIEditor::PhasesDraw Editor::PhasesDraw() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPhasesDraw, static_cast(0), static_cast(0))); - } - - /** - * 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. - */ - void Editor::PhasesDraw(WinUIEditor::PhasesDraw const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetPhasesDraw, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the quality level for text. - */ - WinUIEditor::FontQuality Editor::FontQuality() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetFontQuality, static_cast(0), static_cast(0))); - } - - /** - * Choose the quality level for text from the FontQuality enumeration. - */ - void Editor::FontQuality(WinUIEditor::FontQuality const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFontQuality, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the effect of pasting when there are multiple selections. - */ - WinUIEditor::MultiPaste Editor::MultiPaste() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMultiPaste, static_cast(0), static_cast(0))); - } - - /** - * Change the effect of pasting when there are multiple selections. - */ - void Editor::MultiPaste(WinUIEditor::MultiPaste const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMultiPaste, static_cast(value), static_cast(0)); - } - - /** - * Report accessibility status. - */ - WinUIEditor::Accessibility Editor::Accessibility() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAccessibility, static_cast(0), static_cast(0))); - } - - /** - * Enable or disable accessibility. - */ - void Editor::Accessibility(WinUIEditor::Accessibility const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAccessibility, static_cast(value), static_cast(0)); - } - - /** - * Are the end of line characters visible? - */ - bool Editor::ViewEOL() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetViewEOL, static_cast(0), static_cast(0))); - } - - /** - * Make the end of line characters visible or invisible. - */ - void Editor::ViewEOL(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetViewEOL, static_cast(value), static_cast(0)); - } - - /** - * Retrieve a pointer to the document object. - */ - uint64_t Editor::DocPointer() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetDocPointer, static_cast(0), static_cast(0))); - } - - /** - * Change the document object used. - */ - void Editor::DocPointer(uint64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetDocPointer, static_cast(0), static_cast(value)); - } - - /** - * Retrieve the column number which text should be kept within. - */ - int64_t Editor::EdgeColumn() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetEdgeColumn, static_cast(0), static_cast(0))); - } - - /** - * Set the column number of the edge. - * If text goes past the edge then it is highlighted. - */ - void Editor::EdgeColumn(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetEdgeColumn, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the edge highlight mode. - */ - WinUIEditor::EdgeVisualStyle Editor::EdgeMode() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetEdgeMode, static_cast(0), static_cast(0))); - } - - /** - * 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). - */ - void Editor::EdgeMode(WinUIEditor::EdgeVisualStyle const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetEdgeMode, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the colour used in edge indication. - */ - int32_t Editor::EdgeColour() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetEdgeColour, static_cast(0), static_cast(0))); - } - - /** - * Change the colour used in edge indication. - */ - void Editor::EdgeColour(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetEdgeColour, static_cast(value), static_cast(0)); - } - - /** - * Retrieves the number of lines completely visible. - */ - int64_t Editor::LinesOnScreen() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::LinesOnScreen, static_cast(0), static_cast(0))); - } - - /** - * Is the selection rectangular? The alternative is the more common stream selection. - */ - bool Editor::SelectionIsRectangle() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SelectionIsRectangle, static_cast(0), static_cast(0))); - } - - /** - * Retrieve the zoom level. - */ - int32_t Editor::Zoom() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetZoom, static_cast(0), static_cast(0))); - } - - /** - * 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. - */ - void Editor::Zoom(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetZoom, static_cast(value), static_cast(0)); - } - - /** - * Get which document options are set. - */ - WinUIEditor::DocumentOption Editor::DocumentOptions() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetDocumentOptions, static_cast(0), static_cast(0))); - } - - /** - * Get which document modification events are sent to the container. - */ - WinUIEditor::ModificationFlags Editor::ModEventMask() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetModEventMask, static_cast(0), static_cast(0))); - } - - /** - * Set which document modification events are sent to the container. - */ - void Editor::ModEventMask(WinUIEditor::ModificationFlags const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetModEventMask, static_cast(value), static_cast(0)); - } - - /** - * Get whether command events are sent to the container. - */ - bool Editor::CommandEvents() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCommandEvents, static_cast(0), static_cast(0))); - } - - /** - * Set whether command events are sent to the container. - */ - void Editor::CommandEvents(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCommandEvents, static_cast(value), static_cast(0)); - } - - /** - * Get internal focus flag. - */ - bool Editor::Focus() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetFocus, static_cast(0), static_cast(0))); - } - - /** - * Change internal focus flag. - */ - void Editor::Focus(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFocus, static_cast(value), static_cast(0)); - } - - /** - * Get error status. - */ - WinUIEditor::Status Editor::Status() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetStatus, static_cast(0), static_cast(0))); - } - - /** - * Change error status - 0 = OK. - */ - void Editor::Status(WinUIEditor::Status const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetStatus, static_cast(value), static_cast(0)); - } - - /** - * Get whether mouse gets captured. - */ - bool Editor::MouseDownCaptures() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMouseDownCaptures, static_cast(0), static_cast(0))); - } - - /** - * Set whether the mouse is captured when its button is pressed. - */ - void Editor::MouseDownCaptures(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMouseDownCaptures, static_cast(value), static_cast(0)); - } - - /** - * Get whether mouse wheel can be active outside the window. - */ - bool Editor::MouseWheelCaptures() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMouseWheelCaptures, static_cast(0), static_cast(0))); - } - - /** - * Set whether the mouse wheel can be active outside the window. - */ - void Editor::MouseWheelCaptures(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMouseWheelCaptures, static_cast(value), static_cast(0)); - } - - /** - * Get cursor type. - */ - WinUIEditor::CursorShape Editor::Cursor() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCursor, static_cast(0), static_cast(0))); - } - - /** - * Sets the cursor to one of the SC_CURSOR* values. - */ - void Editor::Cursor(WinUIEditor::CursorShape const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCursor, static_cast(value), static_cast(0)); - } - - /** - * Get the way control characters are displayed. - */ - int32_t Editor::ControlCharSymbol() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetControlCharSymbol, static_cast(0), static_cast(0))); - } - - /** - * Change the way control characters are displayed: - * If symbol is < 32, keep the drawn way, else, use the given character. - */ - void Editor::ControlCharSymbol(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetControlCharSymbol, static_cast(value), static_cast(0)); - } - - /** - * Get the xOffset (ie, horizontal scroll position). - */ - int32_t Editor::XOffset() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetXOffset, static_cast(0), static_cast(0))); - } - - /** - * Set the xOffset (ie, horizontal scroll position). - */ - void Editor::XOffset(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetXOffset, static_cast(value), static_cast(0)); - } - - /** - * Is printing line wrapped? - */ - WinUIEditor::Wrap Editor::PrintWrapMode() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPrintWrapMode, static_cast(0), static_cast(0))); - } - - /** - * Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). - */ - void Editor::PrintWrapMode(WinUIEditor::Wrap const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetPrintWrapMode, static_cast(value), static_cast(0)); - } - - /** - * Get whether underlining for active hotspots. - */ - bool Editor::HotspotActiveUnderline() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetHotspotActiveUnderline, static_cast(0), static_cast(0))); - } - - /** - * Enable / Disable underlining active hotspots. - */ - void Editor::HotspotActiveUnderline(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetHotspotActiveUnderline, static_cast(value), static_cast(0)); - } - - /** - * Get the HotspotSingleLine property - */ - bool Editor::HotspotSingleLine() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetHotspotSingleLine, static_cast(0), static_cast(0))); - } - - /** - * Limit hotspots to single line so hotspots on two lines don't merge. - */ - void Editor::HotspotSingleLine(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetHotspotSingleLine, static_cast(value), static_cast(0)); - } - - /** - * Get the mode of the current selection. - */ - WinUIEditor::SelectionMode Editor::SelectionMode() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionMode, static_cast(0), static_cast(0))); - } - - /** - * Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or - * by lines (SC_SEL_LINES). - */ - void Editor::SelectionMode(WinUIEditor::SelectionMode const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionMode, static_cast(value), static_cast(0)); - } - - /** - * Get whether or not regular caret moves will extend or reduce the selection. - */ - bool Editor::MoveExtendsSelection() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMoveExtendsSelection, static_cast(0), static_cast(0))); - } - - /** - * Set whether or not regular caret moves will extend or reduce the selection. - */ - void Editor::MoveExtendsSelection(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMoveExtendsSelection, static_cast(value), static_cast(0)); - } - - /** - * Get currently selected item position in the auto-completion list - */ - int32_t Editor::AutoCCurrent() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetCurrent, static_cast(0), static_cast(0))); - } - - /** - * Get auto-completion case insensitive behaviour. - */ - WinUIEditor::CaseInsensitiveBehaviour Editor::AutoCCaseInsensitiveBehaviour() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetCaseInsensitiveBehaviour, static_cast(0), static_cast(0))); - } - - /** - * Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. - */ - void Editor::AutoCCaseInsensitiveBehaviour(WinUIEditor::CaseInsensitiveBehaviour const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetCaseInsensitiveBehaviour, static_cast(value), static_cast(0)); - } - - /** - * Retrieve the effect of autocompleting when there are multiple selections. - */ - WinUIEditor::MultiAutoComplete Editor::AutoCMulti() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetMulti, static_cast(0), static_cast(0))); - } - - /** - * Change the effect of autocompleting when there are multiple selections. - */ - void Editor::AutoCMulti(WinUIEditor::MultiAutoComplete const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetMulti, static_cast(value), static_cast(0)); - } - - /** - * Get the way autocompletion lists are ordered. - */ - WinUIEditor::Ordering Editor::AutoCOrder() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetOrder, static_cast(0), static_cast(0))); - } - - /** - * Set the way autocompletion lists are ordered. - */ - void Editor::AutoCOrder(WinUIEditor::Ordering const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetOrder, static_cast(value), static_cast(0)); - } - - /** - * Can the caret preferred x position only be changed by explicit movement commands? - */ - WinUIEditor::CaretSticky Editor::CaretSticky() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretSticky, static_cast(0), static_cast(0))); - } - - /** - * Stop the caret preferred x position changing when the user types. - */ - void Editor::CaretSticky(WinUIEditor::CaretSticky const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretSticky, static_cast(value), static_cast(0)); - } - - /** - * Get convert-on-paste setting - */ - bool Editor::PasteConvertEndings() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPasteConvertEndings, static_cast(0), static_cast(0))); - } - - /** - * Enable/Disable convert-on-paste for line endings - */ - void Editor::PasteConvertEndings(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetPasteConvertEndings, static_cast(value), static_cast(0)); - } - - /** - * Get the background alpha of the caret line. - */ - WinUIEditor::Alpha Editor::CaretLineBackAlpha() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretLineBackAlpha, static_cast(0), static_cast(0))); - } - - /** - * Set background alpha of the caret line. - */ - void Editor::CaretLineBackAlpha(WinUIEditor::Alpha const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretLineBackAlpha, static_cast(value), static_cast(0)); - } - - /** - * Returns the current style of the caret. - */ - WinUIEditor::CaretStyle Editor::CaretStyle() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretStyle, static_cast(0), static_cast(0))); - } - - /** - * Set the style of the caret to be drawn. - */ - void Editor::CaretStyle(WinUIEditor::CaretStyle const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretStyle, static_cast(value), static_cast(0)); - } - - /** - * Get the current indicator - */ - int32_t Editor::IndicatorCurrent() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetIndicatorCurrent, static_cast(0), static_cast(0))); - } - - /** - * Set the indicator used for IndicatorFillRange and IndicatorClearRange - */ - void Editor::IndicatorCurrent(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIndicatorCurrent, static_cast(value), static_cast(0)); - } - - /** - * Get the current indicator value - */ - int32_t Editor::IndicatorValue() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetIndicatorValue, static_cast(0), static_cast(0))); - } - - /** - * Set the value used for IndicatorFillRange - */ - void Editor::IndicatorValue(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIndicatorValue, static_cast(value), static_cast(0)); - } - - /** - * How many entries are allocated to the position cache? - */ - int32_t Editor::PositionCache() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPositionCache, static_cast(0), static_cast(0))); - } - - /** - * Set number of entries in position cache - */ - void Editor::PositionCache(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetPositionCache, static_cast(value), static_cast(0)); - } - - /** - * Get maximum number of threads used for layout - */ - int32_t Editor::LayoutThreads() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLayoutThreads, static_cast(0), static_cast(0))); - } - - /** - * Set maximum number of threads used for layout - */ - void Editor::LayoutThreads(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetLayoutThreads, static_cast(value), static_cast(0)); - } - - /** - * Compact the document buffer and return a read-only pointer to the - * characters in the document. - */ - uint64_t Editor::CharacterPointer() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCharacterPointer, static_cast(0), static_cast(0))); - } - - /** - * Return a position which, to avoid performance costs, should not be within - * the range of a call to GetRangePointer. - */ - int64_t Editor::GapPosition() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetGapPosition, static_cast(0), static_cast(0))); - } - - /** - * Get extra ascent for each line - */ - int32_t Editor::ExtraAscent() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetExtraAscent, static_cast(0), static_cast(0))); - } - - /** - * Set extra ascent for each line - */ - void Editor::ExtraAscent(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetExtraAscent, static_cast(value), static_cast(0)); - } - - /** - * Get extra descent for each line - */ - int32_t Editor::ExtraDescent() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetExtraDescent, static_cast(0), static_cast(0))); - } - - /** - * Set extra descent for each line - */ - void Editor::ExtraDescent(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetExtraDescent, static_cast(value), static_cast(0)); - } - - /** - * Get the start of the range of style numbers used for margin text - */ - int32_t Editor::MarginStyleOffset() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarginGetStyleOffset, static_cast(0), static_cast(0))); - } - - /** - * Get the start of the range of style numbers used for margin text - */ - void Editor::MarginStyleOffset(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarginSetStyleOffset, static_cast(value), static_cast(0)); - } - - /** - * Get the margin options. - */ - WinUIEditor::MarginOption Editor::MarginOptions() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginOptions, static_cast(0), static_cast(0))); - } - - /** - * Set the margin options. - */ - void Editor::MarginOptions(WinUIEditor::MarginOption const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginOptions, static_cast(value), static_cast(0)); - } - - /** - * Get the visibility for the annotations for a view - */ - WinUIEditor::AnnotationVisible Editor::AnnotationVisible() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetVisible, static_cast(0), static_cast(0))); - } - - /** - * Set the visibility for the annotations for a view - */ - void Editor::AnnotationVisible(WinUIEditor::AnnotationVisible const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationSetVisible, static_cast(value), static_cast(0)); - } - - /** - * Get the start of the range of style numbers used for annotations - */ - int32_t Editor::AnnotationStyleOffset() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetStyleOffset, static_cast(0), static_cast(0))); - } - - /** - * Get the start of the range of style numbers used for annotations - */ - void Editor::AnnotationStyleOffset(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationSetStyleOffset, static_cast(value), static_cast(0)); - } - - /** - * Whether switching to rectangular mode while selecting with the mouse is allowed. - */ - bool Editor::MouseSelectionRectangularSwitch() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMouseSelectionRectangularSwitch, static_cast(0), static_cast(0))); - } - - /** - * Set whether switching to rectangular mode while selecting with the mouse is allowed. - */ - void Editor::MouseSelectionRectangularSwitch(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMouseSelectionRectangularSwitch, static_cast(value), static_cast(0)); - } - - /** - * Whether multiple selections can be made - */ - bool Editor::MultipleSelection() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMultipleSelection, static_cast(0), static_cast(0))); - } - - /** - * Set whether multiple selections can be made - */ - void Editor::MultipleSelection(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMultipleSelection, static_cast(value), static_cast(0)); - } - - /** - * Whether typing can be performed into multiple selections - */ - bool Editor::AdditionalSelectionTyping() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAdditionalSelectionTyping, static_cast(0), static_cast(0))); - } - - /** - * Set whether typing can be performed into multiple selections - */ - void Editor::AdditionalSelectionTyping(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAdditionalSelectionTyping, static_cast(value), static_cast(0)); - } - - /** - * Whether additional carets will blink - */ - bool Editor::AdditionalCaretsBlink() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAdditionalCaretsBlink, static_cast(0), static_cast(0))); - } - - /** - * Set whether additional carets will blink - */ - void Editor::AdditionalCaretsBlink(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAdditionalCaretsBlink, static_cast(value), static_cast(0)); - } - - /** - * Whether additional carets are visible - */ - bool Editor::AdditionalCaretsVisible() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAdditionalCaretsVisible, static_cast(0), static_cast(0))); - } - - /** - * Set whether additional carets are visible - */ - void Editor::AdditionalCaretsVisible(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAdditionalCaretsVisible, static_cast(value), static_cast(0)); - } - - /** - * How many selections are there? - */ - int32_t Editor::Selections() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelections, static_cast(0), static_cast(0))); - } - - /** - * Is every selected range empty? - */ - bool Editor::SelectionEmpty() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionEmpty, static_cast(0), static_cast(0))); - } - - /** - * Which selection is the main selection - */ - int32_t Editor::MainSelection() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMainSelection, static_cast(0), static_cast(0))); - } - - /** - * Set the main selection - */ - void Editor::MainSelection(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMainSelection, static_cast(value), static_cast(0)); - } - - /** - * Return the caret position of the rectangular selection. - */ - int64_t Editor::RectangularSelectionCaret() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRectangularSelectionCaret, static_cast(0), static_cast(0))); - } - - /** - * Set the caret position of the rectangular selection. - */ - void Editor::RectangularSelectionCaret(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRectangularSelectionCaret, static_cast(value), static_cast(0)); - } - - /** - * Return the anchor position of the rectangular selection. - */ - int64_t Editor::RectangularSelectionAnchor() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRectangularSelectionAnchor, static_cast(0), static_cast(0))); - } - - /** - * Set the anchor position of the rectangular selection. - */ - void Editor::RectangularSelectionAnchor(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRectangularSelectionAnchor, static_cast(value), static_cast(0)); - } - - /** - * Return the virtual space of the caret of the rectangular selection. - */ - int64_t Editor::RectangularSelectionCaretVirtualSpace() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRectangularSelectionCaretVirtualSpace, static_cast(0), static_cast(0))); - } - - /** - * Set the virtual space of the caret of the rectangular selection. - */ - void Editor::RectangularSelectionCaretVirtualSpace(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRectangularSelectionCaretVirtualSpace, static_cast(value), static_cast(0)); - } - - /** - * Return the virtual space of the anchor of the rectangular selection. - */ - int64_t Editor::RectangularSelectionAnchorVirtualSpace() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRectangularSelectionAnchorVirtualSpace, static_cast(0), static_cast(0))); - } - - /** - * Set the virtual space of the anchor of the rectangular selection. - */ - void Editor::RectangularSelectionAnchorVirtualSpace(int64_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRectangularSelectionAnchorVirtualSpace, static_cast(value), static_cast(0)); - } - - /** - * Return options for virtual space behaviour. - */ - WinUIEditor::VirtualSpace Editor::VirtualSpaceOptions() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetVirtualSpaceOptions, static_cast(0), static_cast(0))); - } - - /** - * Set options for virtual space behaviour. - */ - void Editor::VirtualSpaceOptions(WinUIEditor::VirtualSpace const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetVirtualSpaceOptions, static_cast(value), static_cast(0)); - } - - /** - * Get the modifier key used for rectangular selection. - */ - int32_t Editor::RectangularSelectionModifier() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRectangularSelectionModifier, static_cast(0), static_cast(0))); - } - - void Editor::RectangularSelectionModifier(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRectangularSelectionModifier, static_cast(value), static_cast(0)); - } - - /** - * Get the alpha of the selection. - */ - WinUIEditor::Alpha Editor::AdditionalSelAlpha() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAdditionalSelAlpha, static_cast(0), static_cast(0))); - } - - /** - * Set the alpha of the selection. - */ - void Editor::AdditionalSelAlpha(WinUIEditor::Alpha const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAdditionalSelAlpha, static_cast(value), static_cast(0)); - } - - /** - * Get the foreground colour of additional carets. - */ - int32_t Editor::AdditionalCaretFore() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetAdditionalCaretFore, static_cast(0), static_cast(0))); - } - - /** - * Set the foreground colour of additional carets. - */ - void Editor::AdditionalCaretFore(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAdditionalCaretFore, static_cast(value), static_cast(0)); - } - - /** - * Get the identifier. - */ - int32_t Editor::Identifier() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetIdentifier, static_cast(0), static_cast(0))); - } - - /** - * Set the identifier reported as idFrom in notification messages. - */ - void Editor::Identifier(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIdentifier, static_cast(value), static_cast(0)); - } - - /** - * Get the tech. - */ - WinUIEditor::Technology Editor::Technology() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTechnology, static_cast(0), static_cast(0))); - } - - /** - * Set the technology used. - */ - void Editor::Technology(WinUIEditor::Technology const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTechnology, static_cast(value), static_cast(0)); - } - - /** - * Is the caret line always visible? - */ - bool Editor::CaretLineVisibleAlways() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCaretLineVisibleAlways, static_cast(0), static_cast(0))); - } - - /** - * Sets the caret line to always visible. - */ - void Editor::CaretLineVisibleAlways(bool value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCaretLineVisibleAlways, static_cast(value), static_cast(0)); - } - - /** - * Get the line end types currently allowed. - */ - WinUIEditor::LineEndType Editor::LineEndTypesAllowed() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineEndTypesAllowed, static_cast(0), static_cast(0))); - } - - /** - * Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. - */ - void Editor::LineEndTypesAllowed(WinUIEditor::LineEndType const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetLineEndTypesAllowed, static_cast(value), static_cast(0)); - } - - /** - * Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. - */ - WinUIEditor::LineEndType Editor::LineEndTypesActive() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineEndTypesActive, static_cast(0), static_cast(0))); - } - - /** - * Get the visibility for the end of line annotations for a view - */ - WinUIEditor::EOLAnnotationVisible Editor::EOLAnnotationVisible() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationGetVisible, static_cast(0), static_cast(0))); - } - - /** - * Set the visibility for the end of line annotations for a view - */ - void Editor::EOLAnnotationVisible(WinUIEditor::EOLAnnotationVisible const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationSetVisible, static_cast(value), static_cast(0)); - } - - /** - * Get the start of the range of style numbers used for end of line annotations - */ - int32_t Editor::EOLAnnotationStyleOffset() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationGetStyleOffset, static_cast(0), static_cast(0))); - } - - /** - * Get the start of the range of style numbers used for end of line annotations - */ - void Editor::EOLAnnotationStyleOffset(int32_t value) - { - _editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationSetStyleOffset, static_cast(value), static_cast(0)); - } - - /** - * Retrieve line character index state. - */ - WinUIEditor::LineCharacterIndexType Editor::LineCharacterIndex() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineCharacterIndex, static_cast(0), static_cast(0))); - } - - /** - * Retrieve the lexing language of the document. - */ - int32_t Editor::Lexer() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLexer, static_cast(0), static_cast(0))); - } - - /** - * Bit set of LineEndType enumertion for which line ends beyond the standard - * LF, CR, and CRLF are supported by the lexer. - */ - WinUIEditor::LineEndType Editor::LineEndTypesSupported() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineEndTypesSupported, static_cast(0), static_cast(0))); - } - - /** - * Where styles are duplicated by a feature such as active/inactive code - * return the distance between the two types. - */ - int32_t Editor::DistanceToSecondaryStyles() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::DistanceToSecondaryStyles, static_cast(0), static_cast(0))); - } - - /** - * Retrieve the number of named styles for the lexer. - */ - int32_t Editor::NamedStyles() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetNamedStyles, static_cast(0), static_cast(0))); - } - - /** - * Retrieve bidirectional text display state. - */ - WinUIEditor::Bidirectional Editor::Bidirectional() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetBidirectional, static_cast(0), static_cast(0))); - } - - /** - * Set bidirectional text display state. - */ - void Editor::Bidirectional(WinUIEditor::Bidirectional const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetBidirectional, static_cast(value), static_cast(0)); - } - - /** - * Add text to the document at current position. - */ - void Editor::AddTextFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::AddText, static_cast(length), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::AddText(int64_t length, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::AddText, static_cast(length), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Add array of cells to document. - */ - void Editor::AddStyledText(int64_t length, array_view c) - { - _editor.get()->PublicWndProc(Scintilla::Message::AddStyledText, static_cast(length), reinterpret_cast(c.data())); - } - - /** - * Insert string at a position. - */ - void Editor::InsertTextFromBuffer(int64_t pos, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::InsertText, static_cast(pos), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::InsertText(int64_t pos, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::InsertText, static_cast(pos), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Change the text that is being inserted in response to SC_MOD_INSERTCHECK - */ - void Editor::ChangeInsertionFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ChangeInsertion, static_cast(length), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::ChangeInsertion(int64_t length, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ChangeInsertion, static_cast(length), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Delete all text in the document. - */ - void Editor::ClearAll() - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearAll, static_cast(0), static_cast(0)); - } - - /** - * Delete a range of text in the document. - */ - void Editor::DeleteRange(int64_t start, int64_t lengthDelete) - { - _editor.get()->PublicWndProc(Scintilla::Message::DeleteRange, static_cast(start), static_cast(lengthDelete)); - } - - /** - * Set all style bytes to 0, remove all folding information. - */ - void Editor::ClearDocumentStyle() - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearDocumentStyle, static_cast(0), static_cast(0)); - } - - /** - * Redoes the next action on the undo history. - */ - void Editor::Redo() - { - _editor.get()->PublicWndProc(Scintilla::Message::Redo, static_cast(0), static_cast(0)); - } - - /** - * Select all the text in the document. - */ - void Editor::SelectAll() - { - _editor.get()->PublicWndProc(Scintilla::Message::SelectAll, static_cast(0), static_cast(0)); - } - - /** - * Remember the current position in the undo history as the position - * at which the document was saved. - */ - void Editor::SetSavePoint() - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSavePoint, static_cast(0), static_cast(0)); - } - - /** - * Retrieve a buffer of cells. - * Returns the number of bytes in the buffer not including terminating NULs. - */ - int64_t Editor::GetStyledText(uint64_t tr) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetStyledText, static_cast(0), static_cast(tr))); - } - - /** - * Retrieve a buffer of cells that can be past 2GB. - * Returns the number of bytes in the buffer not including terminating NULs. - */ - int64_t Editor::GetStyledTextFull(uint64_t tr) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetStyledTextFull, static_cast(0), static_cast(tr))); - } - - /** - * Are there any redoable actions in the undo history? - */ - bool Editor::CanRedo() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CanRedo, static_cast(0), static_cast(0))); - } - - /** - * Retrieve the line number at which a particular marker is located. - */ - int64_t Editor::MarkerLineFromHandle(int32_t markerHandle) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerLineFromHandle, static_cast(markerHandle), static_cast(0))); - } - - /** - * Delete a marker. - */ - void Editor::MarkerDeleteHandle(int32_t markerHandle) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerDeleteHandle, static_cast(markerHandle), static_cast(0)); - } - - /** - * Retrieve marker handles of a line - */ - int32_t Editor::MarkerHandleFromLine(int64_t line, int32_t which) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerHandleFromLine, static_cast(line), static_cast(which))); - } - - /** - * Retrieve marker number of a marker handle - */ - int32_t Editor::MarkerNumberFromLine(int64_t line, int32_t which) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerNumberFromLine, static_cast(line), static_cast(which))); - } - - /** - * Find the position from a point within the window. - */ - int64_t Editor::PositionFromPoint(int32_t x, int32_t y) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PositionFromPoint, static_cast(x), static_cast(y))); - } - - /** - * Find the position from a point within the window but return - * INVALID_POSITION if not close to text. - */ - int64_t Editor::PositionFromPointClose(int32_t x, int32_t y) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PositionFromPointClose, static_cast(x), static_cast(y))); - } - - /** - * Set caret to start of a line and ensure it is visible. - */ - void Editor::GotoLine(int64_t line) - { - _editor.get()->PublicWndProc(Scintilla::Message::GotoLine, static_cast(line), static_cast(0)); - } - - /** - * Set caret to a position and ensure it is visible. - */ - void Editor::GotoPos(int64_t caret) - { - _editor.get()->PublicWndProc(Scintilla::Message::GotoPos, static_cast(caret), static_cast(0)); - } - - /** - * Retrieve the text of the line containing the caret. - * Returns the index of the caret on the line. - * Result is NUL-terminated. - */ - int64_t Editor::GetCurLineWriteBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCurLine, static_cast(length), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::GetCurLine(int64_t length) - { - const auto wParam{ static_cast(length) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCurLine, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetCurLine, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Convert all line endings in the document to one mode. - */ - void Editor::ConvertEOLs(WinUIEditor::EndOfLine const &eolMode) - { - _editor.get()->PublicWndProc(Scintilla::Message::ConvertEOLs, static_cast(eolMode), static_cast(0)); - } - - /** - * Set the current styling position to start. - * The unused parameter is no longer used and should be set to 0. - */ - void Editor::StartStyling(int64_t start, int32_t unused) - { - _editor.get()->PublicWndProc(Scintilla::Message::StartStyling, static_cast(start), static_cast(unused)); - } - - /** - * Change style from current styling position for length characters to a style - * and move the current styling position to after this newly styled segment. - */ - void Editor::SetStyling(int64_t length, int32_t style) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetStyling, static_cast(length), static_cast(style)); - } - - /** - * Clear explicit tabstops on a line. - */ - void Editor::ClearTabStops(int64_t line) - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearTabStops, static_cast(line), static_cast(0)); - } - - /** - * Add an explicit tab stop for a line. - */ - void Editor::AddTabStop(int64_t line, int32_t x) - { - _editor.get()->PublicWndProc(Scintilla::Message::AddTabStop, static_cast(line), static_cast(x)); - } - - /** - * Find the next explicit tab stop position on a line after a position. - */ - int32_t Editor::GetNextTabStop(int64_t line, int32_t x) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetNextTabStop, static_cast(line), static_cast(x))); - } - - /** - * Set the symbol used for a particular marker number. - */ - void Editor::MarkerDefine(int32_t markerNumber, WinUIEditor::MarkerSymbol const &markerSymbol) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerDefine, static_cast(markerNumber), static_cast(markerSymbol)); - } - - /** - * Enable/disable highlight for current folding block (smallest one that contains the caret) - */ - void Editor::MarkerEnableHighlight(bool enabled) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerEnableHighlight, static_cast(enabled), static_cast(0)); - } - - /** - * Add a marker to a line, returning an ID which can be used to find or delete the marker. - */ - int32_t Editor::MarkerAdd(int64_t line, int32_t markerNumber) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerAdd, static_cast(line), static_cast(markerNumber))); - } - - /** - * Delete a marker from a line. - */ - void Editor::MarkerDelete(int64_t line, int32_t markerNumber) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerDelete, static_cast(line), static_cast(markerNumber)); - } - - /** - * Delete all markers with a particular number from all lines. - */ - void Editor::MarkerDeleteAll(int32_t markerNumber) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerDeleteAll, static_cast(markerNumber), static_cast(0)); - } - - /** - * Get a bit mask of all the markers set on a line. - */ - int32_t Editor::MarkerGet(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerGet, static_cast(line), static_cast(0))); - } - - /** - * Find the next line at or after lineStart that includes a marker in mask. - * Return -1 when no more lines. - */ - int64_t Editor::MarkerNext(int64_t lineStart, int32_t markerMask) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerNext, static_cast(lineStart), static_cast(markerMask))); - } - - /** - * Find the previous line before lineStart that includes a marker in mask. - */ - int64_t Editor::MarkerPrevious(int64_t lineStart, int32_t markerMask) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerPrevious, static_cast(lineStart), static_cast(markerMask))); - } - - /** - * Define a marker from a pixmap. - */ - void Editor::MarkerDefinePixmapFromBuffer(int32_t markerNumber, Windows::Storage::Streams::IBuffer const &pixmap) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerDefinePixmap, static_cast(markerNumber), reinterpret_cast(pixmap ? pixmap.data() : nullptr)); - } - - void Editor::MarkerDefinePixmap(int32_t markerNumber, hstring const &pixmap) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerDefinePixmap, static_cast(markerNumber), reinterpret_cast(to_string(pixmap).c_str())); - } - - /** - * Add a set of markers to a line. - */ - void Editor::MarkerAddSet(int64_t line, int32_t markerSet) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerAddSet, static_cast(line), static_cast(markerSet)); - } - - /** - * Clear all the styles and make equivalent to the global default style. - */ - void Editor::StyleClearAll() - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleClearAll, static_cast(0), static_cast(0)); - } - - /** - * Reset the default style to its state at startup - */ - void Editor::StyleResetDefault() - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleResetDefault, static_cast(0), static_cast(0)); - } - - /** - * Use the default or platform-defined colour for an element. - */ - void Editor::ResetElementColour(WinUIEditor::Element const &element) - { - _editor.get()->PublicWndProc(Scintilla::Message::ResetElementColour, static_cast(element), static_cast(0)); - } - - /** - * Set the foreground colour of the main and additional selections and whether to use this setting. - */ - void Editor::SetSelFore(bool useSetting, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelFore, static_cast(useSetting), static_cast(fore)); - } - - /** - * Set the background colour of the main and additional selections and whether to use this setting. - */ - void Editor::SetSelBack(bool useSetting, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelBack, static_cast(useSetting), static_cast(back)); - } - - /** - * When key+modifier combination keyDefinition is pressed perform sciCommand. - */ - void Editor::AssignCmdKey(int32_t keyDefinition, int32_t sciCommand) - { - _editor.get()->PublicWndProc(Scintilla::Message::AssignCmdKey, static_cast(keyDefinition), static_cast(sciCommand)); - } - - /** - * When key+modifier combination keyDefinition is pressed do nothing. - */ - void Editor::ClearCmdKey(int32_t keyDefinition) - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearCmdKey, static_cast(keyDefinition), static_cast(0)); - } - - /** - * Drop all key mappings. - */ - void Editor::ClearAllCmdKeys() - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearAllCmdKeys, static_cast(0), static_cast(0)); - } - - /** - * Set the styles for a segment of the document. - */ - void Editor::SetStylingExFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &styles) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetStylingEx, static_cast(length), reinterpret_cast(styles ? styles.data() : nullptr)); - } - - void Editor::SetStylingEx(int64_t length, hstring const &styles) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetStylingEx, static_cast(length), reinterpret_cast(to_string(styles).c_str())); - } - - /** - * Start a sequence of actions that is undone and redone as a unit. - * May be nested. - */ - void Editor::BeginUndoAction() - { - _editor.get()->PublicWndProc(Scintilla::Message::BeginUndoAction, static_cast(0), static_cast(0)); - } - - /** - * End a sequence of actions that is undone and redone as a unit. - */ - void Editor::EndUndoAction() - { - _editor.get()->PublicWndProc(Scintilla::Message::EndUndoAction, static_cast(0), static_cast(0)); - } - - /** - * Push one action onto undo history with no text - */ - void Editor::PushUndoActionType(int32_t type, int64_t pos) - { - _editor.get()->PublicWndProc(Scintilla::Message::PushUndoActionType, static_cast(type), static_cast(pos)); - } - - /** - * Set the text and length of the most recently pushed action - */ - void Editor::ChangeLastUndoActionTextFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ChangeLastUndoActionText, static_cast(length), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::ChangeLastUndoActionText(int64_t length, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ChangeLastUndoActionText, static_cast(length), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Set the foreground colour of all whitespace and whether to use this setting. - */ - void Editor::SetWhitespaceFore(bool useSetting, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWhitespaceFore, static_cast(useSetting), static_cast(fore)); - } - - /** - * Set the background colour of all whitespace and whether to use this setting. - */ - void Editor::SetWhitespaceBack(bool useSetting, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWhitespaceBack, static_cast(useSetting), static_cast(back)); - } - - /** - * Display a auto-completion list. - * The lengthEntered parameter indicates how many characters before - * the caret should be used to provide context. - */ - void Editor::AutoCShowFromBuffer(int64_t lengthEntered, Windows::Storage::Streams::IBuffer const &itemList) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCShow, static_cast(lengthEntered), reinterpret_cast(itemList ? itemList.data() : nullptr)); - } - - void Editor::AutoCShow(int64_t lengthEntered, hstring const &itemList) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCShow, static_cast(lengthEntered), reinterpret_cast(to_string(itemList).c_str())); - } - - /** - * Remove the auto-completion list from the screen. - */ - void Editor::AutoCCancel() - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCCancel, static_cast(0), static_cast(0)); - } - - /** - * Is there an auto-completion list visible? - */ - bool Editor::AutoCActive() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCActive, static_cast(0), static_cast(0))); - } - - /** - * Retrieve the position of the caret when the auto-completion list was displayed. - */ - int64_t Editor::AutoCPosStart() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCPosStart, static_cast(0), static_cast(0))); - } - - /** - * User has selected an item so remove the list and insert the selection. - */ - void Editor::AutoCComplete() - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCComplete, static_cast(0), static_cast(0)); - } - - /** - * Define a set of character that when typed cancel the auto-completion list. - */ - void Editor::AutoCStopsFromBuffer(Windows::Storage::Streams::IBuffer const &characterSet) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCStops, static_cast(0), reinterpret_cast(characterSet ? characterSet.data() : nullptr)); - } - - void Editor::AutoCStops(hstring const &characterSet) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCStops, static_cast(0), reinterpret_cast(to_string(characterSet).c_str())); - } - - /** - * Select the item in the auto-completion list that starts with a string. - */ - void Editor::AutoCSelectFromBuffer(Windows::Storage::Streams::IBuffer const &select) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSelect, static_cast(0), reinterpret_cast(select ? select.data() : nullptr)); - } - - void Editor::AutoCSelect(hstring const &select) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSelect, static_cast(0), reinterpret_cast(to_string(select).c_str())); - } - - /** - * Display a list of strings and send notification when user chooses one. - */ - void Editor::UserListShowFromBuffer(int32_t listType, Windows::Storage::Streams::IBuffer const &itemList) - { - _editor.get()->PublicWndProc(Scintilla::Message::UserListShow, static_cast(listType), reinterpret_cast(itemList ? itemList.data() : nullptr)); - } - - void Editor::UserListShow(int32_t listType, hstring const &itemList) - { - _editor.get()->PublicWndProc(Scintilla::Message::UserListShow, static_cast(listType), reinterpret_cast(to_string(itemList).c_str())); - } - - /** - * Register an XPM image for use in autocompletion lists. - */ - void Editor::RegisterImageFromBuffer(int32_t type, Windows::Storage::Streams::IBuffer const &xpmData) - { - _editor.get()->PublicWndProc(Scintilla::Message::RegisterImage, static_cast(type), reinterpret_cast(xpmData ? xpmData.data() : nullptr)); - } - - void Editor::RegisterImage(int32_t type, hstring const &xpmData) - { - _editor.get()->PublicWndProc(Scintilla::Message::RegisterImage, static_cast(type), reinterpret_cast(to_string(xpmData).c_str())); - } - - /** - * Clear all the registered XPM images. - */ - void Editor::ClearRegisteredImages() - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearRegisteredImages, static_cast(0), static_cast(0)); - } - - /** - * Count characters between two positions. - */ - int64_t Editor::CountCharacters(int64_t start, int64_t end) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CountCharacters, static_cast(start), static_cast(end))); - } - - /** - * Count code units between two positions. - */ - int64_t Editor::CountCodeUnits(int64_t start, int64_t end) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CountCodeUnits, static_cast(start), static_cast(end))); - } - - /** - * Set caret to a position, while removing any existing selection. - */ - void Editor::SetEmptySelection(int64_t caret) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetEmptySelection, static_cast(caret), static_cast(0)); - } - - /** - * Find some text in the document. - */ - int64_t Editor::FindText(WinUIEditor::FindOption const &searchFlags, uint64_t ft) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::FindText, static_cast(searchFlags), static_cast(ft))); - } - - /** - * Find some text in the document. - */ - int64_t Editor::FindTextFull(WinUIEditor::FindOption const &searchFlags, uint64_t ft) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::FindTextFull, static_cast(searchFlags), static_cast(ft))); - } - - /** - * Draw the document into a display context such as a printer. - */ - int64_t Editor::FormatRange(bool draw, uint64_t fr) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::FormatRange, static_cast(draw), static_cast(fr))); - } - - /** - * Draw the document into a display context such as a printer. - */ - int64_t Editor::FormatRangeFull(bool draw, uint64_t fr) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::FormatRangeFull, static_cast(draw), static_cast(fr))); - } - - /** - * Retrieve the contents of a line. - * Returns the length of the line. - */ - int64_t Editor::GetLineWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLine, static_cast(line), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::GetLine(int64_t line) - { - const auto wParam{ static_cast(line) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLine, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetLine, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Select a range of text. - */ - void Editor::SetSel(int64_t anchor, int64_t caret) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSel, static_cast(anchor), static_cast(caret)); - } - - /** - * Retrieve the selected text. - * Return the length of the text. - * Result is NUL-terminated. - */ - int64_t Editor::GetSelTextWriteBuffer(Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelText, static_cast(0), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::GetSelText() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelText, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetSelText, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve a range of text. - * Return the length of the text. - */ - int64_t Editor::GetTextRange(uint64_t tr) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTextRange, static_cast(0), static_cast(tr))); - } - - /** - * Retrieve a range of text that can be past 2GB. - * Return the length of the text. - */ - int64_t Editor::GetTextRangeFull(uint64_t tr) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTextRangeFull, static_cast(0), static_cast(tr))); - } - - /** - * Draw the selection either highlighted or in normal (non-highlighted) style. - */ - void Editor::HideSelection(bool hide) - { - _editor.get()->PublicWndProc(Scintilla::Message::HideSelection, static_cast(hide), static_cast(0)); - } - - /** - * Retrieve the x value of the point in the window where a position is displayed. - */ - int32_t Editor::PointXFromPosition(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PointXFromPosition, static_cast(0), static_cast(pos))); - } - - /** - * Retrieve the y value of the point in the window where a position is displayed. - */ - int32_t Editor::PointYFromPosition(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PointYFromPosition, static_cast(0), static_cast(pos))); - } - - /** - * Retrieve the line containing a position. - */ - int64_t Editor::LineFromPosition(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::LineFromPosition, static_cast(pos), static_cast(0))); - } - - /** - * Retrieve the position at the start of a line. - */ - int64_t Editor::PositionFromLine(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PositionFromLine, static_cast(line), static_cast(0))); - } - - /** - * Scroll horizontally and vertically. - */ - void Editor::LineScroll(int64_t columns, int64_t lines) - { - _editor.get()->PublicWndProc(Scintilla::Message::LineScroll, static_cast(columns), static_cast(lines)); - } - - /** - * Ensure the caret is visible. - */ - void Editor::ScrollCaret() - { - _editor.get()->PublicWndProc(Scintilla::Message::ScrollCaret, static_cast(0), static_cast(0)); - } - - /** - * 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. - */ - void Editor::ScrollRange(int64_t secondary, int64_t primary) - { - _editor.get()->PublicWndProc(Scintilla::Message::ScrollRange, static_cast(secondary), static_cast(primary)); - } - - /** - * Replace the selected text with the argument text. - */ - void Editor::ReplaceSelFromBuffer(Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ReplaceSel, static_cast(0), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::ReplaceSel(hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ReplaceSel, static_cast(0), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Null operation. - */ - void Editor::Null() - { - _editor.get()->PublicWndProc(Scintilla::Message::Null, static_cast(0), static_cast(0)); - } - - /** - * Will a paste succeed? - */ - bool Editor::CanPaste() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CanPaste, static_cast(0), static_cast(0))); - } - - /** - * Are there any undoable actions in the undo history? - */ - bool Editor::CanUndo() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CanUndo, static_cast(0), static_cast(0))); - } - - /** - * Delete the undo history. - */ - void Editor::EmptyUndoBuffer() - { - _editor.get()->PublicWndProc(Scintilla::Message::EmptyUndoBuffer, static_cast(0), static_cast(0)); - } - - /** - * Undo one action in the undo history. - */ - void Editor::Undo() - { - _editor.get()->PublicWndProc(Scintilla::Message::Undo, static_cast(0), static_cast(0)); - } - - /** - * Cut the selection to the clipboard. - */ - void Editor::Cut() - { - _editor.get()->PublicWndProc(Scintilla::Message::Cut, static_cast(0), static_cast(0)); - } - - /** - * Copy the selection to the clipboard. - */ - void Editor::Copy() - { - _editor.get()->PublicWndProc(Scintilla::Message::Copy, static_cast(0), static_cast(0)); - } - - /** - * Paste the contents of the clipboard into the document replacing the selection. - */ - void Editor::Paste() - { - _editor.get()->PublicWndProc(Scintilla::Message::Paste, static_cast(0), static_cast(0)); - } - - /** - * Clear the selection. - */ - void Editor::Clear() - { - _editor.get()->PublicWndProc(Scintilla::Message::Clear, static_cast(0), static_cast(0)); - } - - /** - * Replace the contents of the document with the argument text. - */ - void Editor::SetTextFromBuffer(Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetText, static_cast(0), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::SetText(hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetText, static_cast(0), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Retrieve all the text in the document. - * Returns number of characters retrieved. - * Result is NUL-terminated. - */ - int64_t Editor::GetTextWriteBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetText, static_cast(length), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::GetText(int64_t length) - { - const auto wParam{ static_cast(length) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetText, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetText, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Sets both the start and end of the target in one call. - */ - void Editor::SetTargetRange(int64_t start, int64_t end) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetTargetRange, static_cast(start), static_cast(end)); - } - - /** - * Make the target range start and end be the same as the selection range start and end. - */ - void Editor::TargetFromSelection() - { - _editor.get()->PublicWndProc(Scintilla::Message::TargetFromSelection, static_cast(0), static_cast(0)); - } - - /** - * Sets the target to the whole document. - */ - void Editor::TargetWholeDocument() - { - _editor.get()->PublicWndProc(Scintilla::Message::TargetWholeDocument, static_cast(0), static_cast(0)); - } - - /** - * Replace the target text with the argument text. - * Text is counted so it can contain NULs. - * Returns the length of the replacement text. - */ - int64_t Editor::ReplaceTargetFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::ReplaceTarget, static_cast(length), reinterpret_cast(text ? text.data() : nullptr))); - } - - int64_t Editor::ReplaceTarget(int64_t length, hstring const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::ReplaceTarget, static_cast(length), reinterpret_cast(to_string(text).c_str()))); - } - - /** - * 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. - */ - int64_t Editor::ReplaceTargetREFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::ReplaceTargetRE, static_cast(length), reinterpret_cast(text ? text.data() : nullptr))); - } - - int64_t Editor::ReplaceTargetRE(int64_t length, hstring const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::ReplaceTargetRE, static_cast(length), reinterpret_cast(to_string(text).c_str()))); - } - - /** - * Replace the target text with the argument text but ignore prefix and suffix that - * are the same as current. - */ - int64_t Editor::ReplaceTargetMinimalFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::ReplaceTargetMinimal, static_cast(length), reinterpret_cast(text ? text.data() : nullptr))); - } - - int64_t Editor::ReplaceTargetMinimal(int64_t length, hstring const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::ReplaceTargetMinimal, static_cast(length), reinterpret_cast(to_string(text).c_str()))); - } - - /** - * 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 start of found range or -1 for failure in which case target is not moved. - */ - int64_t Editor::SearchInTargetFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SearchInTarget, static_cast(length), reinterpret_cast(text ? text.data() : nullptr))); - } - - int64_t Editor::SearchInTarget(int64_t length, hstring const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SearchInTarget, static_cast(length), reinterpret_cast(to_string(text).c_str()))); - } - - /** - * Show a call tip containing a definition near position pos. - */ - void Editor::CallTipShowFromBuffer(int64_t pos, Windows::Storage::Streams::IBuffer const &definition) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipShow, static_cast(pos), reinterpret_cast(definition ? definition.data() : nullptr)); - } - - void Editor::CallTipShow(int64_t pos, hstring const &definition) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipShow, static_cast(pos), reinterpret_cast(to_string(definition).c_str())); - } - - /** - * Remove the call tip from the screen. - */ - void Editor::CallTipCancel() - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipCancel, static_cast(0), static_cast(0)); - } - - /** - * Is there an active call tip? - */ - bool Editor::CallTipActive() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CallTipActive, static_cast(0), static_cast(0))); - } - - /** - * Retrieve the position where the caret was before displaying the call tip. - */ - int64_t Editor::CallTipPosStart() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CallTipPosStart, static_cast(0), static_cast(0))); - } - - /** - * Highlight a segment of the definition. - */ - void Editor::CallTipSetHlt(int64_t highlightStart, int64_t highlightEnd) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipSetHlt, static_cast(highlightStart), static_cast(highlightEnd)); - } - - /** - * Find the display line of a document line taking hidden lines into account. - */ - int64_t Editor::VisibleFromDocLine(int64_t docLine) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::VisibleFromDocLine, static_cast(docLine), static_cast(0))); - } - - /** - * Find the document line of a display line taking hidden lines into account. - */ - int64_t Editor::DocLineFromVisible(int64_t displayLine) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::DocLineFromVisible, static_cast(displayLine), static_cast(0))); - } - - /** - * The number of display lines needed to wrap a document line - */ - int64_t Editor::WrapCount(int64_t docLine) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::WrapCount, static_cast(docLine), static_cast(0))); - } - - /** - * Make a range of lines visible. - */ - void Editor::ShowLines(int64_t lineStart, int64_t lineEnd) - { - _editor.get()->PublicWndProc(Scintilla::Message::ShowLines, static_cast(lineStart), static_cast(lineEnd)); - } - - /** - * Make a range of lines invisible. - */ - void Editor::HideLines(int64_t lineStart, int64_t lineEnd) - { - _editor.get()->PublicWndProc(Scintilla::Message::HideLines, static_cast(lineStart), static_cast(lineEnd)); - } - - /** - * Switch a header line between expanded and contracted. - */ - void Editor::ToggleFold(int64_t line) - { - _editor.get()->PublicWndProc(Scintilla::Message::ToggleFold, static_cast(line), static_cast(0)); - } - - /** - * Switch a header line between expanded and contracted and show some text after the line. - */ - void Editor::ToggleFoldShowTextFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ToggleFoldShowText, static_cast(line), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::ToggleFoldShowText(int64_t line, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ToggleFoldShowText, static_cast(line), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Set the default fold display text. - */ - void Editor::SetDefaultFoldDisplayTextFromBuffer(Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetDefaultFoldDisplayText, static_cast(0), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::SetDefaultFoldDisplayText(hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetDefaultFoldDisplayText, static_cast(0), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Get the default fold display text. - */ - int32_t Editor::GetDefaultFoldDisplayTextWriteBuffer(Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetDefaultFoldDisplayText, static_cast(0), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::GetDefaultFoldDisplayText() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetDefaultFoldDisplayText, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetDefaultFoldDisplayText, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Expand or contract a fold header. - */ - void Editor::FoldLine(int64_t line, WinUIEditor::FoldAction const &action) - { - _editor.get()->PublicWndProc(Scintilla::Message::FoldLine, static_cast(line), static_cast(action)); - } - - /** - * Expand or contract a fold header and its children. - */ - void Editor::FoldChildren(int64_t line, WinUIEditor::FoldAction const &action) - { - _editor.get()->PublicWndProc(Scintilla::Message::FoldChildren, static_cast(line), static_cast(action)); - } - - /** - * Expand a fold header and all children. Use the level argument instead of the line's current level. - */ - void Editor::ExpandChildren(int64_t line, WinUIEditor::FoldLevel const &level) - { - _editor.get()->PublicWndProc(Scintilla::Message::ExpandChildren, static_cast(line), static_cast(level)); - } - - /** - * Expand or contract all fold headers. - */ - void Editor::FoldAll(WinUIEditor::FoldAction const &action) - { - _editor.get()->PublicWndProc(Scintilla::Message::FoldAll, static_cast(action), static_cast(0)); - } - - /** - * Ensure a particular line is visible by expanding any header line hiding it. - */ - void Editor::EnsureVisible(int64_t line) - { - _editor.get()->PublicWndProc(Scintilla::Message::EnsureVisible, static_cast(line), static_cast(0)); - } - - /** - * 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. - */ - void Editor::EnsureVisibleEnforcePolicy(int64_t line) - { - _editor.get()->PublicWndProc(Scintilla::Message::EnsureVisibleEnforcePolicy, static_cast(line), static_cast(0)); - } - - /** - * Get position of start of word. - */ - int64_t Editor::WordStartPosition(int64_t pos, bool onlyWordCharacters) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::WordStartPosition, static_cast(pos), static_cast(onlyWordCharacters))); - } - - /** - * Get position of end of word. - */ - int64_t Editor::WordEndPosition(int64_t pos, bool onlyWordCharacters) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::WordEndPosition, static_cast(pos), static_cast(onlyWordCharacters))); - } - - /** - * Is the range start..end considered a word? - */ - bool Editor::IsRangeWord(int64_t start, int64_t end) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IsRangeWord, static_cast(start), static_cast(end))); - } - - /** - * Measure the pixel width of some text in a particular style. - * NUL terminated text argument. - * Does not handle tab or control characters. - */ - int32_t Editor::TextWidthFromBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::TextWidth, static_cast(style), reinterpret_cast(text ? text.data() : nullptr))); - } - - int32_t Editor::TextWidth(int32_t style, hstring const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::TextWidth, static_cast(style), reinterpret_cast(to_string(text).c_str()))); - } - - /** - * Retrieve the height of a particular line of text in pixels. - */ - int32_t Editor::TextHeight(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::TextHeight, static_cast(line), static_cast(0))); - } - - /** - * Append a string to the end of the document without changing the selection. - */ - void Editor::AppendTextFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::AppendText, static_cast(length), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::AppendText(int64_t length, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::AppendText, static_cast(length), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Join the lines in the target. - */ - void Editor::LinesJoin() - { - _editor.get()->PublicWndProc(Scintilla::Message::LinesJoin, static_cast(0), static_cast(0)); - } - - /** - * Split the lines in the target into lines that are less wide than pixelWidth - * where possible. - */ - void Editor::LinesSplit(int32_t pixelWidth) - { - _editor.get()->PublicWndProc(Scintilla::Message::LinesSplit, static_cast(pixelWidth), static_cast(0)); - } - - /** - * Set one of the colours used as a chequerboard pattern in the fold margin - */ - void Editor::SetFoldMarginColour(bool useSetting, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFoldMarginColour, static_cast(useSetting), static_cast(back)); - } - - /** - * Set the other colour used as a chequerboard pattern in the fold margin - */ - void Editor::SetFoldMarginHiColour(bool useSetting, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFoldMarginHiColour, static_cast(useSetting), static_cast(fore)); - } - - /** - * Move caret down one line. - */ - void Editor::LineDown() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineDown, static_cast(0), static_cast(0)); - } - - /** - * Move caret down one line extending selection to new caret position. - */ - void Editor::LineDownExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineDownExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret up one line. - */ - void Editor::LineUp() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineUp, static_cast(0), static_cast(0)); - } - - /** - * Move caret up one line extending selection to new caret position. - */ - void Editor::LineUpExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineUpExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret left one character. - */ - void Editor::CharLeft() - { - _editor.get()->PublicWndProc(Scintilla::Message::CharLeft, static_cast(0), static_cast(0)); - } - - /** - * Move caret left one character extending selection to new caret position. - */ - void Editor::CharLeftExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::CharLeftExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret right one character. - */ - void Editor::CharRight() - { - _editor.get()->PublicWndProc(Scintilla::Message::CharRight, static_cast(0), static_cast(0)); - } - - /** - * Move caret right one character extending selection to new caret position. - */ - void Editor::CharRightExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::CharRightExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret left one word. - */ - void Editor::WordLeft() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordLeft, static_cast(0), static_cast(0)); - } - - /** - * Move caret left one word extending selection to new caret position. - */ - void Editor::WordLeftExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordLeftExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret right one word. - */ - void Editor::WordRight() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordRight, static_cast(0), static_cast(0)); - } - - /** - * Move caret right one word extending selection to new caret position. - */ - void Editor::WordRightExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordRightExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to first position on line. - */ - void Editor::Home() - { - _editor.get()->PublicWndProc(Scintilla::Message::Home, static_cast(0), static_cast(0)); - } - - /** - * Move caret to first position on line extending selection to new caret position. - */ - void Editor::HomeExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::HomeExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to last position on line. - */ - void Editor::LineEnd() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineEnd, static_cast(0), static_cast(0)); - } - - /** - * Move caret to last position on line extending selection to new caret position. - */ - void Editor::LineEndExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineEndExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to first position in document. - */ - void Editor::DocumentStart() - { - _editor.get()->PublicWndProc(Scintilla::Message::DocumentStart, static_cast(0), static_cast(0)); - } - - /** - * Move caret to first position in document extending selection to new caret position. - */ - void Editor::DocumentStartExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::DocumentStartExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to last position in document. - */ - void Editor::DocumentEnd() - { - _editor.get()->PublicWndProc(Scintilla::Message::DocumentEnd, static_cast(0), static_cast(0)); - } - - /** - * Move caret to last position in document extending selection to new caret position. - */ - void Editor::DocumentEndExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::DocumentEndExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret one page up. - */ - void Editor::PageUp() - { - _editor.get()->PublicWndProc(Scintilla::Message::PageUp, static_cast(0), static_cast(0)); - } - - /** - * Move caret one page up extending selection to new caret position. - */ - void Editor::PageUpExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::PageUpExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret one page down. - */ - void Editor::PageDown() - { - _editor.get()->PublicWndProc(Scintilla::Message::PageDown, static_cast(0), static_cast(0)); - } - - /** - * Move caret one page down extending selection to new caret position. - */ - void Editor::PageDownExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::PageDownExtend, static_cast(0), static_cast(0)); - } - - /** - * Switch from insert to overtype mode or the reverse. - */ - void Editor::EditToggleOvertype() - { - _editor.get()->PublicWndProc(Scintilla::Message::EditToggleOvertype, static_cast(0), static_cast(0)); - } - - /** - * Cancel any modes such as call tip or auto-completion list display. - */ - void Editor::Cancel() - { - _editor.get()->PublicWndProc(Scintilla::Message::Cancel, static_cast(0), static_cast(0)); - } - - /** - * Delete the selection or if no selection, the character before the caret. - */ - void Editor::DeleteBack() - { - _editor.get()->PublicWndProc(Scintilla::Message::DeleteBack, static_cast(0), static_cast(0)); - } - - /** - * 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. - */ - void Editor::Tab() - { - _editor.get()->PublicWndProc(Scintilla::Message::Tab, static_cast(0), static_cast(0)); - } - - /** - * Dedent the selected lines. - */ - void Editor::BackTab() - { - _editor.get()->PublicWndProc(Scintilla::Message::BackTab, static_cast(0), static_cast(0)); - } - - /** - * Insert a new line, may use a CRLF, CR or LF depending on EOL mode. - */ - void Editor::NewLine() - { - _editor.get()->PublicWndProc(Scintilla::Message::NewLine, static_cast(0), static_cast(0)); - } - - /** - * Insert a Form Feed character. - */ - void Editor::FormFeed() - { - _editor.get()->PublicWndProc(Scintilla::Message::FormFeed, static_cast(0), static_cast(0)); - } - - /** - * Move caret to before first visible character on line. - * If already there move to first character on line. - */ - void Editor::VCHome() - { - _editor.get()->PublicWndProc(Scintilla::Message::VCHome, static_cast(0), static_cast(0)); - } - - /** - * Like VCHome but extending selection to new caret position. - */ - void Editor::VCHomeExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::VCHomeExtend, static_cast(0), static_cast(0)); - } - - /** - * Magnify the displayed text by increasing the sizes by 1 point. - */ - void Editor::ZoomIn() - { - _editor.get()->PublicWndProc(Scintilla::Message::ZoomIn, static_cast(0), static_cast(0)); - } - - /** - * Make the displayed text smaller by decreasing the sizes by 1 point. - */ - void Editor::ZoomOut() - { - _editor.get()->PublicWndProc(Scintilla::Message::ZoomOut, static_cast(0), static_cast(0)); - } - - /** - * Delete the word to the left of the caret. - */ - void Editor::DelWordLeft() - { - _editor.get()->PublicWndProc(Scintilla::Message::DelWordLeft, static_cast(0), static_cast(0)); - } - - /** - * Delete the word to the right of the caret. - */ - void Editor::DelWordRight() - { - _editor.get()->PublicWndProc(Scintilla::Message::DelWordRight, static_cast(0), static_cast(0)); - } - - /** - * Delete the word to the right of the caret, but not the trailing non-word characters. - */ - void Editor::DelWordRightEnd() - { - _editor.get()->PublicWndProc(Scintilla::Message::DelWordRightEnd, static_cast(0), static_cast(0)); - } - - /** - * Cut the line containing the caret. - */ - void Editor::LineCut() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineCut, static_cast(0), static_cast(0)); - } - - /** - * Delete the line containing the caret. - */ - void Editor::LineDelete() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineDelete, static_cast(0), static_cast(0)); - } - - /** - * Switch the current line with the previous. - */ - void Editor::LineTranspose() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineTranspose, static_cast(0), static_cast(0)); - } - - /** - * Reverse order of selected lines. - */ - void Editor::LineReverse() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineReverse, static_cast(0), static_cast(0)); - } - - /** - * Duplicate the current line. - */ - void Editor::LineDuplicate() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineDuplicate, static_cast(0), static_cast(0)); - } - - /** - * Transform the selection to lower case. - */ - void Editor::LowerCase() - { - _editor.get()->PublicWndProc(Scintilla::Message::LowerCase, static_cast(0), static_cast(0)); - } - - /** - * Transform the selection to upper case. - */ - void Editor::UpperCase() - { - _editor.get()->PublicWndProc(Scintilla::Message::UpperCase, static_cast(0), static_cast(0)); - } - - /** - * Scroll the document down, keeping the caret visible. - */ - void Editor::LineScrollDown() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineScrollDown, static_cast(0), static_cast(0)); - } - - /** - * Scroll the document up, keeping the caret visible. - */ - void Editor::LineScrollUp() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineScrollUp, static_cast(0), static_cast(0)); - } - - /** - * Delete the selection or if no selection, the character before the caret. - * Will not delete the character before at the start of a line. - */ - void Editor::DeleteBackNotLine() - { - _editor.get()->PublicWndProc(Scintilla::Message::DeleteBackNotLine, static_cast(0), static_cast(0)); - } - - /** - * Move caret to first position on display line. - */ - void Editor::HomeDisplay() - { - _editor.get()->PublicWndProc(Scintilla::Message::HomeDisplay, static_cast(0), static_cast(0)); - } - - /** - * Move caret to first position on display line extending selection to - * new caret position. - */ - void Editor::HomeDisplayExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::HomeDisplayExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to last position on display line. - */ - void Editor::LineEndDisplay() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineEndDisplay, static_cast(0), static_cast(0)); - } - - /** - * Move caret to last position on display line extending selection to new - * caret position. - */ - void Editor::LineEndDisplayExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineEndDisplayExtend, static_cast(0), static_cast(0)); - } - - /** - * Like Home but when word-wrap is enabled goes first to start of display line - * HomeDisplay, then to start of document line Home. - */ - void Editor::HomeWrap() - { - _editor.get()->PublicWndProc(Scintilla::Message::HomeWrap, static_cast(0), static_cast(0)); - } - - /** - * Like HomeExtend but when word-wrap is enabled extends first to start of display line - * HomeDisplayExtend, then to start of document line HomeExtend. - */ - void Editor::HomeWrapExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::HomeWrapExtend, static_cast(0), static_cast(0)); - } - - /** - * Like LineEnd but when word-wrap is enabled goes first to end of display line - * LineEndDisplay, then to start of document line LineEnd. - */ - void Editor::LineEndWrap() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineEndWrap, static_cast(0), static_cast(0)); - } - - /** - * Like LineEndExtend but when word-wrap is enabled extends first to end of display line - * LineEndDisplayExtend, then to start of document line LineEndExtend. - */ - void Editor::LineEndWrapExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineEndWrapExtend, static_cast(0), static_cast(0)); - } - - /** - * Like VCHome but when word-wrap is enabled goes first to start of display line - * VCHomeDisplay, then behaves like VCHome. - */ - void Editor::VCHomeWrap() - { - _editor.get()->PublicWndProc(Scintilla::Message::VCHomeWrap, static_cast(0), static_cast(0)); - } - - /** - * Like VCHomeExtend but when word-wrap is enabled extends first to start of display line - * VCHomeDisplayExtend, then behaves like VCHomeExtend. - */ - void Editor::VCHomeWrapExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::VCHomeWrapExtend, static_cast(0), static_cast(0)); - } - - /** - * Copy the line containing the caret. - */ - void Editor::LineCopy() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineCopy, static_cast(0), static_cast(0)); - } - - /** - * Move the caret inside current view if it's not there already. - */ - void Editor::MoveCaretInsideView() - { - _editor.get()->PublicWndProc(Scintilla::Message::MoveCaretInsideView, static_cast(0), static_cast(0)); - } - - /** - * How many characters are on a line, including end of line characters? - */ - int64_t Editor::LineLength(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::LineLength, static_cast(line), static_cast(0))); - } - - /** - * Highlight the characters at two positions. - */ - void Editor::BraceHighlight(int64_t posA, int64_t posB) - { - _editor.get()->PublicWndProc(Scintilla::Message::BraceHighlight, static_cast(posA), static_cast(posB)); - } - - /** - * Use specified indicator to highlight matching braces instead of changing their style. - */ - void Editor::BraceHighlightIndicator(bool useSetting, int32_t indicator) - { - _editor.get()->PublicWndProc(Scintilla::Message::BraceHighlightIndicator, static_cast(useSetting), static_cast(indicator)); - } - - /** - * Highlight the character at a position indicating there is no matching brace. - */ - void Editor::BraceBadLight(int64_t pos) - { - _editor.get()->PublicWndProc(Scintilla::Message::BraceBadLight, static_cast(pos), static_cast(0)); - } - - /** - * Use specified indicator to highlight non matching brace instead of changing its style. - */ - void Editor::BraceBadLightIndicator(bool useSetting, int32_t indicator) - { - _editor.get()->PublicWndProc(Scintilla::Message::BraceBadLightIndicator, static_cast(useSetting), static_cast(indicator)); - } - - /** - * 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. - */ - int64_t Editor::BraceMatch(int64_t pos, int32_t maxReStyle) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::BraceMatch, static_cast(pos), static_cast(maxReStyle))); - } - - /** - * Similar to BraceMatch, but matching starts at the explicit start position. - */ - int64_t Editor::BraceMatchNext(int64_t pos, int64_t startPos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::BraceMatchNext, static_cast(pos), static_cast(startPos))); - } - - /** - * Add a new vertical edge to the view. - */ - void Editor::MultiEdgeAddLine(int64_t column, int32_t edgeColour) - { - _editor.get()->PublicWndProc(Scintilla::Message::MultiEdgeAddLine, static_cast(column), static_cast(edgeColour)); - } - - /** - * Clear all vertical edges. - */ - void Editor::MultiEdgeClearAll() - { - _editor.get()->PublicWndProc(Scintilla::Message::MultiEdgeClearAll, static_cast(0), static_cast(0)); - } - - /** - * Sets the current caret position to be the search anchor. - */ - void Editor::SearchAnchor() - { - _editor.get()->PublicWndProc(Scintilla::Message::SearchAnchor, static_cast(0), static_cast(0)); - } - - /** - * Find some text starting at the search anchor. - * Does not ensure the selection is visible. - */ - int64_t Editor::SearchNextFromBuffer(WinUIEditor::FindOption const &searchFlags, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SearchNext, static_cast(searchFlags), reinterpret_cast(text ? text.data() : nullptr))); - } - - int64_t Editor::SearchNext(WinUIEditor::FindOption const &searchFlags, hstring const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SearchNext, static_cast(searchFlags), reinterpret_cast(to_string(text).c_str()))); - } - - /** - * Find some text starting at the search anchor and moving backwards. - * Does not ensure the selection is visible. - */ - int64_t Editor::SearchPrevFromBuffer(WinUIEditor::FindOption const &searchFlags, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SearchPrev, static_cast(searchFlags), reinterpret_cast(text ? text.data() : nullptr))); - } - - int64_t Editor::SearchPrev(WinUIEditor::FindOption const &searchFlags, hstring const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SearchPrev, static_cast(searchFlags), reinterpret_cast(to_string(text).c_str()))); - } - - /** - * Set whether a pop up menu is displayed automatically when the user presses - * the wrong mouse button on certain areas. - */ - void Editor::UsePopUp(WinUIEditor::PopUp const &popUpMode) - { - _editor.get()->PublicWndProc(Scintilla::Message::UsePopUp, static_cast(popUpMode), static_cast(0)); - } - - /** - * Create a new document object. - * Starts with reference count of 1 and not selected into editor. - */ - uint64_t Editor::CreateDocument(int64_t bytes, WinUIEditor::DocumentOption const &documentOptions) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CreateDocument, static_cast(bytes), static_cast(documentOptions))); - } - - /** - * Extend life of document. - */ - void Editor::AddRefDocument(uint64_t doc) - { - _editor.get()->PublicWndProc(Scintilla::Message::AddRefDocument, static_cast(0), static_cast(doc)); - } - - /** - * Release a reference to the document, deleting document if it fades to black. - */ - void Editor::ReleaseDocument(uint64_t doc) - { - _editor.get()->PublicWndProc(Scintilla::Message::ReleaseDocument, static_cast(0), static_cast(doc)); - } - - /** - * Move to the previous change in capitalisation. - */ - void Editor::WordPartLeft() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordPartLeft, static_cast(0), static_cast(0)); - } - - /** - * Move to the previous change in capitalisation extending selection - * to new caret position. - */ - void Editor::WordPartLeftExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordPartLeftExtend, static_cast(0), static_cast(0)); - } - - /** - * Move to the change next in capitalisation. - */ - void Editor::WordPartRight() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordPartRight, static_cast(0), static_cast(0)); - } - - /** - * Move to the next change in capitalisation extending selection - * to new caret position. - */ - void Editor::WordPartRightExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordPartRightExtend, static_cast(0), static_cast(0)); - } - - /** - * Set the way the display area is determined when a particular line - * is to be moved to by Find, FindNext, GotoLine, etc. - */ - void Editor::SetVisiblePolicy(WinUIEditor::VisiblePolicy const &visiblePolicy, int32_t visibleSlop) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetVisiblePolicy, static_cast(visiblePolicy), static_cast(visibleSlop)); - } - - /** - * Delete back from the current position to the start of the line. - */ - void Editor::DelLineLeft() - { - _editor.get()->PublicWndProc(Scintilla::Message::DelLineLeft, static_cast(0), static_cast(0)); - } - - /** - * Delete forwards from the current position to the end of the line. - */ - void Editor::DelLineRight() - { - _editor.get()->PublicWndProc(Scintilla::Message::DelLineRight, static_cast(0), static_cast(0)); - } - - /** - * Set the last x chosen value to be the caret x position. - */ - void Editor::ChooseCaretX() - { - _editor.get()->PublicWndProc(Scintilla::Message::ChooseCaretX, static_cast(0), static_cast(0)); - } - - /** - * Set the focus to this Scintilla widget. - */ - void Editor::GrabFocus() - { - _editor.get()->PublicWndProc(Scintilla::Message::GrabFocus, static_cast(0), static_cast(0)); - } - - /** - * Set the way the caret is kept visible when going sideways. - * The exclusion zone is given in pixels. - */ - void Editor::SetXCaretPolicy(WinUIEditor::CaretPolicy const &caretPolicy, int32_t caretSlop) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetXCaretPolicy, static_cast(caretPolicy), static_cast(caretSlop)); - } - - /** - * Set the way the line the caret is on is kept visible. - * The exclusion zone is given in lines. - */ - void Editor::SetYCaretPolicy(WinUIEditor::CaretPolicy const &caretPolicy, int32_t caretSlop) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetYCaretPolicy, static_cast(caretPolicy), static_cast(caretSlop)); - } - - /** - * Move caret down one paragraph (delimited by empty lines). - */ - void Editor::ParaDown() - { - _editor.get()->PublicWndProc(Scintilla::Message::ParaDown, static_cast(0), static_cast(0)); - } - - /** - * Extend selection down one paragraph (delimited by empty lines). - */ - void Editor::ParaDownExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::ParaDownExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret up one paragraph (delimited by empty lines). - */ - void Editor::ParaUp() - { - _editor.get()->PublicWndProc(Scintilla::Message::ParaUp, static_cast(0), static_cast(0)); - } - - /** - * Extend selection up one paragraph (delimited by empty lines). - */ - void Editor::ParaUpExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::ParaUpExtend, static_cast(0), static_cast(0)); - } - - /** - * Given a valid document position, return the previous position taking code - * page into account. Returns 0 if passed 0. - */ - int64_t Editor::PositionBefore(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PositionBefore, static_cast(pos), static_cast(0))); - } - - /** - * Given a valid document position, return the next position taking code - * page into account. Maximum value returned is the last position in the document. - */ - int64_t Editor::PositionAfter(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PositionAfter, static_cast(pos), static_cast(0))); - } - - /** - * 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. - */ - int64_t Editor::PositionRelative(int64_t pos, int64_t relative) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PositionRelative, static_cast(pos), static_cast(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. - */ - int64_t Editor::PositionRelativeCodeUnits(int64_t pos, int64_t relative) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PositionRelativeCodeUnits, static_cast(pos), static_cast(relative))); - } - - /** - * Copy a range of text to the clipboard. Positions are clipped into the document. - */ - void Editor::CopyRange(int64_t start, int64_t end) - { - _editor.get()->PublicWndProc(Scintilla::Message::CopyRange, static_cast(start), static_cast(end)); - } - - /** - * Copy argument text to the clipboard. - */ - void Editor::CopyTextFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::CopyText, static_cast(length), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::CopyText(int64_t length, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::CopyText, static_cast(length), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or - * by lines (SC_SEL_LINES) without changing MoveExtendsSelection. - */ - void Editor::ChangeSelectionMode(WinUIEditor::SelectionMode const &selectionMode) - { - _editor.get()->PublicWndProc(Scintilla::Message::ChangeSelectionMode, static_cast(selectionMode), static_cast(0)); - } - - /** - * Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). - */ - int64_t Editor::GetLineSelStartPosition(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineSelStartPosition, static_cast(line), static_cast(0))); - } - - /** - * Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). - */ - int64_t Editor::GetLineSelEndPosition(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineSelEndPosition, static_cast(line), static_cast(0))); - } - - /** - * Move caret down one line, extending rectangular selection to new caret position. - */ - void Editor::LineDownRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineDownRectExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret up one line, extending rectangular selection to new caret position. - */ - void Editor::LineUpRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineUpRectExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret left one character, extending rectangular selection to new caret position. - */ - void Editor::CharLeftRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::CharLeftRectExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret right one character, extending rectangular selection to new caret position. - */ - void Editor::CharRightRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::CharRightRectExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to first position on line, extending rectangular selection to new caret position. - */ - void Editor::HomeRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::HomeRectExtend, static_cast(0), static_cast(0)); - } - - /** - * 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. - */ - void Editor::VCHomeRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::VCHomeRectExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to last position on line, extending rectangular selection to new caret position. - */ - void Editor::LineEndRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::LineEndRectExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret one page up, extending rectangular selection to new caret position. - */ - void Editor::PageUpRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::PageUpRectExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret one page down, extending rectangular selection to new caret position. - */ - void Editor::PageDownRectExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::PageDownRectExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to top of page, or one page up if already at top of page. - */ - void Editor::StutteredPageUp() - { - _editor.get()->PublicWndProc(Scintilla::Message::StutteredPageUp, static_cast(0), static_cast(0)); - } - - /** - * Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. - */ - void Editor::StutteredPageUpExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::StutteredPageUpExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret to bottom of page, or one page down if already at bottom of page. - */ - void Editor::StutteredPageDown() - { - _editor.get()->PublicWndProc(Scintilla::Message::StutteredPageDown, static_cast(0), static_cast(0)); - } - - /** - * Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. - */ - void Editor::StutteredPageDownExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::StutteredPageDownExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret left one word, position cursor at end of word. - */ - void Editor::WordLeftEnd() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordLeftEnd, static_cast(0), static_cast(0)); - } - - /** - * Move caret left one word, position cursor at end of word, extending selection to new caret position. - */ - void Editor::WordLeftEndExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordLeftEndExtend, static_cast(0), static_cast(0)); - } - - /** - * Move caret right one word, position cursor at end of word. - */ - void Editor::WordRightEnd() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordRightEnd, static_cast(0), static_cast(0)); - } - - /** - * Move caret right one word, position cursor at end of word, extending selection to new caret position. - */ - void Editor::WordRightEndExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::WordRightEndExtend, static_cast(0), static_cast(0)); - } - - /** - * Reset the set of characters for whitespace and word characters to the defaults. - */ - void Editor::SetCharsDefault() - { - _editor.get()->PublicWndProc(Scintilla::Message::SetCharsDefault, static_cast(0), static_cast(0)); - } - - /** - * Enlarge the document to a particular size of text bytes. - */ - void Editor::Allocate(int64_t bytes) - { - _editor.get()->PublicWndProc(Scintilla::Message::Allocate, static_cast(bytes), static_cast(0)); - } - - /** - * Returns the target converted to UTF8. - * Return the length in bytes. - */ - int64_t Editor::TargetAsUTF8WriteBuffer(Windows::Storage::Streams::IBuffer const &s) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::TargetAsUTF8, static_cast(0), reinterpret_cast(s ? s.data() : nullptr))); - } - - hstring Editor::TargetAsUTF8() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::TargetAsUTF8, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::TargetAsUTF8, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Set the length of the utf8 argument for calling EncodedFromUTF8. - * Set to -1 and the string will be measured to the first nul. - */ - void Editor::SetLengthForEncode(int64_t bytes) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetLengthForEncode, static_cast(bytes), static_cast(0)); - } - - /** - * Translates a UTF8 string into the document encoding. - * Return the length of the result in bytes. - * On error return 0. - */ - int64_t Editor::EncodedFromUTF8WriteBuffer(Windows::Storage::Streams::IBuffer const &utf8, Windows::Storage::Streams::IBuffer const &encoded) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::EncodedFromUTF8, reinterpret_cast(utf8 ? utf8.data() : nullptr), reinterpret_cast(encoded ? encoded.data() : nullptr))); - } - - hstring Editor::EncodedFromUTF8(hstring const &utf8) - { - const auto wParam{ reinterpret_cast(to_string(utf8).c_str()) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::EncodedFromUTF8, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::EncodedFromUTF8, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * 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. - */ - int64_t Editor::FindColumn(int64_t line, int64_t column) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::FindColumn, static_cast(line), static_cast(column))); - } - - /** - * Switch between sticky and non-sticky: meant to be bound to a key. - */ - void Editor::ToggleCaretSticky() - { - _editor.get()->PublicWndProc(Scintilla::Message::ToggleCaretSticky, static_cast(0), static_cast(0)); - } - - /** - * Replace the selection with text like a rectangular paste. - */ - void Editor::ReplaceRectangularFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ReplaceRectangular, static_cast(length), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::ReplaceRectangular(int64_t length, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::ReplaceRectangular, static_cast(length), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Duplicate the selection. If selection empty duplicate the line containing the caret. - */ - void Editor::SelectionDuplicate() - { - _editor.get()->PublicWndProc(Scintilla::Message::SelectionDuplicate, static_cast(0), static_cast(0)); - } - - /** - * Turn a indicator on over a range. - */ - void Editor::IndicatorFillRange(int64_t start, int64_t lengthFill) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicatorFillRange, static_cast(start), static_cast(lengthFill)); - } - - /** - * Turn a indicator off over a range. - */ - void Editor::IndicatorClearRange(int64_t start, int64_t lengthClear) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicatorClearRange, static_cast(start), static_cast(lengthClear)); - } - - /** - * Are any indicators present at pos? - */ - int32_t Editor::IndicatorAllOnFor(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicatorAllOnFor, static_cast(pos), static_cast(0))); - } - - /** - * What value does a particular indicator have at a position? - */ - int32_t Editor::IndicatorValueAt(int32_t indicator, int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicatorValueAt, static_cast(indicator), static_cast(pos))); - } - - /** - * Where does a particular indicator start? - */ - int64_t Editor::IndicatorStart(int32_t indicator, int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicatorStart, static_cast(indicator), static_cast(pos))); - } - - /** - * Where does a particular indicator end? - */ - int64_t Editor::IndicatorEnd(int32_t indicator, int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicatorEnd, static_cast(indicator), static_cast(pos))); - } - - /** - * Copy the selection, if selection empty copy the line with the caret - */ - void Editor::CopyAllowLine() - { - _editor.get()->PublicWndProc(Scintilla::Message::CopyAllowLine, static_cast(0), static_cast(0)); - } - - /** - * Which symbol was defined for markerNumber with MarkerDefine - */ - int32_t Editor::MarkerSymbolDefined(int32_t markerNumber) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerSymbolDefined, static_cast(markerNumber), static_cast(0))); - } - - /** - * Clear the margin text on all lines - */ - void Editor::MarginTextClearAll() - { - _editor.get()->PublicWndProc(Scintilla::Message::MarginTextClearAll, static_cast(0), static_cast(0)); - } - - /** - * Clear the annotations from all lines - */ - void Editor::AnnotationClearAll() - { - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationClearAll, static_cast(0), static_cast(0)); - } - - /** - * Release all extended (>255) style numbers - */ - void Editor::ReleaseAllExtendedStyles() - { - _editor.get()->PublicWndProc(Scintilla::Message::ReleaseAllExtendedStyles, static_cast(0), static_cast(0)); - } - - /** - * Allocate some extended (>255) style numbers and return the start of the range - */ - int32_t Editor::AllocateExtendedStyles(int32_t numberStyles) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AllocateExtendedStyles, static_cast(numberStyles), static_cast(0))); - } - - /** - * Add a container action to the undo stack - */ - void Editor::AddUndoAction(int32_t token, WinUIEditor::UndoFlags const &flags) - { - _editor.get()->PublicWndProc(Scintilla::Message::AddUndoAction, static_cast(token), static_cast(flags)); - } - - /** - * Find the position of a character from a point within the window. - */ - int64_t Editor::CharPositionFromPoint(int32_t x, int32_t y) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CharPositionFromPoint, static_cast(x), static_cast(y))); - } - - /** - * Find the position of a character from a point within the window. - * Return INVALID_POSITION if not close to text. - */ - int64_t Editor::CharPositionFromPointClose(int32_t x, int32_t y) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CharPositionFromPointClose, static_cast(x), static_cast(y))); - } - - /** - * Clear selections to a single empty stream selection - */ - void Editor::ClearSelections() - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearSelections, static_cast(0), static_cast(0)); - } - - /** - * Set a simple selection - */ - void Editor::SetSelection(int64_t caret, int64_t anchor) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelection, static_cast(caret), static_cast(anchor)); - } - - /** - * Add a selection - */ - void Editor::AddSelection(int64_t caret, int64_t anchor) - { - _editor.get()->PublicWndProc(Scintilla::Message::AddSelection, static_cast(caret), static_cast(anchor)); - } - - /** - * Find the selection index for a point. -1 when not at a selection. - */ - int32_t Editor::SelectionFromPoint(int32_t x, int32_t y) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SelectionFromPoint, static_cast(x), static_cast(y))); - } - - /** - * Drop one selection - */ - void Editor::DropSelectionN(int32_t selection) - { - _editor.get()->PublicWndProc(Scintilla::Message::DropSelectionN, static_cast(selection), static_cast(0)); - } - - /** - * Set the main selection to the next selection. - */ - void Editor::RotateSelection() - { - _editor.get()->PublicWndProc(Scintilla::Message::RotateSelection, static_cast(0), static_cast(0)); - } - - /** - * Swap that caret and anchor of the main selection. - */ - void Editor::SwapMainAnchorCaret() - { - _editor.get()->PublicWndProc(Scintilla::Message::SwapMainAnchorCaret, static_cast(0), static_cast(0)); - } - - /** - * 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. - */ - void Editor::MultipleSelectAddNext() - { - _editor.get()->PublicWndProc(Scintilla::Message::MultipleSelectAddNext, static_cast(0), static_cast(0)); - } - - /** - * 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. - */ - void Editor::MultipleSelectAddEach() - { - _editor.get()->PublicWndProc(Scintilla::Message::MultipleSelectAddEach, static_cast(0), static_cast(0)); - } - - /** - * Indicate that the internal state of a lexer has changed over a range and therefore - * there may be a need to redraw. - */ - int32_t Editor::ChangeLexerState(int64_t start, int64_t end) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::ChangeLexerState, static_cast(start), static_cast(end))); - } - - /** - * Find the next line at or after lineStart that is a contracted fold header line. - * Return -1 when no more lines. - */ - int64_t Editor::ContractedFoldNext(int64_t lineStart) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::ContractedFoldNext, static_cast(lineStart), static_cast(0))); - } - - /** - * Centre current line in window. - */ - void Editor::VerticalCentreCaret() - { - _editor.get()->PublicWndProc(Scintilla::Message::VerticalCentreCaret, static_cast(0), static_cast(0)); - } - - /** - * Move the selected lines up one line, shifting the line above after the selection - */ - void Editor::MoveSelectedLinesUp() - { - _editor.get()->PublicWndProc(Scintilla::Message::MoveSelectedLinesUp, static_cast(0), static_cast(0)); - } - - /** - * Move the selected lines down one line, shifting the line below before the selection - */ - void Editor::MoveSelectedLinesDown() - { - _editor.get()->PublicWndProc(Scintilla::Message::MoveSelectedLinesDown, static_cast(0), static_cast(0)); - } - - /** - * Define a marker from RGBA data. - * It has the width and height from RGBAImageSetWidth/Height - */ - void Editor::MarkerDefineRGBAImageFromBuffer(int32_t markerNumber, Windows::Storage::Streams::IBuffer const &pixels) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerDefineRGBAImage, static_cast(markerNumber), reinterpret_cast(pixels ? pixels.data() : nullptr)); - } - - void Editor::MarkerDefineRGBAImage(int32_t markerNumber, hstring const &pixels) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerDefineRGBAImage, static_cast(markerNumber), reinterpret_cast(to_string(pixels).c_str())); - } - - /** - * Register an RGBA image for use in autocompletion lists. - * It has the width and height from RGBAImageSetWidth/Height - */ - void Editor::RegisterRGBAImageFromBuffer(int32_t type, Windows::Storage::Streams::IBuffer const &pixels) - { - _editor.get()->PublicWndProc(Scintilla::Message::RegisterRGBAImage, static_cast(type), reinterpret_cast(pixels ? pixels.data() : nullptr)); - } - - void Editor::RegisterRGBAImage(int32_t type, hstring const &pixels) - { - _editor.get()->PublicWndProc(Scintilla::Message::RegisterRGBAImage, static_cast(type), reinterpret_cast(to_string(pixels).c_str())); - } - - /** - * Scroll to start of document. - */ - void Editor::ScrollToStart() - { - _editor.get()->PublicWndProc(Scintilla::Message::ScrollToStart, static_cast(0), static_cast(0)); - } - - /** - * Scroll to end of document. - */ - void Editor::ScrollToEnd() - { - _editor.get()->PublicWndProc(Scintilla::Message::ScrollToEnd, static_cast(0), static_cast(0)); - } - - /** - * Create an ILoader*. - */ - uint64_t Editor::CreateLoader(int64_t bytes, WinUIEditor::DocumentOption const &documentOptions) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::CreateLoader, static_cast(bytes), static_cast(documentOptions))); - } - - /** - * On macOS, show a find indicator. - */ - void Editor::FindIndicatorShow(int64_t start, int64_t end) - { - _editor.get()->PublicWndProc(Scintilla::Message::FindIndicatorShow, static_cast(start), static_cast(end)); - } - - /** - * On macOS, flash a find indicator, then fade out. - */ - void Editor::FindIndicatorFlash(int64_t start, int64_t end) - { - _editor.get()->PublicWndProc(Scintilla::Message::FindIndicatorFlash, static_cast(start), static_cast(end)); - } - - /** - * On macOS, hide the find indicator. - */ - void Editor::FindIndicatorHide() - { - _editor.get()->PublicWndProc(Scintilla::Message::FindIndicatorHide, static_cast(0), static_cast(0)); - } - - /** - * Move caret to before first visible character on display line. - * If already there move to first character on display line. - */ - void Editor::VCHomeDisplay() - { - _editor.get()->PublicWndProc(Scintilla::Message::VCHomeDisplay, static_cast(0), static_cast(0)); - } - - /** - * Like VCHomeDisplay but extending selection to new caret position. - */ - void Editor::VCHomeDisplayExtend() - { - _editor.get()->PublicWndProc(Scintilla::Message::VCHomeDisplayExtend, static_cast(0), static_cast(0)); - } - - /** - * Remove a character representation. - */ - void Editor::ClearRepresentationFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter) - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearRepresentation, reinterpret_cast(encodedCharacter ? encodedCharacter.data() : nullptr), static_cast(0)); - } - - void Editor::ClearRepresentation(hstring const &encodedCharacter) - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearRepresentation, reinterpret_cast(to_string(encodedCharacter).c_str()), static_cast(0)); - } - - /** - * Clear representations to default. - */ - void Editor::ClearAllRepresentations() - { - _editor.get()->PublicWndProc(Scintilla::Message::ClearAllRepresentations, static_cast(0), static_cast(0)); - } - - /** - * Clear the end of annotations from all lines - */ - void Editor::EOLAnnotationClearAll() - { - _editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationClearAll, static_cast(0), static_cast(0)); - } - - /** - * Request line character index be created or its use count increased. - */ - void Editor::AllocateLineCharacterIndex(WinUIEditor::LineCharacterIndexType const &lineCharacterIndex) - { - _editor.get()->PublicWndProc(Scintilla::Message::AllocateLineCharacterIndex, static_cast(lineCharacterIndex), static_cast(0)); - } - - /** - * Decrease use count of line character index and remove if 0. - */ - void Editor::ReleaseLineCharacterIndex(WinUIEditor::LineCharacterIndexType const &lineCharacterIndex) - { - _editor.get()->PublicWndProc(Scintilla::Message::ReleaseLineCharacterIndex, static_cast(lineCharacterIndex), static_cast(0)); - } - - /** - * Retrieve the document line containing a position measured in index units. - */ - int64_t Editor::LineFromIndexPosition(int64_t pos, WinUIEditor::LineCharacterIndexType const &lineCharacterIndex) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::LineFromIndexPosition, static_cast(pos), static_cast(lineCharacterIndex))); - } - - /** - * Retrieve the position measured in index units at the start of a document line. - */ - int64_t Editor::IndexPositionFromLine(int64_t line, WinUIEditor::LineCharacterIndexType const &lineCharacterIndex) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndexPositionFromLine, static_cast(line), static_cast(lineCharacterIndex))); - } - - /** - * Start notifying the container of all key presses and commands. - */ - void Editor::StartRecord() - { - _editor.get()->PublicWndProc(Scintilla::Message::StartRecord, static_cast(0), static_cast(0)); - } - - /** - * Stop notifying the container of all key presses and commands. - */ - void Editor::StopRecord() - { - _editor.get()->PublicWndProc(Scintilla::Message::StopRecord, static_cast(0), static_cast(0)); - } - - /** - * Colourise a segment of the document using the current lexing language. - */ - void Editor::Colourise(int64_t start, int64_t end) - { - _editor.get()->PublicWndProc(Scintilla::Message::Colourise, static_cast(start), static_cast(end)); - } - - /** - * For private communication between an application and a known lexer. - */ - uint64_t Editor::PrivateLexerCall(int32_t operation, uint64_t pointer) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PrivateLexerCall, static_cast(operation), static_cast(pointer))); - } - - /** - * Retrieve a '\n' separated list of properties understood by the current lexer. - * Result is NUL-terminated. - */ - int32_t Editor::PropertyNamesWriteBuffer(Windows::Storage::Streams::IBuffer const &names) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PropertyNames, static_cast(0), reinterpret_cast(names ? names.data() : nullptr))); - } - - hstring Editor::PropertyNames() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PropertyNames, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::PropertyNames, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve the type of a property. - */ - WinUIEditor::TypeProperty Editor::PropertyTypeFromBuffer(Windows::Storage::Streams::IBuffer const &name) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PropertyType, reinterpret_cast(name ? name.data() : nullptr), static_cast(0))); - } - - WinUIEditor::TypeProperty Editor::PropertyType(hstring const &name) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::PropertyType, reinterpret_cast(to_string(name).c_str()), static_cast(0))); - } - - /** - * Describe a property. - * Result is NUL-terminated. - */ - int32_t Editor::DescribePropertyWriteBuffer(Windows::Storage::Streams::IBuffer const &name, Windows::Storage::Streams::IBuffer const &description) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::DescribeProperty, reinterpret_cast(name ? name.data() : nullptr), reinterpret_cast(description ? description.data() : nullptr))); - } - - hstring Editor::DescribeProperty(hstring const &name) - { - const auto wParam{ reinterpret_cast(to_string(name).c_str()) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::DescribeProperty, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::DescribeProperty, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. - * Result is NUL-terminated. - */ - int32_t Editor::DescribeKeyWordSetsWriteBuffer(Windows::Storage::Streams::IBuffer const &descriptions) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::DescribeKeyWordSets, static_cast(0), reinterpret_cast(descriptions ? descriptions.data() : nullptr))); - } - - hstring Editor::DescribeKeyWordSets() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::DescribeKeyWordSets, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::DescribeKeyWordSets, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Allocate a set of sub styles for a particular base style, returning start of range - */ - int32_t Editor::AllocateSubStyles(int32_t styleBase, int32_t numberStyles) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AllocateSubStyles, static_cast(styleBase), static_cast(numberStyles))); - } - - /** - * Free allocated sub styles - */ - void Editor::FreeSubStyles() - { - _editor.get()->PublicWndProc(Scintilla::Message::FreeSubStyles, static_cast(0), static_cast(0)); - } - - /** - * Retrieve the name of a style. - * Result is NUL-terminated. - */ - int32_t Editor::NameOfStyleWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &name) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::NameOfStyle, static_cast(style), reinterpret_cast(name ? name.data() : nullptr))); - } - - hstring Editor::NameOfStyle(int32_t style) - { - const auto wParam{ static_cast(style) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::NameOfStyle, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::NameOfStyle, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve a ' ' separated list of style tags like "literal quoted string". - * Result is NUL-terminated. - */ - int32_t Editor::TagsOfStyleWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &tags) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::TagsOfStyle, static_cast(style), reinterpret_cast(tags ? tags.data() : nullptr))); - } - - hstring Editor::TagsOfStyle(int32_t style) - { - const auto wParam{ static_cast(style) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::TagsOfStyle, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::TagsOfStyle, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve a description of a style. - * Result is NUL-terminated. - */ - int32_t Editor::DescriptionOfStyleWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &description) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::DescriptionOfStyle, static_cast(style), reinterpret_cast(description ? description.data() : nullptr))); - } - - hstring Editor::DescriptionOfStyle(int32_t style) - { - const auto wParam{ static_cast(style) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::DescriptionOfStyle, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::DescriptionOfStyle, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Returns the character byte at the position. - */ - int32_t Editor::GetCharAt(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetCharAt, static_cast(pos), static_cast(0))); - } - - /** - * Returns the style byte at the position. - */ - int32_t Editor::GetStyleAt(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetStyleAt, static_cast(pos), static_cast(0))); - } - - /** - * Returns the unsigned style byte at the position. - */ - int32_t Editor::GetStyleIndexAt(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetStyleIndexAt, static_cast(pos), static_cast(0))); - } - - /** - * Get the locale for displaying text. - */ - int32_t Editor::GetFontLocaleWriteBuffer(Windows::Storage::Streams::IBuffer const &localeName) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetFontLocale, static_cast(0), reinterpret_cast(localeName ? localeName.data() : nullptr))); - } - - hstring Editor::GetFontLocale() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetFontLocale, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetFontLocale, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the layer used for a marker that is drawn in the text area, not the margin. - */ - WinUIEditor::Layer Editor::MarkerGetLayer(int32_t markerNumber) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarkerGetLayer, static_cast(markerNumber), static_cast(0))); - } - - /** - * Retrieve the type of a margin. - */ - WinUIEditor::MarginType Editor::GetMarginTypeN(int32_t margin) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginTypeN, static_cast(margin), static_cast(0))); - } - - /** - * Retrieve the width of a margin in pixels. - */ - int32_t Editor::GetMarginWidthN(int32_t margin) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginWidthN, static_cast(margin), static_cast(0))); - } - - /** - * Retrieve the marker mask of a margin. - */ - int32_t Editor::GetMarginMaskN(int32_t margin) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginMaskN, static_cast(margin), static_cast(0))); - } - - /** - * Retrieve the mouse click sensitivity of a margin. - */ - bool Editor::GetMarginSensitiveN(int32_t margin) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginSensitiveN, static_cast(margin), static_cast(0))); - } - - /** - * Retrieve the cursor shown in a margin. - */ - WinUIEditor::CursorShape Editor::GetMarginCursorN(int32_t margin) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginCursorN, static_cast(margin), static_cast(0))); - } - - /** - * Retrieve the background colour of a margin - */ - int32_t Editor::GetMarginBackN(int32_t margin) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMarginBackN, static_cast(margin), static_cast(0))); - } - - /** - * Get the foreground colour of a style. - */ - int32_t Editor::StyleGetFore(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetFore, static_cast(style), static_cast(0))); - } - - /** - * Get the background colour of a style. - */ - int32_t Editor::StyleGetBack(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetBack, static_cast(style), static_cast(0))); - } - - /** - * Get is a style bold or not. - */ - bool Editor::StyleGetBold(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetBold, static_cast(style), static_cast(0))); - } - - /** - * Get is a style italic or not. - */ - bool Editor::StyleGetItalic(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetItalic, static_cast(style), static_cast(0))); - } - - /** - * Get the size of characters of a style. - */ - int32_t Editor::StyleGetSize(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetSize, static_cast(style), static_cast(0))); - } - - /** - * Get the font of a style. - * Returns the length of the fontName - * Result is NUL-terminated. - */ - int32_t Editor::StyleGetFontWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &fontName) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetFont, static_cast(style), reinterpret_cast(fontName ? fontName.data() : nullptr))); - } - - hstring Editor::StyleGetFont(int32_t style) - { - const auto wParam{ static_cast(style) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetFont, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::StyleGetFont, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get is a style to have its end of line filled or not. - */ - bool Editor::StyleGetEOLFilled(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetEOLFilled, static_cast(style), static_cast(0))); - } - - /** - * Get is a style underlined or not. - */ - bool Editor::StyleGetUnderline(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetUnderline, static_cast(style), static_cast(0))); - } - - /** - * Get is a style mixed case, or to force upper or lower case. - */ - WinUIEditor::CaseVisible Editor::StyleGetCase(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetCase, static_cast(style), static_cast(0))); - } - - /** - * Get the character get of the font in a style. - */ - WinUIEditor::CharacterSet Editor::StyleGetCharacterSet(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetCharacterSet, static_cast(style), static_cast(0))); - } - - /** - * Get is a style visible or not. - */ - bool Editor::StyleGetVisible(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetVisible, static_cast(style), static_cast(0))); - } - - /** - * Get is a style changeable or not (read only). - * Experimental feature, currently buggy. - */ - bool Editor::StyleGetChangeable(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetChangeable, static_cast(style), static_cast(0))); - } - - /** - * Get is a style a hotspot or not. - */ - bool Editor::StyleGetHotSpot(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetHotSpot, static_cast(style), static_cast(0))); - } - - /** - * Get the size of characters of a style in points multiplied by 100 - */ - int32_t Editor::StyleGetSizeFractional(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetSizeFractional, static_cast(style), static_cast(0))); - } - - /** - * Get the weight of characters of a style. - */ - WinUIEditor::FontWeight Editor::StyleGetWeight(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetWeight, static_cast(style), static_cast(0))); - } - - /** - * Get whether a style may be monospaced. - */ - bool Editor::StyleGetCheckMonospaced(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetCheckMonospaced, static_cast(style), static_cast(0))); - } - - /** - * Get the invisible representation for a style. - */ - int32_t Editor::StyleGetInvisibleRepresentationWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &representation) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetInvisibleRepresentation, static_cast(style), reinterpret_cast(representation ? representation.data() : nullptr))); - } - - hstring Editor::StyleGetInvisibleRepresentation(int32_t style) - { - const auto wParam{ static_cast(style) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::StyleGetInvisibleRepresentation, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::StyleGetInvisibleRepresentation, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the colour of an element. - */ - int32_t Editor::GetElementColour(WinUIEditor::Element const &element) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetElementColour, static_cast(element), static_cast(0))); - } - - /** - * Get whether an element has been set by SetElementColour. - * When false, a platform-defined or default colour is used. - */ - bool Editor::GetElementIsSet(WinUIEditor::Element const &element) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetElementIsSet, static_cast(element), static_cast(0))); - } - - /** - * Get whether an element supports translucency. - */ - bool Editor::GetElementAllowsTranslucent(WinUIEditor::Element const &element) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetElementAllowsTranslucent, static_cast(element), static_cast(0))); - } - - /** - * Get the colour of an element. - */ - int32_t Editor::GetElementBaseColour(WinUIEditor::Element const &element) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetElementBaseColour, static_cast(element), static_cast(0))); - } - - /** - * Get the set of characters making up words for when moving or selecting by word. - * Returns the number of characters - */ - int32_t Editor::GetWordCharsWriteBuffer(Windows::Storage::Streams::IBuffer const &characters) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWordChars, static_cast(0), reinterpret_cast(characters ? characters.data() : nullptr))); - } - - hstring Editor::GetWordChars() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWordChars, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetWordChars, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * What is the type of an action? - */ - int32_t Editor::GetUndoActionType(int32_t action) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoActionType, static_cast(action), static_cast(0))); - } - - /** - * What is the position of an action? - */ - int64_t Editor::GetUndoActionPosition(int32_t action) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoActionPosition, static_cast(action), static_cast(0))); - } - - /** - * What is the text of an action? - */ - int32_t Editor::GetUndoActionTextWriteBuffer(int32_t action, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoActionText, static_cast(action), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::GetUndoActionText(int32_t action) - { - const auto wParam{ static_cast(action) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetUndoActionText, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetUndoActionText, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve the style of an indicator. - */ - WinUIEditor::IndicatorStyle Editor::IndicGetStyle(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetStyle, static_cast(indicator), static_cast(0))); - } - - /** - * Retrieve the foreground colour of an indicator. - */ - int32_t Editor::IndicGetFore(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetFore, static_cast(indicator), static_cast(0))); - } - - /** - * Retrieve whether indicator drawn under or over text. - */ - bool Editor::IndicGetUnder(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetUnder, static_cast(indicator), static_cast(0))); - } - - /** - * Retrieve the hover style of an indicator. - */ - WinUIEditor::IndicatorStyle Editor::IndicGetHoverStyle(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetHoverStyle, static_cast(indicator), static_cast(0))); - } - - /** - * Retrieve the foreground hover colour of an indicator. - */ - int32_t Editor::IndicGetHoverFore(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetHoverFore, static_cast(indicator), static_cast(0))); - } - - /** - * Retrieve the attributes of an indicator. - */ - WinUIEditor::IndicFlag Editor::IndicGetFlags(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetFlags, static_cast(indicator), static_cast(0))); - } - - /** - * Retrieve the stroke width of an indicator. - */ - int32_t Editor::IndicGetStrokeWidth(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetStrokeWidth, static_cast(indicator), static_cast(0))); - } - - /** - * Retrieve the extra styling information for a line. - */ - int32_t Editor::GetLineState(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineState, static_cast(line), static_cast(0))); - } - - /** - * Retrieve the number of columns that a line is indented. - */ - int32_t Editor::GetLineIndentation(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineIndentation, static_cast(line), static_cast(0))); - } - - /** - * Retrieve the position before the first non indentation character on a line. - */ - int64_t Editor::GetLineIndentPosition(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineIndentPosition, static_cast(line), static_cast(0))); - } - - /** - * Retrieve the column number of a position, taking tab width into account. - */ - int64_t Editor::GetColumn(int64_t pos) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetColumn, static_cast(pos), static_cast(0))); - } - - /** - * Get the position after the last visible characters on a line. - */ - int64_t Editor::GetLineEndPosition(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineEndPosition, static_cast(line), static_cast(0))); - } - - /** - * Retrieve the text in the target. - */ - int64_t Editor::GetTargetTextWriteBuffer(Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTargetText, static_cast(0), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::GetTargetText() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTargetText, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetTargetText, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve the fold level of a line. - */ - WinUIEditor::FoldLevel Editor::GetFoldLevel(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetFoldLevel, static_cast(line), static_cast(0))); - } - - /** - * Find the last child line of a header line. - */ - int64_t Editor::GetLastChild(int64_t line, WinUIEditor::FoldLevel const &level) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLastChild, static_cast(line), static_cast(level))); - } - - /** - * Find the parent line of a child line. - */ - int64_t Editor::GetFoldParent(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetFoldParent, static_cast(line), static_cast(0))); - } - - /** - * Is a line visible? - */ - bool Editor::GetLineVisible(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLineVisible, static_cast(line), static_cast(0))); - } - - /** - * Is a header line expanded? - */ - bool Editor::GetFoldExpanded(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetFoldExpanded, static_cast(line), static_cast(0))); - } - - /** - * Retrieve the value of a tag from a regular expression search. - * Result is NUL-terminated. - */ - int32_t Editor::GetTagWriteBuffer(int32_t tagNumber, Windows::Storage::Streams::IBuffer const &tagValue) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTag, static_cast(tagNumber), reinterpret_cast(tagValue ? tagValue.data() : nullptr))); - } - - hstring Editor::GetTag(int32_t tagNumber) - { - const auto wParam{ static_cast(tagNumber) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetTag, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetTag, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get multi edge positions. - */ - int64_t Editor::GetMultiEdgeColumn(int32_t which) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetMultiEdgeColumn, static_cast(which), static_cast(0))); - } - - /** - * Get the fore colour for active hotspots. - */ - int32_t Editor::GetHotspotActiveFore() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetHotspotActiveFore, static_cast(0), static_cast(0))); - } - - /** - * Get the back colour for active hotspots. - */ - int32_t Editor::GetHotspotActiveBack() - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetHotspotActiveBack, static_cast(0), static_cast(0))); - } - - /** - * Get the set of characters making up whitespace for when moving or selecting by word. - */ - int32_t Editor::GetWhitespaceCharsWriteBuffer(Windows::Storage::Streams::IBuffer const &characters) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWhitespaceChars, static_cast(0), reinterpret_cast(characters ? characters.data() : nullptr))); - } - - hstring Editor::GetWhitespaceChars() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetWhitespaceChars, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetWhitespaceChars, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the set of characters making up punctuation characters - */ - int32_t Editor::GetPunctuationCharsWriteBuffer(Windows::Storage::Streams::IBuffer const &characters) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPunctuationChars, static_cast(0), reinterpret_cast(characters ? characters.data() : nullptr))); - } - - hstring Editor::GetPunctuationChars() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPunctuationChars, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetPunctuationChars, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get currently selected item text in the auto-completion list - * Returns the length of the item text - * Result is NUL-terminated. - */ - int32_t Editor::AutoCGetCurrentTextWriteBuffer(Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetCurrentText, static_cast(0), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::AutoCGetCurrentText() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AutoCGetCurrentText, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::AutoCGetCurrentText, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * 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 lengthRange bytes. - */ - uint64_t Editor::GetRangePointer(int64_t start, int64_t lengthRange) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRangePointer, static_cast(start), static_cast(lengthRange))); - } - - /** - * Get the alpha fill colour of the given indicator. - */ - WinUIEditor::Alpha Editor::IndicGetAlpha(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetAlpha, static_cast(indicator), static_cast(0))); - } - - /** - * Get the alpha outline colour of the given indicator. - */ - WinUIEditor::Alpha Editor::IndicGetOutlineAlpha(int32_t indicator) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::IndicGetOutlineAlpha, static_cast(indicator), static_cast(0))); - } - - /** - * Get the text in the text margin for a line - */ - int32_t Editor::MarginGetTextWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarginGetText, static_cast(line), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::MarginGetText(int64_t line) - { - const auto wParam{ static_cast(line) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarginGetText, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::MarginGetText, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the style number for the text margin for a line - */ - int32_t Editor::MarginGetStyle(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarginGetStyle, static_cast(line), static_cast(0))); - } - - /** - * Get the styles in the text margin for a line - */ - int32_t Editor::MarginGetStylesWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &styles) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarginGetStyles, static_cast(line), reinterpret_cast(styles ? styles.data() : nullptr))); - } - - hstring Editor::MarginGetStyles(int64_t line) - { - const auto wParam{ static_cast(line) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::MarginGetStyles, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::MarginGetStyles, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the annotation text for a line - */ - int32_t Editor::AnnotationGetTextWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetText, static_cast(line), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::AnnotationGetText(int64_t line) - { - const auto wParam{ static_cast(line) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetText, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetText, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the style number for the annotations for a line - */ - int32_t Editor::AnnotationGetStyle(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetStyle, static_cast(line), static_cast(0))); - } - - /** - * Get the annotation styles for a line - */ - int32_t Editor::AnnotationGetStylesWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &styles) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetStyles, static_cast(line), reinterpret_cast(styles ? styles.data() : nullptr))); - } - - hstring Editor::AnnotationGetStyles(int64_t line) - { - const auto wParam{ static_cast(line) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetStyles, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetStyles, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the number of annotation lines for a line - */ - int32_t Editor::AnnotationGetLines(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::AnnotationGetLines, static_cast(line), static_cast(0))); - } - - /** - * Return the caret position of the nth selection. - */ - int64_t Editor::GetSelectionNCaret(int32_t selection) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionNCaret, static_cast(selection), static_cast(0))); - } - - /** - * Return the anchor position of the nth selection. - */ - int64_t Editor::GetSelectionNAnchor(int32_t selection) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionNAnchor, static_cast(selection), static_cast(0))); - } - - /** - * Return the virtual space of the caret of the nth selection. - */ - int64_t Editor::GetSelectionNCaretVirtualSpace(int32_t selection) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionNCaretVirtualSpace, static_cast(selection), static_cast(0))); - } - - /** - * Return the virtual space of the anchor of the nth selection. - */ - int64_t Editor::GetSelectionNAnchorVirtualSpace(int32_t selection) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionNAnchorVirtualSpace, static_cast(selection), static_cast(0))); - } - - /** - * Returns the position at the start of the selection. - */ - int64_t Editor::GetSelectionNStart(int32_t selection) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionNStart, static_cast(selection), static_cast(0))); - } - - /** - * Returns the virtual space at the start of the selection. - */ - int64_t Editor::GetSelectionNStartVirtualSpace(int32_t selection) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionNStartVirtualSpace, static_cast(selection), static_cast(0))); - } - - /** - * Returns the virtual space at the end of the selection. - */ - int64_t Editor::GetSelectionNEndVirtualSpace(int32_t selection) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionNEndVirtualSpace, static_cast(selection), static_cast(0))); - } - - /** - * Returns the position at the end of the selection. - */ - int64_t Editor::GetSelectionNEnd(int32_t selection) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSelectionNEnd, static_cast(selection), static_cast(0))); - } - - /** - * Get the way a character is drawn. - * Result is NUL-terminated. - */ - int32_t Editor::GetRepresentationWriteBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter, Windows::Storage::Streams::IBuffer const &representation) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRepresentation, reinterpret_cast(encodedCharacter ? encodedCharacter.data() : nullptr), reinterpret_cast(representation ? representation.data() : nullptr))); - } - - hstring Editor::GetRepresentation(hstring const &encodedCharacter) - { - const auto wParam{ reinterpret_cast(to_string(encodedCharacter).c_str()) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRepresentation, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetRepresentation, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the appearance of a representation. - */ - WinUIEditor::RepresentationAppearance Editor::GetRepresentationAppearanceFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRepresentationAppearance, reinterpret_cast(encodedCharacter ? encodedCharacter.data() : nullptr), static_cast(0))); - } - - WinUIEditor::RepresentationAppearance Editor::GetRepresentationAppearance(hstring const &encodedCharacter) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRepresentationAppearance, reinterpret_cast(to_string(encodedCharacter).c_str()), static_cast(0))); - } - - /** - * Get the colour of a representation. - */ - int32_t Editor::GetRepresentationColourFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRepresentationColour, reinterpret_cast(encodedCharacter ? encodedCharacter.data() : nullptr), static_cast(0))); - } - - int32_t Editor::GetRepresentationColour(hstring const &encodedCharacter) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetRepresentationColour, reinterpret_cast(to_string(encodedCharacter).c_str()), static_cast(0))); - } - - /** - * Get the end of line annotation text for a line - */ - int32_t Editor::EOLAnnotationGetTextWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationGetText, static_cast(line), reinterpret_cast(text ? text.data() : nullptr))); - } - - hstring Editor::EOLAnnotationGetText(int64_t line) - { - const auto wParam{ static_cast(line) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationGetText, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationGetText, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Get the style number for the end of line annotations for a line - */ - int32_t Editor::EOLAnnotationGetStyle(int64_t line) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationGetStyle, static_cast(line), static_cast(0))); - } - - /** - * Get whether a feature is supported - */ - bool Editor::SupportsFeature(WinUIEditor::Supports const &feature) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::SupportsFeature, static_cast(feature), static_cast(0))); - } - - /** - * Retrieve a "property" value previously set with SetProperty. - * Result is NUL-terminated. - */ - int32_t Editor::GetPropertyWriteBuffer(Windows::Storage::Streams::IBuffer const &key, Windows::Storage::Streams::IBuffer const &value) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetProperty, reinterpret_cast(key ? key.data() : nullptr), reinterpret_cast(value ? value.data() : nullptr))); - } - - hstring Editor::GetProperty(hstring const &key) - { - const auto wParam{ reinterpret_cast(to_string(key).c_str()) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetProperty, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetProperty, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve a "property" value previously set with SetProperty, - * with "$()" variable replacement on returned buffer. - * Result is NUL-terminated. - */ - int32_t Editor::GetPropertyExpandedWriteBuffer(Windows::Storage::Streams::IBuffer const &key, Windows::Storage::Streams::IBuffer const &value) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPropertyExpanded, reinterpret_cast(key ? key.data() : nullptr), reinterpret_cast(value ? value.data() : nullptr))); - } - - hstring Editor::GetPropertyExpanded(hstring const &key) - { - const auto wParam{ reinterpret_cast(to_string(key).c_str()) }; - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPropertyExpanded, wParam, static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetPropertyExpanded, wParam, reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Retrieve a "property" value previously set with SetProperty, - * interpreted as an int AFTER any "$()" variable replacement. - */ - int32_t Editor::GetPropertyIntFromBuffer(Windows::Storage::Streams::IBuffer const &key, int32_t defaultValue) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPropertyInt, reinterpret_cast(key ? key.data() : nullptr), static_cast(defaultValue))); - } - - int32_t Editor::GetPropertyInt(hstring const &key, int32_t defaultValue) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPropertyInt, reinterpret_cast(to_string(key).c_str()), static_cast(defaultValue))); - } - - /** - * Retrieve the name of the lexer. - * Return the length of the text. - * Result is NUL-terminated. - */ - int32_t Editor::GetLexerLanguageWriteBuffer(Windows::Storage::Streams::IBuffer const &language) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLexerLanguage, static_cast(0), reinterpret_cast(language ? language.data() : nullptr))); - } - - hstring Editor::GetLexerLanguage() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetLexerLanguage, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetLexerLanguage, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * The starting style number for the sub styles associated with a base style - */ - int32_t Editor::GetSubStylesStart(int32_t styleBase) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSubStylesStart, static_cast(styleBase), static_cast(0))); - } - - /** - * The number of sub styles associated with a base style - */ - int32_t Editor::GetSubStylesLength(int32_t styleBase) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSubStylesLength, static_cast(styleBase), static_cast(0))); - } - - /** - * For a sub style, return the base style, else return the argument. - */ - int32_t Editor::GetStyleFromSubStyle(int32_t subStyle) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetStyleFromSubStyle, static_cast(subStyle), static_cast(0))); - } - - /** - * For a secondary style, return the primary style, else return the argument. - */ - int32_t Editor::GetPrimaryStyleFromStyle(int32_t style) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetPrimaryStyleFromStyle, static_cast(style), static_cast(0))); - } - - /** - * Get the set of base styles that can be extended with sub styles - * Result is NUL-terminated. - */ - int32_t Editor::GetSubStyleBasesWriteBuffer(Windows::Storage::Streams::IBuffer const &styles) - { - return static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSubStyleBases, static_cast(0), reinterpret_cast(styles ? styles.data() : nullptr))); - } - - hstring Editor::GetSubStyleBases() - { - const auto len{ static_cast(_editor.get()->PublicWndProc(Scintilla::Message::GetSubStyleBases, static_cast(0), static_cast(0))) }; - if (len) - { - std::string value(len, '\0'); - _editor.get()->PublicWndProc(Scintilla::Message::GetSubStyleBases, static_cast(0), reinterpret_cast(value.data())); - return to_hstring(value); - } - else - { - return hstring{}; - } - } - - /** - * Set the locale for displaying text. - */ - void Editor::SetFontLocaleFromBuffer(Windows::Storage::Streams::IBuffer const &localeName) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFontLocale, static_cast(0), reinterpret_cast(localeName ? localeName.data() : nullptr)); - } - - void Editor::SetFontLocale(hstring const &localeName) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFontLocale, static_cast(0), reinterpret_cast(to_string(localeName).c_str())); - } - - /** - * Set the foreground colour used for a particular marker number. - */ - void Editor::MarkerSetFore(int32_t markerNumber, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetFore, static_cast(markerNumber), static_cast(fore)); - } - - /** - * Set the background colour used for a particular marker number. - */ - void Editor::MarkerSetBack(int32_t markerNumber, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetBack, static_cast(markerNumber), static_cast(back)); - } - - /** - * Set the background colour used for a particular marker number when its folding block is selected. - */ - void Editor::MarkerSetBackSelected(int32_t markerNumber, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetBackSelected, static_cast(markerNumber), static_cast(back)); - } - - /** - * Set the foreground colour used for a particular marker number. - */ - void Editor::MarkerSetForeTranslucent(int32_t markerNumber, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetForeTranslucent, static_cast(markerNumber), static_cast(fore)); - } - - /** - * Set the background colour used for a particular marker number. - */ - void Editor::MarkerSetBackTranslucent(int32_t markerNumber, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetBackTranslucent, static_cast(markerNumber), static_cast(back)); - } - - /** - * Set the background colour used for a particular marker number when its folding block is selected. - */ - void Editor::MarkerSetBackSelectedTranslucent(int32_t markerNumber, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetBackSelectedTranslucent, static_cast(markerNumber), static_cast(back)); - } - - /** - * Set the width of strokes used in .01 pixels so 50 = 1/2 pixel width. - */ - void Editor::MarkerSetStrokeWidth(int32_t markerNumber, int32_t hundredths) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetStrokeWidth, static_cast(markerNumber), static_cast(hundredths)); - } - - /** - * Set the alpha used for a marker that is drawn in the text area, not the margin. - */ - void Editor::MarkerSetAlpha(int32_t markerNumber, WinUIEditor::Alpha const &alpha) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetAlpha, static_cast(markerNumber), static_cast(alpha)); - } - - /** - * Set the layer used for a marker that is drawn in the text area, not the margin. - */ - void Editor::MarkerSetLayer(int32_t markerNumber, WinUIEditor::Layer const &layer) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarkerSetLayer, static_cast(markerNumber), static_cast(layer)); - } - - /** - * Set a margin to be either numeric or symbolic. - */ - void Editor::SetMarginTypeN(int32_t margin, WinUIEditor::MarginType const &marginType) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginTypeN, static_cast(margin), static_cast(marginType)); - } - - /** - * Set the width of a margin to a width expressed in pixels. - */ - void Editor::SetMarginWidthN(int32_t margin, int32_t pixelWidth) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginWidthN, static_cast(margin), static_cast(pixelWidth)); - } - - /** - * Set a mask that determines which markers are displayed in a margin. - */ - void Editor::SetMarginMaskN(int32_t margin, int32_t mask) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginMaskN, static_cast(margin), static_cast(mask)); - } - - /** - * Make a margin sensitive or insensitive to mouse clicks. - */ - void Editor::SetMarginSensitiveN(int32_t margin, bool sensitive) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginSensitiveN, static_cast(margin), static_cast(sensitive)); - } - - /** - * Set the cursor shown when the mouse is inside a margin. - */ - void Editor::SetMarginCursorN(int32_t margin, WinUIEditor::CursorShape const &cursor) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginCursorN, static_cast(margin), static_cast(cursor)); - } - - /** - * Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. - */ - void Editor::SetMarginBackN(int32_t margin, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetMarginBackN, static_cast(margin), static_cast(back)); - } - - /** - * Set the foreground colour of a style. - */ - void Editor::StyleSetFore(int32_t style, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetFore, static_cast(style), static_cast(fore)); - } - - /** - * Set the background colour of a style. - */ - void Editor::StyleSetBack(int32_t style, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetBack, static_cast(style), static_cast(back)); - } - - /** - * Set a style to be bold or not. - */ - void Editor::StyleSetBold(int32_t style, bool bold) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetBold, static_cast(style), static_cast(bold)); - } - - /** - * Set a style to be italic or not. - */ - void Editor::StyleSetItalic(int32_t style, bool italic) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetItalic, static_cast(style), static_cast(italic)); - } - - /** - * Set the size of characters of a style. - */ - void Editor::StyleSetSize(int32_t style, int32_t sizePoints) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetSize, static_cast(style), static_cast(sizePoints)); - } - - /** - * Set the font of a style. - */ - void Editor::StyleSetFontFromBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &fontName) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetFont, static_cast(style), reinterpret_cast(fontName ? fontName.data() : nullptr)); - } - - void Editor::StyleSetFont(int32_t style, hstring const &fontName) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetFont, static_cast(style), reinterpret_cast(to_string(fontName).c_str())); - } - - /** - * Set a style to have its end of line filled or not. - */ - void Editor::StyleSetEOLFilled(int32_t style, bool eolFilled) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetEOLFilled, static_cast(style), static_cast(eolFilled)); - } - - /** - * Set a style to be underlined or not. - */ - void Editor::StyleSetUnderline(int32_t style, bool underline) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetUnderline, static_cast(style), static_cast(underline)); - } - - /** - * Set a style to be mixed case, or to force upper or lower case. - */ - void Editor::StyleSetCase(int32_t style, WinUIEditor::CaseVisible const &caseVisible) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetCase, static_cast(style), static_cast(caseVisible)); - } - - /** - * Set the size of characters of a style. Size is in points multiplied by 100. - */ - void Editor::StyleSetSizeFractional(int32_t style, int32_t sizeHundredthPoints) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetSizeFractional, static_cast(style), static_cast(sizeHundredthPoints)); - } - - /** - * Set the weight of characters of a style. - */ - void Editor::StyleSetWeight(int32_t style, WinUIEditor::FontWeight const &weight) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetWeight, static_cast(style), static_cast(weight)); - } - - /** - * Set the character set of the font in a style. - */ - void Editor::StyleSetCharacterSet(int32_t style, WinUIEditor::CharacterSet const &characterSet) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetCharacterSet, static_cast(style), static_cast(characterSet)); - } - - /** - * Set a style to be a hotspot or not. - */ - void Editor::StyleSetHotSpot(int32_t style, bool hotspot) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetHotSpot, static_cast(style), static_cast(hotspot)); - } - - /** - * Indicate that a style may be monospaced over ASCII graphics characters which enables optimizations. - */ - void Editor::StyleSetCheckMonospaced(int32_t style, bool checkMonospaced) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetCheckMonospaced, static_cast(style), static_cast(checkMonospaced)); - } - - /** - * Set the invisible representation for a style. - */ - void Editor::StyleSetInvisibleRepresentationFromBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &representation) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetInvisibleRepresentation, static_cast(style), reinterpret_cast(representation ? representation.data() : nullptr)); - } - - void Editor::StyleSetInvisibleRepresentation(int32_t style, hstring const &representation) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetInvisibleRepresentation, static_cast(style), reinterpret_cast(to_string(representation).c_str())); - } - - /** - * Set the colour of an element. Translucency (alpha) may or may not be significant - * and this may depend on the platform. The alpha byte should commonly be 0xff for opaque. - */ - void Editor::SetElementColour(WinUIEditor::Element const &element, int32_t colourElement) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetElementColour, static_cast(element), static_cast(colourElement)); - } - - /** - * Set a style to be visible or not. - */ - void Editor::StyleSetVisible(int32_t style, bool visible) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetVisible, static_cast(style), static_cast(visible)); - } - - /** - * Set the set of characters making up words for when moving or selecting by word. - * First sets defaults like SetCharsDefault. - */ - void Editor::SetWordCharsFromBuffer(Windows::Storage::Streams::IBuffer const &characters) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWordChars, static_cast(0), reinterpret_cast(characters ? characters.data() : nullptr)); - } - - void Editor::SetWordChars(hstring const &characters) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWordChars, static_cast(0), reinterpret_cast(to_string(characters).c_str())); - } - - /** - * Set an indicator to plain, squiggle or TT. - */ - void Editor::IndicSetStyle(int32_t indicator, WinUIEditor::IndicatorStyle const &indicatorStyle) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetStyle, static_cast(indicator), static_cast(indicatorStyle)); - } - - /** - * Set the foreground colour of an indicator. - */ - void Editor::IndicSetFore(int32_t indicator, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetFore, static_cast(indicator), static_cast(fore)); - } - - /** - * Set an indicator to draw under text or over(default). - */ - void Editor::IndicSetUnder(int32_t indicator, bool under) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetUnder, static_cast(indicator), static_cast(under)); - } - - /** - * Set a hover indicator to plain, squiggle or TT. - */ - void Editor::IndicSetHoverStyle(int32_t indicator, WinUIEditor::IndicatorStyle const &indicatorStyle) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetHoverStyle, static_cast(indicator), static_cast(indicatorStyle)); - } - - /** - * Set the foreground hover colour of an indicator. - */ - void Editor::IndicSetHoverFore(int32_t indicator, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetHoverFore, static_cast(indicator), static_cast(fore)); - } - - /** - * Set the attributes of an indicator. - */ - void Editor::IndicSetFlags(int32_t indicator, WinUIEditor::IndicFlag const &flags) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetFlags, static_cast(indicator), static_cast(flags)); - } - - /** - * Set the stroke width of an indicator in hundredths of a pixel. - */ - void Editor::IndicSetStrokeWidth(int32_t indicator, int32_t hundredths) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetStrokeWidth, static_cast(indicator), static_cast(hundredths)); - } - - /** - * Used to hold extra styling information for each line. - */ - void Editor::SetLineState(int64_t line, int32_t state) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetLineState, static_cast(line), static_cast(state)); - } - - /** - * Set a style to be changeable or not (read only). - * Experimental feature, currently buggy. - */ - void Editor::StyleSetChangeable(int32_t style, bool changeable) - { - _editor.get()->PublicWndProc(Scintilla::Message::StyleSetChangeable, static_cast(style), static_cast(changeable)); - } - - /** - * Define a set of characters that when typed will cause the autocompletion to - * choose the selected item. - */ - void Editor::AutoCSetFillUpsFromBuffer(Windows::Storage::Streams::IBuffer const &characterSet) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetFillUps, static_cast(0), reinterpret_cast(characterSet ? characterSet.data() : nullptr)); - } - - void Editor::AutoCSetFillUps(hstring const &characterSet) - { - _editor.get()->PublicWndProc(Scintilla::Message::AutoCSetFillUps, static_cast(0), reinterpret_cast(to_string(characterSet).c_str())); - } - - /** - * Change the indentation of a line to a number of columns. - */ - void Editor::SetLineIndentation(int64_t line, int32_t indentation) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetLineIndentation, static_cast(line), static_cast(indentation)); - } - - /** - * Enlarge the number of lines allocated. - */ - void Editor::AllocateLines(int64_t lines) - { - _editor.get()->PublicWndProc(Scintilla::Message::AllocateLines, static_cast(lines), static_cast(0)); - } - - /** - * Set the start position in order to change when backspacing removes the calltip. - */ - void Editor::CallTipSetPosStart(int64_t posStart) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipSetPosStart, static_cast(posStart), static_cast(0)); - } - - /** - * Set the background colour for the call tip. - */ - void Editor::CallTipSetBack(int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipSetBack, static_cast(back), static_cast(0)); - } - - /** - * Set the foreground colour for the call tip. - */ - void Editor::CallTipSetFore(int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipSetFore, static_cast(fore), static_cast(0)); - } - - /** - * Set the foreground colour for the highlighted part of the call tip. - */ - void Editor::CallTipSetForeHlt(int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipSetForeHlt, static_cast(fore), static_cast(0)); - } - - /** - * Enable use of STYLE_CALLTIP and set call tip tab size in pixels. - */ - void Editor::CallTipUseStyle(int32_t tabSize) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipUseStyle, static_cast(tabSize), static_cast(0)); - } - - /** - * Set position of calltip, above or below text. - */ - void Editor::CallTipSetPosition(bool above) - { - _editor.get()->PublicWndProc(Scintilla::Message::CallTipSetPosition, static_cast(above), static_cast(0)); - } - - /** - * 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. - */ - void Editor::SetFoldLevel(int64_t line, WinUIEditor::FoldLevel const &level) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFoldLevel, static_cast(line), static_cast(level)); - } - - /** - * Show the children of a header line. - */ - void Editor::SetFoldExpanded(int64_t line, bool expanded) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFoldExpanded, static_cast(line), static_cast(expanded)); - } - - /** - * Set some style options for folding. - */ - void Editor::SetFoldFlags(WinUIEditor::FoldFlag const &flags) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetFoldFlags, static_cast(flags), static_cast(0)); - } - - /** - * Set a fore colour for active hotspots. - */ - void Editor::SetHotspotActiveFore(bool useSetting, int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetHotspotActiveFore, static_cast(useSetting), static_cast(fore)); - } - - /** - * Set a back colour for active hotspots. - */ - void Editor::SetHotspotActiveBack(bool useSetting, int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetHotspotActiveBack, static_cast(useSetting), static_cast(back)); - } - - /** - * Set the set of characters making up whitespace for when moving or selecting by word. - * Should be called after SetWordChars. - */ - void Editor::SetWhitespaceCharsFromBuffer(Windows::Storage::Streams::IBuffer const &characters) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWhitespaceChars, static_cast(0), reinterpret_cast(characters ? characters.data() : nullptr)); - } - - void Editor::SetWhitespaceChars(hstring const &characters) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetWhitespaceChars, static_cast(0), reinterpret_cast(to_string(characters).c_str())); - } - - /** - * Set the set of characters making up punctuation characters - * Should be called after SetWordChars. - */ - void Editor::SetPunctuationCharsFromBuffer(Windows::Storage::Streams::IBuffer const &characters) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetPunctuationChars, static_cast(0), reinterpret_cast(characters ? characters.data() : nullptr)); - } - - void Editor::SetPunctuationChars(hstring const &characters) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetPunctuationChars, static_cast(0), reinterpret_cast(to_string(characters).c_str())); - } - - /** - * Set the alpha fill colour of the given indicator. - */ - void Editor::IndicSetAlpha(int32_t indicator, WinUIEditor::Alpha const &alpha) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetAlpha, static_cast(indicator), static_cast(alpha)); - } - - /** - * Set the alpha outline colour of the given indicator. - */ - void Editor::IndicSetOutlineAlpha(int32_t indicator, WinUIEditor::Alpha const &alpha) - { - _editor.get()->PublicWndProc(Scintilla::Message::IndicSetOutlineAlpha, static_cast(indicator), static_cast(alpha)); - } - - /** - * Set the text in the text margin for a line - */ - void Editor::MarginSetTextFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarginSetText, static_cast(line), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::MarginSetText(int64_t line, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarginSetText, static_cast(line), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Set the style number for the text margin for a line - */ - void Editor::MarginSetStyle(int64_t line, int32_t style) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarginSetStyle, static_cast(line), static_cast(style)); - } - - /** - * Set the style in the text margin for a line - */ - void Editor::MarginSetStylesFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &styles) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarginSetStyles, static_cast(line), reinterpret_cast(styles ? styles.data() : nullptr)); - } - - void Editor::MarginSetStyles(int64_t line, hstring const &styles) - { - _editor.get()->PublicWndProc(Scintilla::Message::MarginSetStyles, static_cast(line), reinterpret_cast(to_string(styles).c_str())); - } - - /** - * Set the annotation text for a line - */ - void Editor::AnnotationSetTextFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationSetText, static_cast(line), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::AnnotationSetText(int64_t line, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationSetText, static_cast(line), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Set the style number for the annotations for a line - */ - void Editor::AnnotationSetStyle(int64_t line, int32_t style) - { - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationSetStyle, static_cast(line), static_cast(style)); - } - - /** - * Set the annotation styles for a line - */ - void Editor::AnnotationSetStylesFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &styles) - { - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationSetStyles, static_cast(line), reinterpret_cast(styles ? styles.data() : nullptr)); - } - - void Editor::AnnotationSetStyles(int64_t line, hstring const &styles) - { - _editor.get()->PublicWndProc(Scintilla::Message::AnnotationSetStyles, static_cast(line), reinterpret_cast(to_string(styles).c_str())); - } - - /** - * Set the caret position of the nth selection. - */ - void Editor::SetSelectionNCaret(int32_t selection, int64_t caret) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionNCaret, static_cast(selection), static_cast(caret)); - } - - /** - * Set the anchor position of the nth selection. - */ - void Editor::SetSelectionNAnchor(int32_t selection, int64_t anchor) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionNAnchor, static_cast(selection), static_cast(anchor)); - } - - /** - * Set the virtual space of the caret of the nth selection. - */ - void Editor::SetSelectionNCaretVirtualSpace(int32_t selection, int64_t space) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionNCaretVirtualSpace, static_cast(selection), static_cast(space)); - } - - /** - * Set the virtual space of the anchor of the nth selection. - */ - void Editor::SetSelectionNAnchorVirtualSpace(int32_t selection, int64_t space) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionNAnchorVirtualSpace, static_cast(selection), static_cast(space)); - } - - /** - * Sets the position that starts the selection - this becomes the anchor. - */ - void Editor::SetSelectionNStart(int32_t selection, int64_t anchor) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionNStart, static_cast(selection), static_cast(anchor)); - } - - /** - * Sets the position that ends the selection - this becomes the currentPosition. - */ - void Editor::SetSelectionNEnd(int32_t selection, int64_t caret) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetSelectionNEnd, static_cast(selection), static_cast(caret)); - } - - /** - * Set the foreground colour of additional selections. - * Must have previously called SetSelFore with non-zero first argument for this to have an effect. - */ - void Editor::SetAdditionalSelFore(int32_t fore) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAdditionalSelFore, static_cast(fore), static_cast(0)); - } - - /** - * Set the background colour of additional selections. - * Must have previously called SetSelBack with non-zero first argument for this to have an effect. - */ - void Editor::SetAdditionalSelBack(int32_t back) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetAdditionalSelBack, static_cast(back), static_cast(0)); - } - - /** - * Set the width for future RGBA image data. - */ - void Editor::RGBAImageSetWidth(int32_t width) - { - _editor.get()->PublicWndProc(Scintilla::Message::RGBAImageSetWidth, static_cast(width), static_cast(0)); - } - - /** - * Set the height for future RGBA image data. - */ - void Editor::RGBAImageSetHeight(int32_t height) - { - _editor.get()->PublicWndProc(Scintilla::Message::RGBAImageSetHeight, static_cast(height), static_cast(0)); - } - - /** - * Set the scale factor in percent for future RGBA image data. - */ - void Editor::RGBAImageSetScale(int32_t scalePercent) - { - _editor.get()->PublicWndProc(Scintilla::Message::RGBAImageSetScale, static_cast(scalePercent), static_cast(0)); - } - - /** - * Set the way a character is drawn. - */ - void Editor::SetRepresentationFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter, Windows::Storage::Streams::IBuffer const &representation) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRepresentation, reinterpret_cast(encodedCharacter ? encodedCharacter.data() : nullptr), reinterpret_cast(representation ? representation.data() : nullptr)); - } - - void Editor::SetRepresentation(hstring const &encodedCharacter, hstring const &representation) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRepresentation, reinterpret_cast(to_string(encodedCharacter).c_str()), reinterpret_cast(to_string(representation).c_str())); - } - - /** - * Set the appearance of a representation. - */ - void Editor::SetRepresentationAppearanceFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter, WinUIEditor::RepresentationAppearance const &appearance) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRepresentationAppearance, reinterpret_cast(encodedCharacter ? encodedCharacter.data() : nullptr), static_cast(appearance)); - } - - void Editor::SetRepresentationAppearance(hstring const &encodedCharacter, WinUIEditor::RepresentationAppearance const &appearance) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRepresentationAppearance, reinterpret_cast(to_string(encodedCharacter).c_str()), static_cast(appearance)); - } - - /** - * Set the colour of a representation. - */ - void Editor::SetRepresentationColourFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter, int32_t colour) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRepresentationColour, reinterpret_cast(encodedCharacter ? encodedCharacter.data() : nullptr), static_cast(colour)); - } - - void Editor::SetRepresentationColour(hstring const &encodedCharacter, int32_t colour) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetRepresentationColour, reinterpret_cast(to_string(encodedCharacter).c_str()), static_cast(colour)); - } - - /** - * Set the end of line annotation text for a line - */ - void Editor::EOLAnnotationSetTextFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationSetText, static_cast(line), reinterpret_cast(text ? text.data() : nullptr)); - } - - void Editor::EOLAnnotationSetText(int64_t line, hstring const &text) - { - _editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationSetText, static_cast(line), reinterpret_cast(to_string(text).c_str())); - } - - /** - * Set the style number for the end of line annotations for a line - */ - void Editor::EOLAnnotationSetStyle(int64_t line, int32_t style) - { - _editor.get()->PublicWndProc(Scintilla::Message::EOLAnnotationSetStyle, static_cast(line), static_cast(style)); - } - - /** - * Set up a value that may be used by a lexer for some optional feature. - */ - void Editor::SetPropertyFromBuffer(Windows::Storage::Streams::IBuffer const &key, Windows::Storage::Streams::IBuffer const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetProperty, reinterpret_cast(key ? key.data() : nullptr), reinterpret_cast(value ? value.data() : nullptr)); - } - - void Editor::SetProperty(hstring const &key, hstring const &value) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetProperty, reinterpret_cast(to_string(key).c_str()), reinterpret_cast(to_string(value).c_str())); - } - - /** - * Set up the key words used by the lexer. - */ - void Editor::SetKeyWordsFromBuffer(int32_t keyWordSet, Windows::Storage::Streams::IBuffer const &keyWords) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetKeyWords, static_cast(keyWordSet), reinterpret_cast(keyWords ? keyWords.data() : nullptr)); - } - - void Editor::SetKeyWords(int32_t keyWordSet, hstring const &keyWords) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetKeyWords, static_cast(keyWordSet), reinterpret_cast(to_string(keyWords).c_str())); - } - - /** - * Set the identifiers that are shown in a particular style - */ - void Editor::SetIdentifiersFromBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &identifiers) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIdentifiers, static_cast(style), reinterpret_cast(identifiers ? identifiers.data() : nullptr)); - } - - void Editor::SetIdentifiers(int32_t style, hstring const &identifiers) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetIdentifiers, static_cast(style), reinterpret_cast(to_string(identifiers).c_str())); - } - - /** - * Set the lexer from an ILexer*. - */ - void Editor::SetILexer(uint64_t ilexer) - { - _editor.get()->PublicWndProc(Scintilla::Message::SetILexer, static_cast(0), static_cast(ilexer)); - } -} diff --git a/WinUIEditor/EditorWrapper.h b/WinUIEditor/EditorWrapper.h deleted file mode 100644 index 2ba8146..0000000 --- a/WinUIEditor/EditorWrapper.h +++ /dev/null @@ -1,4756 +0,0 @@ -#pragma once -#include "Editor.g.h" -#include "StyleNeededEventArgs.g.h" -#include "CharAddedEventArgs.g.h" -#include "SavePointReachedEventArgs.g.h" -#include "SavePointLeftEventArgs.g.h" -#include "ModifyAttemptROEventArgs.g.h" -#include "KeyEventArgs.g.h" -#include "DoubleClickEventArgs.g.h" -#include "UpdateUIEventArgs.g.h" -#include "ModifiedEventArgs.g.h" -#include "MacroRecordEventArgs.g.h" -#include "MarginClickEventArgs.g.h" -#include "NeedShownEventArgs.g.h" -#include "PaintedEventArgs.g.h" -#include "UserListSelectionEventArgs.g.h" -#include "URIDroppedEventArgs.g.h" -#include "DwellStartEventArgs.g.h" -#include "DwellEndEventArgs.g.h" -#include "ZoomChangedEventArgs.g.h" -#include "HotSpotClickEventArgs.g.h" -#include "HotSpotDoubleClickEventArgs.g.h" -#include "CallTipClickEventArgs.g.h" -#include "AutoCSelectionEventArgs.g.h" -#include "IndicatorClickEventArgs.g.h" -#include "IndicatorReleaseEventArgs.g.h" -#include "AutoCCancelledEventArgs.g.h" -#include "AutoCCharDeletedEventArgs.g.h" -#include "HotSpotReleaseClickEventArgs.g.h" -#include "FocusInEventArgs.g.h" -#include "FocusOutEventArgs.g.h" -#include "AutoCCompletedEventArgs.g.h" -#include "MarginRightClickEventArgs.g.h" -#include "AutoCSelectionChangeEventArgs.g.h" - -namespace winrt::WinUIEditor::implementation -{ - struct StyleNeededEventArgs : StyleNeededEventArgsT - { - StyleNeededEventArgs(int32_t position); - - int32_t Position(); - - private: - int32_t _position; - }; - - struct CharAddedEventArgs : CharAddedEventArgsT - { - CharAddedEventArgs(int32_t ch, int32_t characterSource); - - int32_t Ch(); - int32_t CharacterSource(); - - private: - int32_t _ch; - int32_t _characterSource; - }; - - struct SavePointReachedEventArgs : SavePointReachedEventArgsT - { - }; - - struct SavePointLeftEventArgs : SavePointLeftEventArgsT - { - }; - - struct ModifyAttemptROEventArgs : ModifyAttemptROEventArgsT - { - }; - - struct KeyEventArgs : KeyEventArgsT - { - KeyEventArgs(int32_t ch, int32_t modifiers); - - int32_t Ch(); - int32_t Modifiers(); - - private: - int32_t _ch; - int32_t _modifiers; - }; - - struct DoubleClickEventArgs : DoubleClickEventArgsT - { - DoubleClickEventArgs(int32_t modifiers, int32_t position, int32_t line); - - int32_t Modifiers(); - int32_t Position(); - int32_t Line(); - - private: - int32_t _modifiers; - int32_t _position; - int32_t _line; - }; - - struct UpdateUIEventArgs : UpdateUIEventArgsT - { - UpdateUIEventArgs(int32_t updated); - - int32_t Updated(); - - private: - int32_t _updated; - }; - - struct ModifiedEventArgs : ModifiedEventArgsT - { - ModifiedEventArgs(int32_t position, int32_t modificationType, const char *text, int32_t length, int32_t linesAdded, int32_t line, int32_t foldLevelNow, int32_t foldLevelPrev, int32_t token, int32_t annotationLinesAdded); - - int32_t Position(); - int32_t ModificationType(); - Windows::Storage::Streams::IBuffer TextAsBuffer(); - hstring Text(); - int32_t Length(); - int32_t LinesAdded(); - int32_t Line(); - int32_t FoldLevelNow(); - int32_t FoldLevelPrev(); - int32_t Token(); - int32_t AnnotationLinesAdded(); - - private: - int32_t _position; - int32_t _modificationType; - Windows::Storage::Streams::IBuffer _textAsBuffer; - Windows::Foundation::IReference _text; - const char *_textAsPointer; - int32_t _length; - int32_t _linesAdded; - int32_t _line; - int32_t _foldLevelNow; - int32_t _foldLevelPrev; - int32_t _token; - int32_t _annotationLinesAdded; - }; - - struct MacroRecordEventArgs : MacroRecordEventArgsT - { - MacroRecordEventArgs(int32_t message, int32_t wParam, int32_t lParam); - - int32_t Message(); - int32_t WParam(); - int32_t LParam(); - - private: - int32_t _message; - int32_t _wParam; - int32_t _lParam; - }; - - struct MarginClickEventArgs : MarginClickEventArgsT - { - MarginClickEventArgs(int32_t modifiers, int32_t position, int32_t margin); - - int32_t Modifiers(); - int32_t Position(); - int32_t Margin(); - - private: - int32_t _modifiers; - int32_t _position; - int32_t _margin; - }; - - struct NeedShownEventArgs : NeedShownEventArgsT - { - NeedShownEventArgs(int32_t position, int32_t length); - - int32_t Position(); - int32_t Length(); - - private: - int32_t _position; - int32_t _length; - }; - - struct PaintedEventArgs : PaintedEventArgsT - { - }; - - struct UserListSelectionEventArgs : UserListSelectionEventArgsT - { - UserListSelectionEventArgs(int32_t listType, const char *text, int32_t position, int32_t ch, WinUIEditor::CompletionMethods const &listCompletionMethod); - - int32_t ListType(); - Windows::Storage::Streams::IBuffer TextAsBuffer(); - hstring Text(); - int32_t Position(); - int32_t Ch(); - WinUIEditor::CompletionMethods ListCompletionMethod(); - - private: - int32_t _listType; - Windows::Storage::Streams::IBuffer _textAsBuffer; - Windows::Foundation::IReference _text; - const char *_textAsPointer; - int32_t _position; - int32_t _ch; - WinUIEditor::CompletionMethods _listCompletionMethod; - }; - - struct URIDroppedEventArgs : URIDroppedEventArgsT - { - URIDroppedEventArgs(const char *text); - - Windows::Storage::Streams::IBuffer TextAsBuffer(); - hstring Text(); - - private: - Windows::Storage::Streams::IBuffer _textAsBuffer; - Windows::Foundation::IReference _text; - const char *_textAsPointer; - }; - - struct DwellStartEventArgs : DwellStartEventArgsT - { - DwellStartEventArgs(int32_t position, int32_t x, int32_t y); - - int32_t Position(); - int32_t X(); - int32_t Y(); - - private: - int32_t _position; - int32_t _x; - int32_t _y; - }; - - struct DwellEndEventArgs : DwellEndEventArgsT - { - DwellEndEventArgs(int32_t position, int32_t x, int32_t y); - - int32_t Position(); - int32_t X(); - int32_t Y(); - - private: - int32_t _position; - int32_t _x; - int32_t _y; - }; - - struct ZoomChangedEventArgs : ZoomChangedEventArgsT - { - }; - - struct HotSpotClickEventArgs : HotSpotClickEventArgsT - { - HotSpotClickEventArgs(int32_t modifiers, int32_t position); - - int32_t Modifiers(); - int32_t Position(); - - private: - int32_t _modifiers; - int32_t _position; - }; - - struct HotSpotDoubleClickEventArgs : HotSpotDoubleClickEventArgsT - { - HotSpotDoubleClickEventArgs(int32_t modifiers, int32_t position); - - int32_t Modifiers(); - int32_t Position(); - - private: - int32_t _modifiers; - int32_t _position; - }; - - struct CallTipClickEventArgs : CallTipClickEventArgsT - { - CallTipClickEventArgs(int32_t position); - - int32_t Position(); - - private: - int32_t _position; - }; - - struct AutoCSelectionEventArgs : AutoCSelectionEventArgsT - { - AutoCSelectionEventArgs(const char *text, int32_t position, int32_t ch, WinUIEditor::CompletionMethods const &listCompletionMethod); - - Windows::Storage::Streams::IBuffer TextAsBuffer(); - hstring Text(); - int32_t Position(); - int32_t Ch(); - WinUIEditor::CompletionMethods ListCompletionMethod(); - - private: - Windows::Storage::Streams::IBuffer _textAsBuffer; - Windows::Foundation::IReference _text; - const char *_textAsPointer; - int32_t _position; - int32_t _ch; - WinUIEditor::CompletionMethods _listCompletionMethod; - }; - - struct IndicatorClickEventArgs : IndicatorClickEventArgsT - { - IndicatorClickEventArgs(int32_t modifiers, int32_t position); - - int32_t Modifiers(); - int32_t Position(); - - private: - int32_t _modifiers; - int32_t _position; - }; - - struct IndicatorReleaseEventArgs : IndicatorReleaseEventArgsT - { - IndicatorReleaseEventArgs(int32_t modifiers, int32_t position); - - int32_t Modifiers(); - int32_t Position(); - - private: - int32_t _modifiers; - int32_t _position; - }; - - struct AutoCCancelledEventArgs : AutoCCancelledEventArgsT - { - }; - - struct AutoCCharDeletedEventArgs : AutoCCharDeletedEventArgsT - { - }; - - struct HotSpotReleaseClickEventArgs : HotSpotReleaseClickEventArgsT - { - HotSpotReleaseClickEventArgs(int32_t modifiers, int32_t position); - - int32_t Modifiers(); - int32_t Position(); - - private: - int32_t _modifiers; - int32_t _position; - }; - - struct FocusInEventArgs : FocusInEventArgsT - { - }; - - struct FocusOutEventArgs : FocusOutEventArgsT - { - }; - - struct AutoCCompletedEventArgs : AutoCCompletedEventArgsT - { - AutoCCompletedEventArgs(const char *text, int32_t position, int32_t ch, WinUIEditor::CompletionMethods const &listCompletionMethod); - - Windows::Storage::Streams::IBuffer TextAsBuffer(); - hstring Text(); - int32_t Position(); - int32_t Ch(); - WinUIEditor::CompletionMethods ListCompletionMethod(); - - private: - Windows::Storage::Streams::IBuffer _textAsBuffer; - Windows::Foundation::IReference _text; - const char *_textAsPointer; - int32_t _position; - int32_t _ch; - WinUIEditor::CompletionMethods _listCompletionMethod; - }; - - struct MarginRightClickEventArgs : MarginRightClickEventArgsT - { - MarginRightClickEventArgs(int32_t modifiers, int32_t position, int32_t margin); - - int32_t Modifiers(); - int32_t Position(); - int32_t Margin(); - - private: - int32_t _modifiers; - int32_t _position; - int32_t _margin; - }; - - struct AutoCSelectionChangeEventArgs : AutoCSelectionChangeEventArgsT - { - AutoCSelectionChangeEventArgs(int32_t listType, const char *text, int32_t position); - - int32_t ListType(); - Windows::Storage::Streams::IBuffer TextAsBuffer(); - hstring Text(); - int32_t Position(); - - private: - int32_t _listType; - Windows::Storage::Streams::IBuffer _textAsBuffer; - Windows::Foundation::IReference _text; - const char *_textAsPointer; - int32_t _position; - }; - - struct Editor : EditorT - { - Editor(com_ptr const &editor); - - void ProcessEvent(Scintilla::NotificationData *data); - - event_token StyleNeeded(WinUIEditor::StyleNeededHandler const &handler); - void StyleNeeded(event_token const &token); - - event_token CharAdded(WinUIEditor::CharAddedHandler const &handler); - void CharAdded(event_token const &token); - - event_token SavePointReached(WinUIEditor::SavePointReachedHandler const &handler); - void SavePointReached(event_token const &token); - - event_token SavePointLeft(WinUIEditor::SavePointLeftHandler const &handler); - void SavePointLeft(event_token const &token); - - event_token ModifyAttemptRO(WinUIEditor::ModifyAttemptROHandler const &handler); - void ModifyAttemptRO(event_token const &token); - - event_token Key(WinUIEditor::KeyHandler const &handler); - void Key(event_token const &token); - - event_token DoubleClick(WinUIEditor::DoubleClickHandler const &handler); - void DoubleClick(event_token const &token); - - event_token UpdateUI(WinUIEditor::UpdateUIHandler const &handler); - void UpdateUI(event_token const &token); - - event_token Modified(WinUIEditor::ModifiedHandler const &handler); - void Modified(event_token const &token); - - event_token MacroRecord(WinUIEditor::MacroRecordHandler const &handler); - void MacroRecord(event_token const &token); - - event_token MarginClick(WinUIEditor::MarginClickHandler const &handler); - void MarginClick(event_token const &token); - - event_token NeedShown(WinUIEditor::NeedShownHandler const &handler); - void NeedShown(event_token const &token); - - event_token Painted(WinUIEditor::PaintedHandler const &handler); - void Painted(event_token const &token); - - event_token UserListSelection(WinUIEditor::UserListSelectionHandler const &handler); - void UserListSelection(event_token const &token); - - event_token URIDropped(WinUIEditor::URIDroppedHandler const &handler); - void URIDropped(event_token const &token); - - event_token DwellStart(WinUIEditor::DwellStartHandler const &handler); - void DwellStart(event_token const &token); - - event_token DwellEnd(WinUIEditor::DwellEndHandler const &handler); - void DwellEnd(event_token const &token); - - event_token ZoomChanged(WinUIEditor::ZoomChangedHandler const &handler); - void ZoomChanged(event_token const &token); - - event_token HotSpotClick(WinUIEditor::HotSpotClickHandler const &handler); - void HotSpotClick(event_token const &token); - - event_token HotSpotDoubleClick(WinUIEditor::HotSpotDoubleClickHandler const &handler); - void HotSpotDoubleClick(event_token const &token); - - event_token CallTipClick(WinUIEditor::CallTipClickHandler const &handler); - void CallTipClick(event_token const &token); - - event_token AutoCSelection(WinUIEditor::AutoCSelectionHandler const &handler); - void AutoCSelection(event_token const &token); - - event_token IndicatorClick(WinUIEditor::IndicatorClickHandler const &handler); - void IndicatorClick(event_token const &token); - - event_token IndicatorRelease(WinUIEditor::IndicatorReleaseHandler const &handler); - void IndicatorRelease(event_token const &token); - - event_token AutoCCancelled(WinUIEditor::AutoCCancelledHandler const &handler); - void AutoCCancelled(event_token const &token); - - event_token AutoCCharDeleted(WinUIEditor::AutoCCharDeletedHandler const &handler); - void AutoCCharDeleted(event_token const &token); - - event_token HotSpotReleaseClick(WinUIEditor::HotSpotReleaseClickHandler const &handler); - void HotSpotReleaseClick(event_token const &token); - - event_token FocusIn(WinUIEditor::FocusInHandler const &handler); - void FocusIn(event_token const &token); - - event_token FocusOut(WinUIEditor::FocusOutHandler const &handler); - void FocusOut(event_token const &token); - - event_token AutoCCompleted(WinUIEditor::AutoCCompletedHandler const &handler); - void AutoCCompleted(event_token const &token); - - event_token MarginRightClick(WinUIEditor::MarginRightClickHandler const &handler); - void MarginRightClick(event_token const &token); - - event_token AutoCSelectionChange(WinUIEditor::AutoCSelectionChangeHandler const &handler); - void AutoCSelectionChange(event_token const &token); - - /** - * Returns the number of bytes in the document. - */ - int64_t Length(); - - /** - * Returns the position of the caret. - */ - int64_t CurrentPos(); - - /** - * Sets the position of the caret. - */ - void CurrentPos(int64_t value); - - /** - * Returns the position of the opposite end of the selection to the caret. - */ - int64_t Anchor(); - - /** - * Set the selection anchor to a position. The anchor is the opposite - * end of the selection from the caret. - */ - void Anchor(int64_t value); - - /** - * Is undo history being collected? - */ - bool UndoCollection(); - - /** - * Choose between collecting actions into the undo - * history and discarding them. - */ - void UndoCollection(bool value); - - /** - * Are white space characters currently visible? - * Returns one of SCWS_* constants. - */ - WinUIEditor::WhiteSpace ViewWS(); - - /** - * Make white space characters invisible, always visible or visible outside indentation. - */ - void ViewWS(WinUIEditor::WhiteSpace const &value); - - /** - * Retrieve the current tab draw mode. - * Returns one of SCTD_* constants. - */ - WinUIEditor::TabDrawMode TabDrawMode(); - - /** - * Set how tabs are drawn when visible. - */ - void TabDrawMode(WinUIEditor::TabDrawMode const &value); - - /** - * Retrieve the position of the last correctly styled character. - */ - int64_t EndStyled(); - - /** - * Retrieve the current end of line mode - one of CRLF, CR, or LF. - */ - WinUIEditor::EndOfLine EOLMode(); - - /** - * Set the current end of line mode. - */ - void EOLMode(WinUIEditor::EndOfLine const &value); - - /** - * Is drawing done first into a buffer or direct to the screen? - */ - bool BufferedDraw(); - - /** - * If drawing is buffered then each line of text is drawn into a bitmap buffer - * before drawing it to the screen to avoid flicker. - */ - void BufferedDraw(bool value); - - /** - * Retrieve the visible size of a tab. - */ - int32_t TabWidth(); - - /** - * Change the visible size of a tab to be a multiple of the width of a space character. - */ - void TabWidth(int32_t value); - - /** - * Get the minimum visual width of a tab. - */ - int32_t TabMinimumWidth(); - - /** - * Set the minimum visual width of a tab. - */ - void TabMinimumWidth(int32_t value); - - /** - * Is the IME displayed in a window or inline? - */ - WinUIEditor::IMEInteraction IMEInteraction(); - - /** - * Choose to display the IME in a window or inline. - */ - void IMEInteraction(WinUIEditor::IMEInteraction const &value); - - /** - * How many margins are there?. - */ - int32_t Margins(); - - /** - * Allocate a non-standard number of margins. - */ - void Margins(int32_t value); - - /** - * Get the alpha of the selection. - */ - WinUIEditor::Alpha SelAlpha(); - - /** - * Set the alpha of the selection. - */ - void SelAlpha(WinUIEditor::Alpha const &value); - - /** - * Is the selection end of line filled? - */ - bool SelEOLFilled(); - - /** - * Set the selection to have its end of line filled or not. - */ - void SelEOLFilled(bool value); - - /** - * Get the layer for drawing selections - */ - WinUIEditor::Layer SelectionLayer(); - - /** - * Set the layer for drawing selections: either opaquely on base layer or translucently over text - */ - void SelectionLayer(WinUIEditor::Layer const &value); - - /** - * Get the layer of the background of the line containing the caret. - */ - WinUIEditor::Layer CaretLineLayer(); - - /** - * Set the layer of the background of the line containing the caret. - */ - void CaretLineLayer(WinUIEditor::Layer const &value); - - /** - * Get only highlighting subline instead of whole line. - */ - bool CaretLineHighlightSubLine(); - - /** - * Set only highlighting subline instead of whole line. - */ - void CaretLineHighlightSubLine(bool value); - - /** - * Get the time in milliseconds that the caret is on and off. - */ - int32_t CaretPeriod(); - - /** - * Get the time in milliseconds that the caret is on and off. 0 = steady on. - */ - void CaretPeriod(int32_t value); - - /** - * Get the number of characters to have directly indexed categories - */ - int32_t CharacterCategoryOptimization(); - - /** - * Set the number of characters to have directly indexed categories - */ - void CharacterCategoryOptimization(int32_t value); - - /** - * How many undo actions are in the history? - */ - int32_t UndoActions(); - - /** - * Which action is the save point? - */ - int32_t UndoSavePoint(); - - /** - * Set action as the save point - */ - void UndoSavePoint(int32_t value); - - /** - * Which action is the detach point? - */ - int32_t UndoDetach(); - - /** - * Set action as the detach point - */ - void UndoDetach(int32_t value); - - /** - * Which action is the tentative point? - */ - int32_t UndoTentative(); - - /** - * Set action as the tentative point - */ - void UndoTentative(int32_t value); - - /** - * Which action is the current point? - */ - int32_t UndoCurrent(); - - /** - * Set action as the current point - */ - void UndoCurrent(int32_t value); - - /** - * Get the size of the dots used to mark space characters. - */ - int32_t WhitespaceSize(); - - /** - * Set the size of the dots used to mark space characters. - */ - void WhitespaceSize(int32_t value); - - /** - * Retrieve the last line number that has line state. - */ - int32_t MaxLineState(); - - /** - * Is the background of the line containing the caret in a different colour? - */ - bool CaretLineVisible(); - - /** - * Display the background of the line containing the caret in a different colour. - */ - void CaretLineVisible(bool value); - - /** - * Get the colour of the background of the line containing the caret. - */ - int32_t CaretLineBack(); - - /** - * Set the colour of the background of the line containing the caret. - */ - void CaretLineBack(int32_t value); - - /** - * Retrieve the caret line frame width. - * Width = 0 means this option is disabled. - */ - int32_t CaretLineFrame(); - - /** - * Display the caret line framed. - * Set width != 0 to enable this option and width = 0 to disable it. - */ - void CaretLineFrame(int32_t value); - - /** - * Retrieve the auto-completion list separator character. - */ - int32_t AutoCSeparator(); - - /** - * Change the separator character in the string setting up an auto-completion list. - * Default is space but can be changed if items contain space. - */ - void AutoCSeparator(int32_t value); - - /** - * Retrieve whether auto-completion cancelled by backspacing before start. - */ - bool AutoCCancelAtStart(); - - /** - * Should the auto-completion list be cancelled if the user backspaces to a - * position before where the box was created. - */ - void AutoCCancelAtStart(bool value); - - /** - * Retrieve whether a single item auto-completion list automatically choose the item. - */ - bool AutoCChooseSingle(); - - /** - * Should a single item auto-completion list automatically choose the item. - */ - void AutoCChooseSingle(bool value); - - /** - * Retrieve state of ignore case flag. - */ - bool AutoCIgnoreCase(); - - /** - * Set whether case is significant when performing auto-completion searches. - */ - void AutoCIgnoreCase(bool value); - - /** - * Retrieve whether or not autocompletion is hidden automatically when nothing matches. - */ - bool AutoCAutoHide(); - - /** - * Set whether or not autocompletion is hidden automatically when nothing matches. - */ - void AutoCAutoHide(bool value); - - /** - * Retrieve autocompletion options. - */ - WinUIEditor::AutoCompleteOption AutoCOptions(); - - /** - * Set autocompletion options. - */ - void AutoCOptions(WinUIEditor::AutoCompleteOption const &value); - - /** - * Retrieve whether or not autocompletion deletes any word characters - * after the inserted text upon completion. - */ - bool AutoCDropRestOfWord(); - - /** - * Set whether or not autocompletion deletes any word characters - * after the inserted text upon completion. - */ - void AutoCDropRestOfWord(bool value); - - /** - * Retrieve the auto-completion list type-separator character. - */ - int32_t AutoCTypeSeparator(); - - /** - * Change the type-separator character in the string setting up an auto-completion list. - * Default is '?' but can be changed if items contain '?'. - */ - void AutoCTypeSeparator(int32_t value); - - /** - * Get the maximum width, in characters, of auto-completion and user lists. - */ - int32_t AutoCMaxWidth(); - - /** - * 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. - */ - void AutoCMaxWidth(int32_t value); - - /** - * Set the maximum height, in rows, of auto-completion and user lists. - */ - int32_t AutoCMaxHeight(); - - /** - * Set the maximum height, in rows, of auto-completion and user lists. - * The default is 5 rows. - */ - void AutoCMaxHeight(int32_t value); - - /** - * Retrieve indentation size. - */ - int32_t Indent(); - - /** - * Set the number of spaces used for one level of indentation. - */ - void Indent(int32_t value); - - /** - * Retrieve whether tabs will be used in indentation. - */ - bool UseTabs(); - - /** - * Indentation will only use space characters if useTabs is false, otherwise - * it will use a combination of tabs and spaces. - */ - void UseTabs(bool value); - - /** - * Is the horizontal scroll bar visible? - */ - bool HScrollBar(); - - /** - * Show or hide the horizontal scroll bar. - */ - void HScrollBar(bool value); - - /** - * Are the indentation guides visible? - */ - WinUIEditor::IndentView IndentationGuides(); - - /** - * Show or hide indentation guides. - */ - void IndentationGuides(WinUIEditor::IndentView const &value); - - /** - * Get the highlighted indentation guide column. - */ - int64_t HighlightGuide(); - - /** - * Set the highlighted indentation guide column. - * 0 = no highlighted guide. - */ - void HighlightGuide(int64_t value); - - /** - * Get the code page used to interpret the bytes of the document as characters. - */ - int32_t CodePage(); - - /** - * 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. - */ - void CodePage(int32_t value); - - /** - * Get the foreground colour of the caret. - */ - int32_t CaretFore(); - - /** - * Set the foreground colour of the caret. - */ - void CaretFore(int32_t value); - - /** - * In read-only mode? - */ - bool ReadOnly(); - - /** - * Set to read only or read write. - */ - void ReadOnly(bool value); - - /** - * Returns the position at the start of the selection. - */ - int64_t SelectionStart(); - - /** - * Sets the position that starts the selection - this becomes the anchor. - */ - void SelectionStart(int64_t value); - - /** - * Returns the position at the end of the selection. - */ - int64_t SelectionEnd(); - - /** - * Sets the position that ends the selection - this becomes the caret. - */ - void SelectionEnd(int64_t value); - - /** - * Returns the print magnification. - */ - int32_t PrintMagnification(); - - /** - * Sets the print magnification added to the point size of each style for printing. - */ - void PrintMagnification(int32_t value); - - /** - * Returns the print colour mode. - */ - WinUIEditor::PrintOption PrintColourMode(); - - /** - * Modify colours when printing for clearer printed text. - */ - void PrintColourMode(WinUIEditor::PrintOption const &value); - - /** - * Report change history status. - */ - WinUIEditor::ChangeHistoryOption ChangeHistory(); - - /** - * Enable or disable change history. - */ - void ChangeHistory(WinUIEditor::ChangeHistoryOption const &value); - - /** - * Retrieve the display line at the top of the display. - */ - int64_t FirstVisibleLine(); - - /** - * Scroll so that a display line is at the top of the display. - */ - void FirstVisibleLine(int64_t value); - - /** - * Returns the number of lines in the document. There is always at least one. - */ - int64_t LineCount(); - - /** - * Returns the size in pixels of the left margin. - */ - int32_t MarginLeft(); - - /** - * Sets the size in pixels of the left margin. - */ - void MarginLeft(int32_t value); - - /** - * Returns the size in pixels of the right margin. - */ - int32_t MarginRight(); - - /** - * Sets the size in pixels of the right margin. - */ - void MarginRight(int32_t value); - - /** - * Is the document different from when it was last saved? - */ - bool Modify(); - - bool SelectionHidden(); - - /** - * Retrieve the number of characters in the document. - */ - int64_t TextLength(); - - /** - * Retrieve a pointer to a function that processes messages for this Scintilla. - */ - uint64_t DirectFunction(); - - /** - * Retrieve a pointer to a function that processes messages for this Scintilla and returns status. - */ - uint64_t DirectStatusFunction(); - - /** - * Retrieve a pointer value to use as the first argument when calling - * the function returned by GetDirectFunction. - */ - uint64_t DirectPointer(); - - /** - * Returns true if overtype mode is active otherwise false is returned. - */ - bool Overtype(); - - /** - * Set to overtype (true) or insert mode. - */ - void Overtype(bool value); - - /** - * Returns the width of the insert mode caret. - */ - int32_t CaretWidth(); - - /** - * Set the width of the insert mode caret. - */ - void CaretWidth(int32_t value); - - /** - * Get the position that starts the target. - */ - int64_t TargetStart(); - - /** - * Sets the position that starts the target which is used for updating the - * document without affecting the scroll position. - */ - void TargetStart(int64_t value); - - /** - * Get the virtual space of the target start - */ - int64_t TargetStartVirtualSpace(); - - /** - * Sets the virtual space of the target start - */ - void TargetStartVirtualSpace(int64_t value); - - /** - * Get the position that ends the target. - */ - int64_t TargetEnd(); - - /** - * Sets the position that ends the target which is used for updating the - * document without affecting the scroll position. - */ - void TargetEnd(int64_t value); - - /** - * Get the virtual space of the target end - */ - int64_t TargetEndVirtualSpace(); - - /** - * Sets the virtual space of the target end - */ - void TargetEndVirtualSpace(int64_t value); - - /** - * Get the search flags used by SearchInTarget. - */ - WinUIEditor::FindOption SearchFlags(); - - /** - * Set the search flags used by SearchInTarget. - */ - void SearchFlags(WinUIEditor::FindOption const &value); - - /** - * Are all lines visible? - */ - bool AllLinesVisible(); - - /** - * Get the style of fold display text. - */ - WinUIEditor::FoldDisplayTextStyle FoldDisplayTextStyle(); - - /** - * Set the style of fold display text. - */ - void FoldDisplayTextStyle(WinUIEditor::FoldDisplayTextStyle const &value); - - /** - * Get automatic folding behaviours. - */ - WinUIEditor::AutomaticFold AutomaticFold(); - - /** - * Set automatic folding behaviours. - */ - void AutomaticFold(WinUIEditor::AutomaticFold const &value); - - /** - * Does a tab pressed when caret is within indentation indent? - */ - bool TabIndents(); - - /** - * Sets whether a tab pressed when caret is within indentation indents. - */ - void TabIndents(bool value); - - /** - * Does a backspace pressed when caret is within indentation unindent? - */ - bool BackSpaceUnIndents(); - - /** - * Sets whether a backspace pressed when caret is within indentation unindents. - */ - void BackSpaceUnIndents(bool value); - - /** - * Retrieve the time the mouse must sit still to generate a mouse dwell event. - */ - int32_t MouseDwellTime(); - - /** - * Sets the time the mouse must sit still to generate a mouse dwell event. - */ - void MouseDwellTime(int32_t value); - - /** - * Retrieve the limits to idle styling. - */ - WinUIEditor::IdleStyling IdleStyling(); - - /** - * Sets limits to idle styling. - */ - void IdleStyling(WinUIEditor::IdleStyling const &value); - - /** - * Retrieve whether text is word wrapped. - */ - WinUIEditor::Wrap WrapMode(); - - /** - * Sets whether text is word wrapped. - */ - void WrapMode(WinUIEditor::Wrap const &value); - - /** - * Retrive the display mode of visual flags for wrapped lines. - */ - WinUIEditor::WrapVisualFlag WrapVisualFlags(); - - /** - * Set the display mode of visual flags for wrapped lines. - */ - void WrapVisualFlags(WinUIEditor::WrapVisualFlag const &value); - - /** - * Retrive the location of visual flags for wrapped lines. - */ - WinUIEditor::WrapVisualLocation WrapVisualFlagsLocation(); - - /** - * Set the location of visual flags for wrapped lines. - */ - void WrapVisualFlagsLocation(WinUIEditor::WrapVisualLocation const &value); - - /** - * Retrive the start indent for wrapped lines. - */ - int32_t WrapStartIndent(); - - /** - * Set the start indent for wrapped lines. - */ - void WrapStartIndent(int32_t value); - - /** - * Retrieve how wrapped sublines are placed. Default is fixed. - */ - WinUIEditor::WrapIndentMode WrapIndentMode(); - - /** - * Sets how wrapped sublines are placed. Default is fixed. - */ - void WrapIndentMode(WinUIEditor::WrapIndentMode const &value); - - /** - * Retrieve the degree of caching of layout information. - */ - WinUIEditor::LineCache LayoutCache(); - - /** - * Sets the degree of caching of layout information. - */ - void LayoutCache(WinUIEditor::LineCache const &value); - - /** - * Retrieve the document width assumed for scrolling. - */ - int32_t ScrollWidth(); - - /** - * Sets the document width assumed for scrolling. - */ - void ScrollWidth(int32_t value); - - /** - * Retrieve whether the scroll width tracks wide lines. - */ - bool ScrollWidthTracking(); - - /** - * Sets whether the maximum width line displayed is used to set scroll width. - */ - void ScrollWidthTracking(bool value); - - /** - * Retrieve whether the maximum scroll position has the last - * line at the bottom of the view. - */ - bool EndAtLastLine(); - - /** - * 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. - */ - void EndAtLastLine(bool value); - - /** - * Is the vertical scroll bar visible? - */ - bool VScrollBar(); - - /** - * Show or hide the vertical scroll bar. - */ - void VScrollBar(bool value); - - /** - * How many phases is drawing done in? - */ - WinUIEditor::PhasesDraw PhasesDraw(); - - /** - * 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. - */ - void PhasesDraw(WinUIEditor::PhasesDraw const &value); - - /** - * Retrieve the quality level for text. - */ - WinUIEditor::FontQuality FontQuality(); - - /** - * Choose the quality level for text from the FontQuality enumeration. - */ - void FontQuality(WinUIEditor::FontQuality const &value); - - /** - * Retrieve the effect of pasting when there are multiple selections. - */ - WinUIEditor::MultiPaste MultiPaste(); - - /** - * Change the effect of pasting when there are multiple selections. - */ - void MultiPaste(WinUIEditor::MultiPaste const &value); - - /** - * Report accessibility status. - */ - WinUIEditor::Accessibility Accessibility(); - - /** - * Enable or disable accessibility. - */ - void Accessibility(WinUIEditor::Accessibility const &value); - - /** - * Are the end of line characters visible? - */ - bool ViewEOL(); - - /** - * Make the end of line characters visible or invisible. - */ - void ViewEOL(bool value); - - /** - * Retrieve a pointer to the document object. - */ - uint64_t DocPointer(); - - /** - * Change the document object used. - */ - void DocPointer(uint64_t value); - - /** - * Retrieve the column number which text should be kept within. - */ - int64_t EdgeColumn(); - - /** - * Set the column number of the edge. - * If text goes past the edge then it is highlighted. - */ - void EdgeColumn(int64_t value); - - /** - * Retrieve the edge highlight mode. - */ - WinUIEditor::EdgeVisualStyle EdgeMode(); - - /** - * 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). - */ - void EdgeMode(WinUIEditor::EdgeVisualStyle const &value); - - /** - * Retrieve the colour used in edge indication. - */ - int32_t EdgeColour(); - - /** - * Change the colour used in edge indication. - */ - void EdgeColour(int32_t value); - - /** - * Retrieves the number of lines completely visible. - */ - int64_t LinesOnScreen(); - - /** - * Is the selection rectangular? The alternative is the more common stream selection. - */ - bool SelectionIsRectangle(); - - /** - * Retrieve the zoom level. - */ - int32_t Zoom(); - - /** - * 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. - */ - void Zoom(int32_t value); - - /** - * Get which document options are set. - */ - WinUIEditor::DocumentOption DocumentOptions(); - - /** - * Get which document modification events are sent to the container. - */ - WinUIEditor::ModificationFlags ModEventMask(); - - /** - * Set which document modification events are sent to the container. - */ - void ModEventMask(WinUIEditor::ModificationFlags const &value); - - /** - * Get whether command events are sent to the container. - */ - bool CommandEvents(); - - /** - * Set whether command events are sent to the container. - */ - void CommandEvents(bool value); - - /** - * Get internal focus flag. - */ - bool Focus(); - - /** - * Change internal focus flag. - */ - void Focus(bool value); - - /** - * Get error status. - */ - WinUIEditor::Status Status(); - - /** - * Change error status - 0 = OK. - */ - void Status(WinUIEditor::Status const &value); - - /** - * Get whether mouse gets captured. - */ - bool MouseDownCaptures(); - - /** - * Set whether the mouse is captured when its button is pressed. - */ - void MouseDownCaptures(bool value); - - /** - * Get whether mouse wheel can be active outside the window. - */ - bool MouseWheelCaptures(); - - /** - * Set whether the mouse wheel can be active outside the window. - */ - void MouseWheelCaptures(bool value); - - /** - * Get cursor type. - */ - WinUIEditor::CursorShape Cursor(); - - /** - * Sets the cursor to one of the SC_CURSOR* values. - */ - void Cursor(WinUIEditor::CursorShape const &value); - - /** - * Get the way control characters are displayed. - */ - int32_t ControlCharSymbol(); - - /** - * Change the way control characters are displayed: - * If symbol is < 32, keep the drawn way, else, use the given character. - */ - void ControlCharSymbol(int32_t value); - - /** - * Get the xOffset (ie, horizontal scroll position). - */ - int32_t XOffset(); - - /** - * Set the xOffset (ie, horizontal scroll position). - */ - void XOffset(int32_t value); - - /** - * Is printing line wrapped? - */ - WinUIEditor::Wrap PrintWrapMode(); - - /** - * Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). - */ - void PrintWrapMode(WinUIEditor::Wrap const &value); - - /** - * Get whether underlining for active hotspots. - */ - bool HotspotActiveUnderline(); - - /** - * Enable / Disable underlining active hotspots. - */ - void HotspotActiveUnderline(bool value); - - /** - * Get the HotspotSingleLine property - */ - bool HotspotSingleLine(); - - /** - * Limit hotspots to single line so hotspots on two lines don't merge. - */ - void HotspotSingleLine(bool value); - - /** - * Get the mode of the current selection. - */ - WinUIEditor::SelectionMode SelectionMode(); - - /** - * Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or - * by lines (SC_SEL_LINES). - */ - void SelectionMode(WinUIEditor::SelectionMode const &value); - - /** - * Get whether or not regular caret moves will extend or reduce the selection. - */ - bool MoveExtendsSelection(); - - /** - * Set whether or not regular caret moves will extend or reduce the selection. - */ - void MoveExtendsSelection(bool value); - - /** - * Get currently selected item position in the auto-completion list - */ - int32_t AutoCCurrent(); - - /** - * Get auto-completion case insensitive behaviour. - */ - WinUIEditor::CaseInsensitiveBehaviour AutoCCaseInsensitiveBehaviour(); - - /** - * Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. - */ - void AutoCCaseInsensitiveBehaviour(WinUIEditor::CaseInsensitiveBehaviour const &value); - - /** - * Retrieve the effect of autocompleting when there are multiple selections. - */ - WinUIEditor::MultiAutoComplete AutoCMulti(); - - /** - * Change the effect of autocompleting when there are multiple selections. - */ - void AutoCMulti(WinUIEditor::MultiAutoComplete const &value); - - /** - * Get the way autocompletion lists are ordered. - */ - WinUIEditor::Ordering AutoCOrder(); - - /** - * Set the way autocompletion lists are ordered. - */ - void AutoCOrder(WinUIEditor::Ordering const &value); - - /** - * Can the caret preferred x position only be changed by explicit movement commands? - */ - WinUIEditor::CaretSticky CaretSticky(); - - /** - * Stop the caret preferred x position changing when the user types. - */ - void CaretSticky(WinUIEditor::CaretSticky const &value); - - /** - * Get convert-on-paste setting - */ - bool PasteConvertEndings(); - - /** - * Enable/Disable convert-on-paste for line endings - */ - void PasteConvertEndings(bool value); - - /** - * Get the background alpha of the caret line. - */ - WinUIEditor::Alpha CaretLineBackAlpha(); - - /** - * Set background alpha of the caret line. - */ - void CaretLineBackAlpha(WinUIEditor::Alpha const &value); - - /** - * Returns the current style of the caret. - */ - WinUIEditor::CaretStyle CaretStyle(); - - /** - * Set the style of the caret to be drawn. - */ - void CaretStyle(WinUIEditor::CaretStyle const &value); - - /** - * Get the current indicator - */ - int32_t IndicatorCurrent(); - - /** - * Set the indicator used for IndicatorFillRange and IndicatorClearRange - */ - void IndicatorCurrent(int32_t value); - - /** - * Get the current indicator value - */ - int32_t IndicatorValue(); - - /** - * Set the value used for IndicatorFillRange - */ - void IndicatorValue(int32_t value); - - /** - * How many entries are allocated to the position cache? - */ - int32_t PositionCache(); - - /** - * Set number of entries in position cache - */ - void PositionCache(int32_t value); - - /** - * Get maximum number of threads used for layout - */ - int32_t LayoutThreads(); - - /** - * Set maximum number of threads used for layout - */ - void LayoutThreads(int32_t value); - - /** - * Compact the document buffer and return a read-only pointer to the - * characters in the document. - */ - uint64_t CharacterPointer(); - - /** - * Return a position which, to avoid performance costs, should not be within - * the range of a call to GetRangePointer. - */ - int64_t GapPosition(); - - /** - * Get extra ascent for each line - */ - int32_t ExtraAscent(); - - /** - * Set extra ascent for each line - */ - void ExtraAscent(int32_t value); - - /** - * Get extra descent for each line - */ - int32_t ExtraDescent(); - - /** - * Set extra descent for each line - */ - void ExtraDescent(int32_t value); - - /** - * Get the start of the range of style numbers used for margin text - */ - int32_t MarginStyleOffset(); - - /** - * Get the start of the range of style numbers used for margin text - */ - void MarginStyleOffset(int32_t value); - - /** - * Get the margin options. - */ - WinUIEditor::MarginOption MarginOptions(); - - /** - * Set the margin options. - */ - void MarginOptions(WinUIEditor::MarginOption const &value); - - /** - * Get the visibility for the annotations for a view - */ - WinUIEditor::AnnotationVisible AnnotationVisible(); - - /** - * Set the visibility for the annotations for a view - */ - void AnnotationVisible(WinUIEditor::AnnotationVisible const &value); - - /** - * Get the start of the range of style numbers used for annotations - */ - int32_t AnnotationStyleOffset(); - - /** - * Get the start of the range of style numbers used for annotations - */ - void AnnotationStyleOffset(int32_t value); - - /** - * Whether switching to rectangular mode while selecting with the mouse is allowed. - */ - bool MouseSelectionRectangularSwitch(); - - /** - * Set whether switching to rectangular mode while selecting with the mouse is allowed. - */ - void MouseSelectionRectangularSwitch(bool value); - - /** - * Whether multiple selections can be made - */ - bool MultipleSelection(); - - /** - * Set whether multiple selections can be made - */ - void MultipleSelection(bool value); - - /** - * Whether typing can be performed into multiple selections - */ - bool AdditionalSelectionTyping(); - - /** - * Set whether typing can be performed into multiple selections - */ - void AdditionalSelectionTyping(bool value); - - /** - * Whether additional carets will blink - */ - bool AdditionalCaretsBlink(); - - /** - * Set whether additional carets will blink - */ - void AdditionalCaretsBlink(bool value); - - /** - * Whether additional carets are visible - */ - bool AdditionalCaretsVisible(); - - /** - * Set whether additional carets are visible - */ - void AdditionalCaretsVisible(bool value); - - /** - * How many selections are there? - */ - int32_t Selections(); - - /** - * Is every selected range empty? - */ - bool SelectionEmpty(); - - /** - * Which selection is the main selection - */ - int32_t MainSelection(); - - /** - * Set the main selection - */ - void MainSelection(int32_t value); - - /** - * Return the caret position of the rectangular selection. - */ - int64_t RectangularSelectionCaret(); - - /** - * Set the caret position of the rectangular selection. - */ - void RectangularSelectionCaret(int64_t value); - - /** - * Return the anchor position of the rectangular selection. - */ - int64_t RectangularSelectionAnchor(); - - /** - * Set the anchor position of the rectangular selection. - */ - void RectangularSelectionAnchor(int64_t value); - - /** - * Return the virtual space of the caret of the rectangular selection. - */ - int64_t RectangularSelectionCaretVirtualSpace(); - - /** - * Set the virtual space of the caret of the rectangular selection. - */ - void RectangularSelectionCaretVirtualSpace(int64_t value); - - /** - * Return the virtual space of the anchor of the rectangular selection. - */ - int64_t RectangularSelectionAnchorVirtualSpace(); - - /** - * Set the virtual space of the anchor of the rectangular selection. - */ - void RectangularSelectionAnchorVirtualSpace(int64_t value); - - /** - * Return options for virtual space behaviour. - */ - WinUIEditor::VirtualSpace VirtualSpaceOptions(); - - /** - * Set options for virtual space behaviour. - */ - void VirtualSpaceOptions(WinUIEditor::VirtualSpace const &value); - - /** - * Get the modifier key used for rectangular selection. - */ - int32_t RectangularSelectionModifier(); - - void RectangularSelectionModifier(int32_t value); - - /** - * Get the alpha of the selection. - */ - WinUIEditor::Alpha AdditionalSelAlpha(); - - /** - * Set the alpha of the selection. - */ - void AdditionalSelAlpha(WinUIEditor::Alpha const &value); - - /** - * Get the foreground colour of additional carets. - */ - int32_t AdditionalCaretFore(); - - /** - * Set the foreground colour of additional carets. - */ - void AdditionalCaretFore(int32_t value); - - /** - * Get the identifier. - */ - int32_t Identifier(); - - /** - * Set the identifier reported as idFrom in notification messages. - */ - void Identifier(int32_t value); - - /** - * Get the tech. - */ - WinUIEditor::Technology Technology(); - - /** - * Set the technology used. - */ - void Technology(WinUIEditor::Technology const &value); - - /** - * Is the caret line always visible? - */ - bool CaretLineVisibleAlways(); - - /** - * Sets the caret line to always visible. - */ - void CaretLineVisibleAlways(bool value); - - /** - * Get the line end types currently allowed. - */ - WinUIEditor::LineEndType LineEndTypesAllowed(); - - /** - * Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. - */ - void LineEndTypesAllowed(WinUIEditor::LineEndType const &value); - - /** - * Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. - */ - WinUIEditor::LineEndType LineEndTypesActive(); - - /** - * Get the visibility for the end of line annotations for a view - */ - WinUIEditor::EOLAnnotationVisible EOLAnnotationVisible(); - - /** - * Set the visibility for the end of line annotations for a view - */ - void EOLAnnotationVisible(WinUIEditor::EOLAnnotationVisible const &value); - - /** - * Get the start of the range of style numbers used for end of line annotations - */ - int32_t EOLAnnotationStyleOffset(); - - /** - * Get the start of the range of style numbers used for end of line annotations - */ - void EOLAnnotationStyleOffset(int32_t value); - - /** - * Retrieve line character index state. - */ - WinUIEditor::LineCharacterIndexType LineCharacterIndex(); - - /** - * Retrieve the lexing language of the document. - */ - int32_t Lexer(); - - /** - * Bit set of LineEndType enumertion for which line ends beyond the standard - * LF, CR, and CRLF are supported by the lexer. - */ - WinUIEditor::LineEndType LineEndTypesSupported(); - - /** - * Where styles are duplicated by a feature such as active/inactive code - * return the distance between the two types. - */ - int32_t DistanceToSecondaryStyles(); - - /** - * Retrieve the number of named styles for the lexer. - */ - int32_t NamedStyles(); - - /** - * Retrieve bidirectional text display state. - */ - WinUIEditor::Bidirectional Bidirectional(); - - /** - * Set bidirectional text display state. - */ - void Bidirectional(WinUIEditor::Bidirectional const &value); - - /** - * Add text to the document at current position. - */ - void AddTextFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - void AddText(int64_t length, hstring const &text); - - /** - * Add array of cells to document. - */ - void AddStyledText(int64_t length, array_view c); - - /** - * Insert string at a position. - */ - void InsertTextFromBuffer(int64_t pos, Windows::Storage::Streams::IBuffer const &text); - void InsertText(int64_t pos, hstring const &text); - - /** - * Change the text that is being inserted in response to SC_MOD_INSERTCHECK - */ - void ChangeInsertionFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - void ChangeInsertion(int64_t length, hstring const &text); - - /** - * Delete all text in the document. - */ - void ClearAll(); - - /** - * Delete a range of text in the document. - */ - void DeleteRange(int64_t start, int64_t lengthDelete); - - /** - * Set all style bytes to 0, remove all folding information. - */ - void ClearDocumentStyle(); - - /** - * Redoes the next action on the undo history. - */ - void Redo(); - - /** - * Select all the text in the document. - */ - void SelectAll(); - - /** - * Remember the current position in the undo history as the position - * at which the document was saved. - */ - void SetSavePoint(); - - /** - * Retrieve a buffer of cells. - * Returns the number of bytes in the buffer not including terminating NULs. - */ - int64_t GetStyledText(uint64_t tr); - - /** - * Retrieve a buffer of cells that can be past 2GB. - * Returns the number of bytes in the buffer not including terminating NULs. - */ - int64_t GetStyledTextFull(uint64_t tr); - - /** - * Are there any redoable actions in the undo history? - */ - bool CanRedo(); - - /** - * Retrieve the line number at which a particular marker is located. - */ - int64_t MarkerLineFromHandle(int32_t markerHandle); - - /** - * Delete a marker. - */ - void MarkerDeleteHandle(int32_t markerHandle); - - /** - * Retrieve marker handles of a line - */ - int32_t MarkerHandleFromLine(int64_t line, int32_t which); - - /** - * Retrieve marker number of a marker handle - */ - int32_t MarkerNumberFromLine(int64_t line, int32_t which); - - /** - * Find the position from a point within the window. - */ - int64_t PositionFromPoint(int32_t x, int32_t y); - - /** - * Find the position from a point within the window but return - * INVALID_POSITION if not close to text. - */ - int64_t PositionFromPointClose(int32_t x, int32_t y); - - /** - * Set caret to start of a line and ensure it is visible. - */ - void GotoLine(int64_t line); - - /** - * Set caret to a position and ensure it is visible. - */ - void GotoPos(int64_t caret); - - /** - * Retrieve the text of the line containing the caret. - * Returns the index of the caret on the line. - * Result is NUL-terminated. - */ - int64_t GetCurLineWriteBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - hstring GetCurLine(int64_t length); - - /** - * Convert all line endings in the document to one mode. - */ - void ConvertEOLs(WinUIEditor::EndOfLine const &eolMode); - - /** - * Set the current styling position to start. - * The unused parameter is no longer used and should be set to 0. - */ - void StartStyling(int64_t start, int32_t unused); - - /** - * Change style from current styling position for length characters to a style - * and move the current styling position to after this newly styled segment. - */ - void SetStyling(int64_t length, int32_t style); - - /** - * Clear explicit tabstops on a line. - */ - void ClearTabStops(int64_t line); - - /** - * Add an explicit tab stop for a line. - */ - void AddTabStop(int64_t line, int32_t x); - - /** - * Find the next explicit tab stop position on a line after a position. - */ - int32_t GetNextTabStop(int64_t line, int32_t x); - - /** - * Set the symbol used for a particular marker number. - */ - void MarkerDefine(int32_t markerNumber, WinUIEditor::MarkerSymbol const &markerSymbol); - - /** - * Enable/disable highlight for current folding block (smallest one that contains the caret) - */ - void MarkerEnableHighlight(bool enabled); - - /** - * Add a marker to a line, returning an ID which can be used to find or delete the marker. - */ - int32_t MarkerAdd(int64_t line, int32_t markerNumber); - - /** - * Delete a marker from a line. - */ - void MarkerDelete(int64_t line, int32_t markerNumber); - - /** - * Delete all markers with a particular number from all lines. - */ - void MarkerDeleteAll(int32_t markerNumber); - - /** - * Get a bit mask of all the markers set on a line. - */ - int32_t MarkerGet(int64_t line); - - /** - * Find the next line at or after lineStart that includes a marker in mask. - * Return -1 when no more lines. - */ - int64_t MarkerNext(int64_t lineStart, int32_t markerMask); - - /** - * Find the previous line before lineStart that includes a marker in mask. - */ - int64_t MarkerPrevious(int64_t lineStart, int32_t markerMask); - - /** - * Define a marker from a pixmap. - */ - void MarkerDefinePixmapFromBuffer(int32_t markerNumber, Windows::Storage::Streams::IBuffer const &pixmap); - void MarkerDefinePixmap(int32_t markerNumber, hstring const &pixmap); - - /** - * Add a set of markers to a line. - */ - void MarkerAddSet(int64_t line, int32_t markerSet); - - /** - * Clear all the styles and make equivalent to the global default style. - */ - void StyleClearAll(); - - /** - * Reset the default style to its state at startup - */ - void StyleResetDefault(); - - /** - * Use the default or platform-defined colour for an element. - */ - void ResetElementColour(WinUIEditor::Element const &element); - - /** - * Set the foreground colour of the main and additional selections and whether to use this setting. - */ - void SetSelFore(bool useSetting, int32_t fore); - - /** - * Set the background colour of the main and additional selections and whether to use this setting. - */ - void SetSelBack(bool useSetting, int32_t back); - - /** - * When key+modifier combination keyDefinition is pressed perform sciCommand. - */ - void AssignCmdKey(int32_t keyDefinition, int32_t sciCommand); - - /** - * When key+modifier combination keyDefinition is pressed do nothing. - */ - void ClearCmdKey(int32_t keyDefinition); - - /** - * Drop all key mappings. - */ - void ClearAllCmdKeys(); - - /** - * Set the styles for a segment of the document. - */ - void SetStylingExFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &styles); - void SetStylingEx(int64_t length, hstring const &styles); - - /** - * Start a sequence of actions that is undone and redone as a unit. - * May be nested. - */ - void BeginUndoAction(); - - /** - * End a sequence of actions that is undone and redone as a unit. - */ - void EndUndoAction(); - - /** - * Push one action onto undo history with no text - */ - void PushUndoActionType(int32_t type, int64_t pos); - - /** - * Set the text and length of the most recently pushed action - */ - void ChangeLastUndoActionTextFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - void ChangeLastUndoActionText(int64_t length, hstring const &text); - - /** - * Set the foreground colour of all whitespace and whether to use this setting. - */ - void SetWhitespaceFore(bool useSetting, int32_t fore); - - /** - * Set the background colour of all whitespace and whether to use this setting. - */ - void SetWhitespaceBack(bool useSetting, int32_t back); - - /** - * Display a auto-completion list. - * The lengthEntered parameter indicates how many characters before - * the caret should be used to provide context. - */ - void AutoCShowFromBuffer(int64_t lengthEntered, Windows::Storage::Streams::IBuffer const &itemList); - void AutoCShow(int64_t lengthEntered, hstring const &itemList); - - /** - * Remove the auto-completion list from the screen. - */ - void AutoCCancel(); - - /** - * Is there an auto-completion list visible? - */ - bool AutoCActive(); - - /** - * Retrieve the position of the caret when the auto-completion list was displayed. - */ - int64_t AutoCPosStart(); - - /** - * User has selected an item so remove the list and insert the selection. - */ - void AutoCComplete(); - - /** - * Define a set of character that when typed cancel the auto-completion list. - */ - void AutoCStopsFromBuffer(Windows::Storage::Streams::IBuffer const &characterSet); - void AutoCStops(hstring const &characterSet); - - /** - * Select the item in the auto-completion list that starts with a string. - */ - void AutoCSelectFromBuffer(Windows::Storage::Streams::IBuffer const &select); - void AutoCSelect(hstring const &select); - - /** - * Display a list of strings and send notification when user chooses one. - */ - void UserListShowFromBuffer(int32_t listType, Windows::Storage::Streams::IBuffer const &itemList); - void UserListShow(int32_t listType, hstring const &itemList); - - /** - * Register an XPM image for use in autocompletion lists. - */ - void RegisterImageFromBuffer(int32_t type, Windows::Storage::Streams::IBuffer const &xpmData); - void RegisterImage(int32_t type, hstring const &xpmData); - - /** - * Clear all the registered XPM images. - */ - void ClearRegisteredImages(); - - /** - * Count characters between two positions. - */ - int64_t CountCharacters(int64_t start, int64_t end); - - /** - * Count code units between two positions. - */ - int64_t CountCodeUnits(int64_t start, int64_t end); - - /** - * Set caret to a position, while removing any existing selection. - */ - void SetEmptySelection(int64_t caret); - - /** - * Find some text in the document. - */ - int64_t FindText(WinUIEditor::FindOption const &searchFlags, uint64_t ft); - - /** - * Find some text in the document. - */ - int64_t FindTextFull(WinUIEditor::FindOption const &searchFlags, uint64_t ft); - - /** - * Draw the document into a display context such as a printer. - */ - int64_t FormatRange(bool draw, uint64_t fr); - - /** - * Draw the document into a display context such as a printer. - */ - int64_t FormatRangeFull(bool draw, uint64_t fr); - - /** - * Retrieve the contents of a line. - * Returns the length of the line. - */ - int64_t GetLineWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text); - hstring GetLine(int64_t line); - - /** - * Select a range of text. - */ - void SetSel(int64_t anchor, int64_t caret); - - /** - * Retrieve the selected text. - * Return the length of the text. - * Result is NUL-terminated. - */ - int64_t GetSelTextWriteBuffer(Windows::Storage::Streams::IBuffer const &text); - hstring GetSelText(); - - /** - * Retrieve a range of text. - * Return the length of the text. - */ - int64_t GetTextRange(uint64_t tr); - - /** - * Retrieve a range of text that can be past 2GB. - * Return the length of the text. - */ - int64_t GetTextRangeFull(uint64_t tr); - - /** - * Draw the selection either highlighted or in normal (non-highlighted) style. - */ - void HideSelection(bool hide); - - /** - * Retrieve the x value of the point in the window where a position is displayed. - */ - int32_t PointXFromPosition(int64_t pos); - - /** - * Retrieve the y value of the point in the window where a position is displayed. - */ - int32_t PointYFromPosition(int64_t pos); - - /** - * Retrieve the line containing a position. - */ - int64_t LineFromPosition(int64_t pos); - - /** - * Retrieve the position at the start of a line. - */ - int64_t PositionFromLine(int64_t line); - - /** - * Scroll horizontally and vertically. - */ - void LineScroll(int64_t columns, int64_t lines); - - /** - * Ensure the caret is visible. - */ - 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. - */ - void ScrollRange(int64_t secondary, int64_t primary); - - /** - * Replace the selected text with the argument text. - */ - void ReplaceSelFromBuffer(Windows::Storage::Streams::IBuffer const &text); - void ReplaceSel(hstring const &text); - - /** - * Null operation. - */ - void Null(); - - /** - * Will a paste succeed? - */ - bool CanPaste(); - - /** - * Are there any undoable actions in the undo history? - */ - bool CanUndo(); - - /** - * Delete the undo history. - */ - void EmptyUndoBuffer(); - - /** - * Undo one action in the undo history. - */ - void Undo(); - - /** - * Cut the selection to the clipboard. - */ - void Cut(); - - /** - * Copy the selection to the clipboard. - */ - void Copy(); - - /** - * Paste the contents of the clipboard into the document replacing the selection. - */ - void Paste(); - - /** - * Clear the selection. - */ - void Clear(); - - /** - * Replace the contents of the document with the argument text. - */ - void SetTextFromBuffer(Windows::Storage::Streams::IBuffer const &text); - void SetText(hstring const &text); - - /** - * Retrieve all the text in the document. - * Returns number of characters retrieved. - * Result is NUL-terminated. - */ - int64_t GetTextWriteBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - hstring GetText(int64_t length); - - /** - * Sets both the start and end of the target in one call. - */ - void SetTargetRange(int64_t start, int64_t end); - - /** - * Make the target range start and end be the same as the selection range start and end. - */ - void TargetFromSelection(); - - /** - * Sets the target to the whole document. - */ - void TargetWholeDocument(); - - /** - * Replace the target text with the argument text. - * Text is counted so it can contain NULs. - * Returns the length of the replacement text. - */ - int64_t ReplaceTargetFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - int64_t ReplaceTarget(int64_t length, hstring const &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. - */ - int64_t ReplaceTargetREFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - int64_t ReplaceTargetRE(int64_t length, hstring const &text); - - /** - * Replace the target text with the argument text but ignore prefix and suffix that - * are the same as current. - */ - int64_t ReplaceTargetMinimalFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - int64_t ReplaceTargetMinimal(int64_t length, hstring const &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 start of found range or -1 for failure in which case target is not moved. - */ - int64_t SearchInTargetFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - int64_t SearchInTarget(int64_t length, hstring const &text); - - /** - * Show a call tip containing a definition near position pos. - */ - void CallTipShowFromBuffer(int64_t pos, Windows::Storage::Streams::IBuffer const &definition); - void CallTipShow(int64_t pos, hstring const &definition); - - /** - * Remove the call tip from the screen. - */ - void CallTipCancel(); - - /** - * Is there an active call tip? - */ - bool CallTipActive(); - - /** - * Retrieve the position where the caret was before displaying the call tip. - */ - int64_t CallTipPosStart(); - - /** - * Highlight a segment of the definition. - */ - void CallTipSetHlt(int64_t highlightStart, int64_t highlightEnd); - - /** - * Find the display line of a document line taking hidden lines into account. - */ - int64_t VisibleFromDocLine(int64_t docLine); - - /** - * Find the document line of a display line taking hidden lines into account. - */ - int64_t DocLineFromVisible(int64_t displayLine); - - /** - * The number of display lines needed to wrap a document line - */ - int64_t WrapCount(int64_t docLine); - - /** - * Make a range of lines visible. - */ - void ShowLines(int64_t lineStart, int64_t lineEnd); - - /** - * Make a range of lines invisible. - */ - void HideLines(int64_t lineStart, int64_t lineEnd); - - /** - * Switch a header line between expanded and contracted. - */ - void ToggleFold(int64_t line); - - /** - * Switch a header line between expanded and contracted and show some text after the line. - */ - void ToggleFoldShowTextFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text); - void ToggleFoldShowText(int64_t line, hstring const &text); - - /** - * Set the default fold display text. - */ - void SetDefaultFoldDisplayTextFromBuffer(Windows::Storage::Streams::IBuffer const &text); - void SetDefaultFoldDisplayText(hstring const &text); - - /** - * Get the default fold display text. - */ - int32_t GetDefaultFoldDisplayTextWriteBuffer(Windows::Storage::Streams::IBuffer const &text); - hstring GetDefaultFoldDisplayText(); - - /** - * Expand or contract a fold header. - */ - void FoldLine(int64_t line, WinUIEditor::FoldAction const &action); - - /** - * Expand or contract a fold header and its children. - */ - void FoldChildren(int64_t line, WinUIEditor::FoldAction const &action); - - /** - * Expand a fold header and all children. Use the level argument instead of the line's current level. - */ - void ExpandChildren(int64_t line, WinUIEditor::FoldLevel const &level); - - /** - * Expand or contract all fold headers. - */ - void FoldAll(WinUIEditor::FoldAction const &action); - - /** - * Ensure a particular line is visible by expanding any header line hiding it. - */ - void EnsureVisible(int64_t line); - - /** - * 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. - */ - void EnsureVisibleEnforcePolicy(int64_t line); - - /** - * Get position of start of word. - */ - int64_t WordStartPosition(int64_t pos, bool onlyWordCharacters); - - /** - * Get position of end of word. - */ - int64_t WordEndPosition(int64_t pos, bool onlyWordCharacters); - - /** - * Is the range start..end considered a word? - */ - bool IsRangeWord(int64_t start, int64_t end); - - /** - * Measure the pixel width of some text in a particular style. - * NUL terminated text argument. - * Does not handle tab or control characters. - */ - int32_t TextWidthFromBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &text); - int32_t TextWidth(int32_t style, hstring const &text); - - /** - * Retrieve the height of a particular line of text in pixels. - */ - int32_t TextHeight(int64_t line); - - /** - * Append a string to the end of the document without changing the selection. - */ - void AppendTextFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - void AppendText(int64_t length, hstring const &text); - - /** - * Join the lines in the target. - */ - void LinesJoin(); - - /** - * Split the lines in the target into lines that are less wide than pixelWidth - * where possible. - */ - void LinesSplit(int32_t pixelWidth); - - /** - * Set one of the colours used as a chequerboard pattern in the fold margin - */ - void SetFoldMarginColour(bool useSetting, int32_t back); - - /** - * Set the other colour used as a chequerboard pattern in the fold margin - */ - void SetFoldMarginHiColour(bool useSetting, int32_t fore); - - /** - * Move caret down one line. - */ - void LineDown(); - - /** - * Move caret down one line extending selection to new caret position. - */ - void LineDownExtend(); - - /** - * Move caret up one line. - */ - void LineUp(); - - /** - * Move caret up one line extending selection to new caret position. - */ - void LineUpExtend(); - - /** - * Move caret left one character. - */ - void CharLeft(); - - /** - * Move caret left one character extending selection to new caret position. - */ - void CharLeftExtend(); - - /** - * Move caret right one character. - */ - void CharRight(); - - /** - * Move caret right one character extending selection to new caret position. - */ - void CharRightExtend(); - - /** - * Move caret left one word. - */ - void WordLeft(); - - /** - * Move caret left one word extending selection to new caret position. - */ - void WordLeftExtend(); - - /** - * Move caret right one word. - */ - void WordRight(); - - /** - * Move caret right one word extending selection to new caret position. - */ - void WordRightExtend(); - - /** - * Move caret to first position on line. - */ - void Home(); - - /** - * Move caret to first position on line extending selection to new caret position. - */ - void HomeExtend(); - - /** - * Move caret to last position on line. - */ - void LineEnd(); - - /** - * Move caret to last position on line extending selection to new caret position. - */ - void LineEndExtend(); - - /** - * Move caret to first position in document. - */ - void DocumentStart(); - - /** - * Move caret to first position in document extending selection to new caret position. - */ - void DocumentStartExtend(); - - /** - * Move caret to last position in document. - */ - void DocumentEnd(); - - /** - * Move caret to last position in document extending selection to new caret position. - */ - void DocumentEndExtend(); - - /** - * Move caret one page up. - */ - void PageUp(); - - /** - * Move caret one page up extending selection to new caret position. - */ - void PageUpExtend(); - - /** - * Move caret one page down. - */ - void PageDown(); - - /** - * Move caret one page down extending selection to new caret position. - */ - void PageDownExtend(); - - /** - * Switch from insert to overtype mode or the reverse. - */ - void EditToggleOvertype(); - - /** - * Cancel any modes such as call tip or auto-completion list display. - */ - void Cancel(); - - /** - * Delete the selection or if no selection, the character before the caret. - */ - 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. - */ - void Tab(); - - /** - * Dedent the selected lines. - */ - void BackTab(); - - /** - * Insert a new line, may use a CRLF, CR or LF depending on EOL mode. - */ - void NewLine(); - - /** - * Insert a Form Feed character. - */ - void FormFeed(); - - /** - * Move caret to before first visible character on line. - * If already there move to first character on line. - */ - void VCHome(); - - /** - * Like VCHome but extending selection to new caret position. - */ - void VCHomeExtend(); - - /** - * Magnify the displayed text by increasing the sizes by 1 point. - */ - void ZoomIn(); - - /** - * Make the displayed text smaller by decreasing the sizes by 1 point. - */ - void ZoomOut(); - - /** - * Delete the word to the left of the caret. - */ - void DelWordLeft(); - - /** - * Delete the word to the right of the caret. - */ - void DelWordRight(); - - /** - * Delete the word to the right of the caret, but not the trailing non-word characters. - */ - void DelWordRightEnd(); - - /** - * Cut the line containing the caret. - */ - void LineCut(); - - /** - * Delete the line containing the caret. - */ - void LineDelete(); - - /** - * Switch the current line with the previous. - */ - void LineTranspose(); - - /** - * Reverse order of selected lines. - */ - void LineReverse(); - - /** - * Duplicate the current line. - */ - void LineDuplicate(); - - /** - * Transform the selection to lower case. - */ - void LowerCase(); - - /** - * Transform the selection to upper case. - */ - void UpperCase(); - - /** - * Scroll the document down, keeping the caret visible. - */ - void LineScrollDown(); - - /** - * Scroll the document up, keeping the caret visible. - */ - 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. - */ - void DeleteBackNotLine(); - - /** - * Move caret to first position on display line. - */ - void HomeDisplay(); - - /** - * Move caret to first position on display line extending selection to - * new caret position. - */ - void HomeDisplayExtend(); - - /** - * Move caret to last position on display line. - */ - void LineEndDisplay(); - - /** - * Move caret to last position on display line extending selection to new - * caret position. - */ - void LineEndDisplayExtend(); - - /** - * Like Home but when word-wrap is enabled goes first to start of display line - * HomeDisplay, then to start of document line Home. - */ - void HomeWrap(); - - /** - * Like HomeExtend but when word-wrap is enabled extends first to start of display line - * HomeDisplayExtend, then to start of document line HomeExtend. - */ - void HomeWrapExtend(); - - /** - * Like LineEnd but when word-wrap is enabled goes first to end of display line - * LineEndDisplay, then to start of document line LineEnd. - */ - void LineEndWrap(); - - /** - * Like LineEndExtend but when word-wrap is enabled extends first to end of display line - * LineEndDisplayExtend, then to start of document line LineEndExtend. - */ - void LineEndWrapExtend(); - - /** - * Like VCHome but when word-wrap is enabled goes first to start of display line - * VCHomeDisplay, then behaves like VCHome. - */ - void VCHomeWrap(); - - /** - * Like VCHomeExtend but when word-wrap is enabled extends first to start of display line - * VCHomeDisplayExtend, then behaves like VCHomeExtend. - */ - void VCHomeWrapExtend(); - - /** - * Copy the line containing the caret. - */ - void LineCopy(); - - /** - * Move the caret inside current view if it's not there already. - */ - void MoveCaretInsideView(); - - /** - * How many characters are on a line, including end of line characters? - */ - int64_t LineLength(int64_t line); - - /** - * Highlight the characters at two positions. - */ - void BraceHighlight(int64_t posA, int64_t posB); - - /** - * Use specified indicator to highlight matching braces instead of changing their style. - */ - void BraceHighlightIndicator(bool useSetting, int32_t indicator); - - /** - * Highlight the character at a position indicating there is no matching brace. - */ - void BraceBadLight(int64_t pos); - - /** - * Use specified indicator to highlight non matching brace instead of changing its style. - */ - void BraceBadLightIndicator(bool useSetting, int32_t indicator); - - /** - * 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. - */ - int64_t BraceMatch(int64_t pos, int32_t maxReStyle); - - /** - * Similar to BraceMatch, but matching starts at the explicit start position. - */ - int64_t BraceMatchNext(int64_t pos, int64_t startPos); - - /** - * Add a new vertical edge to the view. - */ - void MultiEdgeAddLine(int64_t column, int32_t edgeColour); - - /** - * Clear all vertical edges. - */ - void MultiEdgeClearAll(); - - /** - * Sets the current caret position to be the search anchor. - */ - void SearchAnchor(); - - /** - * Find some text starting at the search anchor. - * Does not ensure the selection is visible. - */ - int64_t SearchNextFromBuffer(WinUIEditor::FindOption const &searchFlags, Windows::Storage::Streams::IBuffer const &text); - int64_t SearchNext(WinUIEditor::FindOption const &searchFlags, hstring const &text); - - /** - * Find some text starting at the search anchor and moving backwards. - * Does not ensure the selection is visible. - */ - int64_t SearchPrevFromBuffer(WinUIEditor::FindOption const &searchFlags, Windows::Storage::Streams::IBuffer const &text); - int64_t SearchPrev(WinUIEditor::FindOption const &searchFlags, hstring const &text); - - /** - * Set whether a pop up menu is displayed automatically when the user presses - * the wrong mouse button on certain areas. - */ - void UsePopUp(WinUIEditor::PopUp const &popUpMode); - - /** - * Create a new document object. - * Starts with reference count of 1 and not selected into editor. - */ - uint64_t CreateDocument(int64_t bytes, WinUIEditor::DocumentOption const &documentOptions); - - /** - * Extend life of document. - */ - void AddRefDocument(uint64_t doc); - - /** - * Release a reference to the document, deleting document if it fades to black. - */ - void ReleaseDocument(uint64_t doc); - - /** - * Move to the previous change in capitalisation. - */ - void WordPartLeft(); - - /** - * Move to the previous change in capitalisation extending selection - * to new caret position. - */ - void WordPartLeftExtend(); - - /** - * Move to the change next in capitalisation. - */ - void WordPartRight(); - - /** - * Move to the next change in capitalisation extending selection - * to new caret position. - */ - void WordPartRightExtend(); - - /** - * Set the way the display area is determined when a particular line - * is to be moved to by Find, FindNext, GotoLine, etc. - */ - void SetVisiblePolicy(WinUIEditor::VisiblePolicy const &visiblePolicy, int32_t visibleSlop); - - /** - * Delete back from the current position to the start of the line. - */ - void DelLineLeft(); - - /** - * Delete forwards from the current position to the end of the line. - */ - void DelLineRight(); - - /** - * Set the last x chosen value to be the caret x position. - */ - void ChooseCaretX(); - - /** - * Set the focus to this Scintilla widget. - */ - void GrabFocus(); - - /** - * Set the way the caret is kept visible when going sideways. - * The exclusion zone is given in pixels. - */ - void SetXCaretPolicy(WinUIEditor::CaretPolicy const &caretPolicy, int32_t caretSlop); - - /** - * Set the way the line the caret is on is kept visible. - * The exclusion zone is given in lines. - */ - void SetYCaretPolicy(WinUIEditor::CaretPolicy const &caretPolicy, int32_t caretSlop); - - /** - * Move caret down one paragraph (delimited by empty lines). - */ - void ParaDown(); - - /** - * Extend selection down one paragraph (delimited by empty lines). - */ - void ParaDownExtend(); - - /** - * Move caret up one paragraph (delimited by empty lines). - */ - void ParaUp(); - - /** - * Extend selection up one paragraph (delimited by empty lines). - */ - void ParaUpExtend(); - - /** - * Given a valid document position, return the previous position taking code - * page into account. Returns 0 if passed 0. - */ - int64_t PositionBefore(int64_t 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. - */ - int64_t PositionAfter(int64_t 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. - */ - int64_t PositionRelative(int64_t pos, int64_t 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. - */ - int64_t PositionRelativeCodeUnits(int64_t pos, int64_t relative); - - /** - * Copy a range of text to the clipboard. Positions are clipped into the document. - */ - void CopyRange(int64_t start, int64_t end); - - /** - * Copy argument text to the clipboard. - */ - void CopyTextFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - void CopyText(int64_t length, hstring const &text); - - /** - * Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or - * by lines (SC_SEL_LINES) without changing MoveExtendsSelection. - */ - void ChangeSelectionMode(WinUIEditor::SelectionMode const &selectionMode); - - /** - * Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). - */ - int64_t GetLineSelStartPosition(int64_t line); - - /** - * Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). - */ - int64_t GetLineSelEndPosition(int64_t line); - - /** - * Move caret down one line, extending rectangular selection to new caret position. - */ - void LineDownRectExtend(); - - /** - * Move caret up one line, extending rectangular selection to new caret position. - */ - void LineUpRectExtend(); - - /** - * Move caret left one character, extending rectangular selection to new caret position. - */ - void CharLeftRectExtend(); - - /** - * Move caret right one character, extending rectangular selection to new caret position. - */ - void CharRightRectExtend(); - - /** - * Move caret to first position on line, extending rectangular selection to new caret position. - */ - 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. - */ - void VCHomeRectExtend(); - - /** - * Move caret to last position on line, extending rectangular selection to new caret position. - */ - void LineEndRectExtend(); - - /** - * Move caret one page up, extending rectangular selection to new caret position. - */ - void PageUpRectExtend(); - - /** - * Move caret one page down, extending rectangular selection to new caret position. - */ - void PageDownRectExtend(); - - /** - * Move caret to top of page, or one page up if already at top of page. - */ - void StutteredPageUp(); - - /** - * Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. - */ - void StutteredPageUpExtend(); - - /** - * Move caret to bottom of page, or one page down if already at bottom of page. - */ - void StutteredPageDown(); - - /** - * Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. - */ - void StutteredPageDownExtend(); - - /** - * Move caret left one word, position cursor at end of word. - */ - void WordLeftEnd(); - - /** - * Move caret left one word, position cursor at end of word, extending selection to new caret position. - */ - void WordLeftEndExtend(); - - /** - * Move caret right one word, position cursor at end of word. - */ - void WordRightEnd(); - - /** - * Move caret right one word, position cursor at end of word, extending selection to new caret position. - */ - void WordRightEndExtend(); - - /** - * Reset the set of characters for whitespace and word characters to the defaults. - */ - void SetCharsDefault(); - - /** - * Enlarge the document to a particular size of text bytes. - */ - void Allocate(int64_t bytes); - - /** - * Returns the target converted to UTF8. - * Return the length in bytes. - */ - int64_t TargetAsUTF8WriteBuffer(Windows::Storage::Streams::IBuffer const &s); - hstring TargetAsUTF8(); - - /** - * Set the length of the utf8 argument for calling EncodedFromUTF8. - * Set to -1 and the string will be measured to the first nul. - */ - void SetLengthForEncode(int64_t bytes); - - /** - * Translates a UTF8 string into the document encoding. - * Return the length of the result in bytes. - * On error return 0. - */ - int64_t EncodedFromUTF8WriteBuffer(Windows::Storage::Streams::IBuffer const &utf8, Windows::Storage::Streams::IBuffer const &encoded); - hstring EncodedFromUTF8(hstring const &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. - */ - int64_t FindColumn(int64_t line, int64_t column); - - /** - * Switch between sticky and non-sticky: meant to be bound to a key. - */ - void ToggleCaretSticky(); - - /** - * Replace the selection with text like a rectangular paste. - */ - void ReplaceRectangularFromBuffer(int64_t length, Windows::Storage::Streams::IBuffer const &text); - void ReplaceRectangular(int64_t length, hstring const &text); - - /** - * Duplicate the selection. If selection empty duplicate the line containing the caret. - */ - void SelectionDuplicate(); - - /** - * Turn a indicator on over a range. - */ - void IndicatorFillRange(int64_t start, int64_t lengthFill); - - /** - * Turn a indicator off over a range. - */ - void IndicatorClearRange(int64_t start, int64_t lengthClear); - - /** - * Are any indicators present at pos? - */ - int32_t IndicatorAllOnFor(int64_t pos); - - /** - * What value does a particular indicator have at a position? - */ - int32_t IndicatorValueAt(int32_t indicator, int64_t pos); - - /** - * Where does a particular indicator start? - */ - int64_t IndicatorStart(int32_t indicator, int64_t pos); - - /** - * Where does a particular indicator end? - */ - int64_t IndicatorEnd(int32_t indicator, int64_t pos); - - /** - * Copy the selection, if selection empty copy the line with the caret - */ - void CopyAllowLine(); - - /** - * Which symbol was defined for markerNumber with MarkerDefine - */ - int32_t MarkerSymbolDefined(int32_t markerNumber); - - /** - * Clear the margin text on all lines - */ - void MarginTextClearAll(); - - /** - * Clear the annotations from all lines - */ - void AnnotationClearAll(); - - /** - * Release all extended (>255) style numbers - */ - void ReleaseAllExtendedStyles(); - - /** - * Allocate some extended (>255) style numbers and return the start of the range - */ - int32_t AllocateExtendedStyles(int32_t numberStyles); - - /** - * Add a container action to the undo stack - */ - void AddUndoAction(int32_t token, WinUIEditor::UndoFlags const &flags); - - /** - * Find the position of a character from a point within the window. - */ - int64_t CharPositionFromPoint(int32_t x, int32_t y); - - /** - * Find the position of a character from a point within the window. - * Return INVALID_POSITION if not close to text. - */ - int64_t CharPositionFromPointClose(int32_t x, int32_t y); - - /** - * Clear selections to a single empty stream selection - */ - void ClearSelections(); - - /** - * Set a simple selection - */ - void SetSelection(int64_t caret, int64_t anchor); - - /** - * Add a selection - */ - void AddSelection(int64_t caret, int64_t anchor); - - /** - * Find the selection index for a point. -1 when not at a selection. - */ - int32_t SelectionFromPoint(int32_t x, int32_t y); - - /** - * Drop one selection - */ - void DropSelectionN(int32_t selection); - - /** - * Set the main selection to the next selection. - */ - void RotateSelection(); - - /** - * Swap that caret and anchor of the main selection. - */ - void SwapMainAnchorCaret(); - - /** - * 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. - */ - void MultipleSelectAddNext(); - - /** - * 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. - */ - void MultipleSelectAddEach(); - - /** - * Indicate that the internal state of a lexer has changed over a range and therefore - * there may be a need to redraw. - */ - int32_t ChangeLexerState(int64_t start, int64_t end); - - /** - * Find the next line at or after lineStart that is a contracted fold header line. - * Return -1 when no more lines. - */ - int64_t ContractedFoldNext(int64_t lineStart); - - /** - * Centre current line in window. - */ - void VerticalCentreCaret(); - - /** - * Move the selected lines up one line, shifting the line above after the selection - */ - void MoveSelectedLinesUp(); - - /** - * Move the selected lines down one line, shifting the line below before the selection - */ - void MoveSelectedLinesDown(); - - /** - * Define a marker from RGBA data. - * It has the width and height from RGBAImageSetWidth/Height - */ - void MarkerDefineRGBAImageFromBuffer(int32_t markerNumber, Windows::Storage::Streams::IBuffer const &pixels); - void MarkerDefineRGBAImage(int32_t markerNumber, hstring const &pixels); - - /** - * Register an RGBA image for use in autocompletion lists. - * It has the width and height from RGBAImageSetWidth/Height - */ - void RegisterRGBAImageFromBuffer(int32_t type, Windows::Storage::Streams::IBuffer const &pixels); - void RegisterRGBAImage(int32_t type, hstring const &pixels); - - /** - * Scroll to start of document. - */ - void ScrollToStart(); - - /** - * Scroll to end of document. - */ - void ScrollToEnd(); - - /** - * Create an ILoader*. - */ - uint64_t CreateLoader(int64_t bytes, WinUIEditor::DocumentOption const &documentOptions); - - /** - * On macOS, show a find indicator. - */ - void FindIndicatorShow(int64_t start, int64_t end); - - /** - * On macOS, flash a find indicator, then fade out. - */ - void FindIndicatorFlash(int64_t start, int64_t end); - - /** - * On macOS, hide the find indicator. - */ - void FindIndicatorHide(); - - /** - * Move caret to before first visible character on display line. - * If already there move to first character on display line. - */ - void VCHomeDisplay(); - - /** - * Like VCHomeDisplay but extending selection to new caret position. - */ - void VCHomeDisplayExtend(); - - /** - * Remove a character representation. - */ - void ClearRepresentationFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter); - void ClearRepresentation(hstring const &encodedCharacter); - - /** - * Clear representations to default. - */ - void ClearAllRepresentations(); - - /** - * Clear the end of annotations from all lines - */ - void EOLAnnotationClearAll(); - - /** - * Request line character index be created or its use count increased. - */ - void AllocateLineCharacterIndex(WinUIEditor::LineCharacterIndexType const &lineCharacterIndex); - - /** - * Decrease use count of line character index and remove if 0. - */ - void ReleaseLineCharacterIndex(WinUIEditor::LineCharacterIndexType const &lineCharacterIndex); - - /** - * Retrieve the document line containing a position measured in index units. - */ - int64_t LineFromIndexPosition(int64_t pos, WinUIEditor::LineCharacterIndexType const &lineCharacterIndex); - - /** - * Retrieve the position measured in index units at the start of a document line. - */ - int64_t IndexPositionFromLine(int64_t line, WinUIEditor::LineCharacterIndexType const &lineCharacterIndex); - - /** - * Start notifying the container of all key presses and commands. - */ - void StartRecord(); - - /** - * Stop notifying the container of all key presses and commands. - */ - void StopRecord(); - - /** - * Colourise a segment of the document using the current lexing language. - */ - void Colourise(int64_t start, int64_t end); - - /** - * For private communication between an application and a known lexer. - */ - uint64_t PrivateLexerCall(int32_t operation, uint64_t pointer); - - /** - * Retrieve a '\n' separated list of properties understood by the current lexer. - * Result is NUL-terminated. - */ - int32_t PropertyNamesWriteBuffer(Windows::Storage::Streams::IBuffer const &names); - hstring PropertyNames(); - - /** - * Retrieve the type of a property. - */ - WinUIEditor::TypeProperty PropertyTypeFromBuffer(Windows::Storage::Streams::IBuffer const &name); - WinUIEditor::TypeProperty PropertyType(hstring const &name); - - /** - * Describe a property. - * Result is NUL-terminated. - */ - int32_t DescribePropertyWriteBuffer(Windows::Storage::Streams::IBuffer const &name, Windows::Storage::Streams::IBuffer const &description); - hstring DescribeProperty(hstring const &name); - - /** - * Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. - * Result is NUL-terminated. - */ - int32_t DescribeKeyWordSetsWriteBuffer(Windows::Storage::Streams::IBuffer const &descriptions); - hstring DescribeKeyWordSets(); - - /** - * Allocate a set of sub styles for a particular base style, returning start of range - */ - int32_t AllocateSubStyles(int32_t styleBase, int32_t numberStyles); - - /** - * Free allocated sub styles - */ - void FreeSubStyles(); - - /** - * Retrieve the name of a style. - * Result is NUL-terminated. - */ - int32_t NameOfStyleWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &name); - hstring NameOfStyle(int32_t style); - - /** - * Retrieve a ' ' separated list of style tags like "literal quoted string". - * Result is NUL-terminated. - */ - int32_t TagsOfStyleWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &tags); - hstring TagsOfStyle(int32_t style); - - /** - * Retrieve a description of a style. - * Result is NUL-terminated. - */ - int32_t DescriptionOfStyleWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &description); - hstring DescriptionOfStyle(int32_t style); - - /** - * Returns the character byte at the position. - */ - int32_t GetCharAt(int64_t pos); - - /** - * Returns the style byte at the position. - */ - int32_t GetStyleAt(int64_t pos); - - /** - * Returns the unsigned style byte at the position. - */ - int32_t GetStyleIndexAt(int64_t pos); - - /** - * Get the locale for displaying text. - */ - int32_t GetFontLocaleWriteBuffer(Windows::Storage::Streams::IBuffer const &localeName); - hstring GetFontLocale(); - - /** - * Get the layer used for a marker that is drawn in the text area, not the margin. - */ - WinUIEditor::Layer MarkerGetLayer(int32_t markerNumber); - - /** - * Retrieve the type of a margin. - */ - WinUIEditor::MarginType GetMarginTypeN(int32_t margin); - - /** - * Retrieve the width of a margin in pixels. - */ - int32_t GetMarginWidthN(int32_t margin); - - /** - * Retrieve the marker mask of a margin. - */ - int32_t GetMarginMaskN(int32_t margin); - - /** - * Retrieve the mouse click sensitivity of a margin. - */ - bool GetMarginSensitiveN(int32_t margin); - - /** - * Retrieve the cursor shown in a margin. - */ - WinUIEditor::CursorShape GetMarginCursorN(int32_t margin); - - /** - * Retrieve the background colour of a margin - */ - int32_t GetMarginBackN(int32_t margin); - - /** - * Get the foreground colour of a style. - */ - int32_t StyleGetFore(int32_t style); - - /** - * Get the background colour of a style. - */ - int32_t StyleGetBack(int32_t style); - - /** - * Get is a style bold or not. - */ - bool StyleGetBold(int32_t style); - - /** - * Get is a style italic or not. - */ - bool StyleGetItalic(int32_t style); - - /** - * Get the size of characters of a style. - */ - int32_t StyleGetSize(int32_t style); - - /** - * Get the font of a style. - * Returns the length of the fontName - * Result is NUL-terminated. - */ - int32_t StyleGetFontWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &fontName); - hstring StyleGetFont(int32_t style); - - /** - * Get is a style to have its end of line filled or not. - */ - bool StyleGetEOLFilled(int32_t style); - - /** - * Get is a style underlined or not. - */ - bool StyleGetUnderline(int32_t style); - - /** - * Get is a style mixed case, or to force upper or lower case. - */ - WinUIEditor::CaseVisible StyleGetCase(int32_t style); - - /** - * Get the character get of the font in a style. - */ - WinUIEditor::CharacterSet StyleGetCharacterSet(int32_t style); - - /** - * Get is a style visible or not. - */ - bool StyleGetVisible(int32_t style); - - /** - * Get is a style changeable or not (read only). - * Experimental feature, currently buggy. - */ - bool StyleGetChangeable(int32_t style); - - /** - * Get is a style a hotspot or not. - */ - bool StyleGetHotSpot(int32_t style); - - /** - * Get the size of characters of a style in points multiplied by 100 - */ - int32_t StyleGetSizeFractional(int32_t style); - - /** - * Get the weight of characters of a style. - */ - WinUIEditor::FontWeight StyleGetWeight(int32_t style); - - /** - * Get whether a style may be monospaced. - */ - bool StyleGetCheckMonospaced(int32_t style); - - /** - * Get the invisible representation for a style. - */ - int32_t StyleGetInvisibleRepresentationWriteBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &representation); - hstring StyleGetInvisibleRepresentation(int32_t style); - - /** - * Get the colour of an element. - */ - int32_t GetElementColour(WinUIEditor::Element const &element); - - /** - * Get whether an element has been set by SetElementColour. - * When false, a platform-defined or default colour is used. - */ - bool GetElementIsSet(WinUIEditor::Element const &element); - - /** - * Get whether an element supports translucency. - */ - bool GetElementAllowsTranslucent(WinUIEditor::Element const &element); - - /** - * Get the colour of an element. - */ - int32_t GetElementBaseColour(WinUIEditor::Element const &element); - - /** - * Get the set of characters making up words for when moving or selecting by word. - * Returns the number of characters - */ - int32_t GetWordCharsWriteBuffer(Windows::Storage::Streams::IBuffer const &characters); - hstring GetWordChars(); - - /** - * What is the type of an action? - */ - int32_t GetUndoActionType(int32_t action); - - /** - * What is the position of an action? - */ - int64_t GetUndoActionPosition(int32_t action); - - /** - * What is the text of an action? - */ - int32_t GetUndoActionTextWriteBuffer(int32_t action, Windows::Storage::Streams::IBuffer const &text); - hstring GetUndoActionText(int32_t action); - - /** - * Retrieve the style of an indicator. - */ - WinUIEditor::IndicatorStyle IndicGetStyle(int32_t indicator); - - /** - * Retrieve the foreground colour of an indicator. - */ - int32_t IndicGetFore(int32_t indicator); - - /** - * Retrieve whether indicator drawn under or over text. - */ - bool IndicGetUnder(int32_t indicator); - - /** - * Retrieve the hover style of an indicator. - */ - WinUIEditor::IndicatorStyle IndicGetHoverStyle(int32_t indicator); - - /** - * Retrieve the foreground hover colour of an indicator. - */ - int32_t IndicGetHoverFore(int32_t indicator); - - /** - * Retrieve the attributes of an indicator. - */ - WinUIEditor::IndicFlag IndicGetFlags(int32_t indicator); - - /** - * Retrieve the stroke width of an indicator. - */ - int32_t IndicGetStrokeWidth(int32_t indicator); - - /** - * Retrieve the extra styling information for a line. - */ - int32_t GetLineState(int64_t line); - - /** - * Retrieve the number of columns that a line is indented. - */ - int32_t GetLineIndentation(int64_t line); - - /** - * Retrieve the position before the first non indentation character on a line. - */ - int64_t GetLineIndentPosition(int64_t line); - - /** - * Retrieve the column number of a position, taking tab width into account. - */ - int64_t GetColumn(int64_t pos); - - /** - * Get the position after the last visible characters on a line. - */ - int64_t GetLineEndPosition(int64_t line); - - /** - * Retrieve the text in the target. - */ - int64_t GetTargetTextWriteBuffer(Windows::Storage::Streams::IBuffer const &text); - hstring GetTargetText(); - - /** - * Retrieve the fold level of a line. - */ - WinUIEditor::FoldLevel GetFoldLevel(int64_t line); - - /** - * Find the last child line of a header line. - */ - int64_t GetLastChild(int64_t line, WinUIEditor::FoldLevel const &level); - - /** - * Find the parent line of a child line. - */ - int64_t GetFoldParent(int64_t line); - - /** - * Is a line visible? - */ - bool GetLineVisible(int64_t line); - - /** - * Is a header line expanded? - */ - bool GetFoldExpanded(int64_t line); - - /** - * Retrieve the value of a tag from a regular expression search. - * Result is NUL-terminated. - */ - int32_t GetTagWriteBuffer(int32_t tagNumber, Windows::Storage::Streams::IBuffer const &tagValue); - hstring GetTag(int32_t tagNumber); - - /** - * Get multi edge positions. - */ - int64_t GetMultiEdgeColumn(int32_t which); - - /** - * Get the fore colour for active hotspots. - */ - int32_t GetHotspotActiveFore(); - - /** - * Get the back colour for active hotspots. - */ - int32_t GetHotspotActiveBack(); - - /** - * Get the set of characters making up whitespace for when moving or selecting by word. - */ - int32_t GetWhitespaceCharsWriteBuffer(Windows::Storage::Streams::IBuffer const &characters); - hstring GetWhitespaceChars(); - - /** - * Get the set of characters making up punctuation characters - */ - int32_t GetPunctuationCharsWriteBuffer(Windows::Storage::Streams::IBuffer const &characters); - hstring GetPunctuationChars(); - - /** - * Get currently selected item text in the auto-completion list - * Returns the length of the item text - * Result is NUL-terminated. - */ - int32_t AutoCGetCurrentTextWriteBuffer(Windows::Storage::Streams::IBuffer const &text); - hstring AutoCGetCurrentText(); - - /** - * 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 lengthRange bytes. - */ - uint64_t GetRangePointer(int64_t start, int64_t lengthRange); - - /** - * Get the alpha fill colour of the given indicator. - */ - WinUIEditor::Alpha IndicGetAlpha(int32_t indicator); - - /** - * Get the alpha outline colour of the given indicator. - */ - WinUIEditor::Alpha IndicGetOutlineAlpha(int32_t indicator); - - /** - * Get the text in the text margin for a line - */ - int32_t MarginGetTextWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text); - hstring MarginGetText(int64_t line); - - /** - * Get the style number for the text margin for a line - */ - int32_t MarginGetStyle(int64_t line); - - /** - * Get the styles in the text margin for a line - */ - int32_t MarginGetStylesWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &styles); - hstring MarginGetStyles(int64_t line); - - /** - * Get the annotation text for a line - */ - int32_t AnnotationGetTextWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text); - hstring AnnotationGetText(int64_t line); - - /** - * Get the style number for the annotations for a line - */ - int32_t AnnotationGetStyle(int64_t line); - - /** - * Get the annotation styles for a line - */ - int32_t AnnotationGetStylesWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &styles); - hstring AnnotationGetStyles(int64_t line); - - /** - * Get the number of annotation lines for a line - */ - int32_t AnnotationGetLines(int64_t line); - - /** - * Return the caret position of the nth selection. - */ - int64_t GetSelectionNCaret(int32_t selection); - - /** - * Return the anchor position of the nth selection. - */ - int64_t GetSelectionNAnchor(int32_t selection); - - /** - * Return the virtual space of the caret of the nth selection. - */ - int64_t GetSelectionNCaretVirtualSpace(int32_t selection); - - /** - * Return the virtual space of the anchor of the nth selection. - */ - int64_t GetSelectionNAnchorVirtualSpace(int32_t selection); - - /** - * Returns the position at the start of the selection. - */ - int64_t GetSelectionNStart(int32_t selection); - - /** - * Returns the virtual space at the start of the selection. - */ - int64_t GetSelectionNStartVirtualSpace(int32_t selection); - - /** - * Returns the virtual space at the end of the selection. - */ - int64_t GetSelectionNEndVirtualSpace(int32_t selection); - - /** - * Returns the position at the end of the selection. - */ - int64_t GetSelectionNEnd(int32_t selection); - - /** - * Get the way a character is drawn. - * Result is NUL-terminated. - */ - int32_t GetRepresentationWriteBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter, Windows::Storage::Streams::IBuffer const &representation); - hstring GetRepresentation(hstring const &encodedCharacter); - - /** - * Get the appearance of a representation. - */ - WinUIEditor::RepresentationAppearance GetRepresentationAppearanceFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter); - WinUIEditor::RepresentationAppearance GetRepresentationAppearance(hstring const &encodedCharacter); - - /** - * Get the colour of a representation. - */ - int32_t GetRepresentationColourFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter); - int32_t GetRepresentationColour(hstring const &encodedCharacter); - - /** - * Get the end of line annotation text for a line - */ - int32_t EOLAnnotationGetTextWriteBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text); - hstring EOLAnnotationGetText(int64_t line); - - /** - * Get the style number for the end of line annotations for a line - */ - int32_t EOLAnnotationGetStyle(int64_t line); - - /** - * Get whether a feature is supported - */ - bool SupportsFeature(WinUIEditor::Supports const &feature); - - /** - * Retrieve a "property" value previously set with SetProperty. - * Result is NUL-terminated. - */ - int32_t GetPropertyWriteBuffer(Windows::Storage::Streams::IBuffer const &key, Windows::Storage::Streams::IBuffer const &value); - hstring GetProperty(hstring const &key); - - /** - * Retrieve a "property" value previously set with SetProperty, - * with "$()" variable replacement on returned buffer. - * Result is NUL-terminated. - */ - int32_t GetPropertyExpandedWriteBuffer(Windows::Storage::Streams::IBuffer const &key, Windows::Storage::Streams::IBuffer const &value); - hstring GetPropertyExpanded(hstring const &key); - - /** - * Retrieve a "property" value previously set with SetProperty, - * interpreted as an int AFTER any "$()" variable replacement. - */ - int32_t GetPropertyIntFromBuffer(Windows::Storage::Streams::IBuffer const &key, int32_t defaultValue); - int32_t GetPropertyInt(hstring const &key, int32_t defaultValue); - - /** - * Retrieve the name of the lexer. - * Return the length of the text. - * Result is NUL-terminated. - */ - int32_t GetLexerLanguageWriteBuffer(Windows::Storage::Streams::IBuffer const &language); - hstring GetLexerLanguage(); - - /** - * The starting style number for the sub styles associated with a base style - */ - int32_t GetSubStylesStart(int32_t styleBase); - - /** - * The number of sub styles associated with a base style - */ - int32_t GetSubStylesLength(int32_t styleBase); - - /** - * For a sub style, return the base style, else return the argument. - */ - int32_t GetStyleFromSubStyle(int32_t subStyle); - - /** - * For a secondary style, return the primary style, else return the argument. - */ - int32_t GetPrimaryStyleFromStyle(int32_t style); - - /** - * Get the set of base styles that can be extended with sub styles - * Result is NUL-terminated. - */ - int32_t GetSubStyleBasesWriteBuffer(Windows::Storage::Streams::IBuffer const &styles); - hstring GetSubStyleBases(); - - /** - * Set the locale for displaying text. - */ - void SetFontLocaleFromBuffer(Windows::Storage::Streams::IBuffer const &localeName); - void SetFontLocale(hstring const &localeName); - - /** - * Set the foreground colour used for a particular marker number. - */ - void MarkerSetFore(int32_t markerNumber, int32_t fore); - - /** - * Set the background colour used for a particular marker number. - */ - void MarkerSetBack(int32_t markerNumber, int32_t back); - - /** - * Set the background colour used for a particular marker number when its folding block is selected. - */ - void MarkerSetBackSelected(int32_t markerNumber, int32_t back); - - /** - * Set the foreground colour used for a particular marker number. - */ - void MarkerSetForeTranslucent(int32_t markerNumber, int32_t fore); - - /** - * Set the background colour used for a particular marker number. - */ - void MarkerSetBackTranslucent(int32_t markerNumber, int32_t back); - - /** - * Set the background colour used for a particular marker number when its folding block is selected. - */ - void MarkerSetBackSelectedTranslucent(int32_t markerNumber, int32_t back); - - /** - * Set the width of strokes used in .01 pixels so 50 = 1/2 pixel width. - */ - void MarkerSetStrokeWidth(int32_t markerNumber, int32_t hundredths); - - /** - * Set the alpha used for a marker that is drawn in the text area, not the margin. - */ - void MarkerSetAlpha(int32_t markerNumber, WinUIEditor::Alpha const &alpha); - - /** - * Set the layer used for a marker that is drawn in the text area, not the margin. - */ - void MarkerSetLayer(int32_t markerNumber, WinUIEditor::Layer const &layer); - - /** - * Set a margin to be either numeric or symbolic. - */ - void SetMarginTypeN(int32_t margin, WinUIEditor::MarginType const &marginType); - - /** - * Set the width of a margin to a width expressed in pixels. - */ - void SetMarginWidthN(int32_t margin, int32_t pixelWidth); - - /** - * Set a mask that determines which markers are displayed in a margin. - */ - void SetMarginMaskN(int32_t margin, int32_t mask); - - /** - * Make a margin sensitive or insensitive to mouse clicks. - */ - void SetMarginSensitiveN(int32_t margin, bool sensitive); - - /** - * Set the cursor shown when the mouse is inside a margin. - */ - void SetMarginCursorN(int32_t margin, WinUIEditor::CursorShape const &cursor); - - /** - * Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. - */ - void SetMarginBackN(int32_t margin, int32_t back); - - /** - * Set the foreground colour of a style. - */ - void StyleSetFore(int32_t style, int32_t fore); - - /** - * Set the background colour of a style. - */ - void StyleSetBack(int32_t style, int32_t back); - - /** - * Set a style to be bold or not. - */ - void StyleSetBold(int32_t style, bool bold); - - /** - * Set a style to be italic or not. - */ - void StyleSetItalic(int32_t style, bool italic); - - /** - * Set the size of characters of a style. - */ - void StyleSetSize(int32_t style, int32_t sizePoints); - - /** - * Set the font of a style. - */ - void StyleSetFontFromBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &fontName); - void StyleSetFont(int32_t style, hstring const &fontName); - - /** - * Set a style to have its end of line filled or not. - */ - void StyleSetEOLFilled(int32_t style, bool eolFilled); - - /** - * Set a style to be underlined or not. - */ - void StyleSetUnderline(int32_t style, bool underline); - - /** - * Set a style to be mixed case, or to force upper or lower case. - */ - void StyleSetCase(int32_t style, WinUIEditor::CaseVisible const &caseVisible); - - /** - * Set the size of characters of a style. Size is in points multiplied by 100. - */ - void StyleSetSizeFractional(int32_t style, int32_t sizeHundredthPoints); - - /** - * Set the weight of characters of a style. - */ - void StyleSetWeight(int32_t style, WinUIEditor::FontWeight const &weight); - - /** - * Set the character set of the font in a style. - */ - void StyleSetCharacterSet(int32_t style, WinUIEditor::CharacterSet const &characterSet); - - /** - * Set a style to be a hotspot or not. - */ - void StyleSetHotSpot(int32_t style, bool hotspot); - - /** - * Indicate that a style may be monospaced over ASCII graphics characters which enables optimizations. - */ - void StyleSetCheckMonospaced(int32_t style, bool checkMonospaced); - - /** - * Set the invisible representation for a style. - */ - void StyleSetInvisibleRepresentationFromBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &representation); - void StyleSetInvisibleRepresentation(int32_t style, hstring const &representation); - - /** - * Set the colour of an element. Translucency (alpha) may or may not be significant - * and this may depend on the platform. The alpha byte should commonly be 0xff for opaque. - */ - void SetElementColour(WinUIEditor::Element const &element, int32_t colourElement); - - /** - * Set a style to be visible or not. - */ - void StyleSetVisible(int32_t style, bool visible); - - /** - * Set the set of characters making up words for when moving or selecting by word. - * First sets defaults like SetCharsDefault. - */ - void SetWordCharsFromBuffer(Windows::Storage::Streams::IBuffer const &characters); - void SetWordChars(hstring const &characters); - - /** - * Set an indicator to plain, squiggle or TT. - */ - void IndicSetStyle(int32_t indicator, WinUIEditor::IndicatorStyle const &indicatorStyle); - - /** - * Set the foreground colour of an indicator. - */ - void IndicSetFore(int32_t indicator, int32_t fore); - - /** - * Set an indicator to draw under text or over(default). - */ - void IndicSetUnder(int32_t indicator, bool under); - - /** - * Set a hover indicator to plain, squiggle or TT. - */ - void IndicSetHoverStyle(int32_t indicator, WinUIEditor::IndicatorStyle const &indicatorStyle); - - /** - * Set the foreground hover colour of an indicator. - */ - void IndicSetHoverFore(int32_t indicator, int32_t fore); - - /** - * Set the attributes of an indicator. - */ - void IndicSetFlags(int32_t indicator, WinUIEditor::IndicFlag const &flags); - - /** - * Set the stroke width of an indicator in hundredths of a pixel. - */ - void IndicSetStrokeWidth(int32_t indicator, int32_t hundredths); - - /** - * Used to hold extra styling information for each line. - */ - void SetLineState(int64_t line, int32_t state); - - /** - * Set a style to be changeable or not (read only). - * Experimental feature, currently buggy. - */ - void StyleSetChangeable(int32_t style, bool changeable); - - /** - * Define a set of characters that when typed will cause the autocompletion to - * choose the selected item. - */ - void AutoCSetFillUpsFromBuffer(Windows::Storage::Streams::IBuffer const &characterSet); - void AutoCSetFillUps(hstring const &characterSet); - - /** - * Change the indentation of a line to a number of columns. - */ - void SetLineIndentation(int64_t line, int32_t indentation); - - /** - * Enlarge the number of lines allocated. - */ - void AllocateLines(int64_t lines); - - /** - * Set the start position in order to change when backspacing removes the calltip. - */ - void CallTipSetPosStart(int64_t posStart); - - /** - * Set the background colour for the call tip. - */ - void CallTipSetBack(int32_t back); - - /** - * Set the foreground colour for the call tip. - */ - void CallTipSetFore(int32_t fore); - - /** - * Set the foreground colour for the highlighted part of the call tip. - */ - void CallTipSetForeHlt(int32_t fore); - - /** - * Enable use of STYLE_CALLTIP and set call tip tab size in pixels. - */ - void CallTipUseStyle(int32_t tabSize); - - /** - * Set position of calltip, above or below text. - */ - void CallTipSetPosition(bool above); - - /** - * 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. - */ - void SetFoldLevel(int64_t line, WinUIEditor::FoldLevel const &level); - - /** - * Show the children of a header line. - */ - void SetFoldExpanded(int64_t line, bool expanded); - - /** - * Set some style options for folding. - */ - void SetFoldFlags(WinUIEditor::FoldFlag const &flags); - - /** - * Set a fore colour for active hotspots. - */ - void SetHotspotActiveFore(bool useSetting, int32_t fore); - - /** - * Set a back colour for active hotspots. - */ - void SetHotspotActiveBack(bool useSetting, int32_t back); - - /** - * Set the set of characters making up whitespace for when moving or selecting by word. - * Should be called after SetWordChars. - */ - void SetWhitespaceCharsFromBuffer(Windows::Storage::Streams::IBuffer const &characters); - void SetWhitespaceChars(hstring const &characters); - - /** - * Set the set of characters making up punctuation characters - * Should be called after SetWordChars. - */ - void SetPunctuationCharsFromBuffer(Windows::Storage::Streams::IBuffer const &characters); - void SetPunctuationChars(hstring const &characters); - - /** - * Set the alpha fill colour of the given indicator. - */ - void IndicSetAlpha(int32_t indicator, WinUIEditor::Alpha const &alpha); - - /** - * Set the alpha outline colour of the given indicator. - */ - void IndicSetOutlineAlpha(int32_t indicator, WinUIEditor::Alpha const &alpha); - - /** - * Set the text in the text margin for a line - */ - void MarginSetTextFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text); - void MarginSetText(int64_t line, hstring const &text); - - /** - * Set the style number for the text margin for a line - */ - void MarginSetStyle(int64_t line, int32_t style); - - /** - * Set the style in the text margin for a line - */ - void MarginSetStylesFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &styles); - void MarginSetStyles(int64_t line, hstring const &styles); - - /** - * Set the annotation text for a line - */ - void AnnotationSetTextFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text); - void AnnotationSetText(int64_t line, hstring const &text); - - /** - * Set the style number for the annotations for a line - */ - void AnnotationSetStyle(int64_t line, int32_t style); - - /** - * Set the annotation styles for a line - */ - void AnnotationSetStylesFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &styles); - void AnnotationSetStyles(int64_t line, hstring const &styles); - - /** - * Set the caret position of the nth selection. - */ - void SetSelectionNCaret(int32_t selection, int64_t caret); - - /** - * Set the anchor position of the nth selection. - */ - void SetSelectionNAnchor(int32_t selection, int64_t anchor); - - /** - * Set the virtual space of the caret of the nth selection. - */ - void SetSelectionNCaretVirtualSpace(int32_t selection, int64_t space); - - /** - * Set the virtual space of the anchor of the nth selection. - */ - void SetSelectionNAnchorVirtualSpace(int32_t selection, int64_t space); - - /** - * Sets the position that starts the selection - this becomes the anchor. - */ - void SetSelectionNStart(int32_t selection, int64_t anchor); - - /** - * Sets the position that ends the selection - this becomes the currentPosition. - */ - void SetSelectionNEnd(int32_t selection, int64_t caret); - - /** - * Set the foreground colour of additional selections. - * Must have previously called SetSelFore with non-zero first argument for this to have an effect. - */ - void SetAdditionalSelFore(int32_t fore); - - /** - * Set the background colour of additional selections. - * Must have previously called SetSelBack with non-zero first argument for this to have an effect. - */ - void SetAdditionalSelBack(int32_t back); - - /** - * Set the width for future RGBA image data. - */ - void RGBAImageSetWidth(int32_t width); - - /** - * Set the height for future RGBA image data. - */ - void RGBAImageSetHeight(int32_t height); - - /** - * Set the scale factor in percent for future RGBA image data. - */ - void RGBAImageSetScale(int32_t scalePercent); - - /** - * Set the way a character is drawn. - */ - void SetRepresentationFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter, Windows::Storage::Streams::IBuffer const &representation); - void SetRepresentation(hstring const &encodedCharacter, hstring const &representation); - - /** - * Set the appearance of a representation. - */ - void SetRepresentationAppearanceFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter, WinUIEditor::RepresentationAppearance const &appearance); - void SetRepresentationAppearance(hstring const &encodedCharacter, WinUIEditor::RepresentationAppearance const &appearance); - - /** - * Set the colour of a representation. - */ - void SetRepresentationColourFromBuffer(Windows::Storage::Streams::IBuffer const &encodedCharacter, int32_t colour); - void SetRepresentationColour(hstring const &encodedCharacter, int32_t colour); - - /** - * Set the end of line annotation text for a line - */ - void EOLAnnotationSetTextFromBuffer(int64_t line, Windows::Storage::Streams::IBuffer const &text); - void EOLAnnotationSetText(int64_t line, hstring const &text); - - /** - * Set the style number for the end of line annotations for a line - */ - void EOLAnnotationSetStyle(int64_t line, int32_t style); - - /** - * Set up a value that may be used by a lexer for some optional feature. - */ - void SetPropertyFromBuffer(Windows::Storage::Streams::IBuffer const &key, Windows::Storage::Streams::IBuffer const &value); - void SetProperty(hstring const &key, hstring const &value); - - /** - * Set up the key words used by the lexer. - */ - void SetKeyWordsFromBuffer(int32_t keyWordSet, Windows::Storage::Streams::IBuffer const &keyWords); - void SetKeyWords(int32_t keyWordSet, hstring const &keyWords); - - /** - * Set the identifiers that are shown in a particular style - */ - void SetIdentifiersFromBuffer(int32_t style, Windows::Storage::Streams::IBuffer const &identifiers); - void SetIdentifiers(int32_t style, hstring const &identifiers); - - /** - * Set the lexer from an ILexer*. - */ - void SetILexer(uint64_t ilexer); - - private: - event _styleNeededEvent; - event _charAddedEvent; - event _savePointReachedEvent; - event _savePointLeftEvent; - event _modifyAttemptROEvent; - event _keyEvent; - event _doubleClickEvent; - event _updateUIEvent; - event _modifiedEvent; - event _macroRecordEvent; - event _marginClickEvent; - event _needShownEvent; - event _paintedEvent; - event _userListSelectionEvent; - event _uRIDroppedEvent; - event _dwellStartEvent; - event _dwellEndEvent; - event _zoomChangedEvent; - event _hotSpotClickEvent; - event _hotSpotDoubleClickEvent; - event _callTipClickEvent; - event _autoCSelectionEvent; - event _indicatorClickEvent; - event _indicatorReleaseEvent; - event _autoCCancelledEvent; - event _autoCCharDeletedEvent; - event _hotSpotReleaseClickEvent; - event _focusInEvent; - event _focusOutEvent; - event _autoCCompletedEvent; - event _marginRightClickEvent; - event _autoCSelectionChangeEvent; - - weak_ref _editor{ nullptr }; - }; -} diff --git a/WinUIEditor/EditorWrapper.idl b/WinUIEditor/EditorWrapper.idl deleted file mode 100644 index cb29f6c..0000000 --- a/WinUIEditor/EditorWrapper.idl +++ /dev/null @@ -1,8489 +0,0 @@ -namespace WinUIEditor -{ - enum ScintillaMessage - { - AddText = 2001, - AddStyledText = 2002, - InsertText = 2003, - ChangeInsertion = 2672, - ClearAll = 2004, - DeleteRange = 2645, - ClearDocumentStyle = 2005, - GetLength = 2006, - GetCharAt = 2007, - GetCurrentPos = 2008, - GetAnchor = 2009, - GetStyleAt = 2010, - GetStyleIndexAt = 2038, - Redo = 2011, - SetUndoCollection = 2012, - SelectAll = 2013, - SetSavePoint = 2014, - GetStyledText = 2015, - GetStyledTextFull = 2778, - CanRedo = 2016, - MarkerLineFromHandle = 2017, - MarkerDeleteHandle = 2018, - MarkerHandleFromLine = 2732, - MarkerNumberFromLine = 2733, - GetUndoCollection = 2019, - GetViewWS = 2020, - SetViewWS = 2021, - GetTabDrawMode = 2698, - SetTabDrawMode = 2699, - PositionFromPoint = 2022, - PositionFromPointClose = 2023, - GotoLine = 2024, - GotoPos = 2025, - SetAnchor = 2026, - GetCurLine = 2027, - GetEndStyled = 2028, - ConvertEOLs = 2029, - GetEOLMode = 2030, - SetEOLMode = 2031, - StartStyling = 2032, - SetStyling = 2033, - GetBufferedDraw = 2034, - SetBufferedDraw = 2035, - SetTabWidth = 2036, - GetTabWidth = 2121, - SetTabMinimumWidth = 2724, - GetTabMinimumWidth = 2725, - ClearTabStops = 2675, - AddTabStop = 2676, - GetNextTabStop = 2677, - SetCodePage = 2037, - SetFontLocale = 2760, - GetFontLocale = 2761, - GetIMEInteraction = 2678, - SetIMEInteraction = 2679, - MarkerDefine = 2040, - MarkerSetFore = 2041, - MarkerSetBack = 2042, - MarkerSetBackSelected = 2292, - MarkerSetForeTranslucent = 2294, - MarkerSetBackTranslucent = 2295, - MarkerSetBackSelectedTranslucent = 2296, - MarkerSetStrokeWidth = 2297, - MarkerEnableHighlight = 2293, - MarkerAdd = 2043, - MarkerDelete = 2044, - MarkerDeleteAll = 2045, - MarkerGet = 2046, - MarkerNext = 2047, - MarkerPrevious = 2048, - MarkerDefinePixmap = 2049, - MarkerAddSet = 2466, - MarkerSetAlpha = 2476, - MarkerGetLayer = 2734, - MarkerSetLayer = 2735, - SetMarginTypeN = 2240, - GetMarginTypeN = 2241, - SetMarginWidthN = 2242, - GetMarginWidthN = 2243, - SetMarginMaskN = 2244, - GetMarginMaskN = 2245, - SetMarginSensitiveN = 2246, - GetMarginSensitiveN = 2247, - SetMarginCursorN = 2248, - GetMarginCursorN = 2249, - SetMarginBackN = 2250, - GetMarginBackN = 2251, - SetMargins = 2252, - GetMargins = 2253, - StyleClearAll = 2050, - StyleSetFore = 2051, - StyleSetBack = 2052, - StyleSetBold = 2053, - StyleSetItalic = 2054, - StyleSetSize = 2055, - StyleSetFont = 2056, - StyleSetEOLFilled = 2057, - StyleResetDefault = 2058, - StyleSetUnderline = 2059, - StyleGetFore = 2481, - StyleGetBack = 2482, - StyleGetBold = 2483, - StyleGetItalic = 2484, - StyleGetSize = 2485, - StyleGetFont = 2486, - StyleGetEOLFilled = 2487, - StyleGetUnderline = 2488, - StyleGetCase = 2489, - StyleGetCharacterSet = 2490, - StyleGetVisible = 2491, - StyleGetChangeable = 2492, - StyleGetHotSpot = 2493, - StyleSetCase = 2060, - StyleSetSizeFractional = 2061, - StyleGetSizeFractional = 2062, - StyleSetWeight = 2063, - StyleGetWeight = 2064, - StyleSetCharacterSet = 2066, - StyleSetHotSpot = 2409, - StyleSetCheckMonospaced = 2254, - StyleGetCheckMonospaced = 2255, - StyleSetInvisibleRepresentation = 2256, - StyleGetInvisibleRepresentation = 2257, - SetElementColour = 2753, - GetElementColour = 2754, - ResetElementColour = 2755, - GetElementIsSet = 2756, - GetElementAllowsTranslucent = 2757, - GetElementBaseColour = 2758, - SetSelFore = 2067, - SetSelBack = 2068, - GetSelAlpha = 2477, - SetSelAlpha = 2478, - GetSelEOLFilled = 2479, - SetSelEOLFilled = 2480, - GetSelectionLayer = 2762, - SetSelectionLayer = 2763, - GetCaretLineLayer = 2764, - SetCaretLineLayer = 2765, - GetCaretLineHighlightSubLine = 2773, - SetCaretLineHighlightSubLine = 2774, - SetCaretFore = 2069, - AssignCmdKey = 2070, - ClearCmdKey = 2071, - ClearAllCmdKeys = 2072, - SetStylingEx = 2073, - StyleSetVisible = 2074, - GetCaretPeriod = 2075, - SetCaretPeriod = 2076, - SetWordChars = 2077, - GetWordChars = 2646, - SetCharacterCategoryOptimization = 2720, - GetCharacterCategoryOptimization = 2721, - BeginUndoAction = 2078, - EndUndoAction = 2079, - GetUndoActions = 2790, - SetUndoSavePoint = 2791, - GetUndoSavePoint = 2792, - SetUndoDetach = 2793, - GetUndoDetach = 2794, - SetUndoTentative = 2795, - GetUndoTentative = 2796, - SetUndoCurrent = 2797, - GetUndoCurrent = 2798, - PushUndoActionType = 2800, - ChangeLastUndoActionText = 2801, - GetUndoActionType = 2802, - GetUndoActionPosition = 2803, - GetUndoActionText = 2804, - IndicSetStyle = 2080, - IndicGetStyle = 2081, - IndicSetFore = 2082, - IndicGetFore = 2083, - IndicSetUnder = 2510, - IndicGetUnder = 2511, - IndicSetHoverStyle = 2680, - IndicGetHoverStyle = 2681, - IndicSetHoverFore = 2682, - IndicGetHoverFore = 2683, - IndicSetFlags = 2684, - IndicGetFlags = 2685, - IndicSetStrokeWidth = 2751, - IndicGetStrokeWidth = 2752, - SetWhitespaceFore = 2084, - SetWhitespaceBack = 2085, - SetWhitespaceSize = 2086, - GetWhitespaceSize = 2087, - SetLineState = 2092, - GetLineState = 2093, - GetMaxLineState = 2094, - GetCaretLineVisible = 2095, - SetCaretLineVisible = 2096, - GetCaretLineBack = 2097, - SetCaretLineBack = 2098, - GetCaretLineFrame = 2704, - SetCaretLineFrame = 2705, - StyleSetChangeable = 2099, - AutoCShow = 2100, - AutoCCancel = 2101, - AutoCActive = 2102, - AutoCPosStart = 2103, - AutoCComplete = 2104, - AutoCStops = 2105, - AutoCSetSeparator = 2106, - AutoCGetSeparator = 2107, - AutoCSelect = 2108, - AutoCSetCancelAtStart = 2110, - AutoCGetCancelAtStart = 2111, - AutoCSetFillUps = 2112, - AutoCSetChooseSingle = 2113, - AutoCGetChooseSingle = 2114, - AutoCSetIgnoreCase = 2115, - AutoCGetIgnoreCase = 2116, - UserListShow = 2117, - AutoCSetAutoHide = 2118, - AutoCGetAutoHide = 2119, - AutoCSetOptions = 2638, - AutoCGetOptions = 2639, - AutoCSetDropRestOfWord = 2270, - AutoCGetDropRestOfWord = 2271, - RegisterImage = 2405, - ClearRegisteredImages = 2408, - AutoCGetTypeSeparator = 2285, - AutoCSetTypeSeparator = 2286, - AutoCSetMaxWidth = 2208, - AutoCGetMaxWidth = 2209, - AutoCSetMaxHeight = 2210, - AutoCGetMaxHeight = 2211, - SetIndent = 2122, - GetIndent = 2123, - SetUseTabs = 2124, - GetUseTabs = 2125, - SetLineIndentation = 2126, - GetLineIndentation = 2127, - GetLineIndentPosition = 2128, - GetColumn = 2129, - CountCharacters = 2633, - CountCodeUnits = 2715, - SetHScrollBar = 2130, - GetHScrollBar = 2131, - SetIndentationGuides = 2132, - GetIndentationGuides = 2133, - SetHighlightGuide = 2134, - GetHighlightGuide = 2135, - GetLineEndPosition = 2136, - GetCodePage = 2137, - GetCaretFore = 2138, - GetReadOnly = 2140, - SetCurrentPos = 2141, - SetSelectionStart = 2142, - GetSelectionStart = 2143, - SetSelectionEnd = 2144, - GetSelectionEnd = 2145, - SetEmptySelection = 2556, - SetPrintMagnification = 2146, - GetPrintMagnification = 2147, - SetPrintColourMode = 2148, - GetPrintColourMode = 2149, - FindText = 2150, - FindTextFull = 2196, - FormatRange = 2151, - FormatRangeFull = 2777, - SetChangeHistory = 2780, - GetChangeHistory = 2781, - GetFirstVisibleLine = 2152, - GetLine = 2153, - GetLineCount = 2154, - AllocateLines = 2089, - SetMarginLeft = 2155, - GetMarginLeft = 2156, - SetMarginRight = 2157, - GetMarginRight = 2158, - GetModify = 2159, - SetSel = 2160, - GetSelText = 2161, - GetTextRange = 2162, - GetTextRangeFull = 2039, - HideSelection = 2163, - GetSelectionHidden = 2088, - PointXFromPosition = 2164, - PointYFromPosition = 2165, - LineFromPosition = 2166, - PositionFromLine = 2167, - LineScroll = 2168, - ScrollCaret = 2169, - ScrollRange = 2569, - ReplaceSel = 2170, - SetReadOnly = 2171, - Null = 2172, - CanPaste = 2173, - CanUndo = 2174, - EmptyUndoBuffer = 2175, - Undo = 2176, - Cut = 2177, - Copy = 2178, - Paste = 2179, - Clear = 2180, - SetText = 2181, - GetText = 2182, - GetTextLength = 2183, - GetDirectFunction = 2184, - GetDirectStatusFunction = 2772, - GetDirectPointer = 2185, - SetOvertype = 2186, - GetOvertype = 2187, - SetCaretWidth = 2188, - GetCaretWidth = 2189, - SetTargetStart = 2190, - GetTargetStart = 2191, - SetTargetStartVirtualSpace = 2728, - GetTargetStartVirtualSpace = 2729, - SetTargetEnd = 2192, - GetTargetEnd = 2193, - SetTargetEndVirtualSpace = 2730, - GetTargetEndVirtualSpace = 2731, - SetTargetRange = 2686, - GetTargetText = 2687, - TargetFromSelection = 2287, - TargetWholeDocument = 2690, - ReplaceTarget = 2194, - ReplaceTargetRE = 2195, - ReplaceTargetMinimal = 2779, - SearchInTarget = 2197, - SetSearchFlags = 2198, - GetSearchFlags = 2199, - CallTipShow = 2200, - CallTipCancel = 2201, - CallTipActive = 2202, - CallTipPosStart = 2203, - CallTipSetPosStart = 2214, - CallTipSetHlt = 2204, - CallTipSetBack = 2205, - CallTipSetFore = 2206, - CallTipSetForeHlt = 2207, - CallTipUseStyle = 2212, - CallTipSetPosition = 2213, - VisibleFromDocLine = 2220, - DocLineFromVisible = 2221, - WrapCount = 2235, - SetFoldLevel = 2222, - GetFoldLevel = 2223, - GetLastChild = 2224, - GetFoldParent = 2225, - ShowLines = 2226, - HideLines = 2227, - GetLineVisible = 2228, - GetAllLinesVisible = 2236, - SetFoldExpanded = 2229, - GetFoldExpanded = 2230, - ToggleFold = 2231, - ToggleFoldShowText = 2700, - FoldDisplayTextSetStyle = 2701, - FoldDisplayTextGetStyle = 2707, - SetDefaultFoldDisplayText = 2722, - GetDefaultFoldDisplayText = 2723, - FoldLine = 2237, - FoldChildren = 2238, - ExpandChildren = 2239, - FoldAll = 2662, - EnsureVisible = 2232, - SetAutomaticFold = 2663, - GetAutomaticFold = 2664, - SetFoldFlags = 2233, - EnsureVisibleEnforcePolicy = 2234, - SetTabIndents = 2260, - GetTabIndents = 2261, - SetBackSpaceUnIndents = 2262, - GetBackSpaceUnIndents = 2263, - SetMouseDwellTime = 2264, - GetMouseDwellTime = 2265, - WordStartPosition = 2266, - WordEndPosition = 2267, - IsRangeWord = 2691, - SetIdleStyling = 2692, - GetIdleStyling = 2693, - SetWrapMode = 2268, - GetWrapMode = 2269, - SetWrapVisualFlags = 2460, - GetWrapVisualFlags = 2461, - SetWrapVisualFlagsLocation = 2462, - GetWrapVisualFlagsLocation = 2463, - SetWrapStartIndent = 2464, - GetWrapStartIndent = 2465, - SetWrapIndentMode = 2472, - GetWrapIndentMode = 2473, - SetLayoutCache = 2272, - GetLayoutCache = 2273, - SetScrollWidth = 2274, - GetScrollWidth = 2275, - SetScrollWidthTracking = 2516, - GetScrollWidthTracking = 2517, - TextWidth = 2276, - SetEndAtLastLine = 2277, - GetEndAtLastLine = 2278, - TextHeight = 2279, - SetVScrollBar = 2280, - GetVScrollBar = 2281, - AppendText = 2282, - GetPhasesDraw = 2673, - SetPhasesDraw = 2674, - SetFontQuality = 2611, - GetFontQuality = 2612, - SetFirstVisibleLine = 2613, - SetMultiPaste = 2614, - GetMultiPaste = 2615, - GetTag = 2616, - LinesJoin = 2288, - LinesSplit = 2289, - SetFoldMarginColour = 2290, - SetFoldMarginHiColour = 2291, - SetAccessibility = 2702, - GetAccessibility = 2703, - LineDown = 2300, - LineDownExtend = 2301, - LineUp = 2302, - LineUpExtend = 2303, - CharLeft = 2304, - CharLeftExtend = 2305, - CharRight = 2306, - CharRightExtend = 2307, - WordLeft = 2308, - WordLeftExtend = 2309, - WordRight = 2310, - WordRightExtend = 2311, - Home = 2312, - HomeExtend = 2313, - LineEnd = 2314, - LineEndExtend = 2315, - DocumentStart = 2316, - DocumentStartExtend = 2317, - DocumentEnd = 2318, - DocumentEndExtend = 2319, - PageUp = 2320, - PageUpExtend = 2321, - PageDown = 2322, - PageDownExtend = 2323, - EditToggleOvertype = 2324, - Cancel = 2325, - DeleteBack = 2326, - Tab = 2327, - BackTab = 2328, - NewLine = 2329, - FormFeed = 2330, - VCHome = 2331, - VCHomeExtend = 2332, - ZoomIn = 2333, - ZoomOut = 2334, - DelWordLeft = 2335, - DelWordRight = 2336, - DelWordRightEnd = 2518, - LineCut = 2337, - LineDelete = 2338, - LineTranspose = 2339, - LineReverse = 2354, - LineDuplicate = 2404, - LowerCase = 2340, - UpperCase = 2341, - LineScrollDown = 2342, - LineScrollUp = 2343, - DeleteBackNotLine = 2344, - HomeDisplay = 2345, - HomeDisplayExtend = 2346, - LineEndDisplay = 2347, - LineEndDisplayExtend = 2348, - HomeWrap = 2349, - HomeWrapExtend = 2450, - LineEndWrap = 2451, - LineEndWrapExtend = 2452, - VCHomeWrap = 2453, - VCHomeWrapExtend = 2454, - LineCopy = 2455, - MoveCaretInsideView = 2401, - LineLength = 2350, - BraceHighlight = 2351, - BraceHighlightIndicator = 2498, - BraceBadLight = 2352, - BraceBadLightIndicator = 2499, - BraceMatch = 2353, - BraceMatchNext = 2369, - GetViewEOL = 2355, - SetViewEOL = 2356, - GetDocPointer = 2357, - SetDocPointer = 2358, - SetModEventMask = 2359, - GetEdgeColumn = 2360, - SetEdgeColumn = 2361, - GetEdgeMode = 2362, - SetEdgeMode = 2363, - GetEdgeColour = 2364, - SetEdgeColour = 2365, - MultiEdgeAddLine = 2694, - MultiEdgeClearAll = 2695, - GetMultiEdgeColumn = 2749, - SearchAnchor = 2366, - SearchNext = 2367, - SearchPrev = 2368, - LinesOnScreen = 2370, - UsePopUp = 2371, - SelectionIsRectangle = 2372, - SetZoom = 2373, - GetZoom = 2374, - CreateDocument = 2375, - AddRefDocument = 2376, - ReleaseDocument = 2377, - GetDocumentOptions = 2379, - GetModEventMask = 2378, - SetCommandEvents = 2717, - GetCommandEvents = 2718, - SetFocus = 2380, - GetFocus = 2381, - SetStatus = 2382, - GetStatus = 2383, - SetMouseDownCaptures = 2384, - GetMouseDownCaptures = 2385, - SetMouseWheelCaptures = 2696, - GetMouseWheelCaptures = 2697, - SetCursor = 2386, - GetCursor = 2387, - SetControlCharSymbol = 2388, - GetControlCharSymbol = 2389, - WordPartLeft = 2390, - WordPartLeftExtend = 2391, - WordPartRight = 2392, - WordPartRightExtend = 2393, - SetVisiblePolicy = 2394, - DelLineLeft = 2395, - DelLineRight = 2396, - SetXOffset = 2397, - GetXOffset = 2398, - ChooseCaretX = 2399, - GrabFocus = 2400, - SetXCaretPolicy = 2402, - SetYCaretPolicy = 2403, - SetPrintWrapMode = 2406, - GetPrintWrapMode = 2407, - SetHotspotActiveFore = 2410, - GetHotspotActiveFore = 2494, - SetHotspotActiveBack = 2411, - GetHotspotActiveBack = 2495, - SetHotspotActiveUnderline = 2412, - GetHotspotActiveUnderline = 2496, - SetHotspotSingleLine = 2421, - GetHotspotSingleLine = 2497, - ParaDown = 2413, - ParaDownExtend = 2414, - ParaUp = 2415, - ParaUpExtend = 2416, - PositionBefore = 2417, - PositionAfter = 2418, - PositionRelative = 2670, - PositionRelativeCodeUnits = 2716, - CopyRange = 2419, - CopyText = 2420, - SetSelectionMode = 2422, - ChangeSelectionMode = 2659, - GetSelectionMode = 2423, - SetMoveExtendsSelection = 2719, - GetMoveExtendsSelection = 2706, - GetLineSelStartPosition = 2424, - GetLineSelEndPosition = 2425, - LineDownRectExtend = 2426, - LineUpRectExtend = 2427, - CharLeftRectExtend = 2428, - CharRightRectExtend = 2429, - HomeRectExtend = 2430, - VCHomeRectExtend = 2431, - LineEndRectExtend = 2432, - PageUpRectExtend = 2433, - PageDownRectExtend = 2434, - StutteredPageUp = 2435, - StutteredPageUpExtend = 2436, - StutteredPageDown = 2437, - StutteredPageDownExtend = 2438, - WordLeftEnd = 2439, - WordLeftEndExtend = 2440, - WordRightEnd = 2441, - WordRightEndExtend = 2442, - SetWhitespaceChars = 2443, - GetWhitespaceChars = 2647, - SetPunctuationChars = 2648, - GetPunctuationChars = 2649, - SetCharsDefault = 2444, - AutoCGetCurrent = 2445, - AutoCGetCurrentText = 2610, - AutoCSetCaseInsensitiveBehaviour = 2634, - AutoCGetCaseInsensitiveBehaviour = 2635, - AutoCSetMulti = 2636, - AutoCGetMulti = 2637, - AutoCSetOrder = 2660, - AutoCGetOrder = 2661, - Allocate = 2446, - TargetAsUTF8 = 2447, - SetLengthForEncode = 2448, - EncodedFromUTF8 = 2449, - FindColumn = 2456, - GetCaretSticky = 2457, - SetCaretSticky = 2458, - ToggleCaretSticky = 2459, - SetPasteConvertEndings = 2467, - GetPasteConvertEndings = 2468, - ReplaceRectangular = 2771, - SelectionDuplicate = 2469, - SetCaretLineBackAlpha = 2470, - GetCaretLineBackAlpha = 2471, - SetCaretStyle = 2512, - GetCaretStyle = 2513, - SetIndicatorCurrent = 2500, - GetIndicatorCurrent = 2501, - SetIndicatorValue = 2502, - GetIndicatorValue = 2503, - IndicatorFillRange = 2504, - IndicatorClearRange = 2505, - IndicatorAllOnFor = 2506, - IndicatorValueAt = 2507, - IndicatorStart = 2508, - IndicatorEnd = 2509, - SetPositionCache = 2514, - GetPositionCache = 2515, - SetLayoutThreads = 2775, - GetLayoutThreads = 2776, - CopyAllowLine = 2519, - GetCharacterPointer = 2520, - GetRangePointer = 2643, - GetGapPosition = 2644, - IndicSetAlpha = 2523, - IndicGetAlpha = 2524, - IndicSetOutlineAlpha = 2558, - IndicGetOutlineAlpha = 2559, - SetExtraAscent = 2525, - GetExtraAscent = 2526, - SetExtraDescent = 2527, - GetExtraDescent = 2528, - MarkerSymbolDefined = 2529, - MarginSetText = 2530, - MarginGetText = 2531, - MarginSetStyle = 2532, - MarginGetStyle = 2533, - MarginSetStyles = 2534, - MarginGetStyles = 2535, - MarginTextClearAll = 2536, - MarginSetStyleOffset = 2537, - MarginGetStyleOffset = 2538, - SetMarginOptions = 2539, - GetMarginOptions = 2557, - AnnotationSetText = 2540, - AnnotationGetText = 2541, - AnnotationSetStyle = 2542, - AnnotationGetStyle = 2543, - AnnotationSetStyles = 2544, - AnnotationGetStyles = 2545, - AnnotationGetLines = 2546, - AnnotationClearAll = 2547, - AnnotationSetVisible = 2548, - AnnotationGetVisible = 2549, - AnnotationSetStyleOffset = 2550, - AnnotationGetStyleOffset = 2551, - ReleaseAllExtendedStyles = 2552, - AllocateExtendedStyles = 2553, - AddUndoAction = 2560, - CharPositionFromPoint = 2561, - CharPositionFromPointClose = 2562, - SetMouseSelectionRectangularSwitch = 2668, - GetMouseSelectionRectangularSwitch = 2669, - SetMultipleSelection = 2563, - GetMultipleSelection = 2564, - SetAdditionalSelectionTyping = 2565, - GetAdditionalSelectionTyping = 2566, - SetAdditionalCaretsBlink = 2567, - GetAdditionalCaretsBlink = 2568, - SetAdditionalCaretsVisible = 2608, - GetAdditionalCaretsVisible = 2609, - GetSelections = 2570, - GetSelectionEmpty = 2650, - ClearSelections = 2571, - SetSelection = 2572, - AddSelection = 2573, - SelectionFromPoint = 2474, - DropSelectionN = 2671, - SetMainSelection = 2574, - GetMainSelection = 2575, - SetSelectionNCaret = 2576, - GetSelectionNCaret = 2577, - SetSelectionNAnchor = 2578, - GetSelectionNAnchor = 2579, - SetSelectionNCaretVirtualSpace = 2580, - GetSelectionNCaretVirtualSpace = 2581, - SetSelectionNAnchorVirtualSpace = 2582, - GetSelectionNAnchorVirtualSpace = 2583, - SetSelectionNStart = 2584, - GetSelectionNStart = 2585, - GetSelectionNStartVirtualSpace = 2726, - SetSelectionNEnd = 2586, - GetSelectionNEndVirtualSpace = 2727, - GetSelectionNEnd = 2587, - SetRectangularSelectionCaret = 2588, - GetRectangularSelectionCaret = 2589, - SetRectangularSelectionAnchor = 2590, - GetRectangularSelectionAnchor = 2591, - SetRectangularSelectionCaretVirtualSpace = 2592, - GetRectangularSelectionCaretVirtualSpace = 2593, - SetRectangularSelectionAnchorVirtualSpace = 2594, - GetRectangularSelectionAnchorVirtualSpace = 2595, - SetVirtualSpaceOptions = 2596, - GetVirtualSpaceOptions = 2597, - SetRectangularSelectionModifier = 2598, - GetRectangularSelectionModifier = 2599, - SetAdditionalSelFore = 2600, - SetAdditionalSelBack = 2601, - SetAdditionalSelAlpha = 2602, - GetAdditionalSelAlpha = 2603, - SetAdditionalCaretFore = 2604, - GetAdditionalCaretFore = 2605, - RotateSelection = 2606, - SwapMainAnchorCaret = 2607, - MultipleSelectAddNext = 2688, - MultipleSelectAddEach = 2689, - ChangeLexerState = 2617, - ContractedFoldNext = 2618, - VerticalCentreCaret = 2619, - MoveSelectedLinesUp = 2620, - MoveSelectedLinesDown = 2621, - SetIdentifier = 2622, - GetIdentifier = 2623, - RGBAImageSetWidth = 2624, - RGBAImageSetHeight = 2625, - RGBAImageSetScale = 2651, - MarkerDefineRGBAImage = 2626, - RegisterRGBAImage = 2627, - ScrollToStart = 2628, - ScrollToEnd = 2629, - SetTechnology = 2630, - GetTechnology = 2631, - CreateLoader = 2632, - FindIndicatorShow = 2640, - FindIndicatorFlash = 2641, - FindIndicatorHide = 2642, - VCHomeDisplay = 2652, - VCHomeDisplayExtend = 2653, - GetCaretLineVisibleAlways = 2654, - SetCaretLineVisibleAlways = 2655, - SetLineEndTypesAllowed = 2656, - GetLineEndTypesAllowed = 2657, - GetLineEndTypesActive = 2658, - SetRepresentation = 2665, - GetRepresentation = 2666, - ClearRepresentation = 2667, - ClearAllRepresentations = 2770, - SetRepresentationAppearance = 2766, - GetRepresentationAppearance = 2767, - SetRepresentationColour = 2768, - GetRepresentationColour = 2769, - EOLAnnotationSetText = 2740, - EOLAnnotationGetText = 2741, - EOLAnnotationSetStyle = 2742, - EOLAnnotationGetStyle = 2743, - EOLAnnotationClearAll = 2744, - EOLAnnotationSetVisible = 2745, - EOLAnnotationGetVisible = 2746, - EOLAnnotationSetStyleOffset = 2747, - EOLAnnotationGetStyleOffset = 2748, - SupportsFeature = 2750, - GetLineCharacterIndex = 2710, - AllocateLineCharacterIndex = 2711, - ReleaseLineCharacterIndex = 2712, - LineFromIndexPosition = 2713, - IndexPositionFromLine = 2714, - StartRecord = 3001, - StopRecord = 3002, - GetLexer = 4002, - Colourise = 4003, - SetProperty = 4004, - SetKeyWords = 4005, - GetProperty = 4008, - GetPropertyExpanded = 4009, - GetPropertyInt = 4010, - GetLexerLanguage = 4012, - PrivateLexerCall = 4013, - PropertyNames = 4014, - PropertyType = 4015, - DescribeProperty = 4016, - DescribeKeyWordSets = 4017, - GetLineEndTypesSupported = 4018, - AllocateSubStyles = 4020, - GetSubStylesStart = 4021, - GetSubStylesLength = 4022, - GetStyleFromSubStyle = 4027, - GetPrimaryStyleFromStyle = 4028, - FreeSubStyles = 4023, - SetIdentifiers = 4024, - DistanceToSecondaryStyles = 4025, - GetSubStyleBases = 4026, - GetNamedStyles = 4029, - NameOfStyle = 4030, - TagsOfStyle = 4031, - DescriptionOfStyle = 4032, - SetILexer = 4033, - GetBidirectional = 2708, - SetBidirectional = 2709, - }; - - enum WhiteSpace - { - Invisible = 0, - VisibleAlways = 1, - VisibleAfterIndent = 2, - VisibleOnlyInIndent = 3, - }; - - enum TabDrawMode - { - LongArrow = 0, - StrikeOut = 1, - }; - - enum EndOfLine - { - CrLf = 0, - Cr = 1, - Lf = 2, - }; - - enum IMEInteraction - { - Windowed = 0, - Inline = 1, - }; - - enum Alpha - { - Transparent = 0, - Opaque = 255, - NoAlpha = 256, - }; - - enum CursorShape - { - Normal = -1, - Arrow = 2, - Wait = 4, - ReverseArrow = 7, - }; - - 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, - Bar = 33, - Character = 10000, - }; - - enum MarkerOutline - { - HistoryRevertedToOrigin = 21, - HistorySaved = 22, - HistoryModified = 23, - HistoryRevertedToModified = 24, - FolderEnd = 25, - FolderOpenMid = 26, - FolderMidTail = 27, - FolderTail = 28, - FolderSub = 29, - Folder = 30, - FolderOpen = 31, - }; - - enum MarginType - { - Symbol = 0, - Number = 1, - Back = 2, - Fore = 3, - Text = 4, - RText = 5, - Colour = 6, - }; - - enum StylesCommon - { - Default = 32, - LineNumber = 33, - BraceLight = 34, - BraceBad = 35, - ControlChar = 36, - IndentGuide = 37, - CallTip = 38, - FoldDisplayText = 39, - LastPredefined = 39, - Max = 255, - }; - - 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, - Iso885915 = 1000, - }; - - enum CaseVisible - { - Mixed = 0, - Upper = 1, - Lower = 2, - Camel = 3, - }; - - enum FontWeight - { - Normal = 400, - SemiBold = 600, - Bold = 700, - }; - - enum Element - { - List = 0, - ListBack = 1, - ListSelected = 2, - ListSelectedBack = 3, - SelectionText = 10, - SelectionBack = 11, - SelectionAdditionalText = 12, - SelectionAdditionalBack = 13, - SelectionSecondaryText = 14, - SelectionSecondaryBack = 15, - SelectionInactiveText = 16, - SelectionInactiveBack = 17, - Caret = 40, - CaretAdditional = 41, - CaretLineBack = 50, - WhiteSpace = 60, - WhiteSpaceBack = 61, - HotSpotActive = 70, - HotSpotActiveBack = 71, - FoldLine = 80, - HiddenLine = 81, - }; - - enum Layer - { - Base = 0, - UnderText = 1, - OverText = 2, - }; - - 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, - PointTop = 22, - Container = 8, - Ime = 32, - ImeMax = 35, - Max = 35, - }; - - enum IndicatorNumbers - { - Container = 8, - Ime = 32, - ImeMax = 35, - HistoryRevertedToOriginInsertion = 36, - HistoryRevertedToOriginDeletion = 37, - HistorySavedInsertion = 38, - HistorySavedDeletion = 39, - HistoryModifiedInsertion = 40, - HistoryModifiedDeletion = 41, - HistoryRevertedToModifiedInsertion = 42, - HistoryRevertedToModifiedDeletion = 43, - Max = 43, - }; - - enum IndicValue - { - Bit = 16777216, - Mask = 16777215, - }; - - enum IndicFlag - { - None = 0, - ValueFore = 1, - }; - - enum AutoCompleteOption - { - Normal = 0, - FixedSize = 1, - }; - - enum IndentView - { - None = 0, - Real = 1, - LookForward = 2, - LookBoth = 3, - }; - - enum PrintOption - { - Normal = 0, - InvertLight = 1, - BlackOnWhite = 2, - ColourOnWhite = 3, - ColourOnWhiteDefaultBG = 4, - ScreenColours = 5, - }; - - [flags] - enum FindOption - { - None = 0, - WholeWord = 2, - MatchCase = 4, - WordStart = 1048576, - RegExp = 2097152, - Posix = 4194304, - Cxx11RegEx = 8388608, - }; - - enum ChangeHistoryOption - { - Disabled = 0, - Enabled = 1, - Markers = 2, - Indicators = 4, - }; - - enum FoldLevel - { - None = 0, - Base = 1024, - WhiteFlag = 4096, - HeaderFlag = 8192, - NumberMask = 4095, - }; - - enum FoldDisplayTextStyle - { - Hidden = 0, - Standard = 1, - Boxed = 2, - }; - - enum FoldAction - { - Contract = 0, - Expand = 1, - Toggle = 2, - ContractEveryLevel = 4, - }; - - enum AutomaticFold - { - None = 0, - Show = 1, - Click = 2, - Change = 4, - }; - - [flags] - enum FoldFlag - { - None = 0, - LineBeforeExpanded = 2, - LineBeforeContracted = 4, - LineAfterExpanded = 8, - LineAfterContracted = 16, - LevelNumbers = 64, - LineState = 128, - }; - - enum IdleStyling - { - None = 0, - ToVisible = 1, - AfterVisible = 2, - All = 3, - }; - - enum Wrap - { - None = 0, - Word = 1, - Char = 2, - WhiteSpace = 3, - }; - - enum WrapVisualFlag - { - None = 0, - End = 1, - Start = 2, - Margin = 4, - }; - - enum WrapVisualLocation - { - Default = 0, - EndByText = 1, - StartByText = 2, - }; - - enum WrapIndentMode - { - Fixed = 0, - Same = 1, - Indent = 2, - DeepIndent = 3, - }; - - enum LineCache - { - None = 0, - Caret = 1, - Page = 2, - Document = 3, - }; - - enum PhasesDraw - { - One = 0, - Two = 1, - Multiple = 2, - }; - - enum FontQuality - { - QualityMask = 15, - QualityDefault = 0, - QualityNonAntialiased = 1, - QualityAntialiased = 2, - QualityLcdOptimized = 3, - }; - - enum MultiPaste - { - Once = 0, - Each = 1, - }; - - enum Accessibility - { - Disabled = 0, - Enabled = 1, - }; - - enum EdgeVisualStyle - { - None = 0, - Line = 1, - Background = 2, - MultiLine = 3, - }; - - enum PopUp - { - Never = 0, - All = 1, - Text = 2, - }; - - [flags] - enum DocumentOption - { - Default = 0, - StylesNone = 1, - TextLarge = 256, - }; - - enum Status - { - Ok = 0, - Failure = 1, - BadAlloc = 2, - WarnStart = 1000, - RegEx = 1001, - }; - - enum VisiblePolicy - { - Slop = 1, - Strict = 4, - }; - - [flags] - enum CaretPolicy - { - Slop = 1, - Strict = 4, - Jumps = 16, - Even = 8, - }; - - enum SelectionMode - { - Stream = 0, - Rectangle = 1, - Lines = 2, - Thin = 3, - }; - - enum CaseInsensitiveBehaviour - { - RespectCase = 0, - IgnoreCase = 1, - }; - - enum MultiAutoComplete - { - Once = 0, - Each = 1, - }; - - enum Ordering - { - PreSorted = 0, - PerformSort = 1, - Custom = 2, - }; - - enum CaretSticky - { - Off = 0, - On = 1, - WhiteSpace = 2, - }; - - [flags] - enum CaretStyle - { - Invisible = 0, - Line = 1, - Block = 2, - OverstrikeBar = 0, - OverstrikeBlock = 16, - Curses = 32, - InsMask = 15, - BlockAfter = 256, - }; - - enum MarginOption - { - None = 0, - SubLineSelect = 1, - }; - - enum AnnotationVisible - { - Hidden = 0, - Standard = 1, - Boxed = 2, - Indented = 3, - }; - - enum UndoFlags - { - None = 0, - MayCoalesce = 1, - }; - - enum VirtualSpace - { - None = 0, - RectangularSelection = 1, - UserAccessible = 2, - NoWrapLineStart = 4, - }; - - enum Technology - { - Default = 0, - DirectWrite = 1, - DirectWriteRetain = 2, - DirectWriteDC = 3, - }; - - enum LineEndType - { - Default = 0, - Unicode = 1, - }; - - [flags] - enum RepresentationAppearance - { - Plain = 0, - Blob = 1, - Colour = 16, - }; - - enum EOLAnnotationVisible - { - Hidden = 0, - Standard = 1, - Boxed = 2, - Stadium = 256, - FlatCircle = 257, - AngleCircle = 258, - CircleFlat = 272, - Flats = 273, - AngleFlat = 274, - CircleAngle = 288, - FlatAngle = 289, - Angles = 290, - }; - - enum Supports - { - LineDrawsFinal = 0, - PixelDivisions = 1, - FractionalStrokeWidth = 2, - TranslucentStroke = 3, - PixelModification = 4, - ThreadSafeMeasureWidths = 5, - }; - - [flags] - enum LineCharacterIndexType - { - None = 0, - Utf32 = 1, - Utf16 = 2, - }; - - enum TypeProperty - { - Boolean = 0, - Integer = 1, - String = 2, - }; - - [flags] - enum ModificationFlags - { - None = 0, - InsertText = 1, - DeleteText = 2, - ChangeStyle = 4, - ChangeFold = 8, - User = 16, - Undo = 32, - Redo = 64, - MultiStepUndoRedo = 128, - LastStepInUndoRedo = 256, - ChangeMarker = 512, - BeforeInsert = 1024, - BeforeDelete = 2048, - MultilineUndoRedo = 4096, - StartAction = 8192, - ChangeIndicator = 16384, - ChangeLineState = 32768, - ChangeMargin = 65536, - ChangeAnnotation = 131072, - Container = 262144, - LexerState = 524288, - InsertCheck = 1048576, - ChangeTabStops = 2097152, - ChangeEOLAnnotation = 4194304, - EventMaskAll = 8388607, - }; - - [flags] - enum Update - { - None = 0, - Content = 1, - Selection = 2, - VScroll = 4, - HScroll = 8, - }; - - enum FocusChange - { - Change = 768, - Setfocus = 512, - Killfocus = 256, - }; - - enum Keys - { - Down = 300, - Up = 301, - Left = 302, - Right = 303, - Home = 304, - End = 305, - Prior = 306, - Next = 307, - Delete = 308, - Insert = 309, - Escape = 7, - Back = 8, - Tab = 9, - Return = 13, - Add = 310, - Subtract = 311, - Divide = 312, - Win = 313, - RWin = 314, - Menu = 315, - }; - - [flags] - enum KeyMod - { - Norm = 0, - Shift = 1, - Ctrl = 2, - Alt = 4, - Super = 8, - Meta = 16, - }; - - enum CompletionMethods - { - FillUp = 1, - DoubleClick = 2, - Tab = 3, - Newline = 4, - Command = 5, - SingleChoice = 6, - }; - - enum CharacterSource - { - DirectInput = 0, - TentativeInput = 1, - ImeResult = 2, - }; - - enum Bidirectional - { - Disabled = 0, - L2r = 1, - R2l = 2, - }; - - 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, - Hollywood = 130, - Raku = 131, - Fsharp = 132, - Julia = 133, - Asciidoc = 134, - Gdscript = 135, - Automatic = 1000, - }; - - enum EditorConstants - { - InvalidPosition = -1, - ScCpUtf8 = 65001, - MarkerMax = 31, - ScMaskFolders = -33554432, - ScMaxMargin = 4, - ScFontSizeMultiplier = 100, - ScTimeForever = 10000000, - KeywordsetMax = 8, - }; - - enum Python - { - PDefault = 0, - PCommentline = 1, - PNumber = 2, - PString = 3, - PCharacter = 4, - PWord = 5, - PTriple = 6, - PTripledouble = 7, - PClassname = 8, - PDefname = 9, - POperator = 10, - PIdentifier = 11, - PCommentblock = 12, - PStringeol = 13, - PWord2 = 14, - PDecorator = 15, - PFstring = 16, - PFcharacter = 17, - PFtriple = 18, - PFtripledouble = 19, - PAttribute = 20, - }; - - enum Nimrod - { - PDefault = 0, - PCommentline = 1, - PNumber = 2, - PString = 3, - PCharacter = 4, - PWord = 5, - PTriple = 6, - PTripledouble = 7, - PClassname = 8, - PDefname = 9, - POperator = 10, - PIdentifier = 11, - PCommentblock = 12, - PStringeol = 13, - PWord2 = 14, - PDecorator = 15, - PFstring = 16, - PFcharacter = 17, - PFtriple = 18, - PFtripledouble = 19, - PAttribute = 20, - }; - - enum Cpp - { - CDefault = 0, - CComment = 1, - CCommentline = 2, - CCommentdoc = 3, - CNumber = 4, - CWord = 5, - CString = 6, - CCharacter = 7, - CUuid = 8, - CPreprocessor = 9, - COperator = 10, - CIdentifier = 11, - CStringeol = 12, - CVerbatim = 13, - CRegex = 14, - CCommentlinedoc = 15, - CWord2 = 16, - CCommentdockeyword = 17, - CCommentdockeyworderror = 18, - CGlobalclass = 19, - CStringraw = 20, - CTripleverbatim = 21, - CHashquotedstring = 22, - CPreprocessorcomment = 23, - CPreprocessorcommentdoc = 24, - CUserliteral = 25, - CTaskmarker = 26, - CEscapesequence = 27, - }; - - enum BullAnt - { - CDefault = 0, - CComment = 1, - CCommentline = 2, - CCommentdoc = 3, - CNumber = 4, - CWord = 5, - CString = 6, - CCharacter = 7, - CUuid = 8, - CPreprocessor = 9, - COperator = 10, - CIdentifier = 11, - CStringeol = 12, - CVerbatim = 13, - CRegex = 14, - CCommentlinedoc = 15, - CWord2 = 16, - CCommentdockeyword = 17, - CCommentdockeyworderror = 18, - CGlobalclass = 19, - CStringraw = 20, - CTripleverbatim = 21, - CHashquotedstring = 22, - CPreprocessorcomment = 23, - CPreprocessorcommentdoc = 24, - CUserliteral = 25, - CTaskmarker = 26, - CEscapesequence = 27, - }; - - enum COBOL - { - CDefault = 0, - CComment = 1, - CCommentline = 2, - CCommentdoc = 3, - CNumber = 4, - CWord = 5, - CString = 6, - CCharacter = 7, - CUuid = 8, - CPreprocessor = 9, - COperator = 10, - CIdentifier = 11, - CStringeol = 12, - CVerbatim = 13, - CRegex = 14, - CCommentlinedoc = 15, - CWord2 = 16, - CCommentdockeyword = 17, - CCommentdockeyworderror = 18, - CGlobalclass = 19, - CStringraw = 20, - CTripleverbatim = 21, - CHashquotedstring = 22, - CPreprocessorcomment = 23, - CPreprocessorcommentdoc = 24, - CUserliteral = 25, - CTaskmarker = 26, - CEscapesequence = 27, - }; - - enum TACL - { - CDefault = 0, - CComment = 1, - CCommentline = 2, - CCommentdoc = 3, - CNumber = 4, - CWord = 5, - CString = 6, - CCharacter = 7, - CUuid = 8, - CPreprocessor = 9, - COperator = 10, - CIdentifier = 11, - CStringeol = 12, - CVerbatim = 13, - CRegex = 14, - CCommentlinedoc = 15, - CWord2 = 16, - CCommentdockeyword = 17, - CCommentdockeyworderror = 18, - CGlobalclass = 19, - CStringraw = 20, - CTripleverbatim = 21, - CHashquotedstring = 22, - CPreprocessorcomment = 23, - CPreprocessorcommentdoc = 24, - CUserliteral = 25, - CTaskmarker = 26, - CEscapesequence = 27, - }; - - enum TAL - { - CDefault = 0, - CComment = 1, - CCommentline = 2, - CCommentdoc = 3, - CNumber = 4, - CWord = 5, - CString = 6, - CCharacter = 7, - CUuid = 8, - CPreprocessor = 9, - COperator = 10, - CIdentifier = 11, - CStringeol = 12, - CVerbatim = 13, - CRegex = 14, - CCommentlinedoc = 15, - CWord2 = 16, - CCommentdockeyword = 17, - CCommentdockeyworderror = 18, - CGlobalclass = 19, - CStringraw = 20, - CTripleverbatim = 21, - CHashquotedstring = 22, - CPreprocessorcomment = 23, - CPreprocessorcommentdoc = 24, - CUserliteral = 25, - CTaskmarker = 26, - CEscapesequence = 27, - }; - - enum D - { - DDefault = 0, - DComment = 1, - DCommentline = 2, - DCommentdoc = 3, - DCommentnested = 4, - DNumber = 5, - DWord = 6, - DWord2 = 7, - DWord3 = 8, - DTypedef = 9, - DString = 10, - DStringeol = 11, - DCharacter = 12, - DOperator = 13, - DIdentifier = 14, - DCommentlinedoc = 15, - DCommentdockeyword = 16, - DCommentdockeyworderror = 17, - DStringb = 18, - DStringr = 19, - DWord5 = 20, - DWord6 = 21, - DWord7 = 22, - }; - - enum TCL - { - TclDefault = 0, - TclComment = 1, - TclCommentline = 2, - TclNumber = 3, - TclWordInQuote = 4, - TclInQuote = 5, - TclOperator = 6, - TclIdentifier = 7, - TclSubstitution = 8, - TclSubBrace = 9, - TclModifier = 10, - TclExpand = 11, - TclWord = 12, - TclWord2 = 13, - TclWord3 = 14, - TclWord4 = 15, - TclWord5 = 16, - TclWord6 = 17, - TclWord7 = 18, - TclWord8 = 19, - TclCommentBox = 20, - TclBlockComment = 21, - }; - - enum HTML - { - HDefault = 0, - HTag = 1, - HTagunknown = 2, - HAttribute = 3, - HAttributeunknown = 4, - HNumber = 5, - HDoublestring = 6, - HSinglestring = 7, - HOther = 8, - HComment = 9, - HEntity = 10, - HTagend = 11, - HXmlstart = 12, - HXmlend = 13, - HScript = 14, - HAsp = 15, - HAspat = 16, - HCdata = 17, - HQuestion = 18, - HValue = 19, - HXccomment = 20, - HSgmlDefault = 21, - HSgmlCommand = 22, - HSgml1stParam = 23, - HSgmlDoublestring = 24, - HSgmlSimplestring = 25, - HSgmlError = 26, - HSgmlSpecial = 27, - HSgmlEntity = 28, - HSgmlComment = 29, - HSgml1stParamComment = 30, - HSgmlBlockDefault = 31, - HjStart = 40, - HjDefault = 41, - HjComment = 42, - HjCommentline = 43, - HjCommentdoc = 44, - HjNumber = 45, - HjWord = 46, - HjKeyword = 47, - HjDoublestring = 48, - HjSinglestring = 49, - HjSymbols = 50, - HjStringeol = 51, - HjRegex = 52, - HjaStart = 55, - HjaDefault = 56, - HjaComment = 57, - HjaCommentline = 58, - HjaCommentdoc = 59, - HjaNumber = 60, - HjaWord = 61, - HjaKeyword = 62, - HjaDoublestring = 63, - HjaSinglestring = 64, - HjaSymbols = 65, - HjaStringeol = 66, - HjaRegex = 67, - HbStart = 70, - HbDefault = 71, - HbCommentline = 72, - HbNumber = 73, - HbWord = 74, - HbString = 75, - HbIdentifier = 76, - HbStringeol = 77, - HbaStart = 80, - HbaDefault = 81, - HbaCommentline = 82, - HbaNumber = 83, - HbaWord = 84, - HbaString = 85, - HbaIdentifier = 86, - HbaStringeol = 87, - HpStart = 90, - HpDefault = 91, - HpCommentline = 92, - HpNumber = 93, - HpString = 94, - HpCharacter = 95, - HpWord = 96, - HpTriple = 97, - HpTripledouble = 98, - HpClassname = 99, - HpDefname = 100, - HpOperator = 101, - HpIdentifier = 102, - HphpComplexVariable = 104, - HpaStart = 105, - HpaDefault = 106, - HpaCommentline = 107, - HpaNumber = 108, - HpaString = 109, - HpaCharacter = 110, - HpaWord = 111, - HpaTriple = 112, - HpaTripledouble = 113, - HpaClassname = 114, - HpaDefname = 115, - HpaOperator = 116, - HpaIdentifier = 117, - HphpDefault = 118, - HphpHstring = 119, - HphpSimplestring = 120, - HphpWord = 121, - HphpNumber = 122, - HphpVariable = 123, - HphpComment = 124, - HphpCommentline = 125, - HphpHstringVariable = 126, - HphpOperator = 127, - }; - - enum XML - { - HDefault = 0, - HTag = 1, - HTagunknown = 2, - HAttribute = 3, - HAttributeunknown = 4, - HNumber = 5, - HDoublestring = 6, - HSinglestring = 7, - HOther = 8, - HComment = 9, - HEntity = 10, - HTagend = 11, - HXmlstart = 12, - HXmlend = 13, - HScript = 14, - HAsp = 15, - HAspat = 16, - HCdata = 17, - HQuestion = 18, - HValue = 19, - HXccomment = 20, - HSgmlDefault = 21, - HSgmlCommand = 22, - HSgml1stParam = 23, - HSgmlDoublestring = 24, - HSgmlSimplestring = 25, - HSgmlError = 26, - HSgmlSpecial = 27, - HSgmlEntity = 28, - HSgmlComment = 29, - HSgml1stParamComment = 30, - HSgmlBlockDefault = 31, - HjStart = 40, - HjDefault = 41, - HjComment = 42, - HjCommentline = 43, - HjCommentdoc = 44, - HjNumber = 45, - HjWord = 46, - HjKeyword = 47, - HjDoublestring = 48, - HjSinglestring = 49, - HjSymbols = 50, - HjStringeol = 51, - HjRegex = 52, - HjaStart = 55, - HjaDefault = 56, - HjaComment = 57, - HjaCommentline = 58, - HjaCommentdoc = 59, - HjaNumber = 60, - HjaWord = 61, - HjaKeyword = 62, - HjaDoublestring = 63, - HjaSinglestring = 64, - HjaSymbols = 65, - HjaStringeol = 66, - HjaRegex = 67, - HbStart = 70, - HbDefault = 71, - HbCommentline = 72, - HbNumber = 73, - HbWord = 74, - HbString = 75, - HbIdentifier = 76, - HbStringeol = 77, - HbaStart = 80, - HbaDefault = 81, - HbaCommentline = 82, - HbaNumber = 83, - HbaWord = 84, - HbaString = 85, - HbaIdentifier = 86, - HbaStringeol = 87, - HpStart = 90, - HpDefault = 91, - HpCommentline = 92, - HpNumber = 93, - HpString = 94, - HpCharacter = 95, - HpWord = 96, - HpTriple = 97, - HpTripledouble = 98, - HpClassname = 99, - HpDefname = 100, - HpOperator = 101, - HpIdentifier = 102, - HphpComplexVariable = 104, - HpaStart = 105, - HpaDefault = 106, - HpaCommentline = 107, - HpaNumber = 108, - HpaString = 109, - HpaCharacter = 110, - HpaWord = 111, - HpaTriple = 112, - HpaTripledouble = 113, - HpaClassname = 114, - HpaDefname = 115, - HpaOperator = 116, - HpaIdentifier = 117, - HphpDefault = 118, - HphpHstring = 119, - HphpSimplestring = 120, - HphpWord = 121, - HphpNumber = 122, - HphpVariable = 123, - HphpComment = 124, - HphpCommentline = 125, - HphpHstringVariable = 126, - HphpOperator = 127, - }; - - enum Perl - { - PlDefault = 0, - PlError = 1, - PlCommentline = 2, - PlPod = 3, - PlNumber = 4, - PlWord = 5, - PlString = 6, - PlCharacter = 7, - PlPunctuation = 8, - PlPreprocessor = 9, - PlOperator = 10, - PlIdentifier = 11, - PlScalar = 12, - PlArray = 13, - PlHash = 14, - PlSymboltable = 15, - PlVariableIndexer = 16, - PlRegex = 17, - PlRegsubst = 18, - PlLongquote = 19, - PlBackticks = 20, - PlDatasection = 21, - PlHereDelim = 22, - PlHereQ = 23, - PlHereQq = 24, - PlHereQx = 25, - PlStringQ = 26, - PlStringQq = 27, - PlStringQx = 28, - PlStringQr = 29, - PlStringQw = 30, - PlPodVerb = 31, - PlSubPrototype = 40, - PlFormatIdent = 41, - PlFormat = 42, - PlStringVar = 43, - PlXlat = 44, - PlRegexVar = 54, - PlRegsubstVar = 55, - PlBackticksVar = 57, - PlHereQqVar = 61, - PlHereQxVar = 62, - PlStringQqVar = 64, - PlStringQxVar = 65, - PlStringQrVar = 66, - }; - - enum Ruby - { - RbDefault = 0, - RbError = 1, - RbCommentline = 2, - RbPod = 3, - RbNumber = 4, - RbWord = 5, - RbString = 6, - RbCharacter = 7, - RbClassname = 8, - RbDefname = 9, - RbOperator = 10, - RbIdentifier = 11, - RbRegex = 12, - RbGlobal = 13, - RbSymbol = 14, - RbModuleName = 15, - RbInstanceVar = 16, - RbClassVar = 17, - RbBackticks = 18, - RbDatasection = 19, - RbHereDelim = 20, - RbHereQ = 21, - RbHereQq = 22, - RbHereQx = 23, - RbStringQ = 24, - RbStringQq = 25, - RbStringQx = 26, - RbStringQr = 27, - RbStringQw = 28, - RbWordDemoted = 29, - RbStdin = 30, - RbStdout = 31, - RbStderr = 40, - RbStringW = 41, - RbStringI = 42, - RbStringQi = 43, - RbStringQs = 44, - RbUpperBound = 45, - }; - - enum VB - { - BDefault = 0, - BComment = 1, - BNumber = 2, - BKeyword = 3, - BString = 4, - BPreprocessor = 5, - BOperator = 6, - BIdentifier = 7, - BDate = 8, - BStringeol = 9, - BKeyword2 = 10, - BKeyword3 = 11, - BKeyword4 = 12, - BConstant = 13, - BAsm = 14, - BLabel = 15, - BError = 16, - BHexnumber = 17, - BBinnumber = 18, - BCommentblock = 19, - BDocline = 20, - BDocblock = 21, - BDockeyword = 22, - }; - - enum VBScript - { - BDefault = 0, - BComment = 1, - BNumber = 2, - BKeyword = 3, - BString = 4, - BPreprocessor = 5, - BOperator = 6, - BIdentifier = 7, - BDate = 8, - BStringeol = 9, - BKeyword2 = 10, - BKeyword3 = 11, - BKeyword4 = 12, - BConstant = 13, - BAsm = 14, - BLabel = 15, - BError = 16, - BHexnumber = 17, - BBinnumber = 18, - BCommentblock = 19, - BDocline = 20, - BDocblock = 21, - BDockeyword = 22, - }; - - enum PowerBasic - { - BDefault = 0, - BComment = 1, - BNumber = 2, - BKeyword = 3, - BString = 4, - BPreprocessor = 5, - BOperator = 6, - BIdentifier = 7, - BDate = 8, - BStringeol = 9, - BKeyword2 = 10, - BKeyword3 = 11, - BKeyword4 = 12, - BConstant = 13, - BAsm = 14, - BLabel = 15, - BError = 16, - BHexnumber = 17, - BBinnumber = 18, - BCommentblock = 19, - BDocline = 20, - BDocblock = 21, - BDockeyword = 22, - }; - - enum BlitzBasic - { - BDefault = 0, - BComment = 1, - BNumber = 2, - BKeyword = 3, - BString = 4, - BPreprocessor = 5, - BOperator = 6, - BIdentifier = 7, - BDate = 8, - BStringeol = 9, - BKeyword2 = 10, - BKeyword3 = 11, - BKeyword4 = 12, - BConstant = 13, - BAsm = 14, - BLabel = 15, - BError = 16, - BHexnumber = 17, - BBinnumber = 18, - BCommentblock = 19, - BDocline = 20, - BDocblock = 21, - BDockeyword = 22, - }; - - enum PureBasic - { - BDefault = 0, - BComment = 1, - BNumber = 2, - BKeyword = 3, - BString = 4, - BPreprocessor = 5, - BOperator = 6, - BIdentifier = 7, - BDate = 8, - BStringeol = 9, - BKeyword2 = 10, - BKeyword3 = 11, - BKeyword4 = 12, - BConstant = 13, - BAsm = 14, - BLabel = 15, - BError = 16, - BHexnumber = 17, - BBinnumber = 18, - BCommentblock = 19, - BDocline = 20, - BDocblock = 21, - BDockeyword = 22, - }; - - enum FreeBasic - { - BDefault = 0, - BComment = 1, - BNumber = 2, - BKeyword = 3, - BString = 4, - BPreprocessor = 5, - BOperator = 6, - BIdentifier = 7, - BDate = 8, - BStringeol = 9, - BKeyword2 = 10, - BKeyword3 = 11, - BKeyword4 = 12, - BConstant = 13, - BAsm = 14, - BLabel = 15, - BError = 16, - BHexnumber = 17, - BBinnumber = 18, - BCommentblock = 19, - BDocline = 20, - BDocblock = 21, - BDockeyword = 22, - }; - - enum Properties - { - PropsDefault = 0, - PropsComment = 1, - PropsSection = 2, - PropsAssignment = 3, - PropsDefval = 4, - PropsKey = 5, - }; - - enum LaTeX - { - LDefault = 0, - LCommand = 1, - LTag = 2, - LMath = 3, - LComment = 4, - LTag2 = 5, - LMath2 = 6, - LComment2 = 7, - LVerbatim = 8, - LShortcmd = 9, - LSpecial = 10, - LCmdopt = 11, - LError = 12, - }; - - enum Lua - { - LuaDefault = 0, - LuaComment = 1, - LuaCommentline = 2, - LuaCommentdoc = 3, - LuaNumber = 4, - LuaWord = 5, - LuaString = 6, - LuaCharacter = 7, - LuaLiteralstring = 8, - LuaPreprocessor = 9, - LuaOperator = 10, - LuaIdentifier = 11, - LuaStringeol = 12, - LuaWord2 = 13, - LuaWord3 = 14, - LuaWord4 = 15, - LuaWord5 = 16, - LuaWord6 = 17, - LuaWord7 = 18, - LuaWord8 = 19, - LuaLabel = 20, - }; - - enum ErrorList - { - ErrDefault = 0, - ErrPython = 1, - ErrGcc = 2, - ErrMs = 3, - ErrCmd = 4, - ErrBorland = 5, - ErrPerl = 6, - ErrNet = 7, - ErrLua = 8, - ErrCtag = 9, - ErrDiffChanged = 10, - ErrDiffAddition = 11, - ErrDiffDeletion = 12, - ErrDiffMessage = 13, - ErrPhp = 14, - ErrElf = 15, - ErrIfc = 16, - ErrIfort = 17, - ErrAbsf = 18, - ErrTidy = 19, - ErrJavaStack = 20, - ErrValue = 21, - ErrGccIncludedFrom = 22, - ErrEscseq = 23, - ErrEscseqUnknown = 24, - ErrGccExcerpt = 25, - ErrBash = 26, - ErrEsBlack = 40, - ErrEsRed = 41, - ErrEsGreen = 42, - ErrEsBrown = 43, - ErrEsBlue = 44, - ErrEsMagenta = 45, - ErrEsCyan = 46, - ErrEsGray = 47, - ErrEsDarkGray = 48, - ErrEsBrightRed = 49, - ErrEsBrightGreen = 50, - ErrEsYellow = 51, - ErrEsBrightBlue = 52, - ErrEsBrightMagenta = 53, - ErrEsBrightCyan = 54, - ErrEsWhite = 55, - }; - - enum Batch - { - BatDefault = 0, - BatComment = 1, - BatWord = 2, - BatLabel = 3, - BatHide = 4, - BatCommand = 5, - BatIdentifier = 6, - BatOperator = 7, - BatAfterLabel = 8, - }; - - enum TCMD - { - TcmdDefault = 0, - TcmdComment = 1, - TcmdWord = 2, - TcmdLabel = 3, - TcmdHide = 4, - TcmdCommand = 5, - TcmdIdentifier = 6, - TcmdOperator = 7, - TcmdEnvironment = 8, - TcmdExpansion = 9, - TcmdClabel = 10, - }; - - enum MakeFile - { - MakeDefault = 0, - MakeComment = 1, - MakePreprocessor = 2, - MakeIdentifier = 3, - MakeOperator = 4, - MakeTarget = 5, - MakeIdeol = 9, - }; - - enum Diff - { - DiffDefault = 0, - DiffComment = 1, - DiffCommand = 2, - DiffHeader = 3, - DiffPosition = 4, - DiffDeleted = 5, - DiffAdded = 6, - DiffChanged = 7, - DiffPatchAdd = 8, - DiffPatchDelete = 9, - DiffRemovedPatchAdd = 10, - DiffRemovedPatchDelete = 11, - }; - - enum Conf - { - ConfDefault = 0, - ConfComment = 1, - ConfNumber = 2, - ConfIdentifier = 3, - ConfExtension = 4, - ConfParameter = 5, - ConfString = 6, - ConfOperator = 7, - ConfIp = 8, - ConfDirective = 9, - }; - - enum Avenue - { - AveDefault = 0, - AveComment = 1, - AveNumber = 2, - AveWord = 3, - AveString = 6, - AveEnum = 7, - AveStringeol = 8, - AveIdentifier = 9, - AveOperator = 10, - AveWord1 = 11, - AveWord2 = 12, - AveWord3 = 13, - AveWord4 = 14, - AveWord5 = 15, - AveWord6 = 16, - }; - - enum Ada - { - AdaDefault = 0, - AdaWord = 1, - AdaIdentifier = 2, - AdaNumber = 3, - AdaDelimiter = 4, - AdaCharacter = 5, - AdaCharactereol = 6, - AdaString = 7, - AdaStringeol = 8, - AdaLabel = 9, - AdaCommentline = 10, - AdaIllegal = 11, - }; - - enum Baan - { - BaanDefault = 0, - BaanComment = 1, - BaanCommentdoc = 2, - BaanNumber = 3, - BaanWord = 4, - BaanString = 5, - BaanPreprocessor = 6, - BaanOperator = 7, - BaanIdentifier = 8, - BaanStringeol = 9, - BaanWord2 = 10, - BaanWord3 = 11, - BaanWord4 = 12, - BaanWord5 = 13, - BaanWord6 = 14, - BaanWord7 = 15, - BaanWord8 = 16, - BaanWord9 = 17, - BaanTabledef = 18, - BaanTablesql = 19, - BaanFunction = 20, - BaanDomdef = 21, - BaanFuncdef = 22, - BaanObjectdef = 23, - BaanDefinedef = 24, - }; - - enum Lisp - { - LispDefault = 0, - LispComment = 1, - LispNumber = 2, - LispKeyword = 3, - LispKeywordKw = 4, - LispSymbol = 5, - LispString = 6, - LispStringeol = 8, - LispIdentifier = 9, - LispOperator = 10, - LispSpecial = 11, - LispMultiComment = 12, - }; - - enum Eiffel - { - EiffelDefault = 0, - EiffelCommentline = 1, - EiffelNumber = 2, - EiffelWord = 3, - EiffelString = 4, - EiffelCharacter = 5, - EiffelOperator = 6, - EiffelIdentifier = 7, - EiffelStringeol = 8, - }; - - enum EiffelKW - { - EiffelDefault = 0, - EiffelCommentline = 1, - EiffelNumber = 2, - EiffelWord = 3, - EiffelString = 4, - EiffelCharacter = 5, - EiffelOperator = 6, - EiffelIdentifier = 7, - EiffelStringeol = 8, - }; - - enum NNCronTab - { - NncrontabDefault = 0, - NncrontabComment = 1, - NncrontabTask = 2, - NncrontabSection = 3, - NncrontabKeyword = 4, - NncrontabModifier = 5, - NncrontabAsterisk = 6, - NncrontabNumber = 7, - NncrontabString = 8, - NncrontabEnvironment = 9, - NncrontabIdentifier = 10, - }; - - enum Forth - { - ForthDefault = 0, - ForthComment = 1, - ForthCommentMl = 2, - ForthIdentifier = 3, - ForthControl = 4, - ForthKeyword = 5, - ForthDefword = 6, - ForthPreword1 = 7, - ForthPreword2 = 8, - ForthNumber = 9, - ForthString = 10, - ForthLocale = 11, - }; - - enum MatLab - { - MatlabDefault = 0, - MatlabComment = 1, - MatlabCommand = 2, - MatlabNumber = 3, - MatlabKeyword = 4, - MatlabString = 5, - MatlabOperator = 6, - MatlabIdentifier = 7, - MatlabDoublequotestring = 8, - }; - - enum Maxima - { - MaximaOperator = 0, - MaximaCommandending = 1, - MaximaComment = 2, - MaximaNumber = 3, - MaximaString = 4, - MaximaCommand = 5, - MaximaVariable = 6, - MaximaUnknown = 7, - }; - - enum Sol - { - ScriptolDefault = 0, - ScriptolWhite = 1, - ScriptolCommentline = 2, - ScriptolPersistent = 3, - ScriptolCstyle = 4, - ScriptolCommentblock = 5, - ScriptolNumber = 6, - ScriptolString = 7, - ScriptolCharacter = 8, - ScriptolStringeol = 9, - ScriptolKeyword = 10, - ScriptolOperator = 11, - ScriptolIdentifier = 12, - ScriptolTriple = 13, - ScriptolClassname = 14, - ScriptolPreprocessor = 15, - }; - - enum Asm - { - AsmDefault = 0, - AsmComment = 1, - AsmNumber = 2, - AsmString = 3, - AsmOperator = 4, - AsmIdentifier = 5, - AsmCpuinstruction = 6, - AsmMathinstruction = 7, - AsmRegister = 8, - AsmDirective = 9, - AsmDirectiveoperand = 10, - AsmCommentblock = 11, - AsmCharacter = 12, - AsmStringeol = 13, - AsmExtinstruction = 14, - AsmCommentdirective = 15, - }; - - enum As - { - AsmDefault = 0, - AsmComment = 1, - AsmNumber = 2, - AsmString = 3, - AsmOperator = 4, - AsmIdentifier = 5, - AsmCpuinstruction = 6, - AsmMathinstruction = 7, - AsmRegister = 8, - AsmDirective = 9, - AsmDirectiveoperand = 10, - AsmCommentblock = 11, - AsmCharacter = 12, - AsmStringeol = 13, - AsmExtinstruction = 14, - AsmCommentdirective = 15, - }; - - enum Fortran - { - FDefault = 0, - FComment = 1, - FNumber = 2, - FString1 = 3, - FString2 = 4, - FStringeol = 5, - FOperator = 6, - FIdentifier = 7, - FWord = 8, - FWord2 = 9, - FWord3 = 10, - FPreprocessor = 11, - FOperator2 = 12, - FLabel = 13, - FContinuation = 14, - }; - - enum F77 - { - FDefault = 0, - FComment = 1, - FNumber = 2, - FString1 = 3, - FString2 = 4, - FStringeol = 5, - FOperator = 6, - FIdentifier = 7, - FWord = 8, - FWord2 = 9, - FWord3 = 10, - FPreprocessor = 11, - FOperator2 = 12, - FLabel = 13, - FContinuation = 14, - }; - - enum CSS - { - CssDefault = 0, - CssTag = 1, - CssClass = 2, - CssPseudoclass = 3, - CssUnknownPseudoclass = 4, - CssOperator = 5, - CssIdentifier = 6, - CssUnknownIdentifier = 7, - CssValue = 8, - CssComment = 9, - CssId = 10, - CssImportant = 11, - CssDirective = 12, - CssDoublestring = 13, - CssSinglestring = 14, - CssIdentifier2 = 15, - CssAttribute = 16, - CssIdentifier3 = 17, - CssPseudoelement = 18, - CssExtendedIdentifier = 19, - CssExtendedPseudoclass = 20, - CssExtendedPseudoelement = 21, - CssGroupRule = 22, - CssVariable = 23, - }; - - enum POV - { - PovDefault = 0, - PovComment = 1, - PovCommentline = 2, - PovNumber = 3, - PovOperator = 4, - PovIdentifier = 5, - PovString = 6, - PovStringeol = 7, - PovDirective = 8, - PovBaddirective = 9, - PovWord2 = 10, - PovWord3 = 11, - PovWord4 = 12, - PovWord5 = 13, - PovWord6 = 14, - PovWord7 = 15, - PovWord8 = 16, - }; - - enum LOUT - { - LoutDefault = 0, - LoutComment = 1, - LoutNumber = 2, - LoutWord = 3, - LoutWord2 = 4, - LoutWord3 = 5, - LoutWord4 = 6, - LoutString = 7, - LoutOperator = 8, - LoutIdentifier = 9, - LoutStringeol = 10, - }; - - enum ESCRIPT - { - EscriptDefault = 0, - EscriptComment = 1, - EscriptCommentline = 2, - EscriptCommentdoc = 3, - EscriptNumber = 4, - EscriptWord = 5, - EscriptString = 6, - EscriptOperator = 7, - EscriptIdentifier = 8, - EscriptBrace = 9, - EscriptWord2 = 10, - EscriptWord3 = 11, - }; - - enum PS - { - PsDefault = 0, - PsComment = 1, - PsDscComment = 2, - PsDscValue = 3, - PsNumber = 4, - PsName = 5, - PsKeyword = 6, - PsLiteral = 7, - PsImmeval = 8, - PsParenArray = 9, - PsParenDict = 10, - PsParenProc = 11, - PsText = 12, - PsHexstring = 13, - PsBase85string = 14, - PsBadstringchar = 15, - }; - - enum NSIS - { - NsisDefault = 0, - NsisComment = 1, - NsisStringdq = 2, - NsisStringlq = 3, - NsisStringrq = 4, - NsisFunction = 5, - NsisVariable = 6, - NsisLabel = 7, - NsisUserdefined = 8, - NsisSectiondef = 9, - NsisSubsectiondef = 10, - NsisIfdefinedef = 11, - NsisMacrodef = 12, - NsisStringvar = 13, - NsisNumber = 14, - NsisSectiongroup = 15, - NsisPageex = 16, - NsisFunctiondef = 17, - NsisCommentbox = 18, - }; - - enum MMIXAL - { - MmixalLeadws = 0, - MmixalComment = 1, - MmixalLabel = 2, - MmixalOpcode = 3, - MmixalOpcodePre = 4, - MmixalOpcodeValid = 5, - MmixalOpcodeUnknown = 6, - MmixalOpcodePost = 7, - MmixalOperands = 8, - MmixalNumber = 9, - MmixalRef = 10, - MmixalChar = 11, - MmixalString = 12, - MmixalRegister = 13, - MmixalHex = 14, - MmixalOperator = 15, - MmixalSymbol = 16, - MmixalInclude = 17, - }; - - enum Clarion - { - ClwDefault = 0, - ClwLabel = 1, - ClwComment = 2, - ClwString = 3, - ClwUserIdentifier = 4, - ClwIntegerConstant = 5, - ClwRealConstant = 6, - ClwPictureString = 7, - ClwKeyword = 8, - ClwCompilerDirective = 9, - ClwRuntimeExpressions = 10, - ClwBuiltinProceduresFunction = 11, - ClwStructureDataType = 12, - ClwAttribute = 13, - ClwStandardEquate = 14, - ClwError = 15, - ClwDeprecated = 16, - }; - - enum LOT - { - LotDefault = 0, - LotHeader = 1, - LotBreak = 2, - LotSet = 3, - LotPass = 4, - LotFail = 5, - LotAbort = 6, - }; - - enum YAML - { - YamlDefault = 0, - YamlComment = 1, - YamlIdentifier = 2, - YamlKeyword = 3, - YamlNumber = 4, - YamlReference = 5, - YamlDocument = 6, - YamlText = 7, - YamlError = 8, - YamlOperator = 9, - }; - - enum TeX - { - TexDefault = 0, - TexSpecial = 1, - TexGroup = 2, - TexSymbol = 3, - TexCommand = 4, - TexText = 5, - }; - - enum Metapost - { - MetapostDefault = 0, - MetapostSpecial = 1, - MetapostGroup = 2, - MetapostSymbol = 3, - MetapostCommand = 4, - MetapostText = 5, - MetapostExtra = 6, - }; - - enum Erlang - { - ErlangDefault = 0, - ErlangComment = 1, - ErlangVariable = 2, - ErlangNumber = 3, - ErlangKeyword = 4, - ErlangString = 5, - ErlangOperator = 6, - ErlangAtom = 7, - ErlangFunctionName = 8, - ErlangCharacter = 9, - ErlangMacro = 10, - ErlangRecord = 11, - ErlangPreproc = 12, - ErlangNodeName = 13, - ErlangCommentFunction = 14, - ErlangCommentModule = 15, - ErlangCommentDoc = 16, - ErlangCommentDocMacro = 17, - ErlangAtomQuoted = 18, - ErlangMacroQuoted = 19, - ErlangRecordQuoted = 20, - ErlangNodeNameQuoted = 21, - ErlangBifs = 22, - ErlangModules = 23, - ErlangModulesAtt = 24, - ErlangUnknown = 31, - }; - - enum Octave - { - MatlabDefault = 0, - MatlabComment = 1, - MatlabCommand = 2, - MatlabNumber = 3, - MatlabKeyword = 4, - MatlabString = 5, - MatlabOperator = 6, - MatlabIdentifier = 7, - MatlabDoublequotestring = 8, - }; - - enum Julia - { - JuliaDefault = 0, - JuliaComment = 1, - JuliaNumber = 2, - JuliaKeyword1 = 3, - JuliaKeyword2 = 4, - JuliaKeyword3 = 5, - JuliaChar = 6, - JuliaOperator = 7, - JuliaBracket = 8, - JuliaIdentifier = 9, - JuliaString = 10, - JuliaSymbol = 11, - JuliaMacro = 12, - JuliaStringinterp = 13, - JuliaDocstring = 14, - JuliaStringliteral = 15, - JuliaCommand = 16, - JuliaCommandliteral = 17, - JuliaTypeannot = 18, - JuliaLexerror = 19, - JuliaKeyword4 = 20, - JuliaTypeoperator = 21, - }; - - enum MSSQL - { - MssqlDefault = 0, - MssqlComment = 1, - MssqlLineComment = 2, - MssqlNumber = 3, - MssqlString = 4, - MssqlOperator = 5, - MssqlIdentifier = 6, - MssqlVariable = 7, - MssqlColumnName = 8, - MssqlStatement = 9, - MssqlDatatype = 10, - MssqlSystable = 11, - MssqlGlobalVariable = 12, - MssqlFunction = 13, - MssqlStoredProcedure = 14, - MssqlDefaultPrefDatatype = 15, - MssqlColumnName2 = 16, - }; - - enum Verilog - { - VDefault = 0, - VComment = 1, - VCommentline = 2, - VCommentlinebang = 3, - VNumber = 4, - VWord = 5, - VString = 6, - VWord2 = 7, - VWord3 = 8, - VPreprocessor = 9, - VOperator = 10, - VIdentifier = 11, - VStringeol = 12, - VUser = 19, - VCommentWord = 20, - VInput = 21, - VOutput = 22, - VInout = 23, - VPortConnect = 24, - }; - - enum Kix - { - KixDefault = 0, - KixComment = 1, - KixString1 = 2, - KixString2 = 3, - KixNumber = 4, - KixVar = 5, - KixMacro = 6, - KixKeyword = 7, - KixFunctions = 8, - KixOperator = 9, - KixCommentstream = 10, - KixIdentifier = 31, - }; - - enum Gui4Cli - { - GcDefault = 0, - GcCommentline = 1, - GcCommentblock = 2, - GcGlobal = 3, - GcEvent = 4, - GcAttribute = 5, - GcControl = 6, - GcCommand = 7, - GcString = 8, - GcOperator = 9, - }; - - enum Specman - { - SnDefault = 0, - SnCode = 1, - SnCommentline = 2, - SnCommentlinebang = 3, - SnNumber = 4, - SnWord = 5, - SnString = 6, - SnWord2 = 7, - SnWord3 = 8, - SnPreprocessor = 9, - SnOperator = 10, - SnIdentifier = 11, - SnStringeol = 12, - SnRegextag = 13, - SnSignal = 14, - SnUser = 19, - }; - - enum Au3 - { - Au3Default = 0, - Au3Comment = 1, - Au3Commentblock = 2, - Au3Number = 3, - Au3Function = 4, - Au3Keyword = 5, - Au3Macro = 6, - Au3String = 7, - Au3Operator = 8, - Au3Variable = 9, - Au3Sent = 10, - Au3Preprocessor = 11, - Au3Special = 12, - Au3Expand = 13, - Au3Comobj = 14, - Au3Udf = 15, - }; - - enum APDL - { - ApdlDefault = 0, - ApdlComment = 1, - ApdlCommentblock = 2, - ApdlNumber = 3, - ApdlString = 4, - ApdlOperator = 5, - ApdlWord = 6, - ApdlProcessor = 7, - ApdlCommand = 8, - ApdlSlashcommand = 9, - ApdlStarcommand = 10, - ApdlArgument = 11, - ApdlFunction = 12, - }; - - enum Bash - { - ShDefault = 0, - ShError = 1, - ShCommentline = 2, - ShNumber = 3, - ShWord = 4, - ShString = 5, - ShCharacter = 6, - ShOperator = 7, - ShIdentifier = 8, - ShScalar = 9, - ShParam = 10, - ShBackticks = 11, - ShHereDelim = 12, - ShHereQ = 13, - }; - - enum Asn1 - { - Asn1Default = 0, - Asn1Comment = 1, - Asn1Identifier = 2, - Asn1String = 3, - Asn1Oid = 4, - Asn1Scalar = 5, - Asn1Keyword = 6, - Asn1Attribute = 7, - Asn1Descriptor = 8, - Asn1Type = 9, - Asn1Operator = 10, - }; - - enum VHDL - { - VhdlDefault = 0, - VhdlComment = 1, - VhdlCommentlinebang = 2, - VhdlNumber = 3, - VhdlString = 4, - VhdlOperator = 5, - VhdlIdentifier = 6, - VhdlStringeol = 7, - VhdlKeyword = 8, - VhdlStdoperator = 9, - VhdlAttribute = 10, - VhdlStdfunction = 11, - VhdlStdpackage = 12, - VhdlStdtype = 13, - VhdlUserword = 14, - VhdlBlockComment = 15, - }; - - enum Caml - { - CamlDefault = 0, - CamlIdentifier = 1, - CamlTagname = 2, - CamlKeyword = 3, - CamlKeyword2 = 4, - CamlKeyword3 = 5, - CamlLinenum = 6, - CamlOperator = 7, - CamlNumber = 8, - CamlChar = 9, - CamlWhite = 10, - CamlString = 11, - CamlComment = 12, - CamlComment1 = 13, - CamlComment2 = 14, - CamlComment3 = 15, - }; - - enum Haskell - { - HaDefault = 0, - HaIdentifier = 1, - HaKeyword = 2, - HaNumber = 3, - HaString = 4, - HaCharacter = 5, - HaClass = 6, - HaModule = 7, - HaCapital = 8, - HaData = 9, - HaImport = 10, - HaOperator = 11, - HaInstance = 12, - HaCommentline = 13, - HaCommentblock = 14, - HaCommentblock2 = 15, - HaCommentblock3 = 16, - HaPragma = 17, - HaPreprocessor = 18, - HaStringeol = 19, - HaReservedOperator = 20, - HaLiterateComment = 21, - HaLiterateCodedelim = 22, - }; - - enum TADS3 - { - T3Default = 0, - T3XDefault = 1, - T3Preprocessor = 2, - T3BlockComment = 3, - T3LineComment = 4, - T3Operator = 5, - T3Keyword = 6, - T3Number = 7, - T3Identifier = 8, - T3SString = 9, - T3DString = 10, - T3XString = 11, - T3LibDirective = 12, - T3MsgParam = 13, - T3HtmlTag = 14, - T3HtmlDefault = 15, - T3HtmlString = 16, - T3User1 = 17, - T3User2 = 18, - T3User3 = 19, - T3Brace = 20, - }; - - enum Rebol - { - RebolDefault = 0, - RebolCommentline = 1, - RebolCommentblock = 2, - RebolPreface = 3, - RebolOperator = 4, - RebolCharacter = 5, - RebolQuotedstring = 6, - RebolBracedstring = 7, - RebolNumber = 8, - RebolPair = 9, - RebolTuple = 10, - RebolBinary = 11, - RebolMoney = 12, - RebolIssue = 13, - RebolTag = 14, - RebolFile = 15, - RebolEmail = 16, - RebolUrl = 17, - RebolDate = 18, - RebolTime = 19, - RebolIdentifier = 20, - RebolWord = 21, - RebolWord2 = 22, - RebolWord3 = 23, - RebolWord4 = 24, - RebolWord5 = 25, - RebolWord6 = 26, - RebolWord7 = 27, - RebolWord8 = 28, - }; - - enum SQL - { - SqlDefault = 0, - SqlComment = 1, - SqlCommentline = 2, - SqlCommentdoc = 3, - SqlNumber = 4, - SqlWord = 5, - SqlString = 6, - SqlCharacter = 7, - SqlSqlplus = 8, - SqlSqlplusPrompt = 9, - SqlOperator = 10, - SqlIdentifier = 11, - SqlSqlplusComment = 13, - SqlCommentlinedoc = 15, - SqlWord2 = 16, - SqlCommentdockeyword = 17, - SqlCommentdockeyworderror = 18, - SqlUser1 = 19, - SqlUser2 = 20, - SqlUser3 = 21, - SqlUser4 = 22, - SqlQuotedidentifier = 23, - SqlQoperator = 24, - }; - - enum Smalltalk - { - StDefault = 0, - StString = 1, - StNumber = 2, - StComment = 3, - StSymbol = 4, - StBinary = 5, - StBool = 6, - StSelf = 7, - StSuper = 8, - StNil = 9, - StGlobal = 10, - StReturn = 11, - StSpecial = 12, - StKwsend = 13, - StAssign = 14, - StCharacter = 15, - StSpecSel = 16, - }; - - enum FlagShip - { - FsDefault = 0, - FsComment = 1, - FsCommentline = 2, - FsCommentdoc = 3, - FsCommentlinedoc = 4, - FsCommentdockeyword = 5, - FsCommentdockeyworderror = 6, - FsKeyword = 7, - FsKeyword2 = 8, - FsKeyword3 = 9, - FsKeyword4 = 10, - FsNumber = 11, - FsString = 12, - FsPreprocessor = 13, - FsOperator = 14, - FsIdentifier = 15, - FsDate = 16, - FsStringeol = 17, - FsConstant = 18, - FsWordoperator = 19, - FsDisabledcode = 20, - FsDefaultC = 21, - FsCommentdocC = 22, - FsCommentlinedocC = 23, - FsKeywordC = 24, - FsKeyword2C = 25, - FsNumberC = 26, - FsStringC = 27, - FsPreprocessorC = 28, - FsOperatorC = 29, - FsIdentifierC = 30, - FsStringeolC = 31, - }; - - enum Csound - { - CsoundDefault = 0, - CsoundComment = 1, - CsoundNumber = 2, - CsoundOperator = 3, - CsoundInstr = 4, - CsoundIdentifier = 5, - CsoundOpcode = 6, - CsoundHeaderstmt = 7, - CsoundUserkeyword = 8, - CsoundCommentblock = 9, - CsoundParam = 10, - CsoundArateVar = 11, - CsoundKrateVar = 12, - CsoundIrateVar = 13, - CsoundGlobalVar = 14, - CsoundStringeol = 15, - }; - - enum Inno - { - InnoDefault = 0, - InnoComment = 1, - InnoKeyword = 2, - InnoParameter = 3, - InnoSection = 4, - InnoPreproc = 5, - InnoInlineExpansion = 6, - InnoCommentPascal = 7, - InnoKeywordPascal = 8, - InnoKeywordUser = 9, - InnoStringDouble = 10, - InnoStringSingle = 11, - InnoIdentifier = 12, - }; - - enum Opal - { - OpalSpace = 0, - OpalCommentBlock = 1, - OpalCommentLine = 2, - OpalInteger = 3, - OpalKeyword = 4, - OpalSort = 5, - OpalString = 6, - OpalPar = 7, - OpalBoolConst = 8, - OpalDefault = 32, - }; - - enum Spice - { - SpiceDefault = 0, - SpiceIdentifier = 1, - SpiceKeyword = 2, - SpiceKeyword2 = 3, - SpiceKeyword3 = 4, - SpiceNumber = 5, - SpiceDelimiter = 6, - SpiceValue = 7, - SpiceCommentline = 8, - }; - - enum CMAKE - { - CmakeDefault = 0, - CmakeComment = 1, - CmakeStringdq = 2, - CmakeStringlq = 3, - CmakeStringrq = 4, - CmakeCommands = 5, - CmakeParameters = 6, - CmakeVariable = 7, - CmakeUserdefined = 8, - CmakeWhiledef = 9, - CmakeForeachdef = 10, - CmakeIfdefinedef = 11, - CmakeMacrodef = 12, - CmakeStringvar = 13, - CmakeNumber = 14, - }; - - enum Gap - { - GapDefault = 0, - GapIdentifier = 1, - GapKeyword = 2, - GapKeyword2 = 3, - GapKeyword3 = 4, - GapKeyword4 = 5, - GapString = 6, - GapChar = 7, - GapOperator = 8, - GapComment = 9, - GapNumber = 10, - GapStringeol = 11, - }; - - enum PLM - { - PlmDefault = 0, - PlmComment = 1, - PlmString = 2, - PlmNumber = 3, - PlmIdentifier = 4, - PlmOperator = 5, - PlmControl = 6, - PlmKeyword = 7, - }; - - enum Progress - { - AblDefault = 0, - AblNumber = 1, - AblWord = 2, - AblString = 3, - AblCharacter = 4, - AblPreprocessor = 5, - AblOperator = 6, - AblIdentifier = 7, - AblBlock = 8, - AblEnd = 9, - AblComment = 10, - AblTaskmarker = 11, - AblLinecomment = 12, - }; - - enum ABAQUS - { - AbaqusDefault = 0, - AbaqusComment = 1, - AbaqusCommentblock = 2, - AbaqusNumber = 3, - AbaqusString = 4, - AbaqusOperator = 5, - AbaqusWord = 6, - AbaqusProcessor = 7, - AbaqusCommand = 8, - AbaqusSlashcommand = 9, - AbaqusStarcommand = 10, - AbaqusArgument = 11, - AbaqusFunction = 12, - }; - - enum Asymptote - { - AsyDefault = 0, - AsyComment = 1, - AsyCommentline = 2, - AsyNumber = 3, - AsyWord = 4, - AsyString = 5, - AsyCharacter = 6, - AsyOperator = 7, - AsyIdentifier = 8, - AsyStringeol = 9, - AsyCommentlinedoc = 10, - AsyWord2 = 11, - }; - - enum R - { - RDefault = 0, - RComment = 1, - RKword = 2, - RBasekword = 3, - ROtherkword = 4, - RNumber = 5, - RString = 6, - RString2 = 7, - ROperator = 8, - RIdentifier = 9, - RInfix = 10, - RInfixeol = 11, - RBackticks = 12, - RRawstring = 13, - RRawstring2 = 14, - REscapesequence = 15, - }; - - enum MagikSF - { - MagikDefault = 0, - MagikComment = 1, - MagikHyperComment = 16, - MagikString = 2, - MagikCharacter = 3, - MagikNumber = 4, - MagikIdentifier = 5, - MagikOperator = 6, - MagikFlow = 7, - MagikContainer = 8, - MagikBracketBlock = 9, - MagikBraceBlock = 10, - MagikSqbracketBlock = 11, - MagikUnknownKeyword = 12, - MagikKeyword = 13, - MagikPragma = 14, - MagikSymbol = 15, - }; - - enum PowerShell - { - PowershellDefault = 0, - PowershellComment = 1, - PowershellString = 2, - PowershellCharacter = 3, - PowershellNumber = 4, - PowershellVariable = 5, - PowershellOperator = 6, - PowershellIdentifier = 7, - PowershellKeyword = 8, - PowershellCmdlet = 9, - PowershellAlias = 10, - PowershellFunction = 11, - PowershellUser1 = 12, - PowershellCommentstream = 13, - PowershellHereString = 14, - PowershellHereCharacter = 15, - PowershellCommentdockeyword = 16, - }; - - enum MySQL - { - MysqlDefault = 0, - MysqlComment = 1, - MysqlCommentline = 2, - MysqlVariable = 3, - MysqlSystemvariable = 4, - MysqlKnownsystemvariable = 5, - MysqlNumber = 6, - MysqlMajorkeyword = 7, - MysqlKeyword = 8, - MysqlDatabaseobject = 9, - MysqlProcedurekeyword = 10, - MysqlString = 11, - MysqlSqstring = 12, - MysqlDqstring = 13, - MysqlOperator = 14, - MysqlFunction = 15, - MysqlIdentifier = 16, - MysqlQuotedidentifier = 17, - MysqlUser1 = 18, - MysqlUser2 = 19, - MysqlUser3 = 20, - MysqlHiddencommand = 21, - MysqlPlaceholder = 22, - }; - - enum Po - { - PoDefault = 0, - PoComment = 1, - PoMsgid = 2, - PoMsgidText = 3, - PoMsgstr = 4, - PoMsgstrText = 5, - PoMsgctxt = 6, - PoMsgctxtText = 7, - PoFuzzy = 8, - PoProgrammerComment = 9, - PoReference = 10, - PoFlags = 11, - PoMsgidTextEol = 12, - PoMsgstrTextEol = 13, - PoMsgctxtTextEol = 14, - PoError = 15, - }; - - enum Pascal - { - PasDefault = 0, - PasIdentifier = 1, - PasComment = 2, - PasComment2 = 3, - PasCommentline = 4, - PasPreprocessor = 5, - PasPreprocessor2 = 6, - PasNumber = 7, - PasHexnumber = 8, - PasWord = 9, - PasString = 10, - PasStringeol = 11, - PasCharacter = 12, - PasOperator = 13, - PasAsm = 14, - }; - - enum SORCUS - { - SorcusDefault = 0, - SorcusCommand = 1, - SorcusParameter = 2, - SorcusCommentline = 3, - SorcusString = 4, - SorcusStringeol = 5, - SorcusIdentifier = 6, - SorcusOperator = 7, - SorcusNumber = 8, - SorcusConstant = 9, - }; - - enum PowerPro - { - PowerproDefault = 0, - PowerproCommentblock = 1, - PowerproCommentline = 2, - PowerproNumber = 3, - PowerproWord = 4, - PowerproWord2 = 5, - PowerproWord3 = 6, - PowerproWord4 = 7, - PowerproDoublequotedstring = 8, - PowerproSinglequotedstring = 9, - PowerproLinecontinue = 10, - PowerproOperator = 11, - PowerproIdentifier = 12, - PowerproStringeol = 13, - PowerproVerbatim = 14, - PowerproAltquote = 15, - PowerproFunction = 16, - }; - - enum SML - { - SmlDefault = 0, - SmlIdentifier = 1, - SmlTagname = 2, - SmlKeyword = 3, - SmlKeyword2 = 4, - SmlKeyword3 = 5, - SmlLinenum = 6, - SmlOperator = 7, - SmlNumber = 8, - SmlChar = 9, - SmlString = 11, - SmlComment = 12, - SmlComment1 = 13, - SmlComment2 = 14, - SmlComment3 = 15, - }; - - enum Markdown - { - MarkdownDefault = 0, - MarkdownLineBegin = 1, - MarkdownStrong1 = 2, - MarkdownStrong2 = 3, - MarkdownEm1 = 4, - MarkdownEm2 = 5, - MarkdownHeader1 = 6, - MarkdownHeader2 = 7, - MarkdownHeader3 = 8, - MarkdownHeader4 = 9, - MarkdownHeader5 = 10, - MarkdownHeader6 = 11, - MarkdownPrechar = 12, - MarkdownUlistItem = 13, - MarkdownOlistItem = 14, - MarkdownBlockquote = 15, - MarkdownStrikeout = 16, - MarkdownHrule = 17, - MarkdownLink = 18, - MarkdownCode = 19, - MarkdownCode2 = 20, - MarkdownCodebk = 21, - }; - - enum Txt2tags - { - Txt2tagsDefault = 0, - Txt2tagsLineBegin = 1, - Txt2tagsStrong1 = 2, - Txt2tagsStrong2 = 3, - Txt2tagsEm1 = 4, - Txt2tagsEm2 = 5, - Txt2tagsHeader1 = 6, - Txt2tagsHeader2 = 7, - Txt2tagsHeader3 = 8, - Txt2tagsHeader4 = 9, - Txt2tagsHeader5 = 10, - Txt2tagsHeader6 = 11, - Txt2tagsPrechar = 12, - Txt2tagsUlistItem = 13, - Txt2tagsOlistItem = 14, - Txt2tagsBlockquote = 15, - Txt2tagsStrikeout = 16, - Txt2tagsHrule = 17, - Txt2tagsLink = 18, - Txt2tagsCode = 19, - Txt2tagsCode2 = 20, - Txt2tagsCodebk = 21, - Txt2tagsComment = 22, - Txt2tagsOption = 23, - Txt2tagsPreproc = 24, - Txt2tagsPostproc = 25, - }; - - enum A68k - { - A68kDefault = 0, - A68kComment = 1, - A68kNumberDec = 2, - A68kNumberBin = 3, - A68kNumberHex = 4, - A68kString1 = 5, - A68kOperator = 6, - A68kCpuinstruction = 7, - A68kExtinstruction = 8, - A68kRegister = 9, - A68kDirective = 10, - A68kMacroArg = 11, - A68kLabel = 12, - A68kString2 = 13, - A68kIdentifier = 14, - A68kMacroDeclaration = 15, - A68kCommentWord = 16, - A68kCommentSpecial = 17, - A68kCommentDoxygen = 18, - }; - - enum Modula - { - ModulaDefault = 0, - ModulaComment = 1, - ModulaDoxycomm = 2, - ModulaDoxykey = 3, - ModulaKeyword = 4, - ModulaReserved = 5, - ModulaNumber = 6, - ModulaBasenum = 7, - ModulaFloat = 8, - ModulaString = 9, - ModulaStrspec = 10, - ModulaChar = 11, - ModulaCharspec = 12, - ModulaProc = 13, - ModulaPragma = 14, - ModulaPrgkey = 15, - ModulaOperator = 16, - ModulaBadstr = 17, - }; - - enum CoffeeScript - { - CoffeescriptDefault = 0, - CoffeescriptComment = 1, - CoffeescriptCommentline = 2, - CoffeescriptCommentdoc = 3, - CoffeescriptNumber = 4, - CoffeescriptWord = 5, - CoffeescriptString = 6, - CoffeescriptCharacter = 7, - CoffeescriptUuid = 8, - CoffeescriptPreprocessor = 9, - CoffeescriptOperator = 10, - CoffeescriptIdentifier = 11, - CoffeescriptStringeol = 12, - CoffeescriptVerbatim = 13, - CoffeescriptRegex = 14, - CoffeescriptCommentlinedoc = 15, - CoffeescriptWord2 = 16, - CoffeescriptCommentdockeyword = 17, - CoffeescriptCommentdockeyworderror = 18, - CoffeescriptGlobalclass = 19, - CoffeescriptStringraw = 20, - CoffeescriptTripleverbatim = 21, - CoffeescriptCommentblock = 22, - CoffeescriptVerboseRegex = 23, - CoffeescriptVerboseRegexComment = 24, - CoffeescriptInstanceproperty = 25, - }; - - enum AVS - { - AvsDefault = 0, - AvsCommentblock = 1, - AvsCommentblockn = 2, - AvsCommentline = 3, - AvsNumber = 4, - AvsOperator = 5, - AvsIdentifier = 6, - AvsString = 7, - AvsTriplestring = 8, - AvsKeyword = 9, - AvsFilter = 10, - AvsPlugin = 11, - AvsFunction = 12, - AvsClipprop = 13, - AvsUserdfn = 14, - }; - - enum ECL - { - EclDefault = 0, - EclComment = 1, - EclCommentline = 2, - EclNumber = 3, - EclString = 4, - EclWord0 = 5, - EclOperator = 6, - EclCharacter = 7, - EclUuid = 8, - EclPreprocessor = 9, - EclUnknown = 10, - EclIdentifier = 11, - EclStringeol = 12, - EclVerbatim = 13, - EclRegex = 14, - EclCommentlinedoc = 15, - EclWord1 = 16, - EclCommentdockeyword = 17, - EclCommentdockeyworderror = 18, - EclWord2 = 19, - EclWord3 = 20, - EclWord4 = 21, - EclWord5 = 22, - EclCommentdoc = 23, - EclAdded = 24, - EclDeleted = 25, - EclChanged = 26, - EclMoved = 27, - }; - - enum OScript - { - OscriptDefault = 0, - OscriptLineComment = 1, - OscriptBlockComment = 2, - OscriptDocComment = 3, - OscriptPreprocessor = 4, - OscriptNumber = 5, - OscriptSinglequoteString = 6, - OscriptDoublequoteString = 7, - OscriptConstant = 8, - OscriptIdentifier = 9, - OscriptGlobal = 10, - OscriptKeyword = 11, - OscriptOperator = 12, - OscriptLabel = 13, - OscriptType = 14, - OscriptFunction = 15, - OscriptObject = 16, - OscriptProperty = 17, - OscriptMethod = 18, - }; - - enum VisualProlog - { - VisualprologDefault = 0, - VisualprologKeyMajor = 1, - VisualprologKeyMinor = 2, - VisualprologKeyDirective = 3, - VisualprologCommentBlock = 4, - VisualprologCommentLine = 5, - VisualprologCommentKey = 6, - VisualprologCommentKeyError = 7, - VisualprologIdentifier = 8, - VisualprologVariable = 9, - VisualprologAnonymous = 10, - VisualprologNumber = 11, - VisualprologOperator = 12, - VisualprologUnused1 = 13, - VisualprologUnused2 = 14, - VisualprologUnused3 = 15, - VisualprologStringQuote = 16, - VisualprologStringEscape = 17, - VisualprologStringEscapeError = 18, - VisualprologUnused4 = 19, - VisualprologString = 20, - VisualprologUnused5 = 21, - VisualprologStringEol = 22, - VisualprologEmbedded = 23, - VisualprologPlaceholder = 24, - }; - - enum StructuredText - { - SttxtDefault = 0, - SttxtComment = 1, - SttxtCommentline = 2, - SttxtKeyword = 3, - SttxtType = 4, - SttxtFunction = 5, - SttxtFb = 6, - SttxtNumber = 7, - SttxtHexnumber = 8, - SttxtPragma = 9, - SttxtOperator = 10, - SttxtCharacter = 11, - SttxtString1 = 12, - SttxtString2 = 13, - SttxtStringeol = 14, - SttxtIdentifier = 15, - SttxtDatetime = 16, - SttxtVars = 17, - SttxtPragmas = 18, - }; - - enum KVIrc - { - KvircDefault = 0, - KvircComment = 1, - KvircCommentblock = 2, - KvircString = 3, - KvircWord = 4, - KvircKeyword = 5, - KvircFunctionKeyword = 6, - KvircFunction = 7, - KvircVariable = 8, - KvircNumber = 9, - KvircOperator = 10, - KvircStringFunction = 11, - KvircStringVariable = 12, - }; - - enum Rust - { - RustDefault = 0, - RustCommentblock = 1, - RustCommentline = 2, - RustCommentblockdoc = 3, - RustCommentlinedoc = 4, - RustNumber = 5, - RustWord = 6, - RustWord2 = 7, - RustWord3 = 8, - RustWord4 = 9, - RustWord5 = 10, - RustWord6 = 11, - RustWord7 = 12, - RustString = 13, - RustStringr = 14, - RustCharacter = 15, - RustOperator = 16, - RustIdentifier = 17, - RustLifetime = 18, - RustMacro = 19, - RustLexerror = 20, - RustBytestring = 21, - RustBytestringr = 22, - RustBytecharacter = 23, - }; - - enum DMAP - { - DmapDefault = 0, - DmapComment = 1, - DmapNumber = 2, - DmapString1 = 3, - DmapString2 = 4, - DmapStringeol = 5, - DmapOperator = 6, - DmapIdentifier = 7, - DmapWord = 8, - DmapWord2 = 9, - DmapWord3 = 10, - }; - - enum DMIS - { - DmisDefault = 0, - DmisComment = 1, - DmisString = 2, - DmisNumber = 3, - DmisKeyword = 4, - DmisMajorword = 5, - DmisMinorword = 6, - DmisUnsupportedMajor = 7, - DmisUnsupportedMinor = 8, - DmisLabel = 9, - }; - - enum REG - { - RegDefault = 0, - RegComment = 1, - RegValuename = 2, - RegString = 3, - RegHexdigit = 4, - RegValuetype = 5, - RegAddedkey = 6, - RegDeletedkey = 7, - RegEscaped = 8, - RegKeypathGuid = 9, - RegStringGuid = 10, - RegParameter = 11, - RegOperator = 12, - }; - - enum BibTeX - { - BibtexDefault = 0, - BibtexEntry = 1, - BibtexUnknownEntry = 2, - BibtexKey = 3, - BibtexParameter = 4, - BibtexValue = 5, - BibtexComment = 6, - }; - - enum Srec - { - HexDefault = 0, - HexRecstart = 1, - HexRectype = 2, - HexRectypeUnknown = 3, - HexBytecount = 4, - HexBytecountWrong = 5, - HexNoaddress = 6, - HexDataaddress = 7, - HexReccount = 8, - HexStartaddress = 9, - HexAddressfieldUnknown = 10, - HexExtendedaddress = 11, - HexDataOdd = 12, - HexDataEven = 13, - HexDataUnknown = 14, - HexDataEmpty = 15, - HexChecksum = 16, - HexChecksumWrong = 17, - HexGarbage = 18, - }; - - enum IHex - { - HexDefault = 0, - HexRecstart = 1, - HexRectype = 2, - HexRectypeUnknown = 3, - HexBytecount = 4, - HexBytecountWrong = 5, - HexNoaddress = 6, - HexDataaddress = 7, - HexReccount = 8, - HexStartaddress = 9, - HexAddressfieldUnknown = 10, - HexExtendedaddress = 11, - HexDataOdd = 12, - HexDataEven = 13, - HexDataUnknown = 14, - HexDataEmpty = 15, - HexChecksum = 16, - HexChecksumWrong = 17, - HexGarbage = 18, - }; - - enum TEHex - { - HexDefault = 0, - HexRecstart = 1, - HexRectype = 2, - HexRectypeUnknown = 3, - HexBytecount = 4, - HexBytecountWrong = 5, - HexNoaddress = 6, - HexDataaddress = 7, - HexReccount = 8, - HexStartaddress = 9, - HexAddressfieldUnknown = 10, - HexExtendedaddress = 11, - HexDataOdd = 12, - HexDataEven = 13, - HexDataUnknown = 14, - HexDataEmpty = 15, - HexChecksum = 16, - HexChecksumWrong = 17, - HexGarbage = 18, - }; - - enum JSON - { - JsonDefault = 0, - JsonNumber = 1, - JsonString = 2, - JsonStringeol = 3, - JsonPropertyname = 4, - JsonEscapesequence = 5, - JsonLinecomment = 6, - JsonBlockcomment = 7, - JsonOperator = 8, - JsonUri = 9, - JsonCompactiri = 10, - JsonKeyword = 11, - JsonLdkeyword = 12, - JsonError = 13, - }; - - enum EDIFACT - { - EdiDefault = 0, - EdiSegmentstart = 1, - EdiSegmentend = 2, - EdiSepElement = 3, - EdiSepComposite = 4, - EdiSepRelease = 5, - EdiUna = 6, - EdiUnh = 7, - EdiBadsegment = 8, - }; - - enum STATA - { - StataDefault = 0, - StataComment = 1, - StataCommentline = 2, - StataCommentblock = 3, - StataNumber = 4, - StataOperator = 5, - StataIdentifier = 6, - StataString = 7, - StataType = 8, - StataWord = 9, - StataGlobalMacro = 10, - StataMacro = 11, - }; - - enum SAS - { - SasDefault = 0, - SasComment = 1, - SasCommentline = 2, - SasCommentblock = 3, - SasNumber = 4, - SasOperator = 5, - SasIdentifier = 6, - SasString = 7, - SasType = 8, - SasWord = 9, - SasGlobalMacro = 10, - SasMacro = 11, - SasMacroKeyword = 12, - SasBlockKeyword = 13, - SasMacroFunction = 14, - SasStatement = 15, - }; - - enum Nim - { - NimDefault = 0, - NimComment = 1, - NimCommentdoc = 2, - NimCommentline = 3, - NimCommentlinedoc = 4, - NimNumber = 5, - NimString = 6, - NimCharacter = 7, - NimWord = 8, - NimTriple = 9, - NimTripledouble = 10, - NimBackticks = 11, - NimFuncname = 12, - NimStringeol = 13, - NimNumerror = 14, - NimOperator = 15, - NimIdentifier = 16, - }; - - enum CIL - { - CilDefault = 0, - CilComment = 1, - CilCommentline = 2, - CilWord = 3, - CilWord2 = 4, - CilWord3 = 5, - CilString = 6, - CilLabel = 7, - CilOperator = 8, - CilIdentifier = 9, - CilStringeol = 10, - }; - - enum X12 - { - X12Default = 0, - X12Bad = 1, - X12Envelope = 2, - X12Functiongroup = 3, - X12Transactionset = 4, - X12Segmentheader = 5, - X12Segmentend = 6, - X12SepElement = 7, - X12SepSubelement = 8, - }; - - enum Dataflex - { - DfDefault = 0, - DfIdentifier = 1, - DfMetatag = 2, - DfImage = 3, - DfCommentline = 4, - DfPreprocessor = 5, - DfPreprocessor2 = 6, - DfNumber = 7, - DfHexnumber = 8, - DfWord = 9, - DfString = 10, - DfStringeol = 11, - DfScopeword = 12, - DfOperator = 13, - DfIcode = 14, - }; - - enum Hollywood - { - HollywoodDefault = 0, - HollywoodComment = 1, - HollywoodCommentblock = 2, - HollywoodNumber = 3, - HollywoodKeyword = 4, - HollywoodStdapi = 5, - HollywoodPluginapi = 6, - HollywoodPluginmethod = 7, - HollywoodString = 8, - HollywoodStringblock = 9, - HollywoodPreprocessor = 10, - HollywoodOperator = 11, - HollywoodIdentifier = 12, - HollywoodConstant = 13, - HollywoodHexnumber = 14, - }; - - enum Raku - { - RakuDefault = 0, - RakuError = 1, - RakuCommentline = 2, - RakuCommentembed = 3, - RakuPod = 4, - RakuCharacter = 5, - RakuHeredocQ = 6, - RakuHeredocQq = 7, - RakuString = 8, - RakuStringQ = 9, - RakuStringQq = 10, - RakuStringQLang = 11, - RakuStringVar = 12, - RakuRegex = 13, - RakuRegexVar = 14, - RakuAdverb = 15, - RakuNumber = 16, - RakuPreprocessor = 17, - RakuOperator = 18, - RakuWord = 19, - RakuFunction = 20, - RakuIdentifier = 21, - RakuTypedef = 22, - RakuMu = 23, - RakuPositional = 24, - RakuAssociative = 25, - RakuCallable = 26, - RakuGrammar = 27, - RakuClass = 28, - }; - - enum FSharp - { - FsharpDefault = 0, - FsharpKeyword = 1, - FsharpKeyword2 = 2, - FsharpKeyword3 = 3, - FsharpKeyword4 = 4, - FsharpKeyword5 = 5, - FsharpIdentifier = 6, - FsharpQuotIdentifier = 7, - FsharpComment = 8, - FsharpCommentline = 9, - FsharpPreprocessor = 10, - FsharpLinenum = 11, - FsharpOperator = 12, - FsharpNumber = 13, - FsharpCharacter = 14, - FsharpString = 15, - FsharpVerbatim = 16, - FsharpQuotation = 17, - FsharpAttribute = 18, - FsharpFormatSpec = 19, - }; - - enum Asciidoc - { - AsciidocDefault = 0, - AsciidocStrong1 = 1, - AsciidocStrong2 = 2, - AsciidocEm1 = 3, - AsciidocEm2 = 4, - AsciidocHeader1 = 5, - AsciidocHeader2 = 6, - AsciidocHeader3 = 7, - AsciidocHeader4 = 8, - AsciidocHeader5 = 9, - AsciidocHeader6 = 10, - AsciidocUlistItem = 11, - AsciidocOlistItem = 12, - AsciidocBlockquote = 13, - AsciidocLink = 14, - AsciidocCodebk = 15, - AsciidocPassbk = 16, - AsciidocComment = 17, - AsciidocCommentbk = 18, - AsciidocLiteral = 19, - AsciidocLiteralbk = 20, - AsciidocAttrib = 21, - AsciidocAttribval = 22, - AsciidocMacro = 23, - }; - - enum GDScript - { - GdDefault = 0, - GdCommentline = 1, - GdNumber = 2, - GdString = 3, - GdCharacter = 4, - GdWord = 5, - GdTriple = 6, - GdTripledouble = 7, - GdClassname = 8, - GdFuncname = 9, - GdOperator = 10, - GdIdentifier = 11, - GdCommentblock = 12, - GdStringeol = 13, - GdWord2 = 14, - GdAnnotation = 15, - GdNodepath = 16, - }; - - [default_interface] - runtimeclass StyleNeededEventArgs - { - Int32 Position { get; }; - } - - [default_interface] - runtimeclass CharAddedEventArgs - { - Int32 Ch { get; }; - Int32 CharacterSource { get; }; - } - - [default_interface] - runtimeclass SavePointReachedEventArgs - { - } - - [default_interface] - runtimeclass SavePointLeftEventArgs - { - } - - [default_interface] - runtimeclass ModifyAttemptROEventArgs - { - } - - [default_interface] - runtimeclass KeyEventArgs - { - Int32 Ch { get; }; - Int32 Modifiers { get; }; - } - - [default_interface] - runtimeclass DoubleClickEventArgs - { - Int32 Modifiers { get; }; - Int32 Position { get; }; - Int32 Line { get; }; - } - - [default_interface] - runtimeclass UpdateUIEventArgs - { - Int32 Updated { get; }; - } - - [default_interface] - runtimeclass ModifiedEventArgs - { - Int32 Position { get; }; - Int32 ModificationType { get; }; - Windows.Storage.Streams.IBuffer TextAsBuffer { get; }; - String Text { get; }; - Int32 Length { get; }; - Int32 LinesAdded { get; }; - Int32 Line { get; }; - Int32 FoldLevelNow { get; }; - Int32 FoldLevelPrev { get; }; - Int32 Token { get; }; - Int32 AnnotationLinesAdded { get; }; - } - - [default_interface] - runtimeclass MacroRecordEventArgs - { - Int32 Message { get; }; - Int32 WParam { get; }; - Int32 LParam { get; }; - } - - [default_interface] - runtimeclass MarginClickEventArgs - { - Int32 Modifiers { get; }; - Int32 Position { get; }; - Int32 Margin { get; }; - } - - [default_interface] - runtimeclass NeedShownEventArgs - { - Int32 Position { get; }; - Int32 Length { get; }; - } - - [default_interface] - runtimeclass PaintedEventArgs - { - } - - [default_interface] - runtimeclass UserListSelectionEventArgs - { - Int32 ListType { get; }; - Windows.Storage.Streams.IBuffer TextAsBuffer { get; }; - String Text { get; }; - Int32 Position { get; }; - Int32 Ch { get; }; - CompletionMethods ListCompletionMethod { get; }; - } - - [default_interface] - runtimeclass URIDroppedEventArgs - { - Windows.Storage.Streams.IBuffer TextAsBuffer { get; }; - String Text { get; }; - } - - [default_interface] - runtimeclass DwellStartEventArgs - { - Int32 Position { get; }; - Int32 X { get; }; - Int32 Y { get; }; - } - - [default_interface] - runtimeclass DwellEndEventArgs - { - Int32 Position { get; }; - Int32 X { get; }; - Int32 Y { get; }; - } - - [default_interface] - runtimeclass ZoomChangedEventArgs - { - } - - [default_interface] - runtimeclass HotSpotClickEventArgs - { - Int32 Modifiers { get; }; - Int32 Position { get; }; - } - - [default_interface] - runtimeclass HotSpotDoubleClickEventArgs - { - Int32 Modifiers { get; }; - Int32 Position { get; }; - } - - [default_interface] - runtimeclass CallTipClickEventArgs - { - Int32 Position { get; }; - } - - [default_interface] - runtimeclass AutoCSelectionEventArgs - { - Windows.Storage.Streams.IBuffer TextAsBuffer { get; }; - String Text { get; }; - Int32 Position { get; }; - Int32 Ch { get; }; - CompletionMethods ListCompletionMethod { get; }; - } - - [default_interface] - runtimeclass IndicatorClickEventArgs - { - Int32 Modifiers { get; }; - Int32 Position { get; }; - } - - [default_interface] - runtimeclass IndicatorReleaseEventArgs - { - Int32 Modifiers { get; }; - Int32 Position { get; }; - } - - [default_interface] - runtimeclass AutoCCancelledEventArgs - { - } - - [default_interface] - runtimeclass AutoCCharDeletedEventArgs - { - } - - [default_interface] - runtimeclass HotSpotReleaseClickEventArgs - { - Int32 Modifiers { get; }; - Int32 Position { get; }; - } - - [default_interface] - runtimeclass FocusInEventArgs - { - } - - [default_interface] - runtimeclass FocusOutEventArgs - { - } - - [default_interface] - runtimeclass AutoCCompletedEventArgs - { - Windows.Storage.Streams.IBuffer TextAsBuffer { get; }; - String Text { get; }; - Int32 Position { get; }; - Int32 Ch { get; }; - CompletionMethods ListCompletionMethod { get; }; - } - - [default_interface] - runtimeclass MarginRightClickEventArgs - { - Int32 Modifiers { get; }; - Int32 Position { get; }; - Int32 Margin { get; }; - } - - [default_interface] - runtimeclass AutoCSelectionChangeEventArgs - { - Int32 ListType { get; }; - Windows.Storage.Streams.IBuffer TextAsBuffer { get; }; - String Text { get; }; - Int32 Position { get; }; - } - - delegate void StyleNeededHandler(Editor sender, StyleNeededEventArgs args); - delegate void CharAddedHandler(Editor sender, CharAddedEventArgs args); - delegate void SavePointReachedHandler(Editor sender, SavePointReachedEventArgs args); - delegate void SavePointLeftHandler(Editor sender, SavePointLeftEventArgs args); - delegate void ModifyAttemptROHandler(Editor sender, ModifyAttemptROEventArgs args); - delegate void KeyHandler(Editor sender, KeyEventArgs args); - delegate void DoubleClickHandler(Editor sender, DoubleClickEventArgs args); - delegate void UpdateUIHandler(Editor sender, UpdateUIEventArgs args); - delegate void ModifiedHandler(Editor sender, ModifiedEventArgs args); - delegate void MacroRecordHandler(Editor sender, MacroRecordEventArgs args); - delegate void MarginClickHandler(Editor sender, MarginClickEventArgs args); - delegate void NeedShownHandler(Editor sender, NeedShownEventArgs args); - delegate void PaintedHandler(Editor sender, PaintedEventArgs args); - delegate void UserListSelectionHandler(Editor sender, UserListSelectionEventArgs args); - delegate void URIDroppedHandler(Editor sender, URIDroppedEventArgs args); - delegate void DwellStartHandler(Editor sender, DwellStartEventArgs args); - delegate void DwellEndHandler(Editor sender, DwellEndEventArgs args); - delegate void ZoomChangedHandler(Editor sender, ZoomChangedEventArgs args); - delegate void HotSpotClickHandler(Editor sender, HotSpotClickEventArgs args); - delegate void HotSpotDoubleClickHandler(Editor sender, HotSpotDoubleClickEventArgs args); - delegate void CallTipClickHandler(Editor sender, CallTipClickEventArgs args); - delegate void AutoCSelectionHandler(Editor sender, AutoCSelectionEventArgs args); - delegate void IndicatorClickHandler(Editor sender, IndicatorClickEventArgs args); - delegate void IndicatorReleaseHandler(Editor sender, IndicatorReleaseEventArgs args); - delegate void AutoCCancelledHandler(Editor sender, AutoCCancelledEventArgs args); - delegate void AutoCCharDeletedHandler(Editor sender, AutoCCharDeletedEventArgs args); - delegate void HotSpotReleaseClickHandler(Editor sender, HotSpotReleaseClickEventArgs args); - delegate void FocusInHandler(Editor sender, FocusInEventArgs args); - delegate void FocusOutHandler(Editor sender, FocusOutEventArgs args); - delegate void AutoCCompletedHandler(Editor sender, AutoCCompletedEventArgs args); - delegate void MarginRightClickHandler(Editor sender, MarginRightClickEventArgs args); - delegate void AutoCSelectionChangeHandler(Editor sender, AutoCSelectionChangeEventArgs args); - - [default_interface] - runtimeclass Editor - { - event StyleNeededHandler StyleNeeded; - event CharAddedHandler CharAdded; - event SavePointReachedHandler SavePointReached; - event SavePointLeftHandler SavePointLeft; - event ModifyAttemptROHandler ModifyAttemptRO; - event KeyHandler Key; - event DoubleClickHandler DoubleClick; - event UpdateUIHandler UpdateUI; - event ModifiedHandler Modified; - event MacroRecordHandler MacroRecord; - event MarginClickHandler MarginClick; - event NeedShownHandler NeedShown; - event PaintedHandler Painted; - event UserListSelectionHandler UserListSelection; - event URIDroppedHandler URIDropped; - event DwellStartHandler DwellStart; - event DwellEndHandler DwellEnd; - event ZoomChangedHandler ZoomChanged; - event HotSpotClickHandler HotSpotClick; - event HotSpotDoubleClickHandler HotSpotDoubleClick; - event CallTipClickHandler CallTipClick; - event AutoCSelectionHandler AutoCSelection; - event IndicatorClickHandler IndicatorClick; - event IndicatorReleaseHandler IndicatorRelease; - event AutoCCancelledHandler AutoCCancelled; - event AutoCCharDeletedHandler AutoCCharDeleted; - event HotSpotReleaseClickHandler HotSpotReleaseClick; - event FocusInHandler FocusIn; - event FocusOutHandler FocusOut; - event AutoCCompletedHandler AutoCCompleted; - event MarginRightClickHandler MarginRightClick; - event AutoCSelectionChangeHandler AutoCSelectionChange; - - /** - * Returns the number of bytes in the document. - */ - Int64 Length { get; }; - - /** - * Returns the position of the caret. - * Sets the position of the caret. - */ - Int64 CurrentPos { get; set; }; - - /** - * Returns the position of the opposite end of the selection to the caret. - * Set the selection anchor to a position. The anchor is the opposite - * end of the selection from the caret. - */ - Int64 Anchor { get; set; }; - - /** - * Is undo history being collected? - * Choose between collecting actions into the undo - * history and discarding them. - */ - Boolean UndoCollection { get; set; }; - - /** - * Are white space characters currently visible? - * Returns one of SCWS_* constants. - * Make white space characters invisible, always visible or visible outside indentation. - */ - WhiteSpace ViewWS { get; set; }; - - /** - * Retrieve the current tab draw mode. - * Returns one of SCTD_* constants. - * Set how tabs are drawn when visible. - */ - TabDrawMode TabDrawMode { get; set; }; - - /** - * Retrieve the position of the last correctly styled character. - */ - Int64 EndStyled { get; }; - - /** - * Retrieve the current end of line mode - one of CRLF, CR, or LF. - * Set the current end of line mode. - */ - EndOfLine EOLMode { get; set; }; - - /** - * Is drawing done first into a buffer or direct to the screen? - * If drawing is buffered then each line of text is drawn into a bitmap buffer - * before drawing it to the screen to avoid flicker. - */ - Boolean BufferedDraw { get; set; }; - - /** - * Retrieve the visible size of a tab. - * Change the visible size of a tab to be a multiple of the width of a space character. - */ - Int32 TabWidth { get; set; }; - - /** - * Get the minimum visual width of a tab. - * Set the minimum visual width of a tab. - */ - Int32 TabMinimumWidth { get; set; }; - - /** - * Is the IME displayed in a window or inline? - * Choose to display the IME in a window or inline. - */ - IMEInteraction IMEInteraction { get; set; }; - - /** - * How many margins are there?. - * Allocate a non-standard number of margins. - */ - Int32 Margins { get; set; }; - - /** - * Get the alpha of the selection. - * Set the alpha of the selection. - */ - Alpha SelAlpha { get; set; }; - - /** - * Is the selection end of line filled? - * Set the selection to have its end of line filled or not. - */ - Boolean SelEOLFilled { get; set; }; - - /** - * Get the layer for drawing selections - * Set the layer for drawing selections: either opaquely on base layer or translucently over text - */ - Layer SelectionLayer { get; set; }; - - /** - * Get the layer of the background of the line containing the caret. - * Set the layer of the background of the line containing the caret. - */ - Layer CaretLineLayer { get; set; }; - - /** - * Get only highlighting subline instead of whole line. - * Set only highlighting subline instead of whole line. - */ - Boolean CaretLineHighlightSubLine { get; set; }; - - /** - * Get the time in milliseconds that the caret is on and off. - * Get the time in milliseconds that the caret is on and off. 0 = steady on. - */ - Int32 CaretPeriod { get; set; }; - - /** - * Get the number of characters to have directly indexed categories - * Set the number of characters to have directly indexed categories - */ - Int32 CharacterCategoryOptimization { get; set; }; - - /** - * How many undo actions are in the history? - */ - Int32 UndoActions { get; }; - - /** - * Which action is the save point? - * Set action as the save point - */ - Int32 UndoSavePoint { get; set; }; - - /** - * Which action is the detach point? - * Set action as the detach point - */ - Int32 UndoDetach { get; set; }; - - /** - * Which action is the tentative point? - * Set action as the tentative point - */ - Int32 UndoTentative { get; set; }; - - /** - * Which action is the current point? - * Set action as the current point - */ - Int32 UndoCurrent { get; set; }; - - /** - * Get the size of the dots used to mark space characters. - * Set the size of the dots used to mark space characters. - */ - Int32 WhitespaceSize { get; set; }; - - /** - * Retrieve the last line number that has line state. - */ - Int32 MaxLineState { get; }; - - /** - * Is the background of the line containing the caret in a different colour? - * Display the background of the line containing the caret in a different colour. - */ - Boolean CaretLineVisible { get; set; }; - - /** - * Get the colour of the background of the line containing the caret. - * Set the colour of the background of the line containing the caret. - */ - Int32 CaretLineBack { get; set; }; - - /** - * Retrieve the caret line frame width. - * Width = 0 means this option is disabled. - * Display the caret line framed. - * Set width != 0 to enable this option and width = 0 to disable it. - */ - Int32 CaretLineFrame { get; set; }; - - /** - * Retrieve the auto-completion list separator character. - * Change the separator character in the string setting up an auto-completion list. - * Default is space but can be changed if items contain space. - */ - Int32 AutoCSeparator { get; set; }; - - /** - * Retrieve whether auto-completion cancelled by backspacing before start. - * Should the auto-completion list be cancelled if the user backspaces to a - * position before where the box was created. - */ - Boolean AutoCCancelAtStart { get; set; }; - - /** - * Retrieve whether a single item auto-completion list automatically choose the item. - * Should a single item auto-completion list automatically choose the item. - */ - Boolean AutoCChooseSingle { get; set; }; - - /** - * Retrieve state of ignore case flag. - * Set whether case is significant when performing auto-completion searches. - */ - Boolean AutoCIgnoreCase { get; set; }; - - /** - * Retrieve whether or not autocompletion is hidden automatically when nothing matches. - * Set whether or not autocompletion is hidden automatically when nothing matches. - */ - Boolean AutoCAutoHide { get; set; }; - - /** - * Retrieve autocompletion options. - * Set autocompletion options. - */ - AutoCompleteOption AutoCOptions { get; set; }; - - /** - * Retrieve whether or not autocompletion deletes any word characters - * after the inserted text upon completion. - * Set whether or not autocompletion deletes any word characters - * after the inserted text upon completion. - */ - Boolean AutoCDropRestOfWord { get; set; }; - - /** - * Retrieve the auto-completion list type-separator character. - * Change the type-separator character in the string setting up an auto-completion list. - * Default is '?' but can be changed if items contain '?'. - */ - Int32 AutoCTypeSeparator { get; set; }; - - /** - * Get the maximum width, in characters, of auto-completion and user lists. - * 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. - */ - Int32 AutoCMaxWidth { get; set; }; - - /** - * Set the maximum height, in rows, of auto-completion and user lists. - * Set the maximum height, in rows, of auto-completion and user lists. - * The default is 5 rows. - */ - Int32 AutoCMaxHeight { get; set; }; - - /** - * Retrieve indentation size. - * Set the number of spaces used for one level of indentation. - */ - Int32 Indent { get; set; }; - - /** - * Retrieve whether tabs will be used in indentation. - * Indentation will only use space characters if useTabs is false, otherwise - * it will use a combination of tabs and spaces. - */ - Boolean UseTabs { get; set; }; - - /** - * Is the horizontal scroll bar visible? - * Show or hide the horizontal scroll bar. - */ - Boolean HScrollBar { get; set; }; - - /** - * Are the indentation guides visible? - * Show or hide indentation guides. - */ - IndentView IndentationGuides { get; set; }; - - /** - * Get the highlighted indentation guide column. - * Set the highlighted indentation guide column. - * 0 = no highlighted guide. - */ - Int64 HighlightGuide { get; set; }; - - /** - * Get the code page used to interpret the bytes of the document as characters. - * 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. - */ - Int32 CodePage { get; set; }; - - /** - * Get the foreground colour of the caret. - * Set the foreground colour of the caret. - */ - Int32 CaretFore { get; set; }; - - /** - * In read-only mode? - * Set to read only or read write. - */ - Boolean ReadOnly { get; set; }; - - /** - * Returns the position at the start of the selection. - * Sets the position that starts the selection - this becomes the anchor. - */ - Int64 SelectionStart { get; set; }; - - /** - * Returns the position at the end of the selection. - * Sets the position that ends the selection - this becomes the caret. - */ - Int64 SelectionEnd { get; set; }; - - /** - * Returns the print magnification. - * Sets the print magnification added to the point size of each style for printing. - */ - Int32 PrintMagnification { get; set; }; - - /** - * Returns the print colour mode. - * Modify colours when printing for clearer printed text. - */ - PrintOption PrintColourMode { get; set; }; - - /** - * Report change history status. - * Enable or disable change history. - */ - ChangeHistoryOption ChangeHistory { get; set; }; - - /** - * Retrieve the display line at the top of the display. - * Scroll so that a display line is at the top of the display. - */ - Int64 FirstVisibleLine { get; set; }; - - /** - * Returns the number of lines in the document. There is always at least one. - */ - Int64 LineCount { get; }; - - /** - * Returns the size in pixels of the left margin. - * Sets the size in pixels of the left margin. - */ - Int32 MarginLeft { get; set; }; - - /** - * Returns the size in pixels of the right margin. - * Sets the size in pixels of the right margin. - */ - Int32 MarginRight { get; set; }; - - /** - * Is the document different from when it was last saved? - */ - Boolean Modify { get; }; - - Boolean SelectionHidden { get; }; - - /** - * Retrieve the number of characters in the document. - */ - Int64 TextLength { get; }; - - /** - * Retrieve a pointer to a function that processes messages for this Scintilla. - */ - UInt64 DirectFunction { get; }; - - /** - * Retrieve a pointer to a function that processes messages for this Scintilla and returns status. - */ - UInt64 DirectStatusFunction { get; }; - - /** - * Retrieve a pointer value to use as the first argument when calling - * the function returned by GetDirectFunction. - */ - UInt64 DirectPointer { get; }; - - /** - * Returns true if overtype mode is active otherwise false is returned. - * Set to overtype (true) or insert mode. - */ - Boolean Overtype { get; set; }; - - /** - * Returns the width of the insert mode caret. - * Set the width of the insert mode caret. - */ - Int32 CaretWidth { get; set; }; - - /** - * Get the position that starts the target. - * Sets the position that starts the target which is used for updating the - * document without affecting the scroll position. - */ - Int64 TargetStart { get; set; }; - - /** - * Get the virtual space of the target start - * Sets the virtual space of the target start - */ - Int64 TargetStartVirtualSpace { get; set; }; - - /** - * Get the position that ends the target. - * Sets the position that ends the target which is used for updating the - * document without affecting the scroll position. - */ - Int64 TargetEnd { get; set; }; - - /** - * Get the virtual space of the target end - * Sets the virtual space of the target end - */ - Int64 TargetEndVirtualSpace { get; set; }; - - /** - * Get the search flags used by SearchInTarget. - * Set the search flags used by SearchInTarget. - */ - FindOption SearchFlags { get; set; }; - - /** - * Are all lines visible? - */ - Boolean AllLinesVisible { get; }; - - /** - * Get the style of fold display text. - * Set the style of fold display text. - */ - FoldDisplayTextStyle FoldDisplayTextStyle { get; set; }; - - /** - * Get automatic folding behaviours. - * Set automatic folding behaviours. - */ - AutomaticFold AutomaticFold { get; set; }; - - /** - * Does a tab pressed when caret is within indentation indent? - * Sets whether a tab pressed when caret is within indentation indents. - */ - Boolean TabIndents { get; set; }; - - /** - * Does a backspace pressed when caret is within indentation unindent? - * Sets whether a backspace pressed when caret is within indentation unindents. - */ - Boolean BackSpaceUnIndents { get; set; }; - - /** - * Retrieve the time the mouse must sit still to generate a mouse dwell event. - * Sets the time the mouse must sit still to generate a mouse dwell event. - */ - Int32 MouseDwellTime { get; set; }; - - /** - * Retrieve the limits to idle styling. - * Sets limits to idle styling. - */ - IdleStyling IdleStyling { get; set; }; - - /** - * Retrieve whether text is word wrapped. - * Sets whether text is word wrapped. - */ - Wrap WrapMode { get; set; }; - - /** - * Retrive the display mode of visual flags for wrapped lines. - * Set the display mode of visual flags for wrapped lines. - */ - WrapVisualFlag WrapVisualFlags { get; set; }; - - /** - * Retrive the location of visual flags for wrapped lines. - * Set the location of visual flags for wrapped lines. - */ - WrapVisualLocation WrapVisualFlagsLocation { get; set; }; - - /** - * Retrive the start indent for wrapped lines. - * Set the start indent for wrapped lines. - */ - Int32 WrapStartIndent { get; set; }; - - /** - * Retrieve how wrapped sublines are placed. Default is fixed. - * Sets how wrapped sublines are placed. Default is fixed. - */ - WrapIndentMode WrapIndentMode { get; set; }; - - /** - * Retrieve the degree of caching of layout information. - * Sets the degree of caching of layout information. - */ - LineCache LayoutCache { get; set; }; - - /** - * Retrieve the document width assumed for scrolling. - * Sets the document width assumed for scrolling. - */ - Int32 ScrollWidth { get; set; }; - - /** - * Retrieve whether the scroll width tracks wide lines. - * Sets whether the maximum width line displayed is used to set scroll width. - */ - Boolean ScrollWidthTracking { get; set; }; - - /** - * Retrieve whether the maximum scroll position has the last - * line at the bottom of the view. - * 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. - */ - Boolean EndAtLastLine { get; set; }; - - /** - * Is the vertical scroll bar visible? - * Show or hide the vertical scroll bar. - */ - Boolean VScrollBar { get; set; }; - - /** - * How many phases is drawing done in? - * 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. - */ - PhasesDraw PhasesDraw { get; set; }; - - /** - * Retrieve the quality level for text. - * Choose the quality level for text from the FontQuality enumeration. - */ - FontQuality FontQuality { get; set; }; - - /** - * Retrieve the effect of pasting when there are multiple selections. - * Change the effect of pasting when there are multiple selections. - */ - MultiPaste MultiPaste { get; set; }; - - /** - * Report accessibility status. - * Enable or disable accessibility. - */ - Accessibility Accessibility { get; set; }; - - /** - * Are the end of line characters visible? - * Make the end of line characters visible or invisible. - */ - Boolean ViewEOL { get; set; }; - - /** - * Retrieve a pointer to the document object. - * Change the document object used. - */ - UInt64 DocPointer { get; set; }; - - /** - * Retrieve the column number which text should be kept within. - * Set the column number of the edge. - * If text goes past the edge then it is highlighted. - */ - Int64 EdgeColumn { get; set; }; - - /** - * Retrieve the edge highlight mode. - * 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). - */ - EdgeVisualStyle EdgeMode { get; set; }; - - /** - * Retrieve the colour used in edge indication. - * Change the colour used in edge indication. - */ - Int32 EdgeColour { get; set; }; - - /** - * Retrieves the number of lines completely visible. - */ - Int64 LinesOnScreen { get; }; - - /** - * Is the selection rectangular? The alternative is the more common stream selection. - */ - Boolean SelectionIsRectangle { get; }; - - /** - * Retrieve the zoom level. - * 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. - */ - Int32 Zoom { get; set; }; - - /** - * Get which document options are set. - */ - DocumentOption DocumentOptions { get; }; - - /** - * Get which document modification events are sent to the container. - * Set which document modification events are sent to the container. - */ - ModificationFlags ModEventMask { get; set; }; - - /** - * Get whether command events are sent to the container. - * Set whether command events are sent to the container. - */ - Boolean CommandEvents { get; set; }; - - /** - * Get internal focus flag. - * Change internal focus flag. - */ - Boolean Focus { get; set; }; - - /** - * Get error status. - * Change error status - 0 = OK. - */ - Status Status { get; set; }; - - /** - * Get whether mouse gets captured. - * Set whether the mouse is captured when its button is pressed. - */ - Boolean MouseDownCaptures { get; set; }; - - /** - * Get whether mouse wheel can be active outside the window. - * Set whether the mouse wheel can be active outside the window. - */ - Boolean MouseWheelCaptures { get; set; }; - - /** - * Get cursor type. - * Sets the cursor to one of the SC_CURSOR* values. - */ - CursorShape Cursor { get; set; }; - - /** - * Get the way control characters are displayed. - * Change the way control characters are displayed: - * If symbol is < 32, keep the drawn way, else, use the given character. - */ - Int32 ControlCharSymbol { get; set; }; - - /** - * Get the xOffset (ie, horizontal scroll position). - * Set the xOffset (ie, horizontal scroll position). - */ - Int32 XOffset { get; set; }; - - /** - * Is printing line wrapped? - * Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). - */ - Wrap PrintWrapMode { get; set; }; - - /** - * Get whether underlining for active hotspots. - * Enable / Disable underlining active hotspots. - */ - Boolean HotspotActiveUnderline { get; set; }; - - /** - * Get the HotspotSingleLine property - * Limit hotspots to single line so hotspots on two lines don't merge. - */ - Boolean HotspotSingleLine { get; set; }; - - /** - * Get the mode of the current selection. - * Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or - * by lines (SC_SEL_LINES). - */ - SelectionMode SelectionMode { get; set; }; - - /** - * Get whether or not regular caret moves will extend or reduce the selection. - * Set whether or not regular caret moves will extend or reduce the selection. - */ - Boolean MoveExtendsSelection { get; set; }; - - /** - * Get currently selected item position in the auto-completion list - */ - Int32 AutoCCurrent { get; }; - - /** - * Get auto-completion case insensitive behaviour. - * Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. - */ - CaseInsensitiveBehaviour AutoCCaseInsensitiveBehaviour { get; set; }; - - /** - * Retrieve the effect of autocompleting when there are multiple selections. - * Change the effect of autocompleting when there are multiple selections. - */ - MultiAutoComplete AutoCMulti { get; set; }; - - /** - * Get the way autocompletion lists are ordered. - * Set the way autocompletion lists are ordered. - */ - Ordering AutoCOrder { get; set; }; - - /** - * Can the caret preferred x position only be changed by explicit movement commands? - * Stop the caret preferred x position changing when the user types. - */ - CaretSticky CaretSticky { get; set; }; - - /** - * Get convert-on-paste setting - * Enable/Disable convert-on-paste for line endings - */ - Boolean PasteConvertEndings { get; set; }; - - /** - * Get the background alpha of the caret line. - * Set background alpha of the caret line. - */ - Alpha CaretLineBackAlpha { get; set; }; - - /** - * Returns the current style of the caret. - * Set the style of the caret to be drawn. - */ - CaretStyle CaretStyle { get; set; }; - - /** - * Get the current indicator - * Set the indicator used for IndicatorFillRange and IndicatorClearRange - */ - Int32 IndicatorCurrent { get; set; }; - - /** - * Get the current indicator value - * Set the value used for IndicatorFillRange - */ - Int32 IndicatorValue { get; set; }; - - /** - * How many entries are allocated to the position cache? - * Set number of entries in position cache - */ - Int32 PositionCache { get; set; }; - - /** - * Get maximum number of threads used for layout - * Set maximum number of threads used for layout - */ - Int32 LayoutThreads { get; set; }; - - /** - * Compact the document buffer and return a read-only pointer to the - * characters in the document. - */ - UInt64 CharacterPointer { get; }; - - /** - * Return a position which, to avoid performance costs, should not be within - * the range of a call to GetRangePointer. - */ - Int64 GapPosition { get; }; - - /** - * Get extra ascent for each line - * Set extra ascent for each line - */ - Int32 ExtraAscent { get; set; }; - - /** - * Get extra descent for each line - * Set extra descent for each line - */ - Int32 ExtraDescent { get; set; }; - - /** - * Get the start of the range of style numbers used for margin text - * Get the start of the range of style numbers used for margin text - */ - Int32 MarginStyleOffset { get; set; }; - - /** - * Get the margin options. - * Set the margin options. - */ - MarginOption MarginOptions { get; set; }; - - /** - * Get the visibility for the annotations for a view - * Set the visibility for the annotations for a view - */ - AnnotationVisible AnnotationVisible { get; set; }; - - /** - * Get the start of the range of style numbers used for annotations - * Get the start of the range of style numbers used for annotations - */ - Int32 AnnotationStyleOffset { get; set; }; - - /** - * Whether switching to rectangular mode while selecting with the mouse is allowed. - * Set whether switching to rectangular mode while selecting with the mouse is allowed. - */ - Boolean MouseSelectionRectangularSwitch { get; set; }; - - /** - * Whether multiple selections can be made - * Set whether multiple selections can be made - */ - Boolean MultipleSelection { get; set; }; - - /** - * Whether typing can be performed into multiple selections - * Set whether typing can be performed into multiple selections - */ - Boolean AdditionalSelectionTyping { get; set; }; - - /** - * Whether additional carets will blink - * Set whether additional carets will blink - */ - Boolean AdditionalCaretsBlink { get; set; }; - - /** - * Whether additional carets are visible - * Set whether additional carets are visible - */ - Boolean AdditionalCaretsVisible { get; set; }; - - /** - * How many selections are there? - */ - Int32 Selections { get; }; - - /** - * Is every selected range empty? - */ - Boolean SelectionEmpty { get; }; - - /** - * Which selection is the main selection - * Set the main selection - */ - Int32 MainSelection { get; set; }; - - /** - * Return the caret position of the rectangular selection. - * Set the caret position of the rectangular selection. - */ - Int64 RectangularSelectionCaret { get; set; }; - - /** - * Return the anchor position of the rectangular selection. - * Set the anchor position of the rectangular selection. - */ - Int64 RectangularSelectionAnchor { get; set; }; - - /** - * Return the virtual space of the caret of the rectangular selection. - * Set the virtual space of the caret of the rectangular selection. - */ - Int64 RectangularSelectionCaretVirtualSpace { get; set; }; - - /** - * Return the virtual space of the anchor of the rectangular selection. - * Set the virtual space of the anchor of the rectangular selection. - */ - Int64 RectangularSelectionAnchorVirtualSpace { get; set; }; - - /** - * Return options for virtual space behaviour. - * Set options for virtual space behaviour. - */ - VirtualSpace VirtualSpaceOptions { get; set; }; - - /** - * Get the modifier key used for rectangular selection. - */ - Int32 RectangularSelectionModifier { get; set; }; - - /** - * Get the alpha of the selection. - * Set the alpha of the selection. - */ - Alpha AdditionalSelAlpha { get; set; }; - - /** - * Get the foreground colour of additional carets. - * Set the foreground colour of additional carets. - */ - Int32 AdditionalCaretFore { get; set; }; - - /** - * Get the identifier. - * Set the identifier reported as idFrom in notification messages. - */ - Int32 Identifier { get; set; }; - - /** - * Get the tech. - * Set the technology used. - */ - Technology Technology { get; set; }; - - /** - * Is the caret line always visible? - * Sets the caret line to always visible. - */ - Boolean CaretLineVisibleAlways { get; set; }; - - /** - * Get the line end types currently allowed. - * Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. - */ - LineEndType LineEndTypesAllowed { get; set; }; - - /** - * Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. - */ - LineEndType LineEndTypesActive { get; }; - - /** - * Get the visibility for the end of line annotations for a view - * Set the visibility for the end of line annotations for a view - */ - EOLAnnotationVisible EOLAnnotationVisible { get; set; }; - - /** - * Get the start of the range of style numbers used for end of line annotations - * Get the start of the range of style numbers used for end of line annotations - */ - Int32 EOLAnnotationStyleOffset { get; set; }; - - /** - * Retrieve line character index state. - */ - LineCharacterIndexType LineCharacterIndex { get; }; - - /** - * Retrieve the lexing language of the document. - */ - Int32 Lexer { get; }; - - /** - * Bit set of LineEndType enumertion for which line ends beyond the standard - * LF, CR, and CRLF are supported by the lexer. - */ - LineEndType LineEndTypesSupported { get; }; - - /** - * Where styles are duplicated by a feature such as active/inactive code - * return the distance between the two types. - */ - Int32 DistanceToSecondaryStyles { get; }; - - /** - * Retrieve the number of named styles for the lexer. - */ - Int32 NamedStyles { get; }; - - /** - * Retrieve bidirectional text display state. - * Set bidirectional text display state. - */ - Bidirectional Bidirectional { get; set; }; - - /** - * Add text to the document at current position. - */ - void AddTextFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - void AddText(Int64 length, String text); - - /** - * Add array of cells to document. - */ - void AddStyledText(Int64 length, UInt8[] c); - - /** - * Insert string at a position. - */ - void InsertTextFromBuffer(Int64 pos, Windows.Storage.Streams.IBuffer text); - void InsertText(Int64 pos, String text); - - /** - * Change the text that is being inserted in response to SC_MOD_INSERTCHECK - */ - void ChangeInsertionFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - void ChangeInsertion(Int64 length, String text); - - /** - * Delete all text in the document. - */ - void ClearAll(); - - /** - * Delete a range of text in the document. - */ - void DeleteRange(Int64 start, Int64 lengthDelete); - - /** - * Set all style bytes to 0, remove all folding information. - */ - void ClearDocumentStyle(); - - /** - * Redoes the next action on the undo history. - */ - void Redo(); - - /** - * Select all the text in the document. - */ - void SelectAll(); - - /** - * Remember the current position in the undo history as the position - * at which the document was saved. - */ - void SetSavePoint(); - - /** - * Retrieve a buffer of cells. - * Returns the number of bytes in the buffer not including terminating NULs. - */ - Int64 GetStyledText(UInt64 tr); - - /** - * Retrieve a buffer of cells that can be past 2GB. - * Returns the number of bytes in the buffer not including terminating NULs. - */ - Int64 GetStyledTextFull(UInt64 tr); - - /** - * Are there any redoable actions in the undo history? - */ - Boolean CanRedo(); - - /** - * Retrieve the line number at which a particular marker is located. - */ - Int64 MarkerLineFromHandle(Int32 markerHandle); - - /** - * Delete a marker. - */ - void MarkerDeleteHandle(Int32 markerHandle); - - /** - * Retrieve marker handles of a line - */ - Int32 MarkerHandleFromLine(Int64 line, Int32 which); - - /** - * Retrieve marker number of a marker handle - */ - Int32 MarkerNumberFromLine(Int64 line, Int32 which); - - /** - * Find the position from a point within the window. - */ - Int64 PositionFromPoint(Int32 x, Int32 y); - - /** - * Find the position from a point within the window but return - * INVALID_POSITION if not close to text. - */ - Int64 PositionFromPointClose(Int32 x, Int32 y); - - /** - * Set caret to start of a line and ensure it is visible. - */ - void GotoLine(Int64 line); - - /** - * Set caret to a position and ensure it is visible. - */ - void GotoPos(Int64 caret); - - /** - * Retrieve the text of the line containing the caret. - * Returns the index of the caret on the line. - * Result is NUL-terminated. - */ - Int64 GetCurLineWriteBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - String GetCurLine(Int64 length); - - /** - * Convert all line endings in the document to one mode. - */ - void ConvertEOLs(EndOfLine eolMode); - - /** - * Set the current styling position to start. - * The unused parameter is no longer used and should be set to 0. - */ - void StartStyling(Int64 start, Int32 unused); - - /** - * Change style from current styling position for length characters to a style - * and move the current styling position to after this newly styled segment. - */ - void SetStyling(Int64 length, Int32 style); - - /** - * Clear explicit tabstops on a line. - */ - void ClearTabStops(Int64 line); - - /** - * Add an explicit tab stop for a line. - */ - void AddTabStop(Int64 line, Int32 x); - - /** - * Find the next explicit tab stop position on a line after a position. - */ - Int32 GetNextTabStop(Int64 line, Int32 x); - - /** - * Set the symbol used for a particular marker number. - */ - void MarkerDefine(Int32 markerNumber, MarkerSymbol markerSymbol); - - /** - * Enable/disable highlight for current folding block (smallest one that contains the caret) - */ - void MarkerEnableHighlight(Boolean enabled); - - /** - * Add a marker to a line, returning an ID which can be used to find or delete the marker. - */ - Int32 MarkerAdd(Int64 line, Int32 markerNumber); - - /** - * Delete a marker from a line. - */ - void MarkerDelete(Int64 line, Int32 markerNumber); - - /** - * Delete all markers with a particular number from all lines. - */ - void MarkerDeleteAll(Int32 markerNumber); - - /** - * Get a bit mask of all the markers set on a line. - */ - Int32 MarkerGet(Int64 line); - - /** - * Find the next line at or after lineStart that includes a marker in mask. - * Return -1 when no more lines. - */ - Int64 MarkerNext(Int64 lineStart, Int32 markerMask); - - /** - * Find the previous line before lineStart that includes a marker in mask. - */ - Int64 MarkerPrevious(Int64 lineStart, Int32 markerMask); - - /** - * Define a marker from a pixmap. - */ - void MarkerDefinePixmapFromBuffer(Int32 markerNumber, Windows.Storage.Streams.IBuffer pixmap); - void MarkerDefinePixmap(Int32 markerNumber, String pixmap); - - /** - * Add a set of markers to a line. - */ - void MarkerAddSet(Int64 line, Int32 markerSet); - - /** - * Clear all the styles and make equivalent to the global default style. - */ - void StyleClearAll(); - - /** - * Reset the default style to its state at startup - */ - void StyleResetDefault(); - - /** - * Use the default or platform-defined colour for an element. - */ - void ResetElementColour(Element element); - - /** - * Set the foreground colour of the main and additional selections and whether to use this setting. - */ - void SetSelFore(Boolean useSetting, Int32 fore); - - /** - * Set the background colour of the main and additional selections and whether to use this setting. - */ - void SetSelBack(Boolean useSetting, Int32 back); - - /** - * When key+modifier combination keyDefinition is pressed perform sciCommand. - */ - void AssignCmdKey(Int32 keyDefinition, Int32 sciCommand); - - /** - * When key+modifier combination keyDefinition is pressed do nothing. - */ - void ClearCmdKey(Int32 keyDefinition); - - /** - * Drop all key mappings. - */ - void ClearAllCmdKeys(); - - /** - * Set the styles for a segment of the document. - */ - void SetStylingExFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer styles); - void SetStylingEx(Int64 length, String styles); - - /** - * Start a sequence of actions that is undone and redone as a unit. - * May be nested. - */ - void BeginUndoAction(); - - /** - * End a sequence of actions that is undone and redone as a unit. - */ - void EndUndoAction(); - - /** - * Push one action onto undo history with no text - */ - void PushUndoActionType(Int32 type, Int64 pos); - - /** - * Set the text and length of the most recently pushed action - */ - void ChangeLastUndoActionTextFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - void ChangeLastUndoActionText(Int64 length, String text); - - /** - * Set the foreground colour of all whitespace and whether to use this setting. - */ - void SetWhitespaceFore(Boolean useSetting, Int32 fore); - - /** - * Set the background colour of all whitespace and whether to use this setting. - */ - void SetWhitespaceBack(Boolean useSetting, Int32 back); - - /** - * Display a auto-completion list. - * The lengthEntered parameter indicates how many characters before - * the caret should be used to provide context. - */ - void AutoCShowFromBuffer(Int64 lengthEntered, Windows.Storage.Streams.IBuffer itemList); - void AutoCShow(Int64 lengthEntered, String itemList); - - /** - * Remove the auto-completion list from the screen. - */ - void AutoCCancel(); - - /** - * Is there an auto-completion list visible? - */ - Boolean AutoCActive(); - - /** - * Retrieve the position of the caret when the auto-completion list was displayed. - */ - Int64 AutoCPosStart(); - - /** - * User has selected an item so remove the list and insert the selection. - */ - void AutoCComplete(); - - /** - * Define a set of character that when typed cancel the auto-completion list. - */ - void AutoCStopsFromBuffer(Windows.Storage.Streams.IBuffer characterSet); - void AutoCStops(String characterSet); - - /** - * Select the item in the auto-completion list that starts with a string. - */ - void AutoCSelectFromBuffer(Windows.Storage.Streams.IBuffer select); - void AutoCSelect(String select); - - /** - * Display a list of strings and send notification when user chooses one. - */ - void UserListShowFromBuffer(Int32 listType, Windows.Storage.Streams.IBuffer itemList); - void UserListShow(Int32 listType, String itemList); - - /** - * Register an XPM image for use in autocompletion lists. - */ - void RegisterImageFromBuffer(Int32 type, Windows.Storage.Streams.IBuffer xpmData); - void RegisterImage(Int32 type, String xpmData); - - /** - * Clear all the registered XPM images. - */ - void ClearRegisteredImages(); - - /** - * Count characters between two positions. - */ - Int64 CountCharacters(Int64 start, Int64 end); - - /** - * Count code units between two positions. - */ - Int64 CountCodeUnits(Int64 start, Int64 end); - - /** - * Set caret to a position, while removing any existing selection. - */ - void SetEmptySelection(Int64 caret); - - /** - * Find some text in the document. - */ - Int64 FindText(FindOption searchFlags, UInt64 ft); - - /** - * Find some text in the document. - */ - Int64 FindTextFull(FindOption searchFlags, UInt64 ft); - - /** - * Draw the document into a display context such as a printer. - */ - Int64 FormatRange(Boolean draw, UInt64 fr); - - /** - * Draw the document into a display context such as a printer. - */ - Int64 FormatRangeFull(Boolean draw, UInt64 fr); - - /** - * Retrieve the contents of a line. - * Returns the length of the line. - */ - Int64 GetLineWriteBuffer(Int64 line, Windows.Storage.Streams.IBuffer text); - String GetLine(Int64 line); - - /** - * Select a range of text. - */ - void SetSel(Int64 anchor, Int64 caret); - - /** - * Retrieve the selected text. - * Return the length of the text. - * Result is NUL-terminated. - */ - Int64 GetSelTextWriteBuffer(Windows.Storage.Streams.IBuffer text); - String GetSelText(); - - /** - * Retrieve a range of text. - * Return the length of the text. - */ - Int64 GetTextRange(UInt64 tr); - - /** - * Retrieve a range of text that can be past 2GB. - * Return the length of the text. - */ - Int64 GetTextRangeFull(UInt64 tr); - - /** - * Draw the selection either highlighted or in normal (non-highlighted) style. - */ - void HideSelection(Boolean hide); - - /** - * Retrieve the x value of the point in the window where a position is displayed. - */ - Int32 PointXFromPosition(Int64 pos); - - /** - * Retrieve the y value of the point in the window where a position is displayed. - */ - Int32 PointYFromPosition(Int64 pos); - - /** - * Retrieve the line containing a position. - */ - Int64 LineFromPosition(Int64 pos); - - /** - * Retrieve the position at the start of a line. - */ - Int64 PositionFromLine(Int64 line); - - /** - * Scroll horizontally and vertically. - */ - void LineScroll(Int64 columns, Int64 lines); - - /** - * Ensure the caret is visible. - */ - 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. - */ - void ScrollRange(Int64 secondary, Int64 primary); - - /** - * Replace the selected text with the argument text. - */ - void ReplaceSelFromBuffer(Windows.Storage.Streams.IBuffer text); - void ReplaceSel(String text); - - /** - * Null operation. - */ - void Null(); - - /** - * Will a paste succeed? - */ - Boolean CanPaste(); - - /** - * Are there any undoable actions in the undo history? - */ - Boolean CanUndo(); - - /** - * Delete the undo history. - */ - void EmptyUndoBuffer(); - - /** - * Undo one action in the undo history. - */ - void Undo(); - - /** - * Cut the selection to the clipboard. - */ - void Cut(); - - /** - * Copy the selection to the clipboard. - */ - void Copy(); - - /** - * Paste the contents of the clipboard into the document replacing the selection. - */ - void Paste(); - - /** - * Clear the selection. - */ - void Clear(); - - /** - * Replace the contents of the document with the argument text. - */ - void SetTextFromBuffer(Windows.Storage.Streams.IBuffer text); - void SetText(String text); - - /** - * Retrieve all the text in the document. - * Returns number of characters retrieved. - * Result is NUL-terminated. - */ - Int64 GetTextWriteBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - String GetText(Int64 length); - - /** - * Sets both the start and end of the target in one call. - */ - void SetTargetRange(Int64 start, Int64 end); - - /** - * Make the target range start and end be the same as the selection range start and end. - */ - void TargetFromSelection(); - - /** - * Sets the target to the whole document. - */ - void TargetWholeDocument(); - - /** - * Replace the target text with the argument text. - * Text is counted so it can contain NULs. - * Returns the length of the replacement text. - */ - Int64 ReplaceTargetFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - Int64 ReplaceTarget(Int64 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. - */ - Int64 ReplaceTargetREFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - Int64 ReplaceTargetRE(Int64 length, String text); - - /** - * Replace the target text with the argument text but ignore prefix and suffix that - * are the same as current. - */ - Int64 ReplaceTargetMinimalFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - Int64 ReplaceTargetMinimal(Int64 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 start of found range or -1 for failure in which case target is not moved. - */ - Int64 SearchInTargetFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - Int64 SearchInTarget(Int64 length, String text); - - /** - * Show a call tip containing a definition near position pos. - */ - void CallTipShowFromBuffer(Int64 pos, Windows.Storage.Streams.IBuffer definition); - void CallTipShow(Int64 pos, String definition); - - /** - * Remove the call tip from the screen. - */ - void CallTipCancel(); - - /** - * Is there an active call tip? - */ - Boolean CallTipActive(); - - /** - * Retrieve the position where the caret was before displaying the call tip. - */ - Int64 CallTipPosStart(); - - /** - * Highlight a segment of the definition. - */ - void CallTipSetHlt(Int64 highlightStart, Int64 highlightEnd); - - /** - * Find the display line of a document line taking hidden lines into account. - */ - Int64 VisibleFromDocLine(Int64 docLine); - - /** - * Find the document line of a display line taking hidden lines into account. - */ - Int64 DocLineFromVisible(Int64 displayLine); - - /** - * The number of display lines needed to wrap a document line - */ - Int64 WrapCount(Int64 docLine); - - /** - * Make a range of lines visible. - */ - void ShowLines(Int64 lineStart, Int64 lineEnd); - - /** - * Make a range of lines invisible. - */ - void HideLines(Int64 lineStart, Int64 lineEnd); - - /** - * Switch a header line between expanded and contracted. - */ - void ToggleFold(Int64 line); - - /** - * Switch a header line between expanded and contracted and show some text after the line. - */ - void ToggleFoldShowTextFromBuffer(Int64 line, Windows.Storage.Streams.IBuffer text); - void ToggleFoldShowText(Int64 line, String text); - - /** - * Set the default fold display text. - */ - void SetDefaultFoldDisplayTextFromBuffer(Windows.Storage.Streams.IBuffer text); - void SetDefaultFoldDisplayText(String text); - - /** - * Get the default fold display text. - */ - Int32 GetDefaultFoldDisplayTextWriteBuffer(Windows.Storage.Streams.IBuffer text); - String GetDefaultFoldDisplayText(); - - /** - * Expand or contract a fold header. - */ - void FoldLine(Int64 line, FoldAction action); - - /** - * Expand or contract a fold header and its children. - */ - void FoldChildren(Int64 line, FoldAction action); - - /** - * Expand a fold header and all children. Use the level argument instead of the line's current level. - */ - void ExpandChildren(Int64 line, FoldLevel level); - - /** - * Expand or contract all fold headers. - */ - void FoldAll(FoldAction action); - - /** - * Ensure a particular line is visible by expanding any header line hiding it. - */ - void EnsureVisible(Int64 line); - - /** - * 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. - */ - void EnsureVisibleEnforcePolicy(Int64 line); - - /** - * Get position of start of word. - */ - Int64 WordStartPosition(Int64 pos, Boolean onlyWordCharacters); - - /** - * Get position of end of word. - */ - Int64 WordEndPosition(Int64 pos, Boolean onlyWordCharacters); - - /** - * Is the range start..end considered a word? - */ - Boolean IsRangeWord(Int64 start, Int64 end); - - /** - * Measure the pixel width of some text in a particular style. - * NUL terminated text argument. - * Does not handle tab or control characters. - */ - Int32 TextWidthFromBuffer(Int32 style, Windows.Storage.Streams.IBuffer text); - Int32 TextWidth(Int32 style, String text); - - /** - * Retrieve the height of a particular line of text in pixels. - */ - Int32 TextHeight(Int64 line); - - /** - * Append a string to the end of the document without changing the selection. - */ - void AppendTextFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - void AppendText(Int64 length, String text); - - /** - * Join the lines in the target. - */ - void LinesJoin(); - - /** - * Split the lines in the target into lines that are less wide than pixelWidth - * where possible. - */ - void LinesSplit(Int32 pixelWidth); - - /** - * Set one of the colours used as a chequerboard pattern in the fold margin - */ - void SetFoldMarginColour(Boolean useSetting, Int32 back); - - /** - * Set the other colour used as a chequerboard pattern in the fold margin - */ - void SetFoldMarginHiColour(Boolean useSetting, Int32 fore); - - /** - * Move caret down one line. - */ - void LineDown(); - - /** - * Move caret down one line extending selection to new caret position. - */ - void LineDownExtend(); - - /** - * Move caret up one line. - */ - void LineUp(); - - /** - * Move caret up one line extending selection to new caret position. - */ - void LineUpExtend(); - - /** - * Move caret left one character. - */ - void CharLeft(); - - /** - * Move caret left one character extending selection to new caret position. - */ - void CharLeftExtend(); - - /** - * Move caret right one character. - */ - void CharRight(); - - /** - * Move caret right one character extending selection to new caret position. - */ - void CharRightExtend(); - - /** - * Move caret left one word. - */ - void WordLeft(); - - /** - * Move caret left one word extending selection to new caret position. - */ - void WordLeftExtend(); - - /** - * Move caret right one word. - */ - void WordRight(); - - /** - * Move caret right one word extending selection to new caret position. - */ - void WordRightExtend(); - - /** - * Move caret to first position on line. - */ - void Home(); - - /** - * Move caret to first position on line extending selection to new caret position. - */ - void HomeExtend(); - - /** - * Move caret to last position on line. - */ - void LineEnd(); - - /** - * Move caret to last position on line extending selection to new caret position. - */ - void LineEndExtend(); - - /** - * Move caret to first position in document. - */ - void DocumentStart(); - - /** - * Move caret to first position in document extending selection to new caret position. - */ - void DocumentStartExtend(); - - /** - * Move caret to last position in document. - */ - void DocumentEnd(); - - /** - * Move caret to last position in document extending selection to new caret position. - */ - void DocumentEndExtend(); - - /** - * Move caret one page up. - */ - void PageUp(); - - /** - * Move caret one page up extending selection to new caret position. - */ - void PageUpExtend(); - - /** - * Move caret one page down. - */ - void PageDown(); - - /** - * Move caret one page down extending selection to new caret position. - */ - void PageDownExtend(); - - /** - * Switch from insert to overtype mode or the reverse. - */ - void EditToggleOvertype(); - - /** - * Cancel any modes such as call tip or auto-completion list display. - */ - void Cancel(); - - /** - * Delete the selection or if no selection, the character before the caret. - */ - 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. - */ - void Tab(); - - /** - * Dedent the selected lines. - */ - void BackTab(); - - /** - * Insert a new line, may use a CRLF, CR or LF depending on EOL mode. - */ - void NewLine(); - - /** - * Insert a Form Feed character. - */ - void FormFeed(); - - /** - * Move caret to before first visible character on line. - * If already there move to first character on line. - */ - void VCHome(); - - /** - * Like VCHome but extending selection to new caret position. - */ - void VCHomeExtend(); - - /** - * Magnify the displayed text by increasing the sizes by 1 point. - */ - void ZoomIn(); - - /** - * Make the displayed text smaller by decreasing the sizes by 1 point. - */ - void ZoomOut(); - - /** - * Delete the word to the left of the caret. - */ - void DelWordLeft(); - - /** - * Delete the word to the right of the caret. - */ - void DelWordRight(); - - /** - * Delete the word to the right of the caret, but not the trailing non-word characters. - */ - void DelWordRightEnd(); - - /** - * Cut the line containing the caret. - */ - void LineCut(); - - /** - * Delete the line containing the caret. - */ - void LineDelete(); - - /** - * Switch the current line with the previous. - */ - void LineTranspose(); - - /** - * Reverse order of selected lines. - */ - void LineReverse(); - - /** - * Duplicate the current line. - */ - void LineDuplicate(); - - /** - * Transform the selection to lower case. - */ - void LowerCase(); - - /** - * Transform the selection to upper case. - */ - void UpperCase(); - - /** - * Scroll the document down, keeping the caret visible. - */ - void LineScrollDown(); - - /** - * Scroll the document up, keeping the caret visible. - */ - 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. - */ - void DeleteBackNotLine(); - - /** - * Move caret to first position on display line. - */ - void HomeDisplay(); - - /** - * Move caret to first position on display line extending selection to - * new caret position. - */ - void HomeDisplayExtend(); - - /** - * Move caret to last position on display line. - */ - void LineEndDisplay(); - - /** - * Move caret to last position on display line extending selection to new - * caret position. - */ - void LineEndDisplayExtend(); - - /** - * Like Home but when word-wrap is enabled goes first to start of display line - * HomeDisplay, then to start of document line Home. - */ - void HomeWrap(); - - /** - * Like HomeExtend but when word-wrap is enabled extends first to start of display line - * HomeDisplayExtend, then to start of document line HomeExtend. - */ - void HomeWrapExtend(); - - /** - * Like LineEnd but when word-wrap is enabled goes first to end of display line - * LineEndDisplay, then to start of document line LineEnd. - */ - void LineEndWrap(); - - /** - * Like LineEndExtend but when word-wrap is enabled extends first to end of display line - * LineEndDisplayExtend, then to start of document line LineEndExtend. - */ - void LineEndWrapExtend(); - - /** - * Like VCHome but when word-wrap is enabled goes first to start of display line - * VCHomeDisplay, then behaves like VCHome. - */ - void VCHomeWrap(); - - /** - * Like VCHomeExtend but when word-wrap is enabled extends first to start of display line - * VCHomeDisplayExtend, then behaves like VCHomeExtend. - */ - void VCHomeWrapExtend(); - - /** - * Copy the line containing the caret. - */ - void LineCopy(); - - /** - * Move the caret inside current view if it's not there already. - */ - void MoveCaretInsideView(); - - /** - * How many characters are on a line, including end of line characters? - */ - Int64 LineLength(Int64 line); - - /** - * Highlight the characters at two positions. - */ - void BraceHighlight(Int64 posA, Int64 posB); - - /** - * Use specified indicator to highlight matching braces instead of changing their style. - */ - void BraceHighlightIndicator(Boolean useSetting, Int32 indicator); - - /** - * Highlight the character at a position indicating there is no matching brace. - */ - void BraceBadLight(Int64 pos); - - /** - * Use specified indicator to highlight non matching brace instead of changing its style. - */ - void BraceBadLightIndicator(Boolean useSetting, Int32 indicator); - - /** - * 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. - */ - Int64 BraceMatch(Int64 pos, Int32 maxReStyle); - - /** - * Similar to BraceMatch, but matching starts at the explicit start position. - */ - Int64 BraceMatchNext(Int64 pos, Int64 startPos); - - /** - * Add a new vertical edge to the view. - */ - void MultiEdgeAddLine(Int64 column, Int32 edgeColour); - - /** - * Clear all vertical edges. - */ - void MultiEdgeClearAll(); - - /** - * Sets the current caret position to be the search anchor. - */ - void SearchAnchor(); - - /** - * Find some text starting at the search anchor. - * Does not ensure the selection is visible. - */ - Int64 SearchNextFromBuffer(FindOption searchFlags, Windows.Storage.Streams.IBuffer text); - Int64 SearchNext(FindOption searchFlags, String text); - - /** - * Find some text starting at the search anchor and moving backwards. - * Does not ensure the selection is visible. - */ - Int64 SearchPrevFromBuffer(FindOption searchFlags, Windows.Storage.Streams.IBuffer text); - Int64 SearchPrev(FindOption searchFlags, String text); - - /** - * Set whether a pop up menu is displayed automatically when the user presses - * the wrong mouse button on certain areas. - */ - void UsePopUp(PopUp popUpMode); - - /** - * Create a new document object. - * Starts with reference count of 1 and not selected into editor. - */ - UInt64 CreateDocument(Int64 bytes, DocumentOption documentOptions); - - /** - * Extend life of document. - */ - void AddRefDocument(UInt64 doc); - - /** - * Release a reference to the document, deleting document if it fades to black. - */ - void ReleaseDocument(UInt64 doc); - - /** - * Move to the previous change in capitalisation. - */ - void WordPartLeft(); - - /** - * Move to the previous change in capitalisation extending selection - * to new caret position. - */ - void WordPartLeftExtend(); - - /** - * Move to the change next in capitalisation. - */ - void WordPartRight(); - - /** - * Move to the next change in capitalisation extending selection - * to new caret position. - */ - void WordPartRightExtend(); - - /** - * Set the way the display area is determined when a particular line - * is to be moved to by Find, FindNext, GotoLine, etc. - */ - void SetVisiblePolicy(VisiblePolicy visiblePolicy, Int32 visibleSlop); - - /** - * Delete back from the current position to the start of the line. - */ - void DelLineLeft(); - - /** - * Delete forwards from the current position to the end of the line. - */ - void DelLineRight(); - - /** - * Set the last x chosen value to be the caret x position. - */ - void ChooseCaretX(); - - /** - * Set the focus to this Scintilla widget. - */ - void GrabFocus(); - - /** - * Set the way the caret is kept visible when going sideways. - * The exclusion zone is given in pixels. - */ - void SetXCaretPolicy(CaretPolicy caretPolicy, Int32 caretSlop); - - /** - * Set the way the line the caret is on is kept visible. - * The exclusion zone is given in lines. - */ - void SetYCaretPolicy(CaretPolicy caretPolicy, Int32 caretSlop); - - /** - * Move caret down one paragraph (delimited by empty lines). - */ - void ParaDown(); - - /** - * Extend selection down one paragraph (delimited by empty lines). - */ - void ParaDownExtend(); - - /** - * Move caret up one paragraph (delimited by empty lines). - */ - void ParaUp(); - - /** - * Extend selection up one paragraph (delimited by empty lines). - */ - void ParaUpExtend(); - - /** - * Given a valid document position, return the previous position taking code - * page into account. Returns 0 if passed 0. - */ - Int64 PositionBefore(Int64 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. - */ - Int64 PositionAfter(Int64 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. - */ - Int64 PositionRelative(Int64 pos, Int64 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. - */ - Int64 PositionRelativeCodeUnits(Int64 pos, Int64 relative); - - /** - * Copy a range of text to the clipboard. Positions are clipped into the document. - */ - void CopyRange(Int64 start, Int64 end); - - /** - * Copy argument text to the clipboard. - */ - void CopyTextFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - void CopyText(Int64 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) without changing MoveExtendsSelection. - */ - void ChangeSelectionMode(SelectionMode selectionMode); - - /** - * Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). - */ - Int64 GetLineSelStartPosition(Int64 line); - - /** - * Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). - */ - Int64 GetLineSelEndPosition(Int64 line); - - /** - * Move caret down one line, extending rectangular selection to new caret position. - */ - void LineDownRectExtend(); - - /** - * Move caret up one line, extending rectangular selection to new caret position. - */ - void LineUpRectExtend(); - - /** - * Move caret left one character, extending rectangular selection to new caret position. - */ - void CharLeftRectExtend(); - - /** - * Move caret right one character, extending rectangular selection to new caret position. - */ - void CharRightRectExtend(); - - /** - * Move caret to first position on line, extending rectangular selection to new caret position. - */ - 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. - */ - void VCHomeRectExtend(); - - /** - * Move caret to last position on line, extending rectangular selection to new caret position. - */ - void LineEndRectExtend(); - - /** - * Move caret one page up, extending rectangular selection to new caret position. - */ - void PageUpRectExtend(); - - /** - * Move caret one page down, extending rectangular selection to new caret position. - */ - void PageDownRectExtend(); - - /** - * Move caret to top of page, or one page up if already at top of page. - */ - void StutteredPageUp(); - - /** - * Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. - */ - void StutteredPageUpExtend(); - - /** - * Move caret to bottom of page, or one page down if already at bottom of page. - */ - void StutteredPageDown(); - - /** - * Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. - */ - void StutteredPageDownExtend(); - - /** - * Move caret left one word, position cursor at end of word. - */ - void WordLeftEnd(); - - /** - * Move caret left one word, position cursor at end of word, extending selection to new caret position. - */ - void WordLeftEndExtend(); - - /** - * Move caret right one word, position cursor at end of word. - */ - void WordRightEnd(); - - /** - * Move caret right one word, position cursor at end of word, extending selection to new caret position. - */ - void WordRightEndExtend(); - - /** - * Reset the set of characters for whitespace and word characters to the defaults. - */ - void SetCharsDefault(); - - /** - * Enlarge the document to a particular size of text bytes. - */ - void Allocate(Int64 bytes); - - /** - * Returns the target converted to UTF8. - * Return the length in bytes. - */ - Int64 TargetAsUTF8WriteBuffer(Windows.Storage.Streams.IBuffer s); - 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. - */ - void SetLengthForEncode(Int64 bytes); - - /** - * Translates a UTF8 string into the document encoding. - * Return the length of the result in bytes. - * On error return 0. - */ - Int64 EncodedFromUTF8WriteBuffer(Windows.Storage.Streams.IBuffer utf8, Windows.Storage.Streams.IBuffer encoded); - 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. - */ - Int64 FindColumn(Int64 line, Int64 column); - - /** - * Switch between sticky and non-sticky: meant to be bound to a key. - */ - void ToggleCaretSticky(); - - /** - * Replace the selection with text like a rectangular paste. - */ - void ReplaceRectangularFromBuffer(Int64 length, Windows.Storage.Streams.IBuffer text); - void ReplaceRectangular(Int64 length, String text); - - /** - * Duplicate the selection. If selection empty duplicate the line containing the caret. - */ - void SelectionDuplicate(); - - /** - * Turn a indicator on over a range. - */ - void IndicatorFillRange(Int64 start, Int64 lengthFill); - - /** - * Turn a indicator off over a range. - */ - void IndicatorClearRange(Int64 start, Int64 lengthClear); - - /** - * Are any indicators present at pos? - */ - Int32 IndicatorAllOnFor(Int64 pos); - - /** - * What value does a particular indicator have at a position? - */ - Int32 IndicatorValueAt(Int32 indicator, Int64 pos); - - /** - * Where does a particular indicator start? - */ - Int64 IndicatorStart(Int32 indicator, Int64 pos); - - /** - * Where does a particular indicator end? - */ - Int64 IndicatorEnd(Int32 indicator, Int64 pos); - - /** - * Copy the selection, if selection empty copy the line with the caret - */ - void CopyAllowLine(); - - /** - * Which symbol was defined for markerNumber with MarkerDefine - */ - Int32 MarkerSymbolDefined(Int32 markerNumber); - - /** - * Clear the margin text on all lines - */ - void MarginTextClearAll(); - - /** - * Clear the annotations from all lines - */ - void AnnotationClearAll(); - - /** - * Release all extended (>255) style numbers - */ - void ReleaseAllExtendedStyles(); - - /** - * Allocate some extended (>255) style numbers and return the start of the range - */ - Int32 AllocateExtendedStyles(Int32 numberStyles); - - /** - * Add a container action to the undo stack - */ - void AddUndoAction(Int32 token, UndoFlags flags); - - /** - * Find the position of a character from a point within the window. - */ - Int64 CharPositionFromPoint(Int32 x, Int32 y); - - /** - * Find the position of a character from a point within the window. - * Return INVALID_POSITION if not close to text. - */ - Int64 CharPositionFromPointClose(Int32 x, Int32 y); - - /** - * Clear selections to a single empty stream selection - */ - void ClearSelections(); - - /** - * Set a simple selection - */ - void SetSelection(Int64 caret, Int64 anchor); - - /** - * Add a selection - */ - void AddSelection(Int64 caret, Int64 anchor); - - /** - * Find the selection index for a point. -1 when not at a selection. - */ - Int32 SelectionFromPoint(Int32 x, Int32 y); - - /** - * Drop one selection - */ - void DropSelectionN(Int32 selection); - - /** - * Set the main selection to the next selection. - */ - void RotateSelection(); - - /** - * Swap that caret and anchor of the main selection. - */ - void SwapMainAnchorCaret(); - - /** - * 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. - */ - void MultipleSelectAddNext(); - - /** - * 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. - */ - void MultipleSelectAddEach(); - - /** - * Indicate that the internal state of a lexer has changed over a range and therefore - * there may be a need to redraw. - */ - Int32 ChangeLexerState(Int64 start, Int64 end); - - /** - * Find the next line at or after lineStart that is a contracted fold header line. - * Return -1 when no more lines. - */ - Int64 ContractedFoldNext(Int64 lineStart); - - /** - * Centre current line in window. - */ - void VerticalCentreCaret(); - - /** - * Move the selected lines up one line, shifting the line above after the selection - */ - void MoveSelectedLinesUp(); - - /** - * Move the selected lines down one line, shifting the line below before the selection - */ - void MoveSelectedLinesDown(); - - /** - * Define a marker from RGBA data. - * It has the width and height from RGBAImageSetWidth/Height - */ - void MarkerDefineRGBAImageFromBuffer(Int32 markerNumber, Windows.Storage.Streams.IBuffer pixels); - void MarkerDefineRGBAImage(Int32 markerNumber, String pixels); - - /** - * Register an RGBA image for use in autocompletion lists. - * It has the width and height from RGBAImageSetWidth/Height - */ - void RegisterRGBAImageFromBuffer(Int32 type, Windows.Storage.Streams.IBuffer pixels); - void RegisterRGBAImage(Int32 type, String pixels); - - /** - * Scroll to start of document. - */ - void ScrollToStart(); - - /** - * Scroll to end of document. - */ - void ScrollToEnd(); - - /** - * Create an ILoader*. - */ - UInt64 CreateLoader(Int64 bytes, DocumentOption documentOptions); - - /** - * On macOS, show a find indicator. - */ - void FindIndicatorShow(Int64 start, Int64 end); - - /** - * On macOS, flash a find indicator, then fade out. - */ - void FindIndicatorFlash(Int64 start, Int64 end); - - /** - * On macOS, hide the find indicator. - */ - void FindIndicatorHide(); - - /** - * Move caret to before first visible character on display line. - * If already there move to first character on display line. - */ - void VCHomeDisplay(); - - /** - * Like VCHomeDisplay but extending selection to new caret position. - */ - void VCHomeDisplayExtend(); - - /** - * Remove a character representation. - */ - void ClearRepresentationFromBuffer(Windows.Storage.Streams.IBuffer encodedCharacter); - void ClearRepresentation(String encodedCharacter); - - /** - * Clear representations to default. - */ - void ClearAllRepresentations(); - - /** - * Clear the end of annotations from all lines - */ - void EOLAnnotationClearAll(); - - /** - * Request line character index be created or its use count increased. - */ - void AllocateLineCharacterIndex(LineCharacterIndexType lineCharacterIndex); - - /** - * Decrease use count of line character index and remove if 0. - */ - void ReleaseLineCharacterIndex(LineCharacterIndexType lineCharacterIndex); - - /** - * Retrieve the document line containing a position measured in index units. - */ - Int64 LineFromIndexPosition(Int64 pos, LineCharacterIndexType lineCharacterIndex); - - /** - * Retrieve the position measured in index units at the start of a document line. - */ - Int64 IndexPositionFromLine(Int64 line, LineCharacterIndexType lineCharacterIndex); - - /** - * Start notifying the container of all key presses and commands. - */ - void StartRecord(); - - /** - * Stop notifying the container of all key presses and commands. - */ - void StopRecord(); - - /** - * Colourise a segment of the document using the current lexing language. - */ - void Colourise(Int64 start, Int64 end); - - /** - * For private communication between an application and a known lexer. - */ - UInt64 PrivateLexerCall(Int32 operation, UInt64 pointer); - - /** - * Retrieve a '\n' separated list of properties understood by the current lexer. - * Result is NUL-terminated. - */ - Int32 PropertyNamesWriteBuffer(Windows.Storage.Streams.IBuffer names); - String PropertyNames(); - - /** - * Retrieve the type of a property. - */ - TypeProperty PropertyTypeFromBuffer(Windows.Storage.Streams.IBuffer name); - TypeProperty PropertyType(String name); - - /** - * Describe a property. - * Result is NUL-terminated. - */ - Int32 DescribePropertyWriteBuffer(Windows.Storage.Streams.IBuffer name, Windows.Storage.Streams.IBuffer description); - String DescribeProperty(String name); - - /** - * Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. - * Result is NUL-terminated. - */ - Int32 DescribeKeyWordSetsWriteBuffer(Windows.Storage.Streams.IBuffer descriptions); - String DescribeKeyWordSets(); - - /** - * Allocate a set of sub styles for a particular base style, returning start of range - */ - Int32 AllocateSubStyles(Int32 styleBase, Int32 numberStyles); - - /** - * Free allocated sub styles - */ - void FreeSubStyles(); - - /** - * Retrieve the name of a style. - * Result is NUL-terminated. - */ - Int32 NameOfStyleWriteBuffer(Int32 style, Windows.Storage.Streams.IBuffer name); - String NameOfStyle(Int32 style); - - /** - * Retrieve a ' ' separated list of style tags like "literal quoted string". - * Result is NUL-terminated. - */ - Int32 TagsOfStyleWriteBuffer(Int32 style, Windows.Storage.Streams.IBuffer tags); - String TagsOfStyle(Int32 style); - - /** - * Retrieve a description of a style. - * Result is NUL-terminated. - */ - Int32 DescriptionOfStyleWriteBuffer(Int32 style, Windows.Storage.Streams.IBuffer description); - String DescriptionOfStyle(Int32 style); - - /** - * Returns the character byte at the position. - */ - Int32 GetCharAt(Int64 pos); - - /** - * Returns the style byte at the position. - */ - Int32 GetStyleAt(Int64 pos); - - /** - * Returns the unsigned style byte at the position. - */ - Int32 GetStyleIndexAt(Int64 pos); - - /** - * Get the locale for displaying text. - */ - Int32 GetFontLocaleWriteBuffer(Windows.Storage.Streams.IBuffer localeName); - String GetFontLocale(); - - /** - * Get the layer used for a marker that is drawn in the text area, not the margin. - */ - Layer MarkerGetLayer(Int32 markerNumber); - - /** - * Retrieve the type of a margin. - */ - MarginType GetMarginTypeN(Int32 margin); - - /** - * Retrieve the width of a margin in pixels. - */ - Int32 GetMarginWidthN(Int32 margin); - - /** - * Retrieve the marker mask of a margin. - */ - Int32 GetMarginMaskN(Int32 margin); - - /** - * Retrieve the mouse click sensitivity of a margin. - */ - Boolean GetMarginSensitiveN(Int32 margin); - - /** - * Retrieve the cursor shown in a margin. - */ - CursorShape GetMarginCursorN(Int32 margin); - - /** - * Retrieve the background colour of a margin - */ - Int32 GetMarginBackN(Int32 margin); - - /** - * Get the foreground colour of a style. - */ - Int32 StyleGetFore(Int32 style); - - /** - * Get the background colour of a style. - */ - Int32 StyleGetBack(Int32 style); - - /** - * Get is a style bold or not. - */ - Boolean StyleGetBold(Int32 style); - - /** - * Get is a style italic or not. - */ - Boolean StyleGetItalic(Int32 style); - - /** - * Get the size of characters of a style. - */ - Int32 StyleGetSize(Int32 style); - - /** - * Get the font of a style. - * Returns the length of the fontName - * Result is NUL-terminated. - */ - Int32 StyleGetFontWriteBuffer(Int32 style, Windows.Storage.Streams.IBuffer fontName); - String StyleGetFont(Int32 style); - - /** - * Get is a style to have its end of line filled or not. - */ - Boolean StyleGetEOLFilled(Int32 style); - - /** - * Get is a style underlined or not. - */ - Boolean StyleGetUnderline(Int32 style); - - /** - * Get is a style mixed case, or to force upper or lower case. - */ - CaseVisible StyleGetCase(Int32 style); - - /** - * Get the character get of the font in a style. - */ - CharacterSet StyleGetCharacterSet(Int32 style); - - /** - * Get is a style visible or not. - */ - Boolean StyleGetVisible(Int32 style); - - /** - * Get is a style changeable or not (read only). - * Experimental feature, currently buggy. - */ - Boolean StyleGetChangeable(Int32 style); - - /** - * Get is a style a hotspot or not. - */ - Boolean StyleGetHotSpot(Int32 style); - - /** - * Get the size of characters of a style in points multiplied by 100 - */ - Int32 StyleGetSizeFractional(Int32 style); - - /** - * Get the weight of characters of a style. - */ - FontWeight StyleGetWeight(Int32 style); - - /** - * Get whether a style may be monospaced. - */ - Boolean StyleGetCheckMonospaced(Int32 style); - - /** - * Get the invisible representation for a style. - */ - Int32 StyleGetInvisibleRepresentationWriteBuffer(Int32 style, Windows.Storage.Streams.IBuffer representation); - String StyleGetInvisibleRepresentation(Int32 style); - - /** - * Get the colour of an element. - */ - Int32 GetElementColour(Element element); - - /** - * Get whether an element has been set by SetElementColour. - * When false, a platform-defined or default colour is used. - */ - Boolean GetElementIsSet(Element element); - - /** - * Get whether an element supports translucency. - */ - Boolean GetElementAllowsTranslucent(Element element); - - /** - * Get the colour of an element. - */ - Int32 GetElementBaseColour(Element element); - - /** - * Get the set of characters making up words for when moving or selecting by word. - * Returns the number of characters - */ - Int32 GetWordCharsWriteBuffer(Windows.Storage.Streams.IBuffer characters); - String GetWordChars(); - - /** - * What is the type of an action? - */ - Int32 GetUndoActionType(Int32 action); - - /** - * What is the position of an action? - */ - Int64 GetUndoActionPosition(Int32 action); - - /** - * What is the text of an action? - */ - Int32 GetUndoActionTextWriteBuffer(Int32 action, Windows.Storage.Streams.IBuffer text); - String GetUndoActionText(Int32 action); - - /** - * Retrieve the style of an indicator. - */ - IndicatorStyle IndicGetStyle(Int32 indicator); - - /** - * Retrieve the foreground colour of an indicator. - */ - Int32 IndicGetFore(Int32 indicator); - - /** - * Retrieve whether indicator drawn under or over text. - */ - Boolean IndicGetUnder(Int32 indicator); - - /** - * Retrieve the hover style of an indicator. - */ - IndicatorStyle IndicGetHoverStyle(Int32 indicator); - - /** - * Retrieve the foreground hover colour of an indicator. - */ - Int32 IndicGetHoverFore(Int32 indicator); - - /** - * Retrieve the attributes of an indicator. - */ - IndicFlag IndicGetFlags(Int32 indicator); - - /** - * Retrieve the stroke width of an indicator. - */ - Int32 IndicGetStrokeWidth(Int32 indicator); - - /** - * Retrieve the extra styling information for a line. - */ - Int32 GetLineState(Int64 line); - - /** - * Retrieve the number of columns that a line is indented. - */ - Int32 GetLineIndentation(Int64 line); - - /** - * Retrieve the position before the first non indentation character on a line. - */ - Int64 GetLineIndentPosition(Int64 line); - - /** - * Retrieve the column number of a position, taking tab width into account. - */ - Int64 GetColumn(Int64 pos); - - /** - * Get the position after the last visible characters on a line. - */ - Int64 GetLineEndPosition(Int64 line); - - /** - * Retrieve the text in the target. - */ - Int64 GetTargetTextWriteBuffer(Windows.Storage.Streams.IBuffer text); - String GetTargetText(); - - /** - * Retrieve the fold level of a line. - */ - FoldLevel GetFoldLevel(Int64 line); - - /** - * Find the last child line of a header line. - */ - Int64 GetLastChild(Int64 line, FoldLevel level); - - /** - * Find the parent line of a child line. - */ - Int64 GetFoldParent(Int64 line); - - /** - * Is a line visible? - */ - Boolean GetLineVisible(Int64 line); - - /** - * Is a header line expanded? - */ - Boolean GetFoldExpanded(Int64 line); - - /** - * Retrieve the value of a tag from a regular expression search. - * Result is NUL-terminated. - */ - Int32 GetTagWriteBuffer(Int32 tagNumber, Windows.Storage.Streams.IBuffer tagValue); - String GetTag(Int32 tagNumber); - - /** - * Get multi edge positions. - */ - Int64 GetMultiEdgeColumn(Int32 which); - - /** - * Get the fore colour for active hotspots. - */ - Int32 GetHotspotActiveFore(); - - /** - * Get the back colour for active hotspots. - */ - Int32 GetHotspotActiveBack(); - - /** - * Get the set of characters making up whitespace for when moving or selecting by word. - */ - Int32 GetWhitespaceCharsWriteBuffer(Windows.Storage.Streams.IBuffer characters); - String GetWhitespaceChars(); - - /** - * Get the set of characters making up punctuation characters - */ - Int32 GetPunctuationCharsWriteBuffer(Windows.Storage.Streams.IBuffer characters); - String GetPunctuationChars(); - - /** - * Get currently selected item text in the auto-completion list - * Returns the length of the item text - * Result is NUL-terminated. - */ - Int32 AutoCGetCurrentTextWriteBuffer(Windows.Storage.Streams.IBuffer text); - String AutoCGetCurrentText(); - - /** - * 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 lengthRange bytes. - */ - UInt64 GetRangePointer(Int64 start, Int64 lengthRange); - - /** - * Get the alpha fill colour of the given indicator. - */ - Alpha IndicGetAlpha(Int32 indicator); - - /** - * Get the alpha outline colour of the given indicator. - */ - Alpha IndicGetOutlineAlpha(Int32 indicator); - - /** - * Get the text in the text margin for a line - */ - Int32 MarginGetTextWriteBuffer(Int64 line, Windows.Storage.Streams.IBuffer text); - String MarginGetText(Int64 line); - - /** - * Get the style number for the text margin for a line - */ - Int32 MarginGetStyle(Int64 line); - - /** - * Get the styles in the text margin for a line - */ - Int32 MarginGetStylesWriteBuffer(Int64 line, Windows.Storage.Streams.IBuffer styles); - String MarginGetStyles(Int64 line); - - /** - * Get the annotation text for a line - */ - Int32 AnnotationGetTextWriteBuffer(Int64 line, Windows.Storage.Streams.IBuffer text); - String AnnotationGetText(Int64 line); - - /** - * Get the style number for the annotations for a line - */ - Int32 AnnotationGetStyle(Int64 line); - - /** - * Get the annotation styles for a line - */ - Int32 AnnotationGetStylesWriteBuffer(Int64 line, Windows.Storage.Streams.IBuffer styles); - String AnnotationGetStyles(Int64 line); - - /** - * Get the number of annotation lines for a line - */ - Int32 AnnotationGetLines(Int64 line); - - /** - * Return the caret position of the nth selection. - */ - Int64 GetSelectionNCaret(Int32 selection); - - /** - * Return the anchor position of the nth selection. - */ - Int64 GetSelectionNAnchor(Int32 selection); - - /** - * Return the virtual space of the caret of the nth selection. - */ - Int64 GetSelectionNCaretVirtualSpace(Int32 selection); - - /** - * Return the virtual space of the anchor of the nth selection. - */ - Int64 GetSelectionNAnchorVirtualSpace(Int32 selection); - - /** - * Returns the position at the start of the selection. - */ - Int64 GetSelectionNStart(Int32 selection); - - /** - * Returns the virtual space at the start of the selection. - */ - Int64 GetSelectionNStartVirtualSpace(Int32 selection); - - /** - * Returns the virtual space at the end of the selection. - */ - Int64 GetSelectionNEndVirtualSpace(Int32 selection); - - /** - * Returns the position at the end of the selection. - */ - Int64 GetSelectionNEnd(Int32 selection); - - /** - * Get the way a character is drawn. - * Result is NUL-terminated. - */ - Int32 GetRepresentationWriteBuffer(Windows.Storage.Streams.IBuffer encodedCharacter, Windows.Storage.Streams.IBuffer representation); - String GetRepresentation(String encodedCharacter); - - /** - * Get the appearance of a representation. - */ - RepresentationAppearance GetRepresentationAppearanceFromBuffer(Windows.Storage.Streams.IBuffer encodedCharacter); - RepresentationAppearance GetRepresentationAppearance(String encodedCharacter); - - /** - * Get the colour of a representation. - */ - Int32 GetRepresentationColourFromBuffer(Windows.Storage.Streams.IBuffer encodedCharacter); - Int32 GetRepresentationColour(String encodedCharacter); - - /** - * Get the end of line annotation text for a line - */ - Int32 EOLAnnotationGetTextWriteBuffer(Int64 line, Windows.Storage.Streams.IBuffer text); - String EOLAnnotationGetText(Int64 line); - - /** - * Get the style number for the end of line annotations for a line - */ - Int32 EOLAnnotationGetStyle(Int64 line); - - /** - * Get whether a feature is supported - */ - Boolean SupportsFeature(Supports feature); - - /** - * Retrieve a "property" value previously set with SetProperty. - * Result is NUL-terminated. - */ - Int32 GetPropertyWriteBuffer(Windows.Storage.Streams.IBuffer key, Windows.Storage.Streams.IBuffer value); - String GetProperty(String key); - - /** - * Retrieve a "property" value previously set with SetProperty, - * with "$()" variable replacement on returned buffer. - * Result is NUL-terminated. - */ - Int32 GetPropertyExpandedWriteBuffer(Windows.Storage.Streams.IBuffer key, Windows.Storage.Streams.IBuffer value); - String GetPropertyExpanded(String key); - - /** - * Retrieve a "property" value previously set with SetProperty, - * interpreted as an int AFTER any "$()" variable replacement. - */ - Int32 GetPropertyIntFromBuffer(Windows.Storage.Streams.IBuffer key, Int32 defaultValue); - Int32 GetPropertyInt(String key, Int32 defaultValue); - - /** - * Retrieve the name of the lexer. - * Return the length of the text. - * Result is NUL-terminated. - */ - Int32 GetLexerLanguageWriteBuffer(Windows.Storage.Streams.IBuffer language); - String GetLexerLanguage(); - - /** - * The starting style number for the sub styles associated with a base style - */ - Int32 GetSubStylesStart(Int32 styleBase); - - /** - * The number of sub styles associated with a base style - */ - Int32 GetSubStylesLength(Int32 styleBase); - - /** - * For a sub style, return the base style, else return the argument. - */ - Int32 GetStyleFromSubStyle(Int32 subStyle); - - /** - * For a secondary style, return the primary style, else return the argument. - */ - Int32 GetPrimaryStyleFromStyle(Int32 style); - - /** - * Get the set of base styles that can be extended with sub styles - * Result is NUL-terminated. - */ - Int32 GetSubStyleBasesWriteBuffer(Windows.Storage.Streams.IBuffer styles); - String GetSubStyleBases(); - - /** - * Set the locale for displaying text. - */ - void SetFontLocaleFromBuffer(Windows.Storage.Streams.IBuffer localeName); - void SetFontLocale(String localeName); - - /** - * Set the foreground colour used for a particular marker number. - */ - void MarkerSetFore(Int32 markerNumber, Int32 fore); - - /** - * Set the background colour used for a particular marker number. - */ - void MarkerSetBack(Int32 markerNumber, Int32 back); - - /** - * Set the background colour used for a particular marker number when its folding block is selected. - */ - void MarkerSetBackSelected(Int32 markerNumber, Int32 back); - - /** - * Set the foreground colour used for a particular marker number. - */ - void MarkerSetForeTranslucent(Int32 markerNumber, Int32 fore); - - /** - * Set the background colour used for a particular marker number. - */ - void MarkerSetBackTranslucent(Int32 markerNumber, Int32 back); - - /** - * Set the background colour used for a particular marker number when its folding block is selected. - */ - void MarkerSetBackSelectedTranslucent(Int32 markerNumber, Int32 back); - - /** - * Set the width of strokes used in .01 pixels so 50 = 1/2 pixel width. - */ - void MarkerSetStrokeWidth(Int32 markerNumber, Int32 hundredths); - - /** - * Set the alpha used for a marker that is drawn in the text area, not the margin. - */ - void MarkerSetAlpha(Int32 markerNumber, Alpha alpha); - - /** - * Set the layer used for a marker that is drawn in the text area, not the margin. - */ - void MarkerSetLayer(Int32 markerNumber, Layer layer); - - /** - * Set a margin to be either numeric or symbolic. - */ - void SetMarginTypeN(Int32 margin, MarginType marginType); - - /** - * Set the width of a margin to a width expressed in pixels. - */ - void SetMarginWidthN(Int32 margin, Int32 pixelWidth); - - /** - * Set a mask that determines which markers are displayed in a margin. - */ - void SetMarginMaskN(Int32 margin, Int32 mask); - - /** - * Make a margin sensitive or insensitive to mouse clicks. - */ - void SetMarginSensitiveN(Int32 margin, Boolean sensitive); - - /** - * Set the cursor shown when the mouse is inside a margin. - */ - void SetMarginCursorN(Int32 margin, CursorShape cursor); - - /** - * Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. - */ - void SetMarginBackN(Int32 margin, Int32 back); - - /** - * Set the foreground colour of a style. - */ - void StyleSetFore(Int32 style, Int32 fore); - - /** - * Set the background colour of a style. - */ - void StyleSetBack(Int32 style, Int32 back); - - /** - * Set a style to be bold or not. - */ - void StyleSetBold(Int32 style, Boolean bold); - - /** - * Set a style to be italic or not. - */ - void StyleSetItalic(Int32 style, Boolean italic); - - /** - * Set the size of characters of a style. - */ - void StyleSetSize(Int32 style, Int32 sizePoints); - - /** - * Set the font of a style. - */ - void StyleSetFontFromBuffer(Int32 style, Windows.Storage.Streams.IBuffer fontName); - void StyleSetFont(Int32 style, String fontName); - - /** - * Set a style to have its end of line filled or not. - */ - void StyleSetEOLFilled(Int32 style, Boolean eolFilled); - - /** - * Set a style to be underlined or not. - */ - void StyleSetUnderline(Int32 style, Boolean underline); - - /** - * Set a style to be mixed case, or to force upper or lower case. - */ - void StyleSetCase(Int32 style, CaseVisible caseVisible); - - /** - * Set the size of characters of a style. Size is in points multiplied by 100. - */ - void StyleSetSizeFractional(Int32 style, Int32 sizeHundredthPoints); - - /** - * Set the weight of characters of a style. - */ - void StyleSetWeight(Int32 style, FontWeight weight); - - /** - * Set the character set of the font in a style. - */ - void StyleSetCharacterSet(Int32 style, CharacterSet characterSet); - - /** - * Set a style to be a hotspot or not. - */ - void StyleSetHotSpot(Int32 style, Boolean hotspot); - - /** - * Indicate that a style may be monospaced over ASCII graphics characters which enables optimizations. - */ - void StyleSetCheckMonospaced(Int32 style, Boolean checkMonospaced); - - /** - * Set the invisible representation for a style. - */ - void StyleSetInvisibleRepresentationFromBuffer(Int32 style, Windows.Storage.Streams.IBuffer representation); - void StyleSetInvisibleRepresentation(Int32 style, String representation); - - /** - * Set the colour of an element. Translucency (alpha) may or may not be significant - * and this may depend on the platform. The alpha byte should commonly be 0xff for opaque. - */ - void SetElementColour(Element element, Int32 colourElement); - - /** - * Set a style to be visible or not. - */ - void StyleSetVisible(Int32 style, Boolean visible); - - /** - * Set the set of characters making up words for when moving or selecting by word. - * First sets defaults like SetCharsDefault. - */ - void SetWordCharsFromBuffer(Windows.Storage.Streams.IBuffer characters); - void SetWordChars(String characters); - - /** - * Set an indicator to plain, squiggle or TT. - */ - void IndicSetStyle(Int32 indicator, IndicatorStyle indicatorStyle); - - /** - * Set the foreground colour of an indicator. - */ - void IndicSetFore(Int32 indicator, Int32 fore); - - /** - * Set an indicator to draw under text or over(default). - */ - void IndicSetUnder(Int32 indicator, Boolean under); - - /** - * Set a hover indicator to plain, squiggle or TT. - */ - void IndicSetHoverStyle(Int32 indicator, IndicatorStyle indicatorStyle); - - /** - * Set the foreground hover colour of an indicator. - */ - void IndicSetHoverFore(Int32 indicator, Int32 fore); - - /** - * Set the attributes of an indicator. - */ - void IndicSetFlags(Int32 indicator, IndicFlag flags); - - /** - * Set the stroke width of an indicator in hundredths of a pixel. - */ - void IndicSetStrokeWidth(Int32 indicator, Int32 hundredths); - - /** - * Used to hold extra styling information for each line. - */ - void SetLineState(Int64 line, Int32 state); - - /** - * Set a style to be changeable or not (read only). - * Experimental feature, currently buggy. - */ - void StyleSetChangeable(Int32 style, Boolean changeable); - - /** - * Define a set of characters that when typed will cause the autocompletion to - * choose the selected item. - */ - void AutoCSetFillUpsFromBuffer(Windows.Storage.Streams.IBuffer characterSet); - void AutoCSetFillUps(String characterSet); - - /** - * Change the indentation of a line to a number of columns. - */ - void SetLineIndentation(Int64 line, Int32 indentation); - - /** - * Enlarge the number of lines allocated. - */ - void AllocateLines(Int64 lines); - - /** - * Set the start position in order to change when backspacing removes the calltip. - */ - void CallTipSetPosStart(Int64 posStart); - - /** - * Set the background colour for the call tip. - */ - void CallTipSetBack(Int32 back); - - /** - * Set the foreground colour for the call tip. - */ - void CallTipSetFore(Int32 fore); - - /** - * Set the foreground colour for the highlighted part of the call tip. - */ - void CallTipSetForeHlt(Int32 fore); - - /** - * Enable use of STYLE_CALLTIP and set call tip tab size in pixels. - */ - void CallTipUseStyle(Int32 tabSize); - - /** - * Set position of calltip, above or below text. - */ - void CallTipSetPosition(Boolean above); - - /** - * 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. - */ - void SetFoldLevel(Int64 line, FoldLevel level); - - /** - * Show the children of a header line. - */ - void SetFoldExpanded(Int64 line, Boolean expanded); - - /** - * Set some style options for folding. - */ - void SetFoldFlags(FoldFlag flags); - - /** - * Set a fore colour for active hotspots. - */ - void SetHotspotActiveFore(Boolean useSetting, Int32 fore); - - /** - * Set a back colour for active hotspots. - */ - void SetHotspotActiveBack(Boolean useSetting, Int32 back); - - /** - * Set the set of characters making up whitespace for when moving or selecting by word. - * Should be called after SetWordChars. - */ - void SetWhitespaceCharsFromBuffer(Windows.Storage.Streams.IBuffer characters); - void SetWhitespaceChars(String characters); - - /** - * Set the set of characters making up punctuation characters - * Should be called after SetWordChars. - */ - void SetPunctuationCharsFromBuffer(Windows.Storage.Streams.IBuffer characters); - void SetPunctuationChars(String characters); - - /** - * Set the alpha fill colour of the given indicator. - */ - void IndicSetAlpha(Int32 indicator, Alpha alpha); - - /** - * Set the alpha outline colour of the given indicator. - */ - void IndicSetOutlineAlpha(Int32 indicator, Alpha alpha); - - /** - * Set the text in the text margin for a line - */ - void MarginSetTextFromBuffer(Int64 line, Windows.Storage.Streams.IBuffer text); - void MarginSetText(Int64 line, String text); - - /** - * Set the style number for the text margin for a line - */ - void MarginSetStyle(Int64 line, Int32 style); - - /** - * Set the style in the text margin for a line - */ - void MarginSetStylesFromBuffer(Int64 line, Windows.Storage.Streams.IBuffer styles); - void MarginSetStyles(Int64 line, String styles); - - /** - * Set the annotation text for a line - */ - void AnnotationSetTextFromBuffer(Int64 line, Windows.Storage.Streams.IBuffer text); - void AnnotationSetText(Int64 line, String text); - - /** - * Set the style number for the annotations for a line - */ - void AnnotationSetStyle(Int64 line, Int32 style); - - /** - * Set the annotation styles for a line - */ - void AnnotationSetStylesFromBuffer(Int64 line, Windows.Storage.Streams.IBuffer styles); - void AnnotationSetStyles(Int64 line, String styles); - - /** - * Set the caret position of the nth selection. - */ - void SetSelectionNCaret(Int32 selection, Int64 caret); - - /** - * Set the anchor position of the nth selection. - */ - void SetSelectionNAnchor(Int32 selection, Int64 anchor); - - /** - * Set the virtual space of the caret of the nth selection. - */ - void SetSelectionNCaretVirtualSpace(Int32 selection, Int64 space); - - /** - * Set the virtual space of the anchor of the nth selection. - */ - void SetSelectionNAnchorVirtualSpace(Int32 selection, Int64 space); - - /** - * Sets the position that starts the selection - this becomes the anchor. - */ - void SetSelectionNStart(Int32 selection, Int64 anchor); - - /** - * Sets the position that ends the selection - this becomes the currentPosition. - */ - void SetSelectionNEnd(Int32 selection, Int64 caret); - - /** - * Set the foreground colour of additional selections. - * Must have previously called SetSelFore with non-zero first argument for this to have an effect. - */ - void SetAdditionalSelFore(Int32 fore); - - /** - * Set the background colour of additional selections. - * Must have previously called SetSelBack with non-zero first argument for this to have an effect. - */ - void SetAdditionalSelBack(Int32 back); - - /** - * Set the width for future RGBA image data. - */ - void RGBAImageSetWidth(Int32 width); - - /** - * Set the height for future RGBA image data. - */ - void RGBAImageSetHeight(Int32 height); - - /** - * Set the scale factor in percent for future RGBA image data. - */ - void RGBAImageSetScale(Int32 scalePercent); - - /** - * Set the way a character is drawn. - */ - void SetRepresentationFromBuffer(Windows.Storage.Streams.IBuffer encodedCharacter, Windows.Storage.Streams.IBuffer representation); - void SetRepresentation(String encodedCharacter, String representation); - - /** - * Set the appearance of a representation. - */ - void SetRepresentationAppearanceFromBuffer(Windows.Storage.Streams.IBuffer encodedCharacter, RepresentationAppearance appearance); - void SetRepresentationAppearance(String encodedCharacter, RepresentationAppearance appearance); - - /** - * Set the colour of a representation. - */ - void SetRepresentationColourFromBuffer(Windows.Storage.Streams.IBuffer encodedCharacter, Int32 colour); - void SetRepresentationColour(String encodedCharacter, Int32 colour); - - /** - * Set the end of line annotation text for a line - */ - void EOLAnnotationSetTextFromBuffer(Int64 line, Windows.Storage.Streams.IBuffer text); - void EOLAnnotationSetText(Int64 line, String text); - - /** - * Set the style number for the end of line annotations for a line - */ - void EOLAnnotationSetStyle(Int64 line, Int32 style); - - /** - * Set up a value that may be used by a lexer for some optional feature. - */ - void SetPropertyFromBuffer(Windows.Storage.Streams.IBuffer key, Windows.Storage.Streams.IBuffer value); - void SetProperty(String key, String value); - - /** - * Set up the key words used by the lexer. - */ - void SetKeyWordsFromBuffer(Int32 keyWordSet, Windows.Storage.Streams.IBuffer keyWords); - void SetKeyWords(Int32 keyWordSet, String keyWords); - - /** - * Set the identifiers that are shown in a particular style - */ - void SetIdentifiersFromBuffer(Int32 style, Windows.Storage.Streams.IBuffer identifiers); - void SetIdentifiers(Int32 style, String identifiers); - - /** - * Set the lexer from an ILexer*. - */ - void SetILexer(UInt64 ilexer); - } -} diff --git a/WinUIEditor/Helpers.cpp b/WinUIEditor/Helpers.cpp deleted file mode 100644 index 5e7557f..0000000 --- a/WinUIEditor/Helpers.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "pch.h" -#include "Helpers.h" - -namespace WinUIEditor -{ - // Derived from https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/ComplexInk/cpp/Common/DeviceResources.h - int ConvertFromDipToPixelUnit(float val, float dpiAdjustmentRatio, bool rounded) - { - float pixelVal = val * dpiAdjustmentRatio; - return static_cast(rounded ? floorf(pixelVal + 0.5f) : pixelVal); // Todo: Test if this is ever necessary - } - - typedef LONG(WINAPI *AppPolicyGetWindowingModelPtr)(HANDLE processToken, AppPolicyWindowingModel *policy); - static AppPolicyGetWindowingModelPtr s_appPolicyGetWindowingModel; - - bool IsClassicWindow() - { - // To avoid issues with AppPolicyGetWindowingModel and Store certification, this method cannot be called normally - // See https://github.com/microsoft/react-native-windows/pull/5369 (though OneCoreUAP_apiset.lib did not pass either) - - if (!s_appPolicyGetWindowingModel) - { - s_appPolicyGetWindowingModel = - reinterpret_cast(GetProcAddress(GetModuleHandleW(L"Api-ms-win-appmodel-runtime-l1-1-2.dll"), "AppPolicyGetWindowingModel")); - } - AppPolicyWindowingModel model; - return !(s_appPolicyGetWindowingModel && SUCCEEDED(s_appPolicyGetWindowingModel(GetCurrentThreadEffectiveToken(), &model))) - || model != AppPolicyWindowingModel_Universal; - } - - winrt::Windows::System::VirtualKeyModifiers GetKeyModifiersForCurrentThread() - { - auto modifiers{ winrt::Windows::System::VirtualKeyModifiers::None }; - -#ifdef WINUI3 - // Todo: Do we need to check Locked? - // Todo: Left vs right keys? - // does not help us - if ((winrt::Microsoft::UI::Input::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::Windows::System::VirtualKey::Shift) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) - { - modifiers |= winrt::Windows::System::VirtualKeyModifiers::Shift; - } - if ((winrt::Microsoft::UI::Input::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::Windows::System::VirtualKey::Control) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) - { - modifiers |= winrt::Windows::System::VirtualKeyModifiers::Control; - } - if ((winrt::Microsoft::UI::Input::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::Windows::System::VirtualKey::Menu) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) - { - modifiers |= winrt::Windows::System::VirtualKeyModifiers::Menu; // Todo: KeyStatus.IsMenuKeyDown? - } - if ((winrt::Microsoft::UI::Input::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::Windows::System::VirtualKey::LeftWindows) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down - || (winrt::Microsoft::UI::Input::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::Windows::System::VirtualKey::RightWindows) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) - { - modifiers |= winrt::Windows::System::VirtualKeyModifiers::Windows; - } -#else - const auto window{ winrt::Windows::UI::Core::CoreWindow::GetForCurrentThread() }; // Todo: is it worth it to store this? - // Todo: Do we need to check Locked? - // Todo: Left vs right keys? - if ((window.GetKeyState(winrt::Windows::System::VirtualKey::Shift) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) - { - modifiers |= winrt::Windows::System::VirtualKeyModifiers::Shift; - } - if ((window.GetKeyState(winrt::Windows::System::VirtualKey::Control) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) - { - modifiers |= winrt::Windows::System::VirtualKeyModifiers::Control; - } - if ((window.GetKeyState(winrt::Windows::System::VirtualKey::Menu) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) - { - modifiers |= winrt::Windows::System::VirtualKeyModifiers::Menu; // Todo: KeyStatus.IsMenuKeyDown? - } - if ((window.GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down - || (window.GetKeyState(winrt::Windows::System::VirtualKey::RightWindows) & winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) - { - modifiers |= winrt::Windows::System::VirtualKeyModifiers::Windows; - } -#endif - - return modifiers; - } -} diff --git a/WinUIEditor/Helpers.h b/WinUIEditor/Helpers.h deleted file mode 100644 index 5824174..0000000 --- a/WinUIEditor/Helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -namespace WinUIEditor -{ - int ConvertFromDipToPixelUnit(float val, float dpiAdjustmentRatio, bool rounded = true); - bool IsClassicWindow(); - winrt::Windows::System::VirtualKeyModifiers GetKeyModifiersForCurrentThread(); -} diff --git a/WinUIEditor/IEditorAccess.idl b/WinUIEditor/IEditorAccess.idl deleted file mode 100644 index 208edf3..0000000 --- a/WinUIEditor/IEditorAccess.idl +++ /dev/null @@ -1,10 +0,0 @@ -import "EditorWrapper.idl"; - -namespace WinUIEditor -{ - interface IEditorAccess - { - Int64 SendMessage(ScintillaMessage message, UInt64 wParam, Int64 lParam); - event Windows.Foundation.EventHandler NotifyMessageReceived; - } -} diff --git a/WinUIEditor/LightPlus.h b/WinUIEditor/LightPlus.h deleted file mode 100644 index 91c46e9..0000000 --- a/WinUIEditor/LightPlus.h +++ /dev/null @@ -1,225 +0,0 @@ -// Ported from -// https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/light_plus.json -// https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/light_vs.json -// under the following license - -/* - MIT License - - Copyright (c) 2015 - present Microsoft Corporation - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -namespace WinUIEditor -{ - constexpr int LightPlusEditorForeground{ IntRGBA(0x00, 0x00, 0x00) }; - - constexpr int LightPlus(Scope scope) - { - switch (scope) - { - case Scope::MetaEmbedded: return IntRGBA(0x00, 0x00, 0x00); - case Scope::SourceGroovyEmbedded: return IntRGBA(0x00, 0x00, 0x00); - case Scope::String__MetaImageInlineMarkdown: return IntRGBA(0x00, 0x00, 0x00); - case Scope::VariableLegacyBuiltinPython: return IntRGBA(0x00, 0x00, 0x00); - case Scope::MetaDiffHeader: return IntRGBA(0x00, 0x00, 0x80); - case Scope::Comment: return IntRGBA(0x00, 0x80, 0x00); - case Scope::ConstantLanguage: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::ConstantNumeric: return IntRGBA(0x09, 0x86, 0x58); - case Scope::VariableOtherEnummember: return IntRGBA(0x00, 0x70, 0xC1); - case Scope::KeywordOperatorPlusExponent: return IntRGBA(0x09, 0x86, 0x58); - case Scope::KeywordOperatorMinusExponent: return IntRGBA(0x09, 0x86, 0x58); - case Scope::ConstantRegexp: return IntRGBA(0x81, 0x1F, 0x3F); - case Scope::EntityNameTag: return IntRGBA(0x80, 0x00, 0x00); - case Scope::EntityNameSelector: return IntRGBA(0x80, 0x00, 0x00); - case Scope::EntityOtherAttribute_Name: return IntRGBA(0xE5, 0x00, 0x00); - case Scope::EntityOtherAttribute_NameClassCss: return IntRGBA(0x80, 0x00, 0x00); - case Scope::EntityOtherAttribute_NameClassMixinCss: return IntRGBA(0x80, 0x00, 0x00); - case Scope::EntityOtherAttribute_NameIdCss: return IntRGBA(0x80, 0x00, 0x00); - case Scope::EntityOtherAttribute_NameParent_SelectorCss: return IntRGBA(0x80, 0x00, 0x00); - case Scope::EntityOtherAttribute_NamePseudo_ClassCss: return IntRGBA(0x80, 0x00, 0x00); - case Scope::EntityOtherAttribute_NamePseudo_ElementCss: return IntRGBA(0x80, 0x00, 0x00); - case Scope::SourceCssLess__EntityOtherAttribute_NameId: return IntRGBA(0x80, 0x00, 0x00); - case Scope::EntityOtherAttribute_NameScss: return IntRGBA(0x80, 0x00, 0x00); - case Scope::Invalid: return IntRGBA(0xCD, 0x31, 0x31); - case Scope::MarkupBold: return IntRGBA(0x00, 0x00, 0x80); - case Scope::MarkupHeading: return IntRGBA(0x80, 0x00, 0x00); - case Scope::MarkupInserted: return IntRGBA(0x09, 0x86, 0x58); - case Scope::MarkupDeleted: return IntRGBA(0xA3, 0x15, 0x15); - case Scope::MarkupChanged: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::PunctuationDefinitionQuoteBeginMarkdown: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::PunctuationDefinitionListBeginMarkdown: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::MarkupInlineRaw: return IntRGBA(0x80, 0x00, 0x00); - case Scope::PunctuationDefinitionTag: return IntRGBA(0x80, 0x00, 0x00); - case Scope::MetaPreprocessor: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::EntityNameFunctionPreprocessor: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::MetaPreprocessorString: return IntRGBA(0xA3, 0x15, 0x15); - case Scope::MetaPreprocessorNumeric: return IntRGBA(0x09, 0x86, 0x58); - case Scope::MetaStructureDictionaryKeyPython: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::Storage: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StorageType: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StorageModifier: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorNoexcept: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::String: return IntRGBA(0xA3, 0x15, 0x15); - case Scope::MetaEmbeddedAssembly: return IntRGBA(0xA3, 0x15, 0x15); - case Scope::StringCommentBufferedBlockPug: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringQuotedPug: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringInterpolatedPug: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringUnquotedPlainInYaml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringUnquotedPlainOutYaml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringUnquotedBlockYaml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringQuotedSingleYaml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringQuotedDoubleXml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringQuotedSingleXml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringUnquotedCdataXml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringQuotedDoubleHtml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringQuotedSingleHtml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringUnquotedHtml: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringQuotedSingleHandlebars: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringQuotedDoubleHandlebars: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::StringRegexp: return IntRGBA(0x81, 0x1F, 0x3F); - case Scope::PunctuationDefinitionTemplate_ExpressionBegin: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::PunctuationDefinitionTemplate_ExpressionEnd: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::PunctuationSectionEmbedded: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::MetaTemplateExpression: return IntRGBA(0x00, 0x00, 0x00); - case Scope::SupportConstantProperty_Value: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::SupportConstantFont_Name: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::SupportConstantMedia_Type: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::SupportConstantMedia: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::ConstantOtherColorRgb_Value: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::ConstantOtherRgb_Value: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::SupportConstantColor: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::SupportTypeVendoredProperty_Name: return IntRGBA(0xE5, 0x00, 0x00); - case Scope::SupportTypeProperty_Name: return IntRGBA(0xE5, 0x00, 0x00); - case Scope::VariableCss: return IntRGBA(0xE5, 0x00, 0x00); - case Scope::VariableScss: return IntRGBA(0xE5, 0x00, 0x00); - case Scope::VariableOtherLess: return IntRGBA(0xE5, 0x00, 0x00); - case Scope::SourceCoffeeEmbedded: return IntRGBA(0xE5, 0x00, 0x00); - case Scope::SupportTypeProperty_NameJson: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::Keyword: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordControl: return IntRGBA(0xAF, 0x00, 0xDB); - case Scope::KeywordOperator: return IntRGBA(0x00, 0x00, 0x00); - case Scope::KeywordOperatorNew: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorExpression: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorCast: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorSizeof: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorAlignof: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorTypeid: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorAlignas: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorInstanceof: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorLogicalPython: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOperatorWordlike: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::KeywordOtherUnit: return IntRGBA(0x09, 0x86, 0x58); - case Scope::PunctuationSectionEmbeddedBeginPhp: return IntRGBA(0x80, 0x00, 0x00); - case Scope::PunctuationSectionEmbeddedEndPhp: return IntRGBA(0x80, 0x00, 0x00); - case Scope::SupportFunctionGit_Rebase: return IntRGBA(0x04, 0x51, 0xA5); - case Scope::ConstantShaGit_Rebase: return IntRGBA(0x09, 0x86, 0x58); - case Scope::StorageModifierImportJava: return IntRGBA(0x00, 0x00, 0x00); - case Scope::VariableLanguageWildcardJava: return IntRGBA(0x00, 0x00, 0x00); - case Scope::StorageModifierPackageJava: return IntRGBA(0x00, 0x00, 0x00); - case Scope::VariableLanguage: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::EntityNameFunction: return IntRGBA(0x79, 0x5E, 0x26); - case Scope::SupportFunction: return IntRGBA(0x79, 0x5E, 0x26); - case Scope::SupportConstantHandlebars: return IntRGBA(0x79, 0x5E, 0x26); - case Scope::SourcePowershell__VariableOtherMember: return IntRGBA(0x79, 0x5E, 0x26); - case Scope::EntityNameOperatorCustom_Literal: return IntRGBA(0x79, 0x5E, 0x26); - case Scope::SupportClass: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::SupportType: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::EntityNameType: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::EntityNameNamespace: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::EntityOtherAttribute: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::EntityNameScope_Resolution: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::EntityNameClass: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeNumericGo: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeByteGo: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeBooleanGo: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeStringGo: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeUintptrGo: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeErrorGo: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeRuneGo: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeCs: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeGenericCs: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeModifierCs: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeVariableCs: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeAnnotationJava: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeGenericJava: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeJava: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeObjectArrayJava: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypePrimitiveArrayJava: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypePrimitiveJava: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeTokenJava: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeGroovy: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeAnnotationGroovy: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeParametersGroovy: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeGenericGroovy: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypeObjectArrayGroovy: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypePrimitiveArrayGroovy: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::StorageTypePrimitiveGroovy: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::MetaTypeCastExpr: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::MetaTypeNewExpr: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::SupportConstantMath: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::SupportConstantDom: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::SupportConstantJson: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::EntityOtherInherited_Class: return IntRGBA(0x26, 0x7F, 0x99); - case Scope::SourceCpp__KeywordOperatorNew: return IntRGBA(0xAF, 0x00, 0xDB); - case Scope::SourceCpp__KeywordOperatorDelete: return IntRGBA(0xAF, 0x00, 0xDB); - case Scope::KeywordOtherUsing: return IntRGBA(0xAF, 0x00, 0xDB); - case Scope::KeywordOtherDirectiveUsing: return IntRGBA(0xAF, 0x00, 0xDB); - case Scope::KeywordOtherOperator: return IntRGBA(0xAF, 0x00, 0xDB); - case Scope::EntityNameOperator: return IntRGBA(0xAF, 0x00, 0xDB); - case Scope::Variable: return IntRGBA(0x00, 0x10, 0x80); - case Scope::MetaDefinitionVariableName: return IntRGBA(0x00, 0x10, 0x80); - case Scope::SupportVariable: return IntRGBA(0x00, 0x10, 0x80); - case Scope::EntityNameVariable: return IntRGBA(0x00, 0x10, 0x80); - case Scope::ConstantOtherPlaceholder: return IntRGBA(0x00, 0x10, 0x80); - case Scope::VariableOtherConstant: return IntRGBA(0x00, 0x70, 0xC1); - case Scope::MetaObject_LiteralKey: return IntRGBA(0x00, 0x10, 0x80); - case Scope::PunctuationDefinitionGroupRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::PunctuationDefinitionGroupAssertionRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::PunctuationDefinitionCharacter_ClassRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::PunctuationCharacterSetBeginRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::PunctuationCharacterSetEndRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::KeywordOperatorNegationRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::SupportOtherParenthesisRegexp: return IntRGBA(0xD1, 0x69, 0x69); - case Scope::ConstantCharacterCharacter_ClassRegexp: return IntRGBA(0x81, 0x1F, 0x3F); - case Scope::ConstantOtherCharacter_ClassSetRegexp: return IntRGBA(0x81, 0x1F, 0x3F); - case Scope::ConstantOtherCharacter_ClassRegexp: return IntRGBA(0x81, 0x1F, 0x3F); - case Scope::ConstantCharacterSetRegexp: return IntRGBA(0x81, 0x1F, 0x3F); - case Scope::KeywordOperatorQuantifierRegexp: return IntRGBA(0x00, 0x00, 0x00); - case Scope::KeywordOperatorOrRegexp: return IntRGBA(0xEE, 0x00, 0x00); - case Scope::KeywordControlAnchorRegexp: return IntRGBA(0xEE, 0x00, 0x00); - case Scope::ConstantCharacter: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::ConstantOtherOption: return IntRGBA(0x00, 0x00, 0xFF); - case Scope::ConstantCharacterEscape: return IntRGBA(0xEE, 0x00, 0x00); - case Scope::EntityNameLabel: return IntRGBA(0x00, 0x00, 0x00); - } - } - - constexpr int LightPlus2(Scope scope) - { - switch (scope) - { - case Scope::MetaPreprocessor: return IntRGBA(0x80, 0x80, 0x80); - default: return LightPlus(scope); - } - } -} diff --git a/WinUIEditor/TextMateScope.h b/WinUIEditor/TextMateScope.h deleted file mode 100644 index 3709191..0000000 --- a/WinUIEditor/TextMateScope.h +++ /dev/null @@ -1,215 +0,0 @@ -// Ported from -// https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/light_plus.json -// https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/light_vs.json -// https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/dark_plus.json -// https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/dark_vs.json -// under the following license - -/* - MIT License - - Copyright (c) 2015 - present Microsoft Corporation - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -enum class Scope -{ - MetaEmbedded, // meta.embedded - SourceGroovyEmbedded, // source.groovy.embedded - String__MetaImageInlineMarkdown, // string meta.image.inline.markdown - VariableLegacyBuiltinPython, // variable.legacy.builtin.python - MetaDiffHeader, // meta.diff.header - Comment, // comment - ConstantLanguage, // constant.language - ConstantNumeric, // constant.numeric - VariableOtherEnummember, // variable.other.enummember - KeywordOperatorPlusExponent, // keyword.operator.plus.exponent - KeywordOperatorMinusExponent, // keyword.operator.minus.exponent - ConstantRegexp, // constant.regexp - EntityNameTag, // entity.name.tag - EntityNameSelector, // entity.name.selector - EntityOtherAttribute_Name, // entity.other.attribute-name - EntityOtherAttribute_NameClassCss, // entity.other.attribute-name.class.css - EntityOtherAttribute_NameClassMixinCss, // entity.other.attribute-name.class.mixin.css - EntityOtherAttribute_NameIdCss, // entity.other.attribute-name.id.css - EntityOtherAttribute_NameParent_SelectorCss, // entity.other.attribute-name.parent-selector.css - EntityOtherAttribute_NamePseudo_ClassCss, // entity.other.attribute-name.pseudo-class.css - EntityOtherAttribute_NamePseudo_ElementCss, // entity.other.attribute-name.pseudo-element.css - SourceCssLess__EntityOtherAttribute_NameId, // source.css.less entity.other.attribute-name.id - EntityOtherAttribute_NameScss, // entity.other.attribute-name.scss - Invalid, // invalid - MarkupBold, // markup.bold - MarkupHeading, // markup.heading - MarkupInserted, // markup.inserted - MarkupDeleted, // markup.deleted - MarkupChanged, // markup.changed - PunctuationDefinitionQuoteBeginMarkdown, // punctuation.definition.quote.begin.markdown - PunctuationDefinitionListBeginMarkdown, // punctuation.definition.list.begin.markdown - MarkupInlineRaw, // markup.inline.raw - PunctuationDefinitionTag, // punctuation.definition.tag - MetaPreprocessor, // meta.preprocessor - EntityNameFunctionPreprocessor, // entity.name.function.preprocessor - MetaPreprocessorString, // meta.preprocessor.string - MetaPreprocessorNumeric, // meta.preprocessor.numeric - MetaStructureDictionaryKeyPython, // meta.structure.dictionary.key.python - Storage, // storage - StorageType, // storage.type - StorageModifier, // storage.modifier - KeywordOperatorNoexcept, // keyword.operator.noexcept - String, // string - MetaEmbeddedAssembly, // meta.embedded.assembly - StringCommentBufferedBlockPug, // string.comment.buffered.block.pug - StringQuotedPug, // string.quoted.pug - StringInterpolatedPug, // string.interpolated.pug - StringUnquotedPlainInYaml, // string.unquoted.plain.in.yaml - StringUnquotedPlainOutYaml, // string.unquoted.plain.out.yaml - StringUnquotedBlockYaml, // string.unquoted.block.yaml - StringQuotedSingleYaml, // string.quoted.single.yaml - StringQuotedDoubleXml, // string.quoted.double.xml - StringQuotedSingleXml, // string.quoted.single.xml - StringUnquotedCdataXml, // string.unquoted.cdata.xml - StringQuotedDoubleHtml, // string.quoted.double.html - StringQuotedSingleHtml, // string.quoted.single.html - StringUnquotedHtml, // string.unquoted.html - StringQuotedSingleHandlebars, // string.quoted.single.handlebars - StringQuotedDoubleHandlebars, // string.quoted.double.handlebars - StringRegexp, // string.regexp - PunctuationDefinitionTemplate_ExpressionBegin, // punctuation.definition.template-expression.begin - PunctuationDefinitionTemplate_ExpressionEnd, // punctuation.definition.template-expression.end - PunctuationSectionEmbedded, // punctuation.section.embedded - MetaTemplateExpression, // meta.template.expression - SupportConstantProperty_Value, // support.constant.property-value - SupportConstantFont_Name, // support.constant.font-name - SupportConstantMedia_Type, // support.constant.media-type - SupportConstantMedia, // support.constant.media - ConstantOtherColorRgb_Value, // constant.other.color.rgb-value - ConstantOtherRgb_Value, // constant.other.rgb-value - SupportConstantColor, // support.constant.color - SupportTypeVendoredProperty_Name, // support.type.vendored.property-name - SupportTypeProperty_Name, // support.type.property-name - VariableCss, // variable.css - VariableScss, // variable.scss - VariableOtherLess, // variable.other.less - SourceCoffeeEmbedded, // source.coffee.embedded - SupportTypeProperty_NameJson, // support.type.property-name.json - Keyword, // keyword - KeywordControl, // keyword.control - KeywordOperator, // keyword.operator - KeywordOperatorNew, // keyword.operator.new - KeywordOperatorExpression, // keyword.operator.expression - KeywordOperatorCast, // keyword.operator.cast - KeywordOperatorSizeof, // keyword.operator.sizeof - KeywordOperatorAlignof, // keyword.operator.alignof - KeywordOperatorTypeid, // keyword.operator.typeid - KeywordOperatorAlignas, // keyword.operator.alignas - KeywordOperatorInstanceof, // keyword.operator.instanceof - KeywordOperatorLogicalPython, // keyword.operator.logical.python - KeywordOperatorWordlike, // keyword.operator.wordlike - KeywordOtherUnit, // keyword.other.unit - PunctuationSectionEmbeddedBeginPhp, // punctuation.section.embedded.begin.php - PunctuationSectionEmbeddedEndPhp, // punctuation.section.embedded.end.php - SupportFunctionGit_Rebase, // support.function.git-rebase - ConstantShaGit_Rebase, // constant.sha.git-rebase - StorageModifierImportJava, // storage.modifier.import.java - VariableLanguageWildcardJava, // variable.language.wildcard.java - StorageModifierPackageJava, // storage.modifier.package.java - VariableLanguage, // variable.language - EntityNameFunction, // entity.name.function - SupportFunction, // support.function - SupportConstantHandlebars, // support.constant.handlebars - SourcePowershell__VariableOtherMember, // source.powershell variable.other.member - EntityNameOperatorCustom_Literal, // entity.name.operator.custom-literal - SupportClass, // support.class - SupportType, // support.type - EntityNameType, // entity.name.type - EntityNameNamespace, // entity.name.namespace - EntityOtherAttribute, // entity.other.attribute - EntityNameScope_Resolution, // entity.name.scope-resolution - EntityNameClass, // entity.name.class - StorageTypeNumericGo, // storage.type.numeric.go - StorageTypeByteGo, // storage.type.byte.go - StorageTypeBooleanGo, // storage.type.boolean.go - StorageTypeStringGo, // storage.type.string.go - StorageTypeUintptrGo, // storage.type.uintptr.go - StorageTypeErrorGo, // storage.type.error.go - StorageTypeRuneGo, // storage.type.rune.go - StorageTypeCs, // storage.type.cs - StorageTypeGenericCs, // storage.type.generic.cs - StorageTypeModifierCs, // storage.type.modifier.cs - StorageTypeVariableCs, // storage.type.variable.cs - StorageTypeAnnotationJava, // storage.type.annotation.java - StorageTypeGenericJava, // storage.type.generic.java - StorageTypeJava, // storage.type.java - StorageTypeObjectArrayJava, // storage.type.object.array.java - StorageTypePrimitiveArrayJava, // storage.type.primitive.array.java - StorageTypePrimitiveJava, // storage.type.primitive.java - StorageTypeTokenJava, // storage.type.token.java - StorageTypeGroovy, // storage.type.groovy - StorageTypeAnnotationGroovy, // storage.type.annotation.groovy - StorageTypeParametersGroovy, // storage.type.parameters.groovy - StorageTypeGenericGroovy, // storage.type.generic.groovy - StorageTypeObjectArrayGroovy, // storage.type.object.array.groovy - StorageTypePrimitiveArrayGroovy, // storage.type.primitive.array.groovy - StorageTypePrimitiveGroovy, // storage.type.primitive.groovy - MetaTypeCastExpr, // meta.type.cast.expr - MetaTypeNewExpr, // meta.type.new.expr - SupportConstantMath, // support.constant.math - SupportConstantDom, // support.constant.dom - SupportConstantJson, // support.constant.json - EntityOtherInherited_Class, // entity.other.inherited-class - SourceCpp__KeywordOperatorNew, // source.cpp keyword.operator.new - SourceCpp__KeywordOperatorDelete, // source.cpp keyword.operator.delete - KeywordOtherUsing, // keyword.other.using - KeywordOtherDirectiveUsing, // keyword.other.directive.using - KeywordOtherOperator, // keyword.other.operator - EntityNameOperator, // entity.name.operator - Variable, // variable - MetaDefinitionVariableName, // meta.definition.variable.name - SupportVariable, // support.variable - EntityNameVariable, // entity.name.variable - ConstantOtherPlaceholder, // constant.other.placeholder - VariableOtherConstant, // variable.other.constant - MetaObject_LiteralKey, // meta.object-literal.key - PunctuationDefinitionGroupRegexp, // punctuation.definition.group.regexp - PunctuationDefinitionGroupAssertionRegexp, // punctuation.definition.group.assertion.regexp - PunctuationDefinitionCharacter_ClassRegexp, // punctuation.definition.character-class.regexp - PunctuationCharacterSetBeginRegexp, // punctuation.character.set.begin.regexp - PunctuationCharacterSetEndRegexp, // punctuation.character.set.end.regexp - KeywordOperatorNegationRegexp, // keyword.operator.negation.regexp - SupportOtherParenthesisRegexp, // support.other.parenthesis.regexp - ConstantCharacterCharacter_ClassRegexp, // constant.character.character-class.regexp - ConstantOtherCharacter_ClassSetRegexp, // constant.other.character-class.set.regexp - ConstantOtherCharacter_ClassRegexp, // constant.other.character-class.regexp - ConstantCharacterSetRegexp, // constant.character.set.regexp - KeywordOperatorQuantifierRegexp, // keyword.operator.quantifier.regexp - KeywordOperatorOrRegexp, // keyword.operator.or.regexp - KeywordControlAnchorRegexp, // keyword.control.anchor.regexp - ConstantCharacter, // constant.character - ConstantOtherOption, // constant.other.option - ConstantCharacterEscape, // constant.character.escape - EntityNameLabel, // entity.name.label - Header, // header - EntityNameTagCss, // entity.name.tag.css - StringTag, // string.tag - StringValue, // string.value - KeywordOperatorDelete, // keyword.operator.delete -}; diff --git a/WinUIEditor/TextRangeProvider.cpp b/WinUIEditor/TextRangeProvider.cpp deleted file mode 100644 index 9707978..0000000 --- a/WinUIEditor/TextRangeProvider.cpp +++ /dev/null @@ -1,334 +0,0 @@ -#include "pch.h" -#include "TextRangeProvider.h" - -using namespace winrt; -using namespace Windows::Foundation; -using namespace DUX; -using namespace DUX::Automation; -using namespace DUX::Automation::Peers; -using namespace DUX::Automation::Provider; -using namespace DUX::Automation::Text; - -constexpr hresult XAML_E_NOT_SUPPORTED{ static_cast(0x80131515) }; - -namespace winrt::WinUIEditor::implementation -{ - TextRangeProvider::TextRangeProvider(IRawElementProviderSimple const &peer, Editor const &editor, int64_t rangeStart, int64_t rangeEnd, Rect const &bounds) - : _peer{ peer }, _editor{ editor }, _rangeStart{ rangeStart }, _rangeEnd{ rangeEnd }, _bounds{ bounds } - { - } - - ITextRangeProvider TextRangeProvider::Clone() - { - return make(_peer, _editor.get(), _rangeStart, _rangeEnd, _bounds); - } - - bool TextRangeProvider::Compare(ITextRangeProvider const &textRangeProvider) - { - const auto target{ textRangeProvider.as() }; - return _rangeStart == target->_rangeStart && _rangeEnd == target->_rangeEnd; - } - - int32_t TextRangeProvider::CompareEndpoints(TextPatternRangeEndpoint const &endpoint, ITextRangeProvider const &textRangeProvider, TextPatternRangeEndpoint const &targetEndpoint) - { - const auto target{ textRangeProvider.as() }; - const auto thisEnd{ endpoint == TextPatternRangeEndpoint::Start ? _rangeStart : _rangeEnd }; - const auto targetEnd{ targetEndpoint == TextPatternRangeEndpoint::Start ? target->_rangeStart : target->_rangeEnd }; - return thisEnd - targetEnd; - } - - void TextRangeProvider::ExpandToEnclosingUnit(TextUnit const &unit) - { - const auto editor{ _editor.get() }; - if (!editor) - { - throw hresult_error{ E_POINTER }; - } - - if (unit == TextUnit::Document) - { - _rangeStart = 0; - _rangeEnd = editor.Length(); - } - else if (unit == TextUnit::Line || unit == TextUnit::Paragraph) - { - const auto line{ editor.LineFromPosition(_rangeStart) }; - _rangeStart = editor.PositionFromLine(line); - _rangeEnd = editor.GetLineEndPosition(line); - } - else if (unit == TextUnit::Page) - { - const auto firstVisibleLine{ editor.FirstVisibleLine() }; - const auto maxLine{ editor.LineCount() - 1 }; - const auto lastVisibleLine{ std::min(maxLine, firstVisibleLine + editor.LinesOnScreen()) }; - - _rangeStart = editor.PositionFromLine(firstVisibleLine); - _rangeEnd = editor.GetLineEndPosition(lastVisibleLine); - } - else if (unit == TextUnit::Word) - { - _rangeStart = editor.WordStartPosition(_rangeStart, false); - _rangeEnd = editor.WordEndPosition(_rangeStart, false); - } - else if (unit == TextUnit::Character) - { - _rangeEnd = std::min(_rangeStart + 1, editor.Length()); // Todo: Multibyte chars - } - } - - ITextRangeProvider TextRangeProvider::FindAttribute(int32_t attributeId, IInspectable const &value, bool backward) - { - throw hresult_not_implemented{}; - } - - ITextRangeProvider TextRangeProvider::FindText(hstring const &text, bool backward, bool ignoreCase) - { - throw hresult_not_implemented{}; - } - - IInspectable TextRangeProvider::GetAttributeValue(int32_t attributeId) - { - const auto editor{ _editor.get() }; - if (!editor) - { - throw hresult_error{ E_POINTER }; - } - - switch (static_cast(attributeId)) - { - case AutomationTextAttributesEnum::IsReadOnlyAttribute: - return box_value(editor.ReadOnly()); - case AutomationTextAttributesEnum::CaretPositionAttribute: - { - const auto sel{ editor.MainSelection() }; - const auto caret{ editor.GetSelectionNCaret(sel) }; - if (caret < _rangeStart || caret > _rangeEnd) - { - // Unknown if caret is outside this text range - // Todo: Not sure if this is the correct behavior - return box_value(AutomationCaretPosition::Unknown); - } - const auto line{ editor.LineFromPosition(caret) }; - if (caret == editor.PositionFromLine(line)) - { - return box_value(AutomationCaretPosition::BeginningOfLine); - } - else if (caret == editor.GetLineEndPosition(line)) - { - return box_value(AutomationCaretPosition::EndOfLine); - } - else - { - return box_value(AutomationCaretPosition::Unknown); - } - } - default: - // Must throw instead of returning nullptr - // https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalControl/XamlUiaTextRange.cpp#L141 - throw_hresult(XAML_E_NOT_SUPPORTED); - } - } - - void TextRangeProvider::GetBoundingRectangles(com_array &returnValue) - { - // Structure: https://github.com/microsoft/terminal/blob/main/src/types/UiaTextRangeBase.cpp#L836 - - const auto editor{ _editor.get() }; - if (!editor) - { - throw hresult_error{ E_POINTER }; - } - - // Todo: see EditorBaseControlAutomationPeer::GetVisibleRanges for caveats - // Todo: Does not account for horizontal scrolling - // Todo: Does not account for ranges that do not start and end at line starts/ends - - const auto firstVisibleLine{ editor.FirstVisibleLine() }; - const auto maxLine{ editor.LineCount() - 1 }; - const auto lastVisibleLine{ std::min(maxLine, firstVisibleLine + editor.LinesOnScreen()) }; - - const auto startLine{ editor.LineFromPosition(_rangeStart) }; - const auto endLine{ editor.LineFromPosition(_rangeEnd) }; - - const auto top{ std::max(startLine, firstVisibleLine) }; - const auto end{ std::min(endLine, lastVisibleLine) }; - const auto count{ end - top + 1 }; - - if (count < 1) - { - returnValue = {}; - return; - } - - auto margins{ editor.MarginLeft() }; - const auto nMargins{ editor.Margins() }; - for (auto i{ 0 }; i < nMargins; i++) - { - margins += editor.GetMarginWidthN(i); - } - const auto maxTextWidth{ static_cast(_bounds.Width) - editor.MarginRight() }; - - returnValue = com_array(count * 4); - // Todo: This code pretends that TextHeight gets the correct height including sublines (wrapping). It does not - for (int64_t i = 0, j = 0; i < count; i++, j += 4) - { - const auto line{ top + i }; - const auto pos{ editor.PositionFromLine(line) }; - const auto xStart{ editor.PointXFromPosition(line == startLine ? _rangeStart : pos) }; - const auto xEnd{ editor.PointXFromPosition((line == endLine ? _rangeEnd : editor.GetLineEndPosition(line))) }; - const auto textStart{ std::max(margins, xStart) }; - returnValue[j + 0] = _bounds.X + textStart; // Left - returnValue[j + 1] = _bounds.Y + editor.PointYFromPosition(pos); // Top - returnValue[j + 2] = std::min(maxTextWidth, xEnd) - textStart; // Width - returnValue[j + 3] = editor.TextHeight(line); // Height - - // Todo: Reconsider how off screen text is handled - if (xEnd < margins) - { - returnValue[j + 0] = _bounds.X + margins; - returnValue[j + 2] = 0; - } - if (xStart > maxTextWidth) - { - returnValue[j + 0] = _bounds.X + maxTextWidth; - returnValue[j + 2] = 0; - } - } - } - - IRawElementProviderSimple TextRangeProvider::GetEnclosingElement() - { - return _peer; - } - - hstring TextRangeProvider::GetText(int32_t maxLength) - { - const auto editor{ _editor.get() }; - if (!editor) - { - throw hresult_error{ E_POINTER }; - } - - const auto length{ std::min(editor.Length() - _rangeStart, maxLength == -1 ? _rangeEnd - _rangeStart : std::min(_rangeEnd - _rangeStart, static_cast(maxLength))) }; - std::string s(length, '\0'); - Scintilla::TextRangeFull range - { - { _rangeStart, _rangeStart + length, }, - &s[0], - }; - editor.GetTextRangeFull(reinterpret_cast(&range)); - return to_hstring(s); - } - - int32_t TextRangeProvider::Move(TextUnit const &unit, int32_t count) - { - // Todo: Bounds checking and other units etc. and make sure handling this right - if (unit == TextUnit::Character) - { - _rangeStart += count; - _rangeEnd += count; - return count; - } - - return 0; - } - - int32_t TextRangeProvider::MoveEndpointByUnit(TextPatternRangeEndpoint const &endpoint, TextUnit const &unit, int32_t count) - { - // Todo: Bounds checking and other units etc. - if (endpoint == TextPatternRangeEndpoint::Start && unit == TextUnit::Character) - { - _rangeStart += count; - return count; - } - else if (endpoint == TextPatternRangeEndpoint::End && unit == TextUnit::Character) - { - _rangeEnd += count; - return count; - } - - return 0; - } - - void TextRangeProvider::MoveEndpointByRange(TextPatternRangeEndpoint const &endpoint, ITextRangeProvider const &textRangeProvider, TextPatternRangeEndpoint const &targetEndpoint) - { - const auto target{ textRangeProvider.as() }; - const auto src{ targetEndpoint == TextPatternRangeEndpoint::Start ? target->_rangeStart : target->_rangeEnd }; - if (endpoint == TextPatternRangeEndpoint::Start) - { - _rangeStart = src; - if (_rangeStart > _rangeEnd) - { - _rangeEnd = _rangeStart; - } - } - else - { - _rangeEnd = src; - if (_rangeStart > _rangeEnd) - { - _rangeStart = _rangeEnd; - } - } - } - - void TextRangeProvider::Select() - { - const auto editor{ _editor.get() }; - if (!editor) - { - throw hresult_error{ E_POINTER }; - } - - editor.SetSelection(_rangeEnd, _rangeStart); - } - - void TextRangeProvider::AddToSelection() - { - const auto editor{ _editor.get() }; - if (!editor) - { - throw hresult_error{ E_POINTER }; - } - - editor.AddSelection(_rangeEnd, _rangeStart); - } - - void TextRangeProvider::RemoveFromSelection() - { - const auto editor{ _editor.get() }; - if (!editor) - { - throw hresult_error{ E_POINTER }; - } - - const auto count{ editor.Selections() }; - for (auto i{ 0 }; i < count; i++) - { - if (_rangeStart == editor.GetSelectionNStart(i) - && _rangeEnd == editor.GetSelectionNEnd(i)) - { - editor.DropSelectionN(i); - return; - } - } - } - - void TextRangeProvider::ScrollIntoView(bool alignToTop) - { - const auto editor{ _editor.get() }; - if (!editor) - { - throw hresult_error{ E_POINTER }; - } - - // Todo: You would want primary to be the caret and secondary to be anchor rather than start and end - // Todo: see if we can honor alignToTop - editor.ScrollRange(_rangeEnd, _rangeStart); - } - - com_array TextRangeProvider::GetChildren() - { - return {}; - } -} diff --git a/WinUIEditor/TextRangeProvider.h b/WinUIEditor/TextRangeProvider.h deleted file mode 100644 index ef6df19..0000000 --- a/WinUIEditor/TextRangeProvider.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include - -namespace winrt::WinUIEditor::implementation -{ - struct TextRangeProvider : implements - { - TextRangeProvider(DUX::Automation::Provider::IRawElementProviderSimple const &peer, WinUIEditor::Editor const &editor, int64_t rangeStart, int64_t rangeEnd, Windows::Foundation::Rect const &bounds); - - DUX::Automation::Provider::ITextRangeProvider Clone(); - bool Compare(DUX::Automation::Provider::ITextRangeProvider const &textRangeProvider); - int32_t CompareEndpoints(DUX::Automation::Text::TextPatternRangeEndpoint const &endpoint, DUX::Automation::Provider::ITextRangeProvider const &textRangeProvider, DUX::Automation::Text::TextPatternRangeEndpoint const &targetEndpoint); - void ExpandToEnclosingUnit(DUX::Automation::Text::TextUnit const &unit); - DUX::Automation::Provider::ITextRangeProvider FindAttribute(int32_t attributeId, Windows::Foundation::IInspectable const &value, bool backward); - DUX::Automation::Provider::ITextRangeProvider FindText(hstring const &text, bool backward, bool ignoreCase); - Windows::Foundation::IInspectable GetAttributeValue(int32_t attributeId); - void GetBoundingRectangles(com_array &returnValue); - DUX::Automation::Provider::IRawElementProviderSimple GetEnclosingElement(); - hstring GetText(int32_t maxLength); - int32_t Move(DUX::Automation::Text::TextUnit const &unit, int32_t count); - int32_t MoveEndpointByUnit(DUX::Automation::Text::TextPatternRangeEndpoint const &endpoint, DUX::Automation::Text::TextUnit const &unit, int32_t count); - void MoveEndpointByRange(DUX::Automation::Text::TextPatternRangeEndpoint const &endpoint, DUX::Automation::Provider::ITextRangeProvider const &textRangeProvider, DUX::Automation::Text::TextPatternRangeEndpoint const &targetEndpoint); - void Select(); - void AddToSelection(); - void RemoveFromSelection(); - void ScrollIntoView(bool alignToTop); - com_array GetChildren(); - - - private: - DUX::Automation::Provider::IRawElementProviderSimple _peer{ nullptr }; - weak_ref _editor{ nullptr }; - int64_t _rangeStart; - int64_t _rangeEnd; - Windows::Foundation::Rect _bounds; - }; -} diff --git a/WinUIEditor/Themes/Generic.xaml b/WinUIEditor/Themes/Generic.xaml deleted file mode 100644 index e20852f..0000000 --- a/WinUIEditor/Themes/Generic.xaml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - diff --git a/WinUIEditor/WinUIEditor.def b/WinUIEditor/WinUIEditor.def deleted file mode 100644 index 24e7c12..0000000 --- a/WinUIEditor/WinUIEditor.def +++ /dev/null @@ -1,3 +0,0 @@ -EXPORTS -DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE -DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE diff --git a/WinUIEditor/WinUIEditor.vcxproj b/WinUIEditor/WinUIEditor.vcxproj deleted file mode 100644 index 210260b..0000000 --- a/WinUIEditor/WinUIEditor.vcxproj +++ /dev/null @@ -1,847 +0,0 @@ - - - - - - - - true - true - true - {290647e3-d8cb-46b5-87ce-409f721e441a} - WinUIEditor - WinUIEditor - en-US - 16.0 - true - Windows Store - 10.0 - 10.0.22621.0 - 10.0.17763.0 - 10.0.15063.0 - true - true - <_NoWinAPIFamilyApp Condition="$(WinUIEditorUseWinUI3)">true - <_VC_Target_Library_Platform Condition="$(WinUIEditorUseWinUI3)">Desktop - false - - - - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - Debug - arm64 - - - Release - ARM - - - Release - Win32 - - - Release - x64 - - - Release - arm64 - - - - DynamicLibrary - v143 - Unicode - false - - - true - true - true - - - false - true - false - - - - - - - - - - - - - - Use - pch.h - $(IntDir)pch.pch - ..\scintilla\winui;..\scintilla\include;..\scintilla\src;..\lexilla\include\;..\lexilla\lexlib;%(AdditionalIncludeDirectories) - Level4 - %(AdditionalOptions) /bigobj - SCI_EMPTYCATALOGUE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_USRDLL;%(PreprocessorDefinitions) - NOMINMAX;_WINRT_DLL;%(PreprocessorDefinitions) - WINUI3;%(PreprocessorDefinitions) - $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) - - - WINUI3;%(PreprocessorDefinitions) - - - Console - true - WinUIEditor.def - user32.lib;%(AdditionalDependencies) - - - - - USE_DUMMY_PAGE;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebug - - - %(IgnoreSpecificDefaultLibraries);libucrtd.lib - %(AdditionalOptions) /defaultlib:ucrtd.lib - - - - - NDEBUG;%(PreprocessorDefinitions) - Guard - MultiThreaded - - - true - true - %(IgnoreSpecificDefaultLibraries);libucrt.lib - %(AdditionalOptions) /defaultlib:ucrt.lib - - - - - - - - - DummyPage.xaml - Code - - - - EditorWrapper.cpp - Code - - - - EditorBaseControl.cpp - Code - - - CodeEditorControl.cpp - Code - - - EditorBaseControlAutomationPeer.cpp - Code - - - - - - - - - - - - NotUsing - - - NotUsing - - - DummyPage.xaml - Code - - - - Code - - - Code - - - Code - - - NotUsing - - - Code - - - Create - - - - NotUsing - - - - - - - - - - - - - - DummyPage.xaml - Code - - - EditorWrapper.cpp - Code - - - EditorBaseControl.cpp - Code - - - CodeEditorControl.cpp - Code - - - EditorBaseControlAutomationPeer.cpp - Code - - - - - - Designer - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - - - NotUsing - - - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - NotUsing - - - - \ No newline at end of file diff --git a/WinUIEditor/WinUIEditor.vcxproj.filters b/WinUIEditor/WinUIEditor.vcxproj.filters deleted file mode 100644 index 0803fe3..0000000 --- a/WinUIEditor/WinUIEditor.vcxproj.filters +++ /dev/null @@ -1,785 +0,0 @@ - - - - - accd3aa8-1ba0-4223-9bbe-0c431709210b - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms - - - {926ab91d-31b4-48c3-b9a4-e681349f27f0} - - - {d2af1cc1-e66c-4161-aa1f-2dce16d662a7} - - - {dcec4768-41d4-43a2-9eaa-ebecc2ebbcca} - - - {d97ff389-708f-4fce-a1ad-4f6ad3a99854} - - - - - Generated Files - - - - - - - - - - - - - - - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexers - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - - - - - - - - - - - - - - - - - - - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Scintilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - Lexilla - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/WinUIEditor/Wrapper.cpp b/WinUIEditor/Wrapper.cpp deleted file mode 100644 index 4f88c21..0000000 --- a/WinUIEditor/Wrapper.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#include "pch.h" -#include "Wrapper.h" - -namespace WinUIEditor -{ - winrt::com_ptr<::IVirtualSurfaceImageSourceNative> Wrapper::VsisNative() - { - return _vsisNative; - } - - void Wrapper::VsisNative(winrt::com_ptr<::IVirtualSurfaceImageSourceNative> const &value) - { - _vsisNative = value; - _sisNativeWithD2D = _vsisNative.as<::ISurfaceImageSourceNativeWithD2D>(); - } - - winrt::com_ptr<::ISurfaceImageSourceNativeWithD2D> Wrapper::SisNativeWithD2D() - { - return _sisNativeWithD2D; - } - - winrt::com_ptr<::ID2D1DeviceContext> Wrapper::D2dDeviceContext() - { - return _d2dDeviceContext; - } - - void Wrapper::TrimDxgiDevice() - { - if (_dxgiDevice) - { - _dxgiDevice->Trim(); - } - } - - float Wrapper::LogicalDpi() - { - return _logicalDpi; - } - - void Wrapper::LogicalDpi(float value) - { - _logicalDpi = value; - } - - int Wrapper::Width() - { - return _width; - } - - void Wrapper::Width(int value) - { - _width = value; - } - - int Wrapper::Height() - { - return _height; - } - - void Wrapper::Height(int value) - { - _height = value; - } - - void Wrapper::SetMouseCapture(bool on) - { - if (!_mouseCaptureElement) - { - return; - } - - if (on) - { - if (_lastPointer) // Todo: Check if works - { - _captured = _mouseCaptureElement.CapturePointer(_lastPointer); - } - } - else - { - _mouseCaptureElement.ReleasePointerCaptures(); // Todo: Or just one? - _captured = false; - } - } - - bool Wrapper::HaveMouseCapture() - { - return _captured; - } - - void Wrapper::SetMouseCaptureElement(winrt::DUX::UIElement const &element) - { - _mouseCaptureElement = element; - // Todo: Do we need to revoke? - // Todo: Do we need a strong/weak reference? - _mouseCaptureElement.PointerPressed([&](winrt::Windows::Foundation::IInspectable const &sender, winrt::DUX::Input::PointerRoutedEventArgs const &args) - { - _lastPointer = args.Pointer(); - }); - _mouseCaptureElement.PointerCaptureLost([&](winrt::Windows::Foundation::IInspectable const &sender, winrt::DUX::Input::PointerRoutedEventArgs const &args) - { - _captured = false; - }); - } - - void Wrapper::SetCursor(winrt::DCUR cursor) - { -#ifdef WINUI3 - if (_mouseCaptureElement) - { - _mouseCaptureElement.try_as().ProtectedCursor(winrt::Microsoft::UI::Input::InputSystemCursor::Create(cursor)); - } -#else - winrt::Windows::UI::Core::CoreWindow::GetForCurrentThread().PointerCursor(winrt::Windows::UI::Core::CoreCursor{ cursor, 0 }); -#endif - } - - void Wrapper::SetScrollBars(winrt::DUX::Controls::Primitives::ScrollBar const &horizontalScrollBar, winrt::DUX::Controls::Primitives::ScrollBar const &verticalScrollBar) - { - _horizontalScrollBar = horizontalScrollBar; - _verticalScrollBar = verticalScrollBar; - } - - bool Wrapper::HasScrollBars() - { - return _horizontalScrollBar && _verticalScrollBar; - } - - void Wrapper::HorizontalScrollBarValue(double value) - { - _horizontalScrollBar.Value(value); - } - - void Wrapper::VerticalScrollBarValue(double value) - { - _verticalScrollBar.Value(value); - } - - void Wrapper::HorizontalScrollBarMinimum(double value) - { - _horizontalScrollBar.Minimum(value); - } - - void Wrapper::VerticalScrollBarMinimum(double value) - { - _verticalScrollBar.Minimum(value); - } - - void Wrapper::HorizontalScrollBarMaximum(double value) - { - _horizontalScrollBar.Maximum(value); - } - - void Wrapper::VerticalScrollBarMaximum(double value) - { - _verticalScrollBar.Maximum(value); - } - - void Wrapper::HorizontalScrollBarViewportSize(double value) - { - _horizontalScrollBar.ViewportSize(value); - } - - void Wrapper::VerticalScrollBarViewportSize(double value) - { - _verticalScrollBar.ViewportSize(value); - } - - double Wrapper::HorizontalScrollBarValue() - { - return _horizontalScrollBar.Value(); - } - - double Wrapper::VerticalScrollBarValue() - { - return _verticalScrollBar.Value(); - } - - double Wrapper::HorizontalScrollBarMinimum() - { - return _horizontalScrollBar.Minimum(); - } - - double Wrapper::VerticalScrollBarMinimum() - { - return _verticalScrollBar.Minimum(); - } - - double Wrapper::HorizontalScrollBarMaximum() - { - return _horizontalScrollBar.Maximum(); - } - - double Wrapper::VerticalScrollBarMaximum() - { - return _verticalScrollBar.Maximum(); - } - - double Wrapper::HorizontalScrollBarViewportSize() - { - return _horizontalScrollBar.ViewportSize(); - } - - double Wrapper::VerticalScrollBarViewportSize() - { - return _verticalScrollBar.ViewportSize(); - } - - winrt::Windows::Foundation::IAsyncOperation Wrapper::StartDragAsync(winrt::DUI::PointerPoint const &pointerPoint) - { - return _mouseCaptureElement.StartDragAsync(pointerPoint); - } - - void Wrapper::CreateGraphicsDevices() - { - // Todo: Is there any cleanup that needs to be done when the control is deleted or if the device gets re-created? - - uint32_t creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; - - D3D_FEATURE_LEVEL featureLevels[] = - { - D3D_FEATURE_LEVEL_11_1, - D3D_FEATURE_LEVEL_11_0, - D3D_FEATURE_LEVEL_10_1, - D3D_FEATURE_LEVEL_10_0, - D3D_FEATURE_LEVEL_9_3, - D3D_FEATURE_LEVEL_9_2, - D3D_FEATURE_LEVEL_9_1, - }; - - // Create the Direct3D device - winrt::com_ptr d3dDevice; - D3D_FEATURE_LEVEL supportedFeatureLevel; - winrt::check_hresult(D3D11CreateDevice( - nullptr, - D3D_DRIVER_TYPE_HARDWARE, - 0, - creationFlags, - featureLevels, - ARRAYSIZE(featureLevels), - D3D11_SDK_VERSION, - d3dDevice.put(), - &supportedFeatureLevel, - nullptr)); - - // Get the Direct3D device. - _dxgiDevice = d3dDevice.as(); - - // Create the Direct2D device and a corresponding context - winrt::com_ptr d2dDevice; - D2D1CreateDevice(_dxgiDevice.get(), nullptr, d2dDevice.put()); - - winrt::check_hresult( - d2dDevice->CreateDeviceContext( - D2D1_DEVICE_CONTEXT_OPTIONS_NONE, - _d2dDeviceContext.put())); - - // Associate the Direct2D device with the SurfaceImageSource - SisNativeWithD2D()->SetDevice(d2dDevice.get()); - } -} diff --git a/WinUIEditor/Wrapper.h b/WinUIEditor/Wrapper.h deleted file mode 100644 index ebcf7b3..0000000 --- a/WinUIEditor/Wrapper.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -namespace WinUIEditor -{ - class Wrapper - { - public: - winrt::com_ptr<::IVirtualSurfaceImageSourceNative> VsisNative(); - void VsisNative(winrt::com_ptr<::IVirtualSurfaceImageSourceNative> const &value); - winrt::com_ptr<::ISurfaceImageSourceNativeWithD2D> SisNativeWithD2D(); - winrt::com_ptr<::ID2D1DeviceContext> D2dDeviceContext(); - void TrimDxgiDevice(); - float LogicalDpi(); - void LogicalDpi(float value); - int Width(); - void Width(int value); - int Height(); - void Height(int value); - - // Todo: Make abstract - void SetMouseCapture(bool on); - bool HaveMouseCapture(); - - // Todo: Move to separate XAML class - void SetMouseCaptureElement(winrt::DUX::UIElement const &element); - void SetCursor(winrt::DCUR cursor); - - void SetScrollBars(winrt::DUX::Controls::Primitives::ScrollBar const &horizontalScrollBar, winrt::DUX::Controls::Primitives::ScrollBar const &verticalScrollBar); - bool HasScrollBars(); - void HorizontalScrollBarValue(double value); - void VerticalScrollBarValue(double value); - void HorizontalScrollBarMinimum(double value); - void VerticalScrollBarMinimum(double value); - void HorizontalScrollBarMaximum(double value); - void VerticalScrollBarMaximum(double value); - void HorizontalScrollBarViewportSize(double value); - void VerticalScrollBarViewportSize(double value); - double HorizontalScrollBarValue(); - double VerticalScrollBarValue(); - double HorizontalScrollBarMinimum(); - double VerticalScrollBarMinimum(); - double HorizontalScrollBarMaximum(); - double VerticalScrollBarMaximum(); - double HorizontalScrollBarViewportSize(); - double VerticalScrollBarViewportSize(); - - winrt::Windows::Foundation::IAsyncOperation StartDragAsync(winrt::DUI::PointerPoint const &pointerPoint); - - void CreateGraphicsDevices(); - - // Font used for arrows in folding column markers. Stored here to allow retrieval from SurfaceD2D - // Do not access outside of GetChevronFontFromSurface - std::shared_ptr chevronFont{ nullptr }; - Scintilla::Internal::XYPOSITION chevronFontSize{ -1.0 }; - - private: - winrt::DUX::Input::Pointer _lastPointer{ nullptr }; - winrt::DUX::UIElement _mouseCaptureElement{ nullptr }; - winrt::DUX::Controls::Primitives::ScrollBar _horizontalScrollBar{ nullptr }; - winrt::DUX::Controls::Primitives::ScrollBar _verticalScrollBar{ nullptr }; - bool _captured; - winrt::com_ptr _vsisNative{ nullptr }; - winrt::com_ptr<::ISurfaceImageSourceNativeWithD2D> _sisNativeWithD2D{ nullptr }; - winrt::com_ptr<::ID2D1DeviceContext> _d2dDeviceContext{ nullptr }; - winrt::com_ptr<::IDXGIDevice3> _dxgiDevice{ nullptr }; - float _logicalDpi; - int _width; - int _height; - }; -} diff --git a/WinUIEditor/packages.config b/WinUIEditor/packages.config deleted file mode 100644 index 245a2b5..0000000 --- a/WinUIEditor/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/WinUIEditor/pch.cpp b/WinUIEditor/pch.cpp deleted file mode 100644 index bcb5590..0000000 --- a/WinUIEditor/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/WinUIEditor/pch.h b/WinUIEditor/pch.h deleted file mode 100644 index 40a5a95..0000000 --- a/WinUIEditor/pch.h +++ /dev/null @@ -1,144 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef WINUI3 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#define DUX Microsoft::UI::Xaml -#define DUXC Microsoft::UI::Xaml::Controls -#define DUI Microsoft::UI::Input -#define DCUR Microsoft::UI::Input::InputSystemCursorShape -#define DUD Microsoft::UI::Dispatching -#else -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DUX Windows::UI::Xaml -#define DUXC Windows::UI::Xaml::Controls -#define DUI Windows::UI::Input -#define DCUR Windows::UI::Core::CoreCursorType -#define DUD Windows::System -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "ScintillaTypes.h" -#include "ScintillaMessages.h" -#include "ScintillaStructures.h" -#include "ILoader.h" -#include "ILexer.h" - -#include "Debugging.h" -#include "Geometry.h" -#include "Platform.h" - -#include "CharacterCategoryMap.h" -#include "Position.h" -#include "UniqueString.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "CallTip.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "CaseConvert.h" -#include "UniConversion.h" -#include "Selection.h" -#include "PositionCache.h" -#include "EditModel.h" -#include "MarginView.h" -#include "EditView.h" -#include "Editor.h" -#include "ElapsedPeriod.h" - -#include "AutoComplete.h" -#include "ScintillaBase.h" - -#include "Scintilla.h" - -#include "Lexilla.h" -#include "SciLexer.h" - -#ifndef USE_DUMMY_PAGE -#include "ControlIncludes.h" -#endif diff --git a/WinUIEditorCsWinRT/WinUIEditorCsWinRT.csproj b/WinUIEditorCsWinRT/WinUIEditorCsWinRT.csproj deleted file mode 100644 index 4515c01..0000000 --- a/WinUIEditorCsWinRT/WinUIEditorCsWinRT.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - net6.0-windows10.0.17763.0 - AnyCPU - - - - WinUIEditor - $(OutDir) - - - - .\nuget\ - $(GeneratedNugetDir)WinUIEditorWinUI3.nuspec - $(GeneratedNugetDir)WinUIEditorUWP.nuspec - $(GeneratedNugetDir) - true - - - - - - - - - - - - - - - - - - - - - - - - - - - None - -