diff --git a/.filenesting.json b/.filenesting.json new file mode 100644 index 0000000..0b71966 --- /dev/null +++ b/.filenesting.json @@ -0,0 +1,3 @@ +{ + "help":"https://go.microsoft.com/fwlink/?linkid=866610" +} \ No newline at end of file diff --git a/RustTools.sln b/RustTools.sln index 76d8dd4..f3db4c6 100644 --- a/RustTools.sln +++ b/RustTools.sln @@ -5,6 +5,8 @@ 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}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/RustTools/App.xaml.cs b/RustTools/App.xaml.cs index 4105107..11428cd 100644 --- a/RustTools/App.xaml.cs +++ b/RustTools/App.xaml.cs @@ -153,9 +153,9 @@ public partial class App : Microsoft.UI.Xaml.Application { //MainWindow.Activate(); //MainWindow = new MainWindow(); - var editor=new Editor.EditorWin(); - editor.Activate(); - //await App.GetService().ActivateAsync(args); + //new Editor.EditorWin().Activate(); + MainWindow = new MainWindow(); + await App.GetService().ActivateAsync(args); } } } diff --git a/RustTools/Assets/image/folder_20.svg b/RustTools/Assets/image/folder_20.svg new file mode 100644 index 0000000..48ac82c --- /dev/null +++ b/RustTools/Assets/image/folder_20.svg @@ -0,0 +1,14 @@ + + + +]> + + + + diff --git a/RustTools/Editor/EditorLoad.cs b/RustTools/Editor/EditorLoad.cs new file mode 100644 index 0000000..15af86d --- /dev/null +++ b/RustTools/Editor/EditorLoad.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.ApplicationModel.Payments; + +namespace RustTools.Editor; +public class EditorLoad +{ + /// + /// 加载所有的文件 Debug 用 + /// + /// + /// + private void LoadDirectory(DirectoryInfo directoryInfo, ExplorerItem parentItem) + { + // 获取当前目录中的所有子目录 + var directories = directoryInfo.GetDirectories(); + foreach (var directory in directories) + { + // 创建新的 ExplorerItem 代表当前子目录 + var folderItem = new ExplorerItem + { + Name = directory.Name, + Type = ExplorerItem.ExplorerItemType.Folder + }; + + // 将这个目录项添加到父级的 Children 集合中 + parentItem.Children.Add(folderItem); + + // 递归调用,继续加载子目录中的内容 + LoadDirectory(directory, folderItem); + } + + // 获取当前目录中的所有文件 + var files = directoryInfo.GetFiles(); + foreach (var file in files) + { + // 创建新的 ExplorerItem 代表当前文件 + var fileItem = new ExplorerItem + { + Name = file.Name, + Type = ExplorerItem.ExplorerItemType.File + }; + + // 将这个文件项添加到父级的 Children 集合中 + parentItem.Children.Add(fileItem); + } + } + + public ObservableCollection GetData(string dir) + { + var list = new ObservableCollection(); + + var directoryInfos = new DirectoryInfo(dir); + + // 创建根节点 ExplorerItem 根节点不显示防止用户删除 + //var rootItem = new ExplorerItem + //{ + // Name = directoryInfos.Name, + // Dir = directoryInfos.FullName, + // Type = ExplorerItem.ExplorerItemType.Folder, + //}; + //LoadDirectory(directoryInfos,rootItem); + foreach (var file in directoryInfos.GetDirectories()) { + var explorerItem = new ExplorerItem() + { + Name = file.Name, + Dir = file.FullName, + Type = ExplorerItem.ExplorerItemType.Folder + }; + list.Add(explorerItem); + foreach (var a in file.GetDirectories()) + { + explorerItem.Children.Add(new ExplorerItem() + { + Name = a.Name, + Dir = a.FullName, + Type = ExplorerItem.ExplorerItemType.Folder + }); + } + foreach (var a in file.GetFiles()) + { + explorerItem.Children.Add(new ExplorerItem() + { + Name = a.Name, + Dir = a.FullName, + Type = ExplorerItem.ExplorerItemType.File + }); + } + } + foreach (var file in directoryInfos.GetFiles()) + { + list.Add(new ExplorerItem() + { + Name = file.Name, + Dir = file.FullName, + Type = ExplorerItem.ExplorerItemType.File + }); + } + return list; + ExplorerItem folder1 = new ExplorerItem() + { + Name = "Work Documents", + Type = ExplorerItem.ExplorerItemType.Folder, + Children = + { + new ExplorerItem() + { + Name = "Functional Specifications", + Type = ExplorerItem.ExplorerItemType.Folder, + Children = + { + new ExplorerItem() + { + Name = "TreeView spec", + Type = ExplorerItem.ExplorerItemType.File, + } + } + }, + new ExplorerItem() + { + Name = "Feature Schedule", + Type = ExplorerItem.ExplorerItemType.File, + }, + new ExplorerItem() + { + Name = "Overall Project Plan", + Type = ExplorerItem.ExplorerItemType.File, + }, + new ExplorerItem() + { + Name = "Feature Resources Allocation", + Type = ExplorerItem.ExplorerItemType.File, + } + } + }; + ExplorerItem folder2 = new ExplorerItem() + { + Name = "Personal Folder", + Type = ExplorerItem.ExplorerItemType.Folder, + Children = + { + new ExplorerItem() + { + Name = "Home Remodel Folder", + Type = ExplorerItem.ExplorerItemType.Folder, + Children = + { + new ExplorerItem() + { + Name = "Contractor Contact Info", + Type = ExplorerItem.ExplorerItemType.File, + }, + new ExplorerItem() + { + Name = "Paint Color Scheme", + Type = ExplorerItem.ExplorerItemType.File, + }, + new ExplorerItem() + { + Name = "Flooring Woodgrain type", + Type = ExplorerItem.ExplorerItemType.File, + }, + new ExplorerItem() + { + Name = "Kitchen Cabinet Style", + Type = ExplorerItem.ExplorerItemType.File, + } + } + } + } + }; + + list.Add(folder1); + list.Add(folder2); + return list; + } +} diff --git a/RustTools/Editor/EditorWin.xaml b/RustTools/Editor/EditorWin.xaml index 84577a7..aae4a2d 100644 --- a/RustTools/Editor/EditorWin.xaml +++ b/RustTools/Editor/EditorWin.xaml @@ -3,6 +3,7 @@ x:Class="RustTools.Editor.EditorWin" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:controlpages="using:RustTools.Editor" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:RustTools" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -11,14 +12,91 @@ MinHeight="500" mc:Ignorable="d"> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - + + + + + + + + + + + + + + + + + + - + diff --git a/RustTools/Editor/EditorWin.xaml.cs b/RustTools/Editor/EditorWin.xaml.cs index e7ea4c2..bdb5812 100644 --- a/RustTools/Editor/EditorWin.xaml.cs +++ b/RustTools/Editor/EditorWin.xaml.cs @@ -1,12 +1,26 @@ +using System.Collections.ObjectModel; 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; @@ -17,7 +31,8 @@ namespace RustTools.Editor; /// public sealed partial class EditorWin : WindowEx { - + //Ŀ¼б + public ObservableCollection DataSource=new (); private Microsoft.UI.Windowing.AppWindow? app; public EditorWin() { @@ -28,27 +43,25 @@ public sealed partial class EditorWin : WindowEx if (frame != null) { gj.UpdateTitleBar(this, frame.ActualTheme); - grid.RequestedTheme = frame.ActualTheme; + page.RequestedTheme = frame.ActualTheme; } //WindowManager.Get(this).IsMinimizable = false; - //WindowManager.Get(this).IsMaximizable = false; - //WindowManager.Get(this).IsResizable = false; - //WindowManager.Get(this).IsAlwaysOnTop = false; - //WindowManager.Get(this).IsTitleBarVisible = false; - - //app = GetAppWindowForCurrentWindow(); //app.Closing += OnClosing; //Closed += EditorWin_Closed; - + var directoryInfo = new DirectoryInfo("D:\\steam\\steamapps\\common\\Rusted Warfare\\mods\\units\\Ͻ0.90.2"); + DataSource = new EditorLoad().GetData(directoryInfo.FullName); + Title=directoryInfo.Name; + TitleText.Text = directoryInfo.Name; Closed += EditorWin_Closed; - } - - private async Task SaveDataAsync() - { + 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. } + //ûûб private bool IsSave = false; private ContentDialog? ClosedDialog; @@ -65,7 +78,7 @@ public sealed partial class EditorWin : WindowEx // ʾһԻ򣬸֪ûڲܹر ClosedDialog = new ContentDialog { - XamlRoot = grid.XamlRoot, + XamlRoot = page.XamlRoot, Title = "", Content = "㻹δļڱС", PrimaryButtonText = "ر", @@ -96,4 +109,107 @@ public sealed partial class EditorWin : WindowEx var myWndId = Win32Interop.GetWindowIdFromWindow(hWnd); return Microsoft.UI.Windowing.AppWindow.GetFromWindowId(myWndId); } + private void TreeView_ItemInvoked(TreeView sender, TreeViewItemInvokedEventArgs args) + { + // ȡǰѡе + // ȡ + var invokedItem = args.InvokedItem; + // Ƿظѡ + if (sender.SelectedItem is ExplorerItem selectedItem && invokedItem != null && selectedItem == invokedItem) + { + // ͬһֱӷأнһ + return; + } + if (invokedItem is not ExplorerItem explorerItem) + { + return; + } + if (explorerItem.Type == ExplorerItem.ExplorerItemType.Folder) + { + var directoryInfo = new DirectoryInfo(explorerItem.Dir); + } + } + + private void TreeView_DragItemsStarting(TreeView sender, TreeViewDragItemsStartingEventArgs args) + { + args.Cancel = true; + // ϶ + var items = args.Items.Cast(); + var v = items.ToList()[0]; + args.Data.SetData("TreeViewItems", v.Dir); + args.Data.RequestedOperation = DataPackageOperation.Move; + } + //϶Ŀͣ TreeView ʱΪòṩӾ + private void TreeView_DragOver(object sender, DragEventArgs e) + { + // Ƿ "TreeViewItems" + gj.sc("aaaaaa"); + if (e.DataView.Contains("TreeViewItems")) + { + e.AcceptedOperation = DataPackageOperation.Move; // ļϷ + } + else + { + gj.sc("No"); + e.AcceptedOperation = DataPackageOperation.None; // ϷŲ + } + } + //Ŀõ߼ļļƶµλá + private async void TreeView_Drop(object sender, DragEventArgs e) + { + gj.sc(e); + // ȡ϶ + if (e.DataView.Contains("TreeViewItems")) + { + // ȷݲΪ + if (await e.DataView.GetDataAsync("TreeViewItems") is string Dir) + { + gj.sc(Dir); + // ȡλõ TreeViewItem + var treeView = sender as TreeView; + ExplorerItem v = treeView.DataContext is ExplorerItem; + //var dropPosition = e.GetPosition(treeView); + //data.Name + gj.sc(v.Name); + } + } + } + private IList initialSelectedItems; + /// + /// shiftѡ״̬ + /// + /// + /// + private void treeView_KeyDown(object sender, KeyRoutedEventArgs e) + { + // ǷShift + if (e.Key == Windows.System.VirtualKey.Shift) + { + gj.sc(e.Key); + // öѡģʽ + treeView.SelectionMode = TreeViewSelectionMode.Multiple; + } + } + private void treeView_KeyUp(object sender, KeyRoutedEventArgs e) + { + // ǷɿShift + if (e.Key == Windows.System.VirtualKey.Shift) + { // ǰѡģʽѡеĿ + var selectedItems = treeView.SelectedItems.ToList(); + foreach (var item in selectedItems) + { + treeView.SelectedItems.Remove(item); + } + gj.sc("ȡ"); + // ȡѡģʽ + treeView.SelectionMode = TreeViewSelectionMode.Single; + //treeView.SelectedItems.Clear(); + } + } + + private void tabView_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args) + { + sender.TabItems.Remove(args.Tab); + } + } diff --git a/RustTools/Editor/ExplorerItemTemplateSelector.cs b/RustTools/Editor/ExplorerItemTemplateSelector.cs new file mode 100644 index 0000000..ec2845f --- /dev/null +++ b/RustTools/Editor/ExplorerItemTemplateSelector.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using System.Collections.ObjectModel; +using System.ComponentModel; + +namespace RustTools.Editor; +public class ExplorerItemTemplateSelector : DataTemplateSelector +{ + public DataTemplate FolderTemplate + { + get; set; + } + public DataTemplate FileTemplate + { + get; set; + } + + protected override DataTemplate SelectTemplateCore(object item) + { + var explorerItem = (ExplorerItem)item; + return explorerItem.Type == ExplorerItem.ExplorerItemType.Folder ? FolderTemplate : FileTemplate; + } +} +public class ExplorerItem : INotifyPropertyChanged +{ + public enum ExplorerItemType { Folder, File }; + public event PropertyChangedEventHandler PropertyChanged; + public string Name + { + get; set; + } + public ExplorerItemType Type + { + get; set; + } + public string Dir + { + get;set; + } + private ObservableCollection m_children; + public ObservableCollection Children + { + get + { + if (m_children == null) + { + m_children = new ObservableCollection(); + } + return m_children; + } + set + { + m_children = value; + } + } + + private bool m_isExpanded; + public bool IsExpanded + { + get + { + return m_isExpanded; + } + set + { + if (m_isExpanded != value) + { + m_isExpanded = value; + NotifyPropertyChanged("IsExpanded"); + } + } + } + + private void NotifyPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public static implicit operator ExplorerItem(bool v) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/RustTools/RustTools.csproj b/RustTools/RustTools.csproj index 731408f..6c32035 100644 --- a/RustTools/RustTools.csproj +++ b/RustTools/RustTools.csproj @@ -19,7 +19,6 @@ README.md zh-cn - False True 3386EC79D3BB9691D0A8DA634167500B242E109D @@ -28,7 +27,6 @@ False True Never - C:\\RustTools D:\RustTools @@ -46,46 +44,19 @@ + + + + Always - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - + - - - - true - - + \ No newline at end of file diff --git a/RustTools/Views/ModulePage.xaml.cs b/RustTools/Views/ModulePage.xaml.cs index 59c268e..476e6df 100644 --- a/RustTools/Views/ModulePage.xaml.cs +++ b/RustTools/Views/ModulePage.xaml.cs @@ -37,6 +37,7 @@ public class DataObject get; set; } +#pragma warning disable CS8765 // 参数类型的为 Null 性与重写成员不匹配(可能是由于为 Null 性特性)。 public override bool Equals(object obj) { if (obj is DataObject other) @@ -111,7 +112,8 @@ public sealed partial class ModulePage : Page } private void Button_Delete(object sender, RoutedEventArgs e) { - var menuItem = sender as ButtonBase; + var menuItem = sender as Control; + gj.sc(menuItem); if (menuItem != null) { if (menuItem.DataContext is DataObject folderItem) diff --git a/UseWinUI3.txt b/UseWinUI3.txt new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/UseWinUI3.txt @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/WinUIEditor/CodeEditorControl.cpp b/WinUIEditor/CodeEditorControl.cpp new file mode 100644 index 0000000..6d31b5e --- /dev/null +++ b/WinUIEditor/CodeEditorControl.cpp @@ -0,0 +1,336 @@ +#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 new file mode 100644 index 0000000..7b7d320 --- /dev/null +++ b/WinUIEditor/CodeEditorControl.h @@ -0,0 +1,75 @@ +#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 new file mode 100644 index 0000000..6f8b3cf --- /dev/null +++ b/WinUIEditor/CodeEditorControl.idl @@ -0,0 +1,19 @@ +#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 new file mode 100644 index 0000000..a19e41c --- /dev/null +++ b/WinUIEditor/CodeEditorHandler.SciEdit.cpp @@ -0,0 +1,669 @@ +// 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 new file mode 100644 index 0000000..10ea8c1 --- /dev/null +++ b/WinUIEditor/CodeEditorHandler.SciEdit.h @@ -0,0 +1,91 @@ +// 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 new file mode 100644 index 0000000..3929a91 --- /dev/null +++ b/WinUIEditor/CodeEditorHandler.SyntaxHighlighting.cpp @@ -0,0 +1,395 @@ +#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 new file mode 100644 index 0000000..9544f33 --- /dev/null +++ b/WinUIEditor/CodeEditorHandler.cpp @@ -0,0 +1,557 @@ +#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 new file mode 100644 index 0000000..97db0e8 --- /dev/null +++ b/WinUIEditor/CodeEditorHandler.h @@ -0,0 +1,102 @@ +#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 new file mode 100644 index 0000000..50ed875 --- /dev/null +++ b/WinUIEditor/ControlIncludes.h @@ -0,0 +1,4 @@ +#pragma once + +#include "EditorBaseControl.h" +#include "CodeEditorControl.h" diff --git a/WinUIEditor/DarkPlus.h b/WinUIEditor/DarkPlus.h new file mode 100644 index 0000000..5a4184e --- /dev/null +++ b/WinUIEditor/DarkPlus.h @@ -0,0 +1,213 @@ +// 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 new file mode 100644 index 0000000..ba6fe22 --- /dev/null +++ b/WinUIEditor/Defines.idl @@ -0,0 +1,5 @@ +#ifdef WINUI3 +#define DUX Microsoft.UI.Xaml +#else +#define DUX Windows.UI.Xaml +#endif diff --git a/WinUIEditor/DummyPage.cpp b/WinUIEditor/DummyPage.cpp new file mode 100644 index 0000000..47f3a04 --- /dev/null +++ b/WinUIEditor/DummyPage.cpp @@ -0,0 +1,13 @@ +#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 new file mode 100644 index 0000000..5cf60b9 --- /dev/null +++ b/WinUIEditor/DummyPage.h @@ -0,0 +1,19 @@ +#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 new file mode 100644 index 0000000..f18d16e --- /dev/null +++ b/WinUIEditor/DummyPage.idl @@ -0,0 +1,11 @@ +#include "Defines.idl" + +namespace WinUIEditor +{ + [default_interface] + [webhosthidden] + runtimeclass DummyPage : DUX.Controls.Page + { + DummyPage(); + } +} diff --git a/WinUIEditor/DummyPage.xaml b/WinUIEditor/DummyPage.xaml new file mode 100644 index 0000000..43bbe74 --- /dev/null +++ b/WinUIEditor/DummyPage.xaml @@ -0,0 +1,8 @@ + diff --git a/WinUIEditor/EditorBaseControl.cpp b/WinUIEditor/EditorBaseControl.cpp new file mode 100644 index 0000000..3e329fe --- /dev/null +++ b/WinUIEditor/EditorBaseControl.cpp @@ -0,0 +1,665 @@ +#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 new file mode 100644 index 0000000..68bb834 --- /dev/null +++ b/WinUIEditor/EditorBaseControl.h @@ -0,0 +1,121 @@ +#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 new file mode 100644 index 0000000..a502e24 --- /dev/null +++ b/WinUIEditor/EditorBaseControl.idl @@ -0,0 +1,15 @@ +#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 new file mode 100644 index 0000000..ab142dc --- /dev/null +++ b/WinUIEditor/EditorBaseControlAutomationPeer.cpp @@ -0,0 +1,190 @@ +#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 new file mode 100644 index 0000000..6a7977c --- /dev/null +++ b/WinUIEditor/EditorBaseControlAutomationPeer.h @@ -0,0 +1,43 @@ +#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 new file mode 100644 index 0000000..64e27cd --- /dev/null +++ b/WinUIEditor/EditorBaseControlAutomationPeer.idl @@ -0,0 +1,15 @@ +#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 new file mode 100644 index 0000000..183a3e8 --- /dev/null +++ b/WinUIEditor/EditorWrapper.cpp @@ -0,0 +1,8461 @@ +#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 new file mode 100644 index 0000000..2ba8146 --- /dev/null +++ b/WinUIEditor/EditorWrapper.h @@ -0,0 +1,4756 @@ +#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 new file mode 100644 index 0000000..cb29f6c --- /dev/null +++ b/WinUIEditor/EditorWrapper.idl @@ -0,0 +1,8489 @@ +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 new file mode 100644 index 0000000..5e7557f --- /dev/null +++ b/WinUIEditor/Helpers.cpp @@ -0,0 +1,81 @@ +#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 new file mode 100644 index 0000000..5824174 --- /dev/null +++ b/WinUIEditor/Helpers.h @@ -0,0 +1,8 @@ +#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 new file mode 100644 index 0000000..208edf3 --- /dev/null +++ b/WinUIEditor/IEditorAccess.idl @@ -0,0 +1,10 @@ +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 new file mode 100644 index 0000000..91c46e9 --- /dev/null +++ b/WinUIEditor/LightPlus.h @@ -0,0 +1,225 @@ +// 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 new file mode 100644 index 0000000..3709191 --- /dev/null +++ b/WinUIEditor/TextMateScope.h @@ -0,0 +1,215 @@ +// 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 new file mode 100644 index 0000000..9707978 --- /dev/null +++ b/WinUIEditor/TextRangeProvider.cpp @@ -0,0 +1,334 @@ +#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 new file mode 100644 index 0000000..ef6df19 --- /dev/null +++ b/WinUIEditor/TextRangeProvider.h @@ -0,0 +1,38 @@ +#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 new file mode 100644 index 0000000..e20852f --- /dev/null +++ b/WinUIEditor/Themes/Generic.xaml @@ -0,0 +1,67 @@ + + + + + + + diff --git a/WinUIEditor/WinUIEditor.def b/WinUIEditor/WinUIEditor.def new file mode 100644 index 0000000..24e7c12 --- /dev/null +++ b/WinUIEditor/WinUIEditor.def @@ -0,0 +1,3 @@ +EXPORTS +DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE +DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE diff --git a/WinUIEditor/WinUIEditor.vcxproj b/WinUIEditor/WinUIEditor.vcxproj new file mode 100644 index 0000000..210260b --- /dev/null +++ b/WinUIEditor/WinUIEditor.vcxproj @@ -0,0 +1,847 @@ + + + + + + + + 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 new file mode 100644 index 0000000..0803fe3 --- /dev/null +++ b/WinUIEditor/WinUIEditor.vcxproj.filters @@ -0,0 +1,785 @@ + + + + + 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 new file mode 100644 index 0000000..4f88c21 --- /dev/null +++ b/WinUIEditor/Wrapper.cpp @@ -0,0 +1,261 @@ +#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 new file mode 100644 index 0000000..ebcf7b3 --- /dev/null +++ b/WinUIEditor/Wrapper.h @@ -0,0 +1,70 @@ +#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 new file mode 100644 index 0000000..245a2b5 --- /dev/null +++ b/WinUIEditor/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/WinUIEditor/pch.cpp b/WinUIEditor/pch.cpp new file mode 100644 index 0000000..bcb5590 --- /dev/null +++ b/WinUIEditor/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/WinUIEditor/pch.h b/WinUIEditor/pch.h new file mode 100644 index 0000000..40a5a95 --- /dev/null +++ b/WinUIEditor/pch.h @@ -0,0 +1,144 @@ +#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 new file mode 100644 index 0000000..4515c01 --- /dev/null +++ b/WinUIEditorCsWinRT/WinUIEditorCsWinRT.csproj @@ -0,0 +1,49 @@ + + + + + + net6.0-windows10.0.17763.0 + AnyCPU + + + + WinUIEditor + $(OutDir) + + + + .\nuget\ + $(GeneratedNugetDir)WinUIEditorWinUI3.nuspec + $(GeneratedNugetDir)WinUIEditorUWP.nuspec + $(GeneratedNugetDir) + true + + + + + + + + + + + + + + + + + + + + + + + + + + + None + +