diff --git a/NppMarkdownPanel/Forms/MarkdownPreviewForm.cs b/NppMarkdownPanel/Forms/MarkdownPreviewForm.cs index 5cfb048..8f9517e 100644 --- a/NppMarkdownPanel/Forms/MarkdownPreviewForm.cs +++ b/NppMarkdownPanel/Forms/MarkdownPreviewForm.cs @@ -36,7 +36,7 @@ public partial class MarkdownPreviewForm : Form "; - private Task renderTask; + private Task> renderTask; private readonly Action toolWindowCloseAction; private int lastVerticalScroll = 0; private string htmlContent; @@ -62,6 +62,31 @@ public MarkdownPreviewForm(Action toolWindowCloseAction) markdownGenerator = MarkdownPanelController.GetMarkdownGeneratorImpl(); } + private Tuple RenderHtmlInternal(string currentText, string filepath) + { + var result = markdownGenerator.ConvertToHtml(currentText, filepath); + var resultWithRelativeImages = markdownGenerator.ConvertToHtml(currentText, null); + var defaultBodyStyle = ""; + + // Path of plugin directory + var markdownStyleContent = ""; + + var assemblyPath = Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location); + + if (File.Exists(CssFileName)) + { + markdownStyleContent = File.ReadAllText(CssFileName); + } + else + { + markdownStyleContent = File.ReadAllText(assemblyPath + "\\" + MainResources.DefaultCssFile); + } + + var markdownHtml = string.Format(DEFAULT_HTML_BASE, Path.GetFileName(filepath), markdownStyleContent, defaultBodyStyle, result); + var markdownHtml2 = string.Format(DEFAULT_HTML_BASE, Path.GetFileName(filepath), markdownStyleContent, defaultBodyStyle, resultWithRelativeImages); + return new Tuple(markdownHtml, markdownHtml2); + } + public void RenderMarkdown(string currentText, string filepath) { if (renderTask == null || renderTask.IsCompleted) @@ -70,31 +95,11 @@ public void RenderMarkdown(string currentText, string filepath) MakeAndDisplayScreenShot(); var context = TaskScheduler.FromCurrentSynchronizationContext(); - renderTask = new Task(() => - { - var result = markdownGenerator.ConvertToHtml(currentText, filepath); - var defaultBodyStyle = ""; - - // Path of plugin directory - var markdownStyleContent = ""; - - var assemblyPath = Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location); - - if (File.Exists(CssFileName)) - { - markdownStyleContent = File.ReadAllText(CssFileName); - } - else - { - markdownStyleContent = File.ReadAllText(assemblyPath + "\\" + MainResources.DefaultCssFile); - } - - var markdownHtml = string.Format(DEFAULT_HTML_BASE, Path.GetFileName(filepath), markdownStyleContent, defaultBodyStyle, result); - return markdownHtml; - }); + renderTask = new Task>(() => RenderHtmlInternal(currentText, filepath)); renderTask.ContinueWith((renderedText) => { - htmlContent = renderedText.Result; + webBrowserPreview.DocumentText = renderedText.Result.Item1; + htmlContent = renderedText.Result.Item2; if (!String.IsNullOrWhiteSpace(HtmlFileName)) { bool valid = Utils.ValidateFileSelection(HtmlFileName, out string fullPath, out string error, "HTML Output"); @@ -111,8 +116,6 @@ public void RenderMarkdown(string currentText, string filepath) } } } - - webBrowserPreview.DocumentText = htmlContent; AdjustZoomLevel(); }, context); renderTask.Start(); diff --git a/NppMarkdownPanel/MarkdigMarkdownGenerator.cs b/NppMarkdownPanel/MarkdigMarkdownGenerator.cs index 4e37d1c..8a97c99 100644 --- a/NppMarkdownPanel/MarkdigMarkdownGenerator.cs +++ b/NppMarkdownPanel/MarkdigMarkdownGenerator.cs @@ -31,10 +31,19 @@ public string ConvertToHtml(string markDownText, string filepath) pipeline.PreciseSourceLocation = true; try { - htmlRenderer.BaseUrl = new Uri(filepath); + if (filepath != null) + { + htmlRenderer.BaseUrl = new Uri(filepath); + } + else + { + htmlRenderer.BaseUrl = null; + } + } - catch + catch (Exception e) { + if (e != null) {} } sb.Clear(); diff --git a/NppMarkdownPanel/MarkdownPanelController.cs b/NppMarkdownPanel/MarkdownPanelController.cs index a502921..3ac789e 100644 --- a/NppMarkdownPanel/MarkdownPanelController.cs +++ b/NppMarkdownPanel/MarkdownPanelController.cs @@ -52,9 +52,9 @@ public void OnNotification(ScNotification notification) { if (notification.Header.Code == (uint)SciMsg.SCN_UPDATEUI) { - if (syncViewWithCaretPosition && lastCaretPosition != scintillaGateway.GetCurrentPos()) + if (syncViewWithCaretPosition && lastCaretPosition != scintillaGateway.GetCurrentPos().Value) { - lastCaretPosition = scintillaGateway.GetCurrentPos(); + lastCaretPosition = scintillaGateway.GetCurrentPos().Value; ScrollToElementAtLineNo(scintillaGateway.GetCurrentLineNumber()); } } @@ -162,13 +162,24 @@ private void SyncViewWithCaret() public void SetToolBarIcon() { - toolbarIcons tbIcons = new toolbarIcons(); - tbIcons.hToolbarBmp = Properties.Resources.markdown_16x16_solid.GetHbitmap(); - tbIcons.hToolbarIconDarkMode = Properties.Resources.markdown_16x16_solid_dark.GetHbitmap(); - IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIcons)); - Marshal.StructureToPtr(tbIcons, pTbIcons, false); - Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON, PluginBase._funcItems.Items[idMyDlg]._cmdID, pTbIcons); + toolbarIconsOld tbIconsOld = new toolbarIconsOld(); + tbIconsOld.hToolbarBmp = Properties.Resources.markdown_16x16_solid.GetHbitmap(); + tbIconsOld.hToolbarIcon = Properties.Resources.markdown_16x16_solid_dark.GetHicon(); + IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIconsOld)); + Marshal.StructureToPtr(tbIconsOld, pTbIcons, false); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON_DEPRECATED, PluginBase._funcItems.Items[idMyDlg]._cmdID, pTbIcons); Marshal.FreeHGlobal(pTbIcons); + + // if npp version >= 8 then use new NPPM_ADDTOOLBARICON_FORDARKMODE + /* toolbarIconsNew tbIconsNew = new toolbarIconsNew(); + tbIconsNew.hToolbarBmp = Properties.Resources.markdown_16x16_solid.GetHbitmap(); + tbIconsNew.hToolbarIcon = Properties.Resources.markdown_16x16_solid.GetHicon(); + tbIconsNew.hToolbarIconDarkMode = Properties.Resources.markdown_16x16_solid.GetHicon(); + // tbIconsOld.hToolbarIconDarkMode = Properties.Resources.markdown_16x16_solid_dark.GetHbitmap(); + IntPtr pTbIconsNew = Marshal.AllocHGlobal(Marshal.SizeOf(tbIconsNew)); + Marshal.StructureToPtr(tbIconsNew, pTbIconsNew, false); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON_FORDARKMODE, PluginBase._funcItems.Items[idMyDlg]._cmdID, pTbIconsNew); + Marshal.FreeHGlobal(pTbIconsNew);*/ } public void PluginCleanUp() diff --git a/NppMarkdownPanel/NppMarkdownPanel.csproj b/NppMarkdownPanel/NppMarkdownPanel.csproj index 1f4c083..cd3c763 100644 --- a/NppMarkdownPanel/NppMarkdownPanel.csproj +++ b/NppMarkdownPanel/NppMarkdownPanel.csproj @@ -423,6 +423,10 @@ + + + + - - + DestinationFolder="$(MSBuildProgramFiles32)\Notepad++\plugins\" + Condition="Exists('$(MSBuildProgramFiles32)\Notepad++\plugins\') AND '$(Platform)'=='x86'" + ContinueOnError="false" /> diff --git a/NppMarkdownPanel/PluginInfrastructure/GatewayDomain.cs b/NppMarkdownPanel/PluginInfrastructure/GatewayDomain.cs index a6e2c9c..7087a1c 100644 --- a/NppMarkdownPanel/PluginInfrastructure/GatewayDomain.cs +++ b/NppMarkdownPanel/PluginInfrastructure/GatewayDomain.cs @@ -1,6 +1,7 @@ // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. using System; using System.Runtime.InteropServices; +using System.Text; namespace Kbg.NppPluginNET.PluginInfrastructure { @@ -22,7 +23,7 @@ public Colour(int rgb) } /// - /// + /// /// /// a number 0-255 /// a number 0-255 @@ -201,6 +202,7 @@ public Cells(char[] charactersAndStyles) { this.charactersAndStyles = charactersAndStyles; } + public char[] Value { get { return charactersAndStyles; } } } @@ -228,8 +230,11 @@ struct Sci_TextRange public CharacterRange chrg; public IntPtr lpstrText; } + public IntPtr NativePointer { get { _initNativeStruct(); return _ptrSciTextRange; } } + public string lpstrText { get { _readNativeStruct(); return Marshal.PtrToStringAnsi(_sciTextRange.lpstrText); } } + public CharacterRange chrg { get { _readNativeStruct(); return _sciTextRange.chrg; } set { _sciTextRange.chrg = value; _initNativeStruct(); } } void _initNativeStruct() @@ -263,728 +268,6 @@ public void Dispose() /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ - /// Is undo history being collected? (Scintilla feature SCWS_) - public enum WhiteSpace - { - INVISIBLE = 0, - VISIBLEALWAYS = 1, - VISIBLEAFTERINDENT = 2, - VISIBLEONLYININDENT = 3 - } - /// Make white space characters invisible, always visible or visible outside indentation. (Scintilla feature SCTD_) - public enum TabDrawMode - { - LONGARROW = 0, - STRIKEOUT = 1 - } - /// Retrieve the position of the last correctly styled character. (Scintilla feature SC_EOL_) - public enum EndOfLine - { - CRLF = 0, - CR = 1, - LF = 2 - } - /// - /// Set the code page used to interpret the bytes of the document as characters. - /// The SC_CP_UTF8 value can be used to enter Unicode mode. - /// (Scintilla feature SC_IME_) - /// - public enum IMEInteraction - { - WINDOWED = 0, - INLINE = 1 - } - /// Choose to display the the IME in a winow or inline. (Scintilla feature SC_MARK_) - public enum MarkerSymbol - { - CIRCLE = 0, - ROUNDRECT = 1, - ARROW = 2, - SMALLRECT = 3, - SHORTARROW = 4, - EMPTY = 5, - ARROWDOWN = 6, - MINUS = 7, - PLUS = 8, - VLINE = 9, - LCORNER = 10, - TCORNER = 11, - BOXPLUS = 12, - BOXPLUSCONNECTED = 13, - BOXMINUS = 14, - BOXMINUSCONNECTED = 15, - LCORNERCURVE = 16, - TCORNERCURVE = 17, - CIRCLEPLUS = 18, - CIRCLEPLUSCONNECTED = 19, - CIRCLEMINUS = 20, - CIRCLEMINUSCONNECTED = 21, - BACKGROUND = 22, - DOTDOTDOT = 23, - ARROWS = 24, - PIXMAP = 25, - FULLRECT = 26, - LEFTRECT = 27, - AVAILABLE = 28, - UNDERLINE = 29, - RGBAIMAGE = 30, - BOOKMARK = 31, - VERTICALBOOKMARK = 32, - CHARACTER = 10000 - } - /// Invisible mark that only sets the line background colour. (Scintilla feature SC_MARKNUM_) - public enum MarkerOutline - { - FOLDEREND = 25, - FOLDEROPENMID = 26, - FOLDERMIDTAIL = 27, - FOLDERTAIL = 28, - FOLDERSUB = 29, - FOLDER = 30, - FOLDEROPEN = 31 - } - /// Set the alpha used for a marker that is drawn in the text area, not the margin. (Scintilla feature SC_MARGIN_) - public enum MarginType - { - SYMBOL = 0, - NUMBER = 1, - BACK = 2, - FORE = 3, - TEXT = 4, - RTEXT = 5, - COLOUR = 6 - } - /// Styles in range 32..39 are predefined for parts of the UI and are not used as normal styles. (Scintilla feature STYLE_) - public enum StylesCommon - { - DEFAULT = 32, - LINENUMBER = 33, - BRACELIGHT = 34, - BRACEBAD = 35, - CONTROLCHAR = 36, - INDENTGUIDE = 37, - CALLTIP = 38, - FOLDDISPLAYTEXT = 39, - LASTPREDEFINED = 39, - MAX = 255 - } - /// - /// Character set identifiers are used in StyleSetCharacterSet. - /// The values are the same as the Windows *_CHARSET values. - /// (Scintilla feature SC_CHARSET_) - /// - public enum CharacterSet - { - ANSI = 0, - DEFAULT = 1, - BALTIC = 186, - CHINESEBIG5 = 136, - EASTEUROPE = 238, - GB2312 = 134, - GREEK = 161, - HANGUL = 129, - MAC = 77, - OEM = 255, - RUSSIAN = 204, - OEM866 = 866, - CYRILLIC = 1251, - SHIFTJIS = 128, - SYMBOL = 2, - TURKISH = 162, - JOHAB = 130, - HEBREW = 177, - ARABIC = 178, - VIETNAMESE = 163, - THAI = 222, - _8859_15 = 1000 - } - /// Set a style to be underlined or not. (Scintilla feature SC_CASE_) - public enum CaseVisible - { - MIXED = 0, - UPPER = 1, - LOWER = 2, - CAMEL = 3 - } - /// Get the size of characters of a style in points multiplied by 100 (Scintilla feature SC_WEIGHT_) - public enum FontWeight - { - NORMAL = 400, - SEMIBOLD = 600, - BOLD = 700 - } - /// Indicator style enumeration and some constants (Scintilla feature INDIC_) - public enum IndicatorStyle - { - PLAIN = 0, - SQUIGGLE = 1, - TT = 2, - DIAGONAL = 3, - STRIKE = 4, - HIDDEN = 5, - BOX = 6, - ROUNDBOX = 7, - STRAIGHTBOX = 8, - DASH = 9, - DOTS = 10, - SQUIGGLELOW = 11, - DOTBOX = 12, - SQUIGGLEPIXMAP = 13, - COMPOSITIONTHICK = 14, - COMPOSITIONTHIN = 15, - FULLBOX = 16, - TEXTFORE = 17, - POINT = 18, - POINTCHARACTER = 19, - GRADIENT = 20, - GRADIENTCENTRE = 21, - CONTAINER = 8, - IME = 32, - IME_MAX = 35, - MAX = 35 - } - /// - /// INDIC_CONTAINER, INDIC_IME, INDIC_IME_MAX, and INDIC_MAX are indicator numbers, - /// not IndicatorStyles so should not really be in the INDIC_ enumeration. - /// They are redeclared in IndicatorNumbers INDICATOR_. - /// (Scintilla feature INDICATOR_) - /// - public enum IndicatorNumbers - { - CONTAINER = 8, - IME = 32, - IME_MAX = 35, - MAX = 35 - } - /// Retrieve the foreground hover colour of an indicator. (Scintilla feature SC_INDICVALUE) - public enum IndicValue - { - BIT = 0x1000000, - MASK = 0xFFFFFF - } - /// Retrieve the foreground hover colour of an indicator. (Scintilla feature SC_INDICFLAG_) - public enum IndicFlag - { - VALUEFORE = 1 - } - /// Is the horizontal scroll bar visible? (Scintilla feature SC_IV_) - public enum IndentView - { - NONE = 0, - REAL = 1, - LOOKFORWARD = 2, - LOOKBOTH = 3 - } - /// Returns the print magnification. (Scintilla feature SC_PRINT_) - public enum PrintOption - { - NORMAL = 0, - INVERTLIGHT = 1, - BLACKONWHITE = 2, - COLOURONWHITE = 3, - COLOURONWHITEDEFAULTBG = 4, - SCREENCOLOURS = 5 - } - /// Returns the print colour mode. (Scintilla feature SCFIND_) - public enum FindOption - { - NONE = 0x0, - WHOLEWORD = 0x2, - MATCHCASE = 0x4, - WORDSTART = 0x00100000, - REGEXP = 0x00200000, - POSIX = 0x00400000, - CXX11REGEX = 0x00800000 - } - /// The number of display lines needed to wrap a document line (Scintilla feature SC_FOLDLEVEL) - public enum FoldLevel - { - BASE = 0x400, - WHITEFLAG = 0x1000, - HEADERFLAG = 0x2000, - NUMBERMASK = 0x0FFF - } - /// Switch a header line between expanded and contracted and show some text after the line. (Scintilla feature SC_FOLDDISPLAYTEXT_) - public enum FoldDisplayTextStyle - { - HIDDEN = 0, - STANDARD = 1, - BOXED = 2 - } - /// Get the default fold display text. (Scintilla feature SC_FOLDACTION_) - public enum FoldAction - { - CONTRACT = 0, - EXPAND = 1, - TOGGLE = 2 - } - /// Ensure a particular line is visible by expanding any header line hiding it. (Scintilla feature SC_AUTOMATICFOLD_) - public enum AutomaticFold - { - SHOW = 0x0001, - CLICK = 0x0002, - CHANGE = 0x0004 - } - /// Get automatic folding behaviours. (Scintilla feature SC_FOLDFLAG_) - public enum FoldFlag - { - LINEBEFORE_EXPANDED = 0x0002, - LINEBEFORE_CONTRACTED = 0x0004, - LINEAFTER_EXPANDED = 0x0008, - LINEAFTER_CONTRACTED = 0x0010, - LEVELNUMBERS = 0x0040, - LINESTATE = 0x0080 - } - /// Is the range start..end considered a word? (Scintilla feature SC_IDLESTYLING_) - public enum IdleStyling - { - NONE = 0, - TOVISIBLE = 1, - AFTERVISIBLE = 2, - ALL = 3 - } - /// Retrieve the limits to idle styling. (Scintilla feature SC_WRAP_) - public enum Wrap - { - NONE = 0, - WORD = 1, - CHAR = 2, - WHITESPACE = 3 - } - /// Retrieve whether text is word wrapped. (Scintilla feature SC_WRAPVISUALFLAG_) - public enum WrapVisualFlag - { - NONE = 0x0000, - END = 0x0001, - START = 0x0002, - MARGIN = 0x0004 - } - /// Retrive the display mode of visual flags for wrapped lines. (Scintilla feature SC_WRAPVISUALFLAGLOC_) - public enum WrapVisualLocation - { - DEFAULT = 0x0000, - END_BY_TEXT = 0x0001, - START_BY_TEXT = 0x0002 - } - /// Retrive the start indent for wrapped lines. (Scintilla feature SC_WRAPINDENT_) - public enum WrapIndentMode - { - FIXED = 0, - SAME = 1, - INDENT = 2, - DEEPINDENT = 3 - } - /// Retrieve how wrapped sublines are placed. Default is fixed. (Scintilla feature SC_CACHE_) - public enum LineCache - { - NONE = 0, - CARET = 1, - PAGE = 2, - DOCUMENT = 3 - } - /// Append a string to the end of the document without changing the selection. (Scintilla feature SC_PHASES_) - public enum PhasesDraw - { - ONE = 0, - TWO = 1, - MULTIPLE = 2 - } - /// Control font anti-aliasing. (Scintilla feature SC_EFF_) - public enum FontQuality - { - QUALITY_MASK = 0xF, - QUALITY_DEFAULT = 0, - QUALITY_NON_ANTIALIASED = 1, - QUALITY_ANTIALIASED = 2, - QUALITY_LCD_OPTIMIZED = 3 - } - /// Scroll so that a display line is at the top of the display. (Scintilla feature SC_MULTIPASTE_) - public enum MultiPaste - { - ONCE = 0, - EACH = 1 - } - /// Set the other colour used as a chequerboard pattern in the fold margin (Scintilla feature SC_ACCESSIBILITY_) - public enum Accessibility - { - DISABLED = 0, - ENABLED = 1 - } - /// Set which document modification events are sent to the container. (Scintilla feature EDGE_) - public enum EdgeVisualStyle - { - NONE = 0, - LINE = 1, - BACKGROUND = 2, - MULTILINE = 3 - } - /// Retrieves the number of lines completely visible. (Scintilla feature SC_POPUP_) - public enum PopUp - { - NEVER = 0, - ALL = 1, - TEXT = 2 - } - /// Retrieve the zoom level. (Scintilla feature SC_DOCUMENTOPTION_) - public enum DocumentOption - { - DEFAULT = 0, - STYLES_NONE = 0x1, - TEXT_LARGE = 0x100 - } - /// Get internal focus flag. (Scintilla feature SC_STATUS_) - public enum Status - { - OK = 0, - FAILURE = 1, - BADALLOC = 2, - WARN_START = 1000, - WARN_REGEX = 1001 - } - /// Get whether mouse wheel can be active outside the window. (Scintilla feature SC_CURSOR) - public enum CursorShape - { - NORMAL = -1, - ARROW = 2, - WAIT = 4, - REVERSEARROW = 7 - } - /// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy. (Scintilla feature VISIBLE_) - public enum VisiblePolicy - { - SLOP = 0x01, - STRICT = 0x04 - } - /// Set the focus to this Scintilla widget. (Scintilla feature CARET_) - public enum CaretPolicy - { - SLOP = 0x01, - STRICT = 0x04, - JUMPS = 0x10, - EVEN = 0x08 - } - /// Copy argument text to the clipboard. (Scintilla feature SC_SEL_) - public enum SelectionMode - { - STREAM = 0, - RECTANGLE = 1, - LINES = 2, - THIN = 3 - } - /// - /// Get currently selected item text in the auto-completion list - /// Returns the length of the item text - /// Result is NUL-terminated. - /// (Scintilla feature SC_CASEINSENSITIVEBEHAVIOUR_) - /// - public enum CaseInsensitiveBehaviour - { - RESPECTCASE = 0, - IGNORECASE = 1 - } - /// Get auto-completion case insensitive behaviour. (Scintilla feature SC_MULTIAUTOC_) - public enum MultiAutoComplete - { - ONCE = 0, - EACH = 1 - } - /// Retrieve the effect of autocompleting when there are multiple selections. (Scintilla feature SC_ORDER_) - public enum Ordering - { - PRESORTED = 0, - PERFORMSORT = 1, - CUSTOM = 2 - } - /// Stop the caret preferred x position changing when the user types. (Scintilla feature SC_CARETSTICKY_) - public enum CaretSticky - { - OFF = 0, - ON = 1, - WHITESPACE = 2 - } - /// Duplicate the selection. If selection empty duplicate the line containing the caret. (Scintilla feature SC_ALPHA_) - public enum Alpha - { - TRANSPARENT = 0, - OPAQUE = 255, - NOALPHA = 256 - } - /// Get the background alpha of the caret line. (Scintilla feature CARETSTYLE_) - public enum CaretStyle - { - INVISIBLE = 0, - LINE = 1, - BLOCK = 2, - OVERSTRIKE_BAR = 0, - OVERSTRIKE_BLOCK = 0x10, - INS_MASK = 0xF, - BLOCK_AFTER = 0x100 - } - /// Get the start of the range of style numbers used for margin text (Scintilla feature SC_MARGINOPTION_) - public enum MarginOption - { - NONE = 0, - SUBLINESELECT = 1 - } - /// Clear the annotations from all lines (Scintilla feature ANNOTATION_) - public enum AnnotationVisible - { - HIDDEN = 0, - STANDARD = 1, - BOXED = 2, - INDENTED = 3 - } - /// Allocate some extended (>255) style numbers and return the start of the range (Scintilla feature UNDO_) - public enum UndoFlags - { - NONE = 0, - MAY_COALESCE = 1 - } - /// Return the virtual space of the anchor of the rectangular selection. (Scintilla feature SCVS_) - public enum VirtualSpace - { - NONE = 0, - RECTANGULARSELECTION = 1, - USERACCESSIBLE = 2, - NOWRAPLINESTART = 4 - } - /// Scroll to end of document. (Scintilla feature SC_TECHNOLOGY_) - public enum Technology - { - DEFAULT = 0, - DIRECTWRITE = 1, - DIRECTWRITERETAIN = 2, - DIRECTWRITEDC = 3 - } - /// - /// Line end types which may be used in addition to LF, CR, and CRLF - /// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, - /// U+2029 Paragraph Separator, and U+0085 Next Line - /// (Scintilla feature SC_LINE_END_TYPE_) - /// - public enum LineEndType - { - DEFAULT = 0, - UNICODE = 1 - } - /// - /// Retrieve a '\n' separated list of properties understood by the current lexer. - /// Result is NUL-terminated. - /// (Scintilla feature SC_TYPE_) - /// - public enum TypeProperty - { - BOOLEAN = 0, - INTEGER = 1, - STRING = 2 - } - /// - /// Notifications - /// Type of modification and the action which caused the modification. - /// These are defined as a bit mask to make it easy to specify which notifications are wanted. - /// One bit is set from each of SC_MOD_* and SC_PERFORMED_*. - /// (Scintilla feature SC_MOD_ SC_PERFORMED_ SC_MULTISTEPUNDOREDO SC_LASTSTEPINUNDOREDO SC_MULTILINEUNDOREDO SC_STARTACTION SC_MODEVENTMASKALL) - /// - public enum ModificationFlags - { - } - /// - /// Notifications - /// Type of modification and the action which caused the modification. - /// These are defined as a bit mask to make it easy to specify which notifications are wanted. - /// One bit is set from each of SC_MOD_* and SC_PERFORMED_*. - /// (Scintilla feature SC_UPDATE_) - /// - public enum Update - { - CONTENT = 0x1, - SELECTION = 0x2, - V_SCROLL = 0x4, - H_SCROLL = 0x8 - } - /// - /// Symbolic key codes and modifier flags. - /// ASCII and other printable characters below 256. - /// Extended keys above 300. - /// (Scintilla feature SCMOD_) - /// - public enum KeyMod - { - NORM = 0, - SHIFT = 1, - CTRL = 2, - ALT = 4, - SUPER = 8, - META = 16 - } - /// - /// Symbolic key codes and modifier flags. - /// ASCII and other printable characters below 256. - /// Extended keys above 300. - /// (Scintilla feature SC_AC_) - /// - public enum CompletionMethods - { - FILLUP = 1, - DOUBLECLICK = 2, - TAB = 3, - NEWLINE = 4, - COMMAND = 5 - } - /// characterSource for SCN_CHARADDED (Scintilla feature SC_CHARACTERSOURCE_) - public enum CharacterSource - { - DIRECT_INPUT = 0, - TENTATIVE_INPUT = 1, - IME_RESULT = 2 - } - /// For SciLexer.h (Scintilla feature SCLEX_) - public enum Lexer - { - CONTAINER = 0, - NULL = 1, - PYTHON = 2, - CPP = 3, - HTML = 4, - XML = 5, - PERL = 6, - SQL = 7, - VB = 8, - PROPERTIES = 9, - ERRORLIST = 10, - MAKEFILE = 11, - BATCH = 12, - XCODE = 13, - LATEX = 14, - LUA = 15, - DIFF = 16, - CONF = 17, - PASCAL = 18, - AVE = 19, - ADA = 20, - LISP = 21, - RUBY = 22, - EIFFEL = 23, - EIFFELKW = 24, - TCL = 25, - NNCRONTAB = 26, - BULLANT = 27, - VBSCRIPT = 28, - BAAN = 31, - MATLAB = 32, - SCRIPTOL = 33, - ASM = 34, - CPPNOCASE = 35, - FORTRAN = 36, - F77 = 37, - CSS = 38, - POV = 39, - LOUT = 40, - ESCRIPT = 41, - PS = 42, - NSIS = 43, - MMIXAL = 44, - CLW = 45, - CLWNOCASE = 46, - LOT = 47, - YAML = 48, - TEX = 49, - METAPOST = 50, - POWERBASIC = 51, - FORTH = 52, - ERLANG = 53, - OCTAVE = 54, - MSSQL = 55, - VERILOG = 56, - KIX = 57, - GUI4CLI = 58, - SPECMAN = 59, - AU3 = 60, - APDL = 61, - BASH = 62, - ASN1 = 63, - VHDL = 64, - CAML = 65, - BLITZBASIC = 66, - PUREBASIC = 67, - HASKELL = 68, - PHPSCRIPT = 69, - TADS3 = 70, - REBOL = 71, - SMALLTALK = 72, - FLAGSHIP = 73, - CSOUND = 74, - FREEBASIC = 75, - INNOSETUP = 76, - OPAL = 77, - SPICE = 78, - D = 79, - CMAKE = 80, - GAP = 81, - PLM = 82, - PROGRESS = 83, - ABAQUS = 84, - ASYMPTOTE = 85, - R = 86, - MAGIK = 87, - POWERSHELL = 88, - MYSQL = 89, - PO = 90, - TAL = 91, - COBOL = 92, - TACL = 93, - SORCUS = 94, - POWERPRO = 95, - NIMROD = 96, - SML = 97, - MARKDOWN = 98, - TXT2TAGS = 99, - A68K = 100, - MODULA = 101, - COFFEESCRIPT = 102, - TCMD = 103, - AVS = 104, - ECL = 105, - OSCRIPT = 106, - VISUALPROLOG = 107, - LITERATEHASKELL = 108, - STTXT = 109, - KVIRC = 110, - RUST = 111, - DMAP = 112, - AS = 113, - DMIS = 114, - REGISTRY = 115, - BIBTEX = 116, - SREC = 117, - IHEX = 118, - TEHEX = 119, - JSON = 120, - EDIFACT = 121, - INDENT = 122, - MAXIMA = 123, - STATA = 124, - SAS = 125, - NIM = 126, - CIL = 127, - X12 = 128, - DATAFLEX = 129, - AUTOMATIC = 1000 - } - /// GTK Specific to work around focus and accelerator problems: (Scintilla feature SC_BIDIRECTIONAL_) - public enum Bidirectional - { - DISABLED = 0, - L2R = 1, - R2L = 2 - } - /// Set bidirectional text display state. (Scintilla feature SC_LINECHARACTERINDEX_) - public enum LineCharacterIndexType - { - NONE = 0, - UTF32 = 1, - UTF16 = 2 - } /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ } diff --git a/NppMarkdownPanel/PluginInfrastructure/IScintillaGateway.cs b/NppMarkdownPanel/PluginInfrastructure/IScintillaGateway.cs index 981e1b7..7b15765 100644 --- a/NppMarkdownPanel/PluginInfrastructure/IScintillaGateway.cs +++ b/NppMarkdownPanel/PluginInfrastructure/IScintillaGateway.cs @@ -40,7 +40,7 @@ public interface IScintillaGateway unsafe void AddStyledText(int length, Cells c); /// Insert string at a position. (Scintilla feature 2003) - unsafe void InsertText(int pos, string text); + unsafe void InsertText(Position pos, string text); /// Change the text that is being inserted in response to SC_MOD_INSERTCHECK (Scintilla feature 2672) unsafe void ChangeInsertion(int length, string text); @@ -49,7 +49,7 @@ public interface IScintillaGateway void ClearAll(); /// Delete a range of text in the document. (Scintilla feature 2645) - void DeleteRange(int start, int lengthDelete); + void DeleteRange(Position pos, int deleteLength); /// Set all style bytes to 0, remove all folding information. (Scintilla feature 2005) void ClearDocumentStyle(); @@ -58,16 +58,16 @@ public interface IScintillaGateway int GetLength(); /// Returns the character byte at the position. (Scintilla feature 2007) - int GetCharAt(int pos); + int GetCharAt(Position pos); /// Returns the position of the caret. (Scintilla feature 2008) - int GetCurrentPos(); + Position GetCurrentPos(); /// Returns the position of the opposite end of the selection to the caret. (Scintilla feature 2009) - int GetAnchor(); + Position GetAnchor(); /// Returns the style byte at the position. (Scintilla feature 2010) - int GetStyleAt(int pos); + int GetStyleAt(Position pos); /// Redoes the next action on the undo history. (Scintilla feature 2011) void Redo(); @@ -100,10 +100,10 @@ public interface IScintillaGateway bool CanRedo(); /// Retrieve the line number at which a particular marker is located. (Scintilla feature 2017) - int MarkerLineFromHandle(int markerHandle); + int MarkerLineFromHandle(int handle); /// Delete a marker. (Scintilla feature 2018) - void MarkerDeleteHandle(int markerHandle); + void MarkerDeleteHandle(int handle); /// Is undo history being collected? (Scintilla feature 2019) bool GetUndoCollection(); @@ -113,43 +113,33 @@ public interface IScintillaGateway /// Returns one of SCWS_* constants. /// (Scintilla feature 2020) /// - WhiteSpace GetViewWS(); + int GetViewWS(); /// Make white space characters invisible, always visible or visible outside indentation. (Scintilla feature 2021) - void SetViewWS(WhiteSpace viewWS); - - /// - /// Retrieve the current tab draw mode. - /// Returns one of SCTD_* constants. - /// (Scintilla feature 2698) - /// - TabDrawMode GetTabDrawMode(); - - /// Set how tabs are drawn when visible. (Scintilla feature 2699) - void SetTabDrawMode(TabDrawMode tabDrawMode); + void SetViewWS(int viewWS); /// Find the position from a point within the window. (Scintilla feature 2022) - int PositionFromPoint(int x, int y); + Position PositionFromPoint(int x, int y); /// /// Find the position from a point within the window but return /// INVALID_POSITION if not close to text. /// (Scintilla feature 2023) /// - int PositionFromPointClose(int x, int y); + Position PositionFromPointClose(int x, int y); /// Set caret to start of a line and ensure it is visible. (Scintilla feature 2024) void GotoLine(int line); /// Set caret to a position and ensure it is visible. (Scintilla feature 2025) - void GotoPos(int caret); + void GotoPos(Position pos); /// /// Set the selection anchor to a position. The anchor is the opposite /// end of the selection from the caret. /// (Scintilla feature 2026) /// - void SetAnchor(int anchor); + void SetAnchor(Position posAnchor); /// /// Retrieve the text of the line containing the caret. @@ -160,23 +150,23 @@ public interface IScintillaGateway unsafe string GetCurLine(int length); /// Retrieve the position of the last correctly styled character. (Scintilla feature 2028) - int GetEndStyled(); + Position GetEndStyled(); /// Convert all line endings in the document to one mode. (Scintilla feature 2029) - void ConvertEOLs(EndOfLine eolMode); + void ConvertEOLs(int eolMode); /// Retrieve the current end of line mode - one of CRLF, CR, or LF. (Scintilla feature 2030) - EndOfLine GetEOLMode(); + int GetEOLMode(); /// Set the current end of line mode. (Scintilla feature 2031) - void SetEOLMode(EndOfLine eolMode); + void SetEOLMode(int eolMode); /// - /// Set the current styling position to start. - /// The unused parameter is no longer used and should be set to 0. + /// Set the current styling position to pos and the styling mask to mask. + /// The styling mask can be used to protect some bits in each styling byte from modification. /// (Scintilla feature 2032) /// - void StartStyling(int start, int unused); + void StartStyling(Position pos, int mask); /// /// Change style from current styling position for length characters to a style @@ -217,14 +207,14 @@ public interface IScintillaGateway /// void SetCodePage(int codePage); - /// Is the IME displayed in a window or inline? (Scintilla feature 2678) - IMEInteraction GetIMEInteraction(); + /// Is the IME displayed in a winow or inline? (Scintilla feature 2678) + int GetIMEInteraction(); /// Choose to display the the IME in a winow or inline. (Scintilla feature 2679) - void SetIMEInteraction(IMEInteraction imeInteraction); + void SetIMEInteraction(int imeInteraction); /// Set the symbol used for a particular marker number. (Scintilla feature 2040) - void MarkerDefine(int markerNumber, MarkerSymbol markerSymbol); + void MarkerDefine(int markerNumber, int markerSymbol); /// Set the foreground colour used for a particular marker number. (Scintilla feature 2041) void MarkerSetFore(int markerNumber, Colour fore); @@ -264,16 +254,16 @@ public interface IScintillaGateway unsafe void MarkerDefinePixmap(int markerNumber, string pixmap); /// Add a set of markers to a line. (Scintilla feature 2466) - void MarkerAddSet(int line, int markerSet); + void MarkerAddSet(int line, int set); /// Set the alpha used for a marker that is drawn in the text area, not the margin. (Scintilla feature 2476) - void MarkerSetAlpha(int markerNumber, Alpha alpha); + void MarkerSetAlpha(int markerNumber, int alpha); /// Set a margin to be either numeric or symbolic. (Scintilla feature 2240) - void SetMarginTypeN(int margin, MarginType marginType); + void SetMarginTypeN(int margin, int marginType); /// Retrieve the type of a margin. (Scintilla feature 2241) - MarginType GetMarginTypeN(int margin); + int GetMarginTypeN(int margin); /// Set the width of a margin to a width expressed in pixels. (Scintilla feature 2242) void SetMarginWidthN(int margin, int pixelWidth); @@ -294,22 +284,10 @@ public interface IScintillaGateway bool GetMarginSensitiveN(int margin); /// Set the cursor shown when the mouse is inside a margin. (Scintilla feature 2248) - void SetMarginCursorN(int margin, CursorShape cursor); + void SetMarginCursorN(int margin, int cursor); /// Retrieve the cursor shown in a margin. (Scintilla feature 2249) - CursorShape GetMarginCursorN(int margin); - - /// Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. (Scintilla feature 2250) - void SetMarginBackN(int margin, Colour back); - - /// Retrieve the background colour of a margin (Scintilla feature 2251) - Colour GetMarginBackN(int margin); - - /// Allocate a non-standard number of margins. (Scintilla feature 2252) - void SetMargins(int margins); - - /// How many margins are there?. (Scintilla feature 2253) - int GetMargins(); + int GetMarginCursorN(int margin); /// Clear all the styles and make equivalent to the global default style. (Scintilla feature 2050) void StyleClearAll(); @@ -333,7 +311,7 @@ public interface IScintillaGateway unsafe void StyleSetFont(int style, string fontName); /// Set a style to have its end of line filled or not. (Scintilla feature 2057) - void StyleSetEOLFilled(int style, bool eolFilled); + void StyleSetEOLFilled(int style, bool filled); /// Reset the default style to its state at startup (Scintilla feature 2058) void StyleResetDefault(); @@ -371,10 +349,10 @@ public interface IScintillaGateway bool StyleGetUnderline(int style); /// Get is a style mixed case, or to force upper or lower case. (Scintilla feature 2489) - CaseVisible StyleGetCase(int style); + int StyleGetCase(int style); /// Get the character get of the font in a style. (Scintilla feature 2490) - CharacterSet StyleGetCharacterSet(int style); + int StyleGetCharacterSet(int style); /// Get is a style visible or not. (Scintilla feature 2491) bool StyleGetVisible(int style); @@ -390,22 +368,22 @@ public interface IScintillaGateway bool StyleGetHotSpot(int style); /// Set a style to be mixed case, or to force upper or lower case. (Scintilla feature 2060) - void StyleSetCase(int style, CaseVisible caseVisible); + void StyleSetCase(int style, int caseForce); /// Set the size of characters of a style. Size is in points multiplied by 100. (Scintilla feature 2061) - void StyleSetSizeFractional(int style, int sizeHundredthPoints); + void StyleSetSizeFractional(int style, int caseForce); /// Get the size of characters of a style in points multiplied by 100 (Scintilla feature 2062) int StyleGetSizeFractional(int style); /// Set the weight of characters of a style. (Scintilla feature 2063) - void StyleSetWeight(int style, FontWeight weight); + void StyleSetWeight(int style, int weight); /// Get the weight of characters of a style. (Scintilla feature 2064) - FontWeight StyleGetWeight(int style); + int StyleGetWeight(int style); /// Set the character set of the font in a style. (Scintilla feature 2066) - void StyleSetCharacterSet(int style, CharacterSet characterSet); + void StyleSetCharacterSet(int style, int characterSet); /// Set a style to be a hotspot or not. (Scintilla feature 2409) void StyleSetHotSpot(int style, bool hotspot); @@ -417,10 +395,10 @@ public interface IScintillaGateway void SetSelBack(bool useSetting, Colour back); /// Get the alpha of the selection. (Scintilla feature 2477) - Alpha GetSelAlpha(); + int GetSelAlpha(); /// Set the alpha of the selection. (Scintilla feature 2478) - void SetSelAlpha(Alpha alpha); + void SetSelAlpha(int alpha); /// Is the selection end of line filled? (Scintilla feature 2479) bool GetSelEOLFilled(); @@ -431,11 +409,11 @@ public interface IScintillaGateway /// Set the foreground colour of the caret. (Scintilla feature 2069) void SetCaretFore(Colour fore); - /// When key+modifier combination keyDefinition is pressed perform sciCommand. (Scintilla feature 2070) - void AssignCmdKey(KeyModifier keyDefinition, int sciCommand); + /// When key+modifier combination km is pressed perform msg. (Scintilla feature 2070) + void AssignCmdKey(KeyModifier km, int msg); - /// When key+modifier combination keyDefinition is pressed do nothing. (Scintilla feature 2071) - void ClearCmdKey(KeyModifier keyDefinition); + /// When key+modifier combination km is pressed do nothing. (Scintilla feature 2071) + void ClearCmdKey(KeyModifier km); /// Drop all key mappings. (Scintilla feature 2072) void ClearAllCmdKeys(); @@ -466,12 +444,6 @@ public interface IScintillaGateway /// unsafe string GetWordChars(); - /// Set the number of characters to have directly indexed categories (Scintilla feature 2720) - void SetCharacterCategoryOptimization(int countCharacters); - - /// Get the number of characters to have directly indexed categories (Scintilla feature 2721) - int GetCharacterCategoryOptimization(); - /// /// Start a sequence of actions that is undone and redone as a unit. /// May be nested. @@ -483,40 +455,40 @@ public interface IScintillaGateway void EndUndoAction(); /// Set an indicator to plain, squiggle or TT. (Scintilla feature 2080) - void IndicSetStyle(int indicator, IndicatorStyle indicatorStyle); + void IndicSetStyle(int indic, int style); /// Retrieve the style of an indicator. (Scintilla feature 2081) - IndicatorStyle IndicGetStyle(int indicator); + int IndicGetStyle(int indic); /// Set the foreground colour of an indicator. (Scintilla feature 2082) - void IndicSetFore(int indicator, Colour fore); + void IndicSetFore(int indic, Colour fore); /// Retrieve the foreground colour of an indicator. (Scintilla feature 2083) - Colour IndicGetFore(int indicator); + Colour IndicGetFore(int indic); /// Set an indicator to draw under text or over(default). (Scintilla feature 2510) - void IndicSetUnder(int indicator, bool under); + void IndicSetUnder(int indic, bool under); /// Retrieve whether indicator drawn under or over text. (Scintilla feature 2511) - bool IndicGetUnder(int indicator); + bool IndicGetUnder(int indic); /// Set a hover indicator to plain, squiggle or TT. (Scintilla feature 2680) - void IndicSetHoverStyle(int indicator, IndicatorStyle indicatorStyle); + void IndicSetHoverStyle(int indic, int style); /// Retrieve the hover style of an indicator. (Scintilla feature 2681) - IndicatorStyle IndicGetHoverStyle(int indicator); + int IndicGetHoverStyle(int indic); /// Set the foreground hover colour of an indicator. (Scintilla feature 2682) - void IndicSetHoverFore(int indicator, Colour fore); + void IndicSetHoverFore(int indic, Colour fore); /// Retrieve the foreground hover colour of an indicator. (Scintilla feature 2683) - Colour IndicGetHoverFore(int indicator); + Colour IndicGetHoverFore(int indic); /// Set the attributes of an indicator. (Scintilla feature 2684) - void IndicSetFlags(int indicator, IndicFlag flags); + void IndicSetFlags(int indic, int flags); /// Retrieve the attributes of an indicator. (Scintilla feature 2685) - IndicFlag IndicGetFlags(int indicator); + int IndicGetFlags(int indic); /// Set the foreground colour of all whitespace and whether to use this setting. (Scintilla feature 2084) void SetWhitespaceFore(bool useSetting, Colour fore); @@ -530,6 +502,17 @@ public interface IScintillaGateway /// Get the size of the dots used to mark space characters. (Scintilla feature 2087) int GetWhitespaceSize(); + /// + /// Divide each styling byte into lexical class bits (default: 5) and indicator + /// bits (default: 3). If a lexer requires more than 32 lexical states, then this + /// is used to expand the possible states. + /// (Scintilla feature 2090) + /// + void SetStyleBits(int bits); + + /// Retrieve number of bits in style bytes used to hold the lexical state. (Scintilla feature 2091) + int GetStyleBits(); + /// Used to hold extra styling information for each line. (Scintilla feature 2092) void SetLineState(int line, int state); @@ -551,20 +534,6 @@ public interface IScintillaGateway /// Set the colour of the background of the line containing the caret. (Scintilla feature 2098) void SetCaretLineBack(Colour back); - /// - /// Retrieve the caret line frame width. - /// Width = 0 means this option is disabled. - /// (Scintilla feature 2704) - /// - int GetCaretLineFrame(); - - /// - /// Display the caret line framed. - /// Set width != 0 to enable this option and width = 0 to disable it. - /// (Scintilla feature 2705) - /// - void SetCaretLineFrame(int width); - /// /// Set a style to be changeable or not (read only). /// Experimental feature, currently buggy. @@ -574,11 +543,11 @@ public interface IScintillaGateway /// /// Display a auto-completion list. - /// The lengthEntered parameter indicates how many characters before + /// The lenEntered parameter indicates how many characters before /// the caret should be used to provide context. /// (Scintilla feature 2100) /// - unsafe void AutoCShow(int lengthEntered, string itemList); + unsafe void AutoCShow(int lenEntered, string itemList); /// Remove the auto-completion list from the screen. (Scintilla feature 2101) void AutoCCancel(); @@ -587,7 +556,7 @@ public interface IScintillaGateway bool AutoCActive(); /// Retrieve the position of the caret when the auto-completion list was displayed. (Scintilla feature 2103) - int AutoCPosStart(); + Position AutoCPosStart(); /// User has selected an item so remove the list and insert the selection. (Scintilla feature 2104) void AutoCComplete(); @@ -606,7 +575,7 @@ public interface IScintillaGateway int AutoCGetSeparator(); /// Select the item in the auto-completion list that starts with a string. (Scintilla feature 2108) - unsafe void AutoCSelect(string select); + unsafe void AutoCSelect(string text); /// /// Should the auto-completion list be cancelled if the user backspaces to a @@ -713,34 +682,31 @@ public interface IScintillaGateway bool GetUseTabs(); /// Change the indentation of a line to a number of columns. (Scintilla feature 2126) - void SetLineIndentation(int line, int indentation); + void SetLineIndentation(int line, int indentSize); /// Retrieve the number of columns that a line is indented. (Scintilla feature 2127) int GetLineIndentation(int line); /// Retrieve the position before the first non indentation character on a line. (Scintilla feature 2128) - int GetLineIndentPosition(int line); + Position GetLineIndentPosition(int line); /// Retrieve the column number of a position, taking tab width into account. (Scintilla feature 2129) - int GetColumn(int pos); + int GetColumn(Position pos); /// Count characters between two positions. (Scintilla feature 2633) - int CountCharacters(int start, int end); - - /// Count code units between two positions. (Scintilla feature 2715) - int CountCodeUnits(int start, int end); + int CountCharacters(int startPos, int endPos); /// Show or hide the horizontal scroll bar. (Scintilla feature 2130) - void SetHScrollBar(bool visible); + void SetHScrollBar(bool show); /// Is the horizontal scroll bar visible? (Scintilla feature 2131) bool GetHScrollBar(); /// Show or hide indentation guides. (Scintilla feature 2132) - void SetIndentationGuides(IndentView indentView); + void SetIndentationGuides(int indentView); /// Are the indentation guides visible? (Scintilla feature 2133) - IndentView GetIndentationGuides(); + int GetIndentationGuides(); /// /// Set the highlighted indentation guide column. @@ -753,7 +719,7 @@ public interface IScintillaGateway int GetHighlightGuide(); /// Get the position after the last visible characters on a line. (Scintilla feature 2136) - int GetLineEndPosition(int line); + Position GetLineEndPosition(int line); /// Get the code page used to interpret the bytes of the document as characters. (Scintilla feature 2137) int GetCodePage(); @@ -765,22 +731,22 @@ public interface IScintillaGateway bool GetReadOnly(); /// Sets the position of the caret. (Scintilla feature 2141) - void SetCurrentPos(int caret); + void SetCurrentPos(Position pos); /// Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2142) - void SetSelectionStart(int anchor); + void SetSelectionStart(Position pos); /// Returns the position at the start of the selection. (Scintilla feature 2143) - int GetSelectionStart(); + Position GetSelectionStart(); - /// Sets the position that ends the selection - this becomes the caret. (Scintilla feature 2144) - void SetSelectionEnd(int caret); + /// Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2144) + void SetSelectionEnd(Position pos); /// Returns the position at the end of the selection. (Scintilla feature 2145) - int GetSelectionEnd(); + Position GetSelectionEnd(); /// Set caret to a position, while removing any existing selection. (Scintilla feature 2556) - void SetEmptySelection(int caret); + void SetEmptySelection(Position pos); /// Sets the print magnification added to the point size of each style for printing. (Scintilla feature 2146) void SetPrintMagnification(int magnification); @@ -789,13 +755,13 @@ public interface IScintillaGateway int GetPrintMagnification(); /// Modify colours when printing for clearer printed text. (Scintilla feature 2148) - void SetPrintColourMode(PrintOption mode); + void SetPrintColourMode(int mode); /// Returns the print colour mode. (Scintilla feature 2149) - PrintOption GetPrintColourMode(); + int GetPrintColourMode(); /// Find some text in the document. (Scintilla feature 2150) - int FindText(FindOption searchFlags, TextToFind ft); + Position FindText(int flags, TextToFind ft); /// Retrieve the display line at the top of the display. (Scintilla feature 2152) int GetFirstVisibleLine(); @@ -826,7 +792,7 @@ public interface IScintillaGateway bool GetModify(); /// Select a range of text. (Scintilla feature 2160) - void SetSel(int anchor, int caret); + void SetSel(Position start, Position end); /// /// Retrieve the selected text. @@ -843,20 +809,20 @@ public interface IScintillaGateway /// int GetTextRange(TextRange tr); - /// Draw the selection either highlighted or in normal (non-highlighted) style. (Scintilla feature 2163) - void HideSelection(bool hide); + /// Draw the selection in normal style or with selection highlighted. (Scintilla feature 2163) + void HideSelection(bool normal); /// Retrieve the x value of the point in the window where a position is displayed. (Scintilla feature 2164) - int PointXFromPosition(int pos); + int PointXFromPosition(Position pos); /// Retrieve the y value of the point in the window where a position is displayed. (Scintilla feature 2165) - int PointYFromPosition(int pos); + int PointYFromPosition(Position pos); /// Retrieve the line containing a position. (Scintilla feature 2166) - int LineFromPosition(int pos); + int LineFromPosition(Position pos); /// Retrieve the position at the start of a line. (Scintilla feature 2167) - int PositionFromLine(int line); + Position PositionFromLine(int line); /// Scroll horizontally and vertically. (Scintilla feature 2168) void LineScroll(int columns, int lines); @@ -870,7 +836,7 @@ public interface IScintillaGateway /// This may be used to make a search match visible. /// (Scintilla feature 2569) /// - void ScrollRange(int secondary, int primary); + void ScrollRange(Position secondary, Position primary); /// Replace the selected text with the argument text. (Scintilla feature 2170) unsafe void ReplaceSel(string text); @@ -930,7 +896,7 @@ public interface IScintillaGateway IntPtr GetDirectPointer(); /// Set to overtype (true) or insert mode. (Scintilla feature 2186) - void SetOvertype(bool overType); + void SetOvertype(bool overtype); /// Returns true if overtype mode is active otherwise false is returned. (Scintilla feature 2187) bool GetOvertype(); @@ -946,33 +912,27 @@ public interface IScintillaGateway /// document without affecting the scroll position. /// (Scintilla feature 2190) /// - void SetTargetStart(int start); + void SetTargetStart(Position pos); /// Get the position that starts the target. (Scintilla feature 2191) - int GetTargetStart(); + Position GetTargetStart(); /// /// Sets the position that ends the target which is used for updating the /// document without affecting the scroll position. /// (Scintilla feature 2192) /// - void SetTargetEnd(int end); + void SetTargetEnd(Position pos); /// Get the position that ends the target. (Scintilla feature 2193) - int GetTargetEnd(); + Position GetTargetEnd(); /// Sets both the start and end of the target in one call. (Scintilla feature 2686) - void SetTargetRange(int start, int end); + void SetTargetRange(Position start, Position end); /// Retrieve the text in the target. (Scintilla feature 2687) unsafe string GetTargetText(); - /// Make the target range start and end be the same as the selection range start and end. (Scintilla feature 2287) - void TargetFromSelection(); - - /// Sets the target to the whole document. (Scintilla feature 2690) - void TargetWholeDocument(); - /// /// Replace the target text with the argument text. /// Text is counted so it can contain NULs. @@ -995,19 +955,19 @@ public interface IScintillaGateway /// /// 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. + /// Returns length of range or -1 for failure in which case target is not moved. /// (Scintilla feature 2197) /// unsafe int SearchInTarget(int length, string text); /// Set the search flags used by SearchInTarget. (Scintilla feature 2198) - void SetSearchFlags(FindOption searchFlags); + void SetSearchFlags(int flags); /// Get the search flags used by SearchInTarget. (Scintilla feature 2199) - FindOption GetSearchFlags(); + int GetSearchFlags(); /// Show a call tip containing a definition near position pos. (Scintilla feature 2200) - unsafe void CallTipShow(int pos, string definition); + unsafe void CallTipShow(Position pos, string definition); /// Remove the call tip from the screen. (Scintilla feature 2201) void CallTipCancel(); @@ -1016,13 +976,13 @@ public interface IScintillaGateway bool CallTipActive(); /// Retrieve the position where the caret was before displaying the call tip. (Scintilla feature 2203) - int CallTipPosStart(); + Position CallTipPosStart(); /// Set the start position in order to change when backspacing removes the calltip. (Scintilla feature 2214) void CallTipSetPosStart(int posStart); /// Highlight a segment of the definition. (Scintilla feature 2204) - void CallTipSetHlt(int highlightStart, int highlightEnd); + void CallTipSetHlt(int start, int end); /// Set the background colour for the call tip. (Scintilla feature 2205) void CallTipSetBack(Colour back); @@ -1040,13 +1000,13 @@ public interface IScintillaGateway void CallTipSetPosition(bool above); /// Find the display line of a document line taking hidden lines into account. (Scintilla feature 2220) - int VisibleFromDocLine(int docLine); + int VisibleFromDocLine(int line); /// Find the document line of a display line taking hidden lines into account. (Scintilla feature 2221) - int DocLineFromVisible(int displayLine); + int DocLineFromVisible(int lineDisplay); /// The number of display lines needed to wrap a document line (Scintilla feature 2235) - int WrapCount(int docLine); + int WrapCount(int line); /// /// Set the fold level of a line. @@ -1054,13 +1014,13 @@ public interface IScintillaGateway /// line is a header and whether it is effectively white space. /// (Scintilla feature 2222) /// - void SetFoldLevel(int line, FoldLevel level); + void SetFoldLevel(int line, int level); /// Retrieve the fold level of a line. (Scintilla feature 2223) - FoldLevel GetFoldLevel(int line); + int GetFoldLevel(int line); /// Find the last child line of a header line. (Scintilla feature 2224) - int GetLastChild(int line, FoldLevel level); + int GetLastChild(int line, int level); /// Find the parent line of a child line. (Scintilla feature 2225) int GetFoldParent(int line); @@ -1086,44 +1046,29 @@ public interface IScintillaGateway /// Switch a header line between expanded and contracted. (Scintilla feature 2231) void ToggleFold(int line); - /// Switch a header line between expanded and contracted and show some text after the line. (Scintilla feature 2700) - unsafe void ToggleFoldShowText(int line, string text); - - /// Set the style of fold display text. (Scintilla feature 2701) - void FoldDisplayTextSetStyle(FoldDisplayTextStyle style); - - /// Get the style of fold display text. (Scintilla feature 2707) - FoldDisplayTextStyle FoldDisplayTextGetStyle(); - - /// Set the default fold display text. (Scintilla feature 2722) - unsafe void SetDefaultFoldDisplayText(string text); - - /// Get the default fold display text. (Scintilla feature 2723) - unsafe string GetDefaultFoldDisplayText(); - /// Expand or contract a fold header. (Scintilla feature 2237) - void FoldLine(int line, FoldAction action); + void FoldLine(int line, int action); /// Expand or contract a fold header and its children. (Scintilla feature 2238) - void FoldChildren(int line, FoldAction action); + void FoldChildren(int line, int action); /// Expand a fold header and all children. Use the level argument instead of the line's current level. (Scintilla feature 2239) - void ExpandChildren(int line, FoldLevel level); + void ExpandChildren(int line, int level); /// Expand or contract all fold headers. (Scintilla feature 2662) - void FoldAll(FoldAction action); + void FoldAll(int action); /// Ensure a particular line is visible by expanding any header line hiding it. (Scintilla feature 2232) void EnsureVisible(int line); /// Set automatic folding behaviours. (Scintilla feature 2663) - void SetAutomaticFold(AutomaticFold automaticFold); + void SetAutomaticFold(int automaticFold); /// Get automatic folding behaviours. (Scintilla feature 2664) - AutomaticFold GetAutomaticFold(); + int GetAutomaticFold(); /// Set some style options for folding. (Scintilla feature 2233) - void SetFoldFlags(FoldFlag flags); + void SetFoldFlags(int flags); /// /// Ensure a particular line is visible by expanding any header line hiding it. @@ -1151,37 +1096,28 @@ public interface IScintillaGateway int GetMouseDwellTime(); /// Get position of start of word. (Scintilla feature 2266) - int WordStartPosition(int pos, bool onlyWordCharacters); + int WordStartPosition(Position pos, bool onlyWordCharacters); /// Get position of end of word. (Scintilla feature 2267) - int WordEndPosition(int pos, bool onlyWordCharacters); - - /// Is the range start..end considered a word? (Scintilla feature 2691) - bool IsRangeWord(int start, int end); - - /// Sets limits to idle styling. (Scintilla feature 2692) - void SetIdleStyling(IdleStyling idleStyling); - - /// Retrieve the limits to idle styling. (Scintilla feature 2693) - IdleStyling GetIdleStyling(); + int WordEndPosition(Position pos, bool onlyWordCharacters); /// Sets whether text is word wrapped. (Scintilla feature 2268) - void SetWrapMode(Wrap wrapMode); + void SetWrapMode(int mode); /// Retrieve whether text is word wrapped. (Scintilla feature 2269) - Wrap GetWrapMode(); + int GetWrapMode(); /// Set the display mode of visual flags for wrapped lines. (Scintilla feature 2460) - void SetWrapVisualFlags(WrapVisualFlag wrapVisualFlags); + void SetWrapVisualFlags(int wrapVisualFlags); /// Retrive the display mode of visual flags for wrapped lines. (Scintilla feature 2461) - WrapVisualFlag GetWrapVisualFlags(); + int GetWrapVisualFlags(); /// Set the location of visual flags for wrapped lines. (Scintilla feature 2462) - void SetWrapVisualFlagsLocation(WrapVisualLocation wrapVisualFlagsLocation); + void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation); /// Retrive the location of visual flags for wrapped lines. (Scintilla feature 2463) - WrapVisualLocation GetWrapVisualFlagsLocation(); + int GetWrapVisualFlagsLocation(); /// Set the start indent for wrapped lines. (Scintilla feature 2464) void SetWrapStartIndent(int indent); @@ -1190,16 +1126,16 @@ public interface IScintillaGateway int GetWrapStartIndent(); /// Sets how wrapped sublines are placed. Default is fixed. (Scintilla feature 2472) - void SetWrapIndentMode(WrapIndentMode wrapIndentMode); + void SetWrapIndentMode(int mode); /// Retrieve how wrapped sublines are placed. Default is fixed. (Scintilla feature 2473) - WrapIndentMode GetWrapIndentMode(); + int GetWrapIndentMode(); /// Sets the degree of caching of layout information. (Scintilla feature 2272) - void SetLayoutCache(LineCache cacheMode); + void SetLayoutCache(int mode); /// Retrieve the degree of caching of layout information. (Scintilla feature 2273) - LineCache GetLayoutCache(); + int GetLayoutCache(); /// Sets the document width assumed for scrolling. (Scintilla feature 2274) void SetScrollWidth(int pixelWidth); @@ -1240,7 +1176,7 @@ public interface IScintillaGateway int TextHeight(int line); /// Show or hide the vertical scroll bar. (Scintilla feature 2280) - void SetVScrollBar(bool visible); + void SetVScrollBar(bool show); /// Is the vertical scroll bar visible? (Scintilla feature 2281) bool GetVScrollBar(); @@ -1248,8 +1184,18 @@ public interface IScintillaGateway /// Append a string to the end of the document without changing the selection. (Scintilla feature 2282) unsafe void AppendText(int length, string text); + /// Is drawing done in two phases with backgrounds drawn before foregrounds? (Scintilla feature 2283) + bool GetTwoPhaseDraw(); + + /// + /// In twoPhaseDraw mode, drawing is performed in two phases, first the background + /// and then the foreground. This avoids chopping off characters that overlap the next run. + /// (Scintilla feature 2284) + /// + void SetTwoPhaseDraw(bool twoPhase); + /// How many phases is drawing done in? (Scintilla feature 2673) - PhasesDraw GetPhasesDraw(); + int GetPhasesDraw(); /// /// In one phase draw, text is drawn in a series of rectangular blocks with no overlap. @@ -1258,22 +1204,22 @@ public interface IScintillaGateway /// to overlap from one line to the next. /// (Scintilla feature 2674) /// - void SetPhasesDraw(PhasesDraw phases); + void SetPhasesDraw(int phases); /// Choose the quality level for text from the FontQuality enumeration. (Scintilla feature 2611) - void SetFontQuality(FontQuality fontQuality); + void SetFontQuality(int fontQuality); /// Retrieve the quality level for text. (Scintilla feature 2612) - FontQuality GetFontQuality(); + int GetFontQuality(); /// Scroll so that a display line is at the top of the display. (Scintilla feature 2613) - void SetFirstVisibleLine(int displayLine); + void SetFirstVisibleLine(int lineDisplay); /// Change the effect of pasting when there are multiple selections. (Scintilla feature 2614) - void SetMultiPaste(MultiPaste multiPaste); + void SetMultiPaste(int multiPaste); - /// Retrieve the effect of pasting when there are multiple selections. (Scintilla feature 2615) - MultiPaste GetMultiPaste(); + /// Retrieve the effect of pasting when there are multiple selections.. (Scintilla feature 2615) + int GetMultiPaste(); /// /// Retrieve the value of a tag from a regular expression search. @@ -1282,6 +1228,9 @@ public interface IScintillaGateway /// unsafe string GetTag(int tagNumber); + /// Make the target range start and end be the same as the selection range start and end. (Scintilla feature 2287) + void TargetFromSelection(); + /// Join the lines in the target. (Scintilla feature 2288) void LinesJoin(); @@ -1292,18 +1241,12 @@ public interface IScintillaGateway /// void LinesSplit(int pixelWidth); - /// Set one of the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2290) + /// Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2290) void SetFoldMarginColour(bool useSetting, Colour back); - /// Set the other colour used as a chequerboard pattern in the fold margin (Scintilla feature 2291) + /// Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2291) void SetFoldMarginHiColour(bool useSetting, Colour fore); - /// Enable or disable accessibility. (Scintilla feature 2702) - void SetAccessibility(Accessibility accessibility); - - /// Report accessibility status. (Scintilla feature 2703) - Accessibility GetAccessibility(); - /// Move caret down one line. (Scintilla feature 2300) void LineDown(); @@ -1435,9 +1378,6 @@ public interface IScintillaGateway /// Switch the current line with the previous. (Scintilla feature 2339) void LineTranspose(); - /// Reverse order of selected lines. (Scintilla feature 2354) - void LineReverse(); - /// Duplicate the current line. (Scintilla feature 2404) void LineDuplicate(); @@ -1481,43 +1421,61 @@ public interface IScintillaGateway 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. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2349) /// void HomeWrap(); /// - /// Like HomeExtend but when word-wrap is enabled extends first to start of display line - /// HomeDisplayExtend, then to start of document line HomeExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2450) /// void HomeWrapExtend(); /// - /// Like LineEnd but when word-wrap is enabled goes first to end of display line - /// LineEndDisplay, then to start of document line LineEnd. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2451) /// void LineEndWrap(); /// - /// Like LineEndExtend but when word-wrap is enabled extends first to end of display line - /// LineEndDisplayExtend, then to start of document line LineEndExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2452) /// void LineEndWrapExtend(); /// - /// Like VCHome but when word-wrap is enabled goes first to start of display line - /// VCHomeDisplay, then behaves like VCHome. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2453) /// void VCHomeWrap(); /// - /// Like VCHomeExtend but when word-wrap is enabled extends first to start of display line - /// VCHomeDisplayExtend, then behaves like VCHomeExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2454) /// void VCHomeWrapExtend(); @@ -1532,23 +1490,19 @@ public interface IScintillaGateway int LineLength(int line); /// Highlight the characters at two positions. (Scintilla feature 2351) - void BraceHighlight(int posA, int posB); + void BraceHighlight(Position pos1, Position pos2); /// Use specified indicator to highlight matching braces instead of changing their style. (Scintilla feature 2498) - void BraceHighlightIndicator(bool useSetting, int indicator); + void BraceHighlightIndicator(bool useBraceHighlightIndicator, int indicator); /// Highlight the character at a position indicating there is no matching brace. (Scintilla feature 2352) - void BraceBadLight(int pos); + void BraceBadLight(Position pos); /// Use specified indicator to highlight non matching brace instead of changing its style. (Scintilla feature 2499) - void BraceBadLightIndicator(bool useSetting, int indicator); + void BraceBadLightIndicator(bool useBraceBadLightIndicator, int 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. - /// (Scintilla feature 2353) - /// - int BraceMatch(int pos, int maxReStyle); + /// Find the position of a matching brace or INVALID_POSITION if no match. (Scintilla feature 2353) + Position BraceMatch(Position pos); /// Are the end of line characters visible? (Scintilla feature 2355) bool GetViewEOL(); @@ -1560,10 +1514,10 @@ public interface IScintillaGateway IntPtr GetDocPointer(); /// Change the document object used. (Scintilla feature 2358) - void SetDocPointer(IntPtr doc); + void SetDocPointer(IntPtr pointer); /// Set which document modification events are sent to the container. (Scintilla feature 2359) - void SetModEventMask(ModificationFlags eventMask); + void SetModEventMask(int mask); /// Retrieve the column number which text should be kept within. (Scintilla feature 2360) int GetEdgeColumn(); @@ -1576,14 +1530,14 @@ public interface IScintillaGateway void SetEdgeColumn(int column); /// Retrieve the edge highlight mode. (Scintilla feature 2362) - EdgeVisualStyle GetEdgeMode(); + int GetEdgeMode(); /// - /// The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that + /// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that /// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). /// (Scintilla feature 2363) /// - void SetEdgeMode(EdgeVisualStyle edgeMode); + void SetEdgeMode(int mode); /// Retrieve the colour used in edge indication. (Scintilla feature 2364) Colour GetEdgeColour(); @@ -1591,12 +1545,6 @@ public interface IScintillaGateway /// Change the colour used in edge indication. (Scintilla feature 2365) void SetEdgeColour(Colour edgeColour); - /// Add a new vertical edge to the view. (Scintilla feature 2694) - void MultiEdgeAddLine(int column, Colour edgeColour); - - /// Clear all vertical edges. (Scintilla feature 2695) - void MultiEdgeClearAll(); - /// Sets the current caret position to be the search anchor. (Scintilla feature 2366) void SearchAnchor(); @@ -1605,24 +1553,24 @@ public interface IScintillaGateway /// Does not ensure the selection is visible. /// (Scintilla feature 2367) /// - unsafe int SearchNext(FindOption searchFlags, string text); + unsafe int SearchNext(int flags, string text); /// /// Find some text starting at the search anchor and moving backwards. /// Does not ensure the selection is visible. /// (Scintilla feature 2368) /// - unsafe int SearchPrev(FindOption searchFlags, string text); + unsafe int SearchPrev(int flags, string text); /// Retrieves the number of lines completely visible. (Scintilla feature 2370) int LinesOnScreen(); /// /// Set whether a pop up menu is displayed automatically when the user presses - /// the wrong mouse button on certain areas. + /// the wrong mouse button. /// (Scintilla feature 2371) /// - void UsePopUp(PopUp popUpMode); + void UsePopUp(bool allowPopUp); /// Is the selection rectangular? The alternative is the more common stream selection. (Scintilla feature 2372) bool SelectionIsRectangle(); @@ -1632,7 +1580,7 @@ public interface IScintillaGateway /// It may be positive to magnify or negative to reduce. /// (Scintilla feature 2373) /// - void SetZoom(int zoomInPoints); + void SetZoom(int zoom); /// Retrieve the zoom level. (Scintilla feature 2374) int GetZoom(); @@ -1642,25 +1590,16 @@ public interface IScintillaGateway /// Starts with reference count of 1 and not selected into editor. /// (Scintilla feature 2375) /// - IntPtr CreateDocument(int bytes, DocumentOption documentOptions); + int CreateDocument(); /// Extend life of document. (Scintilla feature 2376) - void AddRefDocument(IntPtr doc); + void AddRefDocument(int doc); /// Release a reference to the document, deleting document if it fades to black. (Scintilla feature 2377) - void ReleaseDocument(IntPtr doc); - - /// Get which document options are set. (Scintilla feature 2379) - DocumentOption GetDocumentOptions(); + void ReleaseDocument(int doc); /// Get which document modification events are sent to the container. (Scintilla feature 2378) - ModificationFlags GetModEventMask(); - - /// Set whether command events are sent to the container. (Scintilla feature 2717) - void SetCommandEvents(bool commandEvents); - - /// Get whether command events are sent to the container. (Scintilla feature 2718) - bool GetCommandEvents(); + int GetModEventMask(); /// Change internal focus flag. (Scintilla feature 2380) void SetFocus(bool focus); @@ -1669,10 +1608,10 @@ public interface IScintillaGateway bool GetFocus(); /// Change error status - 0 = OK. (Scintilla feature 2382) - void SetStatus(Status status); + void SetStatus(int statusCode); /// Get error status. (Scintilla feature 2383) - Status GetStatus(); + int GetStatus(); /// Set whether the mouse is captured when its button is pressed. (Scintilla feature 2384) void SetMouseDownCaptures(bool captures); @@ -1680,17 +1619,11 @@ public interface IScintillaGateway /// Get whether mouse gets captured. (Scintilla feature 2385) bool GetMouseDownCaptures(); - /// Set whether the mouse wheel can be active outside the window. (Scintilla feature 2696) - void SetMouseWheelCaptures(bool captures); - - /// Get whether mouse wheel can be active outside the window. (Scintilla feature 2697) - bool GetMouseWheelCaptures(); - /// Sets the cursor to one of the SC_CURSOR* values. (Scintilla feature 2386) - void SetCursor(CursorShape cursorType); + void SetCursor(int cursorType); /// Get cursor type. (Scintilla feature 2387) - CursorShape GetCursor(); + int GetCursor(); /// /// Change the way control characters are displayed: @@ -1727,7 +1660,7 @@ public interface IScintillaGateway /// is to be moved to by Find, FindNext, GotoLine, etc. /// (Scintilla feature 2394) /// - void SetVisiblePolicy(VisiblePolicy visiblePolicy, int visibleSlop); + void SetVisiblePolicy(int visiblePolicy, int visibleSlop); /// Delete back from the current position to the start of the line. (Scintilla feature 2395) void DelLineLeft(); @@ -1735,10 +1668,10 @@ public interface IScintillaGateway /// Delete forwards from the current position to the end of the line. (Scintilla feature 2396) void DelLineRight(); - /// Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2397) - void SetXOffset(int xOffset); + /// Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2397) + void SetXOffset(int newOffset); - /// Get the xOffset (ie, horizontal scroll position). (Scintilla feature 2398) + /// Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2398) int GetXOffset(); /// Set the last x chosen value to be the caret x position. (Scintilla feature 2399) @@ -1752,20 +1685,20 @@ public interface IScintillaGateway /// The exclusion zone is given in pixels. /// (Scintilla feature 2402) /// - void SetXCaretPolicy(CaretPolicy caretPolicy, int caretSlop); + void SetXCaretPolicy(int caretPolicy, int caretSlop); /// /// Set the way the line the caret is on is kept visible. /// The exclusion zone is given in lines. /// (Scintilla feature 2403) /// - void SetYCaretPolicy(CaretPolicy caretPolicy, int caretSlop); + void SetYCaretPolicy(int caretPolicy, int caretSlop); /// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). (Scintilla feature 2406) - void SetPrintWrapMode(Wrap wrapMode); + void SetPrintWrapMode(int mode); /// Is printing line wrapped? (Scintilla feature 2407) - Wrap GetPrintWrapMode(); + int GetPrintWrapMode(); /// Set a fore colour for active hotspots. (Scintilla feature 2410) void SetHotspotActiveFore(bool useSetting, Colour fore); @@ -1791,16 +1724,16 @@ public interface IScintillaGateway /// Get the HotspotSingleLine property (Scintilla feature 2497) bool GetHotspotSingleLine(); - /// Move caret down one paragraph (delimited by empty lines). (Scintilla feature 2413) + /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2413) void ParaDown(); - /// Extend selection down one paragraph (delimited by empty lines). (Scintilla feature 2414) + /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2414) void ParaDownExtend(); - /// Move caret up one paragraph (delimited by empty lines). (Scintilla feature 2415) + /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2415) void ParaUp(); - /// Extend selection up one paragraph (delimited by empty lines). (Scintilla feature 2416) + /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2416) void ParaUpExtend(); /// @@ -1808,32 +1741,24 @@ public interface IScintillaGateway /// page into account. Returns 0 if passed 0. /// (Scintilla feature 2417) /// - int PositionBefore(int pos); + Position PositionBefore(Position pos); /// /// Given a valid document position, return the next position taking code /// page into account. Maximum value returned is the last position in the document. /// (Scintilla feature 2418) /// - int PositionAfter(int pos); + Position PositionAfter(Position pos); /// /// Given a valid document position, return a position that differs in a number /// of characters. Returned value is always between 0 and last position in document. /// (Scintilla feature 2670) /// - int PositionRelative(int pos, int relative); - - /// - /// Given a valid document position, return a position that differs in a number - /// of UTF-16 code units. Returned value is always between 0 and last position in document. - /// The result may point half way (2 bytes) inside a non-BMP character. - /// (Scintilla feature 2716) - /// - int PositionRelativeCodeUnits(int pos, int relative); + Position PositionRelative(Position pos, int relative); /// Copy a range of text to the clipboard. Positions are clipped into the document. (Scintilla feature 2419) - void CopyRange(int start, int end); + void CopyRange(Position start, Position end); /// Copy argument text to the clipboard. (Scintilla feature 2420) unsafe void CopyText(int length, string text); @@ -1843,19 +1768,16 @@ public interface IScintillaGateway /// by lines (SC_SEL_LINES). /// (Scintilla feature 2422) /// - void SetSelectionMode(SelectionMode selectionMode); + void SetSelectionMode(int mode); /// Get the mode of the current selection. (Scintilla feature 2423) - SelectionMode GetSelectionMode(); - - /// Get whether or not regular caret moves will extend or reduce the selection. (Scintilla feature 2706) - bool GetMoveExtendsSelection(); + int GetSelectionMode(); /// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2424) - int GetLineSelStartPosition(int line); + Position GetLineSelStartPosition(int line); /// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2425) - int GetLineSelEndPosition(int line); + Position GetLineSelEndPosition(int line); /// Move caret down one line, extending rectangular selection to new caret position. (Scintilla feature 2426) void LineDownRectExtend(); @@ -1948,22 +1870,22 @@ public interface IScintillaGateway unsafe string AutoCGetCurrentText(); /// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. (Scintilla feature 2634) - void AutoCSetCaseInsensitiveBehaviour(CaseInsensitiveBehaviour behaviour); + void AutoCSetCaseInsensitiveBehaviour(int behaviour); /// Get auto-completion case insensitive behaviour. (Scintilla feature 2635) - CaseInsensitiveBehaviour AutoCGetCaseInsensitiveBehaviour(); + int AutoCGetCaseInsensitiveBehaviour(); /// Change the effect of autocompleting when there are multiple selections. (Scintilla feature 2636) - void AutoCSetMulti(MultiAutoComplete multi); + void AutoCSetMulti(int multi); - /// Retrieve the effect of autocompleting when there are multiple selections. (Scintilla feature 2637) - MultiAutoComplete AutoCGetMulti(); + /// Retrieve the effect of autocompleting when there are multiple selections.. (Scintilla feature 2637) + int AutoCGetMulti(); /// Set the way autocompletion lists are ordered. (Scintilla feature 2660) - void AutoCSetOrder(Ordering order); + void AutoCSetOrder(int order); /// Get the way autocompletion lists are ordered. (Scintilla feature 2661) - Ordering AutoCGetOrder(); + int AutoCGetOrder(); /// Enlarge the document to a particular size of text bytes. (Scintilla feature 2446) void Allocate(int bytes); @@ -1998,10 +1920,10 @@ public interface IScintillaGateway int FindColumn(int line, int column); /// Can the caret preferred x position only be changed by explicit movement commands? (Scintilla feature 2457) - CaretSticky GetCaretSticky(); + int GetCaretSticky(); /// Stop the caret preferred x position changing when the user types. (Scintilla feature 2458) - void SetCaretSticky(CaretSticky useCaretStickyBehaviour); + void SetCaretSticky(int useCaretStickyBehaviour); /// Switch between sticky and non-sticky: meant to be bound to a key. (Scintilla feature 2459) void ToggleCaretSticky(); @@ -2016,16 +1938,16 @@ public interface IScintillaGateway void SelectionDuplicate(); /// Set background alpha of the caret line. (Scintilla feature 2470) - void SetCaretLineBackAlpha(Alpha alpha); + void SetCaretLineBackAlpha(int alpha); /// Get the background alpha of the caret line. (Scintilla feature 2471) - Alpha GetCaretLineBackAlpha(); + int GetCaretLineBackAlpha(); /// Set the style of the caret to be drawn. (Scintilla feature 2512) - void SetCaretStyle(CaretStyle caretStyle); + void SetCaretStyle(int caretStyle); /// Returns the current style of the caret. (Scintilla feature 2513) - CaretStyle GetCaretStyle(); + int GetCaretStyle(); /// Set the indicator used for IndicatorFillRange and IndicatorClearRange (Scintilla feature 2500) void SetIndicatorCurrent(int indicator); @@ -2040,22 +1962,22 @@ public interface IScintillaGateway int GetIndicatorValue(); /// Turn a indicator on over a range. (Scintilla feature 2504) - void IndicatorFillRange(int start, int lengthFill); + void IndicatorFillRange(int position, int fillLength); /// Turn a indicator off over a range. (Scintilla feature 2505) - void IndicatorClearRange(int start, int lengthClear); + void IndicatorClearRange(int position, int clearLength); - /// Are any indicators present at pos? (Scintilla feature 2506) - int IndicatorAllOnFor(int pos); + /// Are any indicators present at position? (Scintilla feature 2506) + int IndicatorAllOnFor(int position); - /// What value does a particular indicator have at a position? (Scintilla feature 2507) - int IndicatorValueAt(int indicator, int pos); + /// What value does a particular indicator have at at a position? (Scintilla feature 2507) + int IndicatorValueAt(int indicator, int position); /// Where does a particular indicator start? (Scintilla feature 2508) - int IndicatorStart(int indicator, int pos); + int IndicatorStart(int indicator, int position); /// Where does a particular indicator end? (Scintilla feature 2509) - int IndicatorEnd(int indicator, int pos); + int IndicatorEnd(int indicator, int position); /// Set number of entries in position cache (Scintilla feature 2514) void SetPositionCache(int size); @@ -2076,29 +1998,29 @@ public interface IScintillaGateway /// /// 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. + /// to rangeLength bytes. /// (Scintilla feature 2643) /// - IntPtr GetRangePointer(int start, int lengthRange); + IntPtr GetRangePointer(int position, int rangeLength); /// /// Return a position which, to avoid performance costs, should not be within /// the range of a call to GetRangePointer. /// (Scintilla feature 2644) /// - int GetGapPosition(); + Position GetGapPosition(); /// Set the alpha fill colour of the given indicator. (Scintilla feature 2523) - void IndicSetAlpha(int indicator, Alpha alpha); + void IndicSetAlpha(int indicator, int alpha); /// Get the alpha fill colour of the given indicator. (Scintilla feature 2524) - Alpha IndicGetAlpha(int indicator); + int IndicGetAlpha(int indicator); /// Set the alpha outline colour of the given indicator. (Scintilla feature 2558) - void IndicSetOutlineAlpha(int indicator, Alpha alpha); + void IndicSetOutlineAlpha(int indicator, int alpha); /// Get the alpha outline colour of the given indicator. (Scintilla feature 2559) - Alpha IndicGetOutlineAlpha(int indicator); + int IndicGetOutlineAlpha(int indicator); /// Set extra ascent for each line (Scintilla feature 2525) void SetExtraAscent(int extraAscent); @@ -2143,10 +2065,10 @@ public interface IScintillaGateway int MarginGetStyleOffset(); /// Set the margin options. (Scintilla feature 2539) - void SetMarginOptions(MarginOption marginOptions); + void SetMarginOptions(int marginOptions); /// Get the margin options. (Scintilla feature 2557) - MarginOption GetMarginOptions(); + int GetMarginOptions(); /// Set the annotation text for a line (Scintilla feature 2540) unsafe void AnnotationSetText(int line, string text); @@ -2173,10 +2095,10 @@ public interface IScintillaGateway void AnnotationClearAll(); /// Set the visibility for the annotations for a view (Scintilla feature 2548) - void AnnotationSetVisible(AnnotationVisible visible); + void AnnotationSetVisible(int visible); /// Get the visibility for the annotations for a view (Scintilla feature 2549) - AnnotationVisible AnnotationGetVisible(); + int AnnotationGetVisible(); /// Get the start of the range of style numbers used for annotations (Scintilla feature 2550) void AnnotationSetStyleOffset(int style); @@ -2191,17 +2113,17 @@ public interface IScintillaGateway int AllocateExtendedStyles(int numberStyles); /// Add a container action to the undo stack (Scintilla feature 2560) - void AddUndoAction(int token, UndoFlags flags); + void AddUndoAction(int token, int flags); /// Find the position of a character from a point within the window. (Scintilla feature 2561) - int CharPositionFromPoint(int x, int y); + Position CharPositionFromPoint(int x, int y); /// /// Find the position of a character from a point within the window. /// Return INVALID_POSITION if not close to text. /// (Scintilla feature 2562) /// - int CharPositionFromPointClose(int x, int y); + Position CharPositionFromPointClose(int x, int y); /// Set whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2668) void SetMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch); @@ -2228,7 +2150,7 @@ public interface IScintillaGateway bool GetAdditionalCaretsBlink(); /// Set whether additional carets are visible (Scintilla feature 2608) - void SetAdditionalCaretsVisible(bool additionalCaretsVisible); + void SetAdditionalCaretsVisible(bool additionalCaretsBlink); /// Whether additional carets are visible (Scintilla feature 2609) bool GetAdditionalCaretsVisible(); @@ -2243,10 +2165,10 @@ public interface IScintillaGateway void ClearSelections(); /// Set a simple selection (Scintilla feature 2572) - void SetSelection(int caret, int anchor); + int SetSelection(int caret, int anchor); /// Add a selection (Scintilla feature 2573) - void AddSelection(int caret, int anchor); + int AddSelection(int caret, int anchor); /// Drop one selection (Scintilla feature 2671) void DropSelectionN(int selection); @@ -2257,74 +2179,74 @@ public interface IScintillaGateway /// Which selection is the main selection (Scintilla feature 2575) int GetMainSelection(); - /// Set the caret position of the nth selection. (Scintilla feature 2576) - void SetSelectionNCaret(int selection, int caret); + /// Which selection is the main selection (Scintilla feature 2576) + void SetSelectionNCaret(int selection, Position pos); - /// Return the caret position of the nth selection. (Scintilla feature 2577) - int GetSelectionNCaret(int selection); + /// Which selection is the main selection (Scintilla feature 2577) + Position GetSelectionNCaret(int selection); - /// Set the anchor position of the nth selection. (Scintilla feature 2578) - void SetSelectionNAnchor(int selection, int anchor); + /// Which selection is the main selection (Scintilla feature 2578) + void SetSelectionNAnchor(int selection, Position posAnchor); - /// Return the anchor position of the nth selection. (Scintilla feature 2579) - int GetSelectionNAnchor(int selection); + /// Which selection is the main selection (Scintilla feature 2579) + Position GetSelectionNAnchor(int selection); - /// Set the virtual space of the caret of the nth selection. (Scintilla feature 2580) + /// Which selection is the main selection (Scintilla feature 2580) void SetSelectionNCaretVirtualSpace(int selection, int space); - /// Return the virtual space of the caret of the nth selection. (Scintilla feature 2581) + /// Which selection is the main selection (Scintilla feature 2581) int GetSelectionNCaretVirtualSpace(int selection); - /// Set the virtual space of the anchor of the nth selection. (Scintilla feature 2582) + /// Which selection is the main selection (Scintilla feature 2582) void SetSelectionNAnchorVirtualSpace(int selection, int space); - /// Return the virtual space of the anchor of the nth selection. (Scintilla feature 2583) + /// Which selection is the main selection (Scintilla feature 2583) int GetSelectionNAnchorVirtualSpace(int selection); /// Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2584) - void SetSelectionNStart(int selection, int anchor); + void SetSelectionNStart(int selection, Position pos); /// Returns the position at the start of the selection. (Scintilla feature 2585) - int GetSelectionNStart(int selection); + Position GetSelectionNStart(int selection); /// Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2586) - void SetSelectionNEnd(int selection, int caret); + void SetSelectionNEnd(int selection, Position pos); /// Returns the position at the end of the selection. (Scintilla feature 2587) - int GetSelectionNEnd(int selection); + Position GetSelectionNEnd(int selection); - /// Set the caret position of the rectangular selection. (Scintilla feature 2588) - void SetRectangularSelectionCaret(int caret); + /// Returns the position at the end of the selection. (Scintilla feature 2588) + void SetRectangularSelectionCaret(Position pos); - /// Return the caret position of the rectangular selection. (Scintilla feature 2589) - int GetRectangularSelectionCaret(); + /// Returns the position at the end of the selection. (Scintilla feature 2589) + Position GetRectangularSelectionCaret(); - /// Set the anchor position of the rectangular selection. (Scintilla feature 2590) - void SetRectangularSelectionAnchor(int anchor); + /// Returns the position at the end of the selection. (Scintilla feature 2590) + void SetRectangularSelectionAnchor(Position posAnchor); - /// Return the anchor position of the rectangular selection. (Scintilla feature 2591) - int GetRectangularSelectionAnchor(); + /// Returns the position at the end of the selection. (Scintilla feature 2591) + Position GetRectangularSelectionAnchor(); - /// Set the virtual space of the caret of the rectangular selection. (Scintilla feature 2592) + /// Returns the position at the end of the selection. (Scintilla feature 2592) void SetRectangularSelectionCaretVirtualSpace(int space); - /// Return the virtual space of the caret of the rectangular selection. (Scintilla feature 2593) + /// Returns the position at the end of the selection. (Scintilla feature 2593) int GetRectangularSelectionCaretVirtualSpace(); - /// Set the virtual space of the anchor of the rectangular selection. (Scintilla feature 2594) + /// Returns the position at the end of the selection. (Scintilla feature 2594) void SetRectangularSelectionAnchorVirtualSpace(int space); - /// Return the virtual space of the anchor of the rectangular selection. (Scintilla feature 2595) + /// Returns the position at the end of the selection. (Scintilla feature 2595) int GetRectangularSelectionAnchorVirtualSpace(); - /// Set options for virtual space behaviour. (Scintilla feature 2596) - void SetVirtualSpaceOptions(VirtualSpace virtualSpaceOptions); + /// Returns the position at the end of the selection. (Scintilla feature 2596) + void SetVirtualSpaceOptions(int virtualSpaceOptions); - /// Return options for virtual space behaviour. (Scintilla feature 2597) - VirtualSpace GetVirtualSpaceOptions(); + /// Returns the position at the end of the selection. (Scintilla feature 2597) + int GetVirtualSpaceOptions(); /// - /// On GTK, allow selecting the modifier key to use for mouse-based + /// On GTK+, allow selecting the modifier key to use for mouse-based /// rectangular selection. Often the window manager requires Alt+Mouse Drag /// for moving windows. /// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. @@ -2350,10 +2272,10 @@ public interface IScintillaGateway void SetAdditionalSelBack(Colour back); /// Set the alpha of the selection. (Scintilla feature 2602) - void SetAdditionalSelAlpha(Alpha alpha); + void SetAdditionalSelAlpha(int alpha); /// Get the alpha of the selection. (Scintilla feature 2603) - Alpha GetAdditionalSelAlpha(); + int GetAdditionalSelAlpha(); /// Set the foreground colour of additional carets. (Scintilla feature 2604) void SetAdditionalCaretFore(Colour fore); @@ -2367,26 +2289,12 @@ public interface IScintillaGateway /// Swap that caret and anchor of the main selection. (Scintilla feature 2607) 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. - /// (Scintilla feature 2688) - /// - 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. - /// (Scintilla feature 2689) - /// - void MultipleSelectAddEach(); - /// /// Indicate that the internal state of a lexer has changed over a range and therefore /// there may be a need to redraw. /// (Scintilla feature 2617) /// - int ChangeLexerState(int start, int end); + int ChangeLexerState(Position start, Position end); /// /// Find the next line at or after lineStart that is a contracted fold header line. @@ -2404,7 +2312,7 @@ public interface IScintillaGateway /// Move the selected lines down one line, shifting the line below before the selection (Scintilla feature 2621) void MoveSelectedLinesDown(); - /// Set the identifier reported as idFrom in notification messages. (Scintilla feature 2622) + /// Set the identifier reported as IdFrom in notification messages. (Scintilla feature 2622) void SetIdentifier(int identifier); /// Get the identifier. (Scintilla feature 2623) @@ -2440,19 +2348,19 @@ public interface IScintillaGateway void ScrollToEnd(); /// Set the technology used. (Scintilla feature 2630) - void SetTechnology(Technology technology); + void SetTechnology(int technology); /// Get the tech. (Scintilla feature 2631) - Technology GetTechnology(); + int GetTechnology(); /// Create an ILoader*. (Scintilla feature 2632) - IntPtr CreateLoader(int bytes, DocumentOption documentOptions); + int CreateLoader(int bytes); /// On OS X, show a find indicator. (Scintilla feature 2640) - void FindIndicatorShow(int start, int end); + void FindIndicatorShow(Position start, Position end); /// On OS X, flash a find indicator, then fade out. (Scintilla feature 2641) - void FindIndicatorFlash(int start, int end); + void FindIndicatorFlash(Position start, Position end); /// On OS X, hide the find indicator. (Scintilla feature 2642) void FindIndicatorHide(); @@ -2474,13 +2382,13 @@ public interface IScintillaGateway void SetCaretLineVisibleAlways(bool alwaysVisible); /// Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. (Scintilla feature 2656) - void SetLineEndTypesAllowed(LineEndType lineEndBitSet); + void SetLineEndTypesAllowed(int lineEndBitSet); /// Get the line end types currently allowed. (Scintilla feature 2657) - LineEndType GetLineEndTypesAllowed(); + int GetLineEndTypesAllowed(); /// Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. (Scintilla feature 2658) - LineEndType GetLineEndTypesActive(); + int GetLineEndTypesActive(); /// Set the way a character is drawn. (Scintilla feature 2665) unsafe void SetRepresentation(string encodedCharacter, string representation); @@ -2508,13 +2416,13 @@ public interface IScintillaGateway int GetLexer(); /// Colourise a segment of the document using the current lexing language. (Scintilla feature 4003) - void Colourise(int start, int end); + void Colourise(Position start, Position end); /// Set up a value that may be used by a lexer for some optional feature. (Scintilla feature 4004) unsafe void SetProperty(string key, string value); /// Set up the key words used by the lexer. (Scintilla feature 4005) - unsafe void SetKeyWords(int keyWordSet, string keyWords); + unsafe void SetKeyWords(int keywordSet, string keyWords); /// Set the lexing language of the document based on string name. (Scintilla feature 4006) unsafe void SetLexerLanguage(string language); @@ -2542,7 +2450,10 @@ public interface IScintillaGateway /// interpreted as an int AFTER any "$()" variable replacement. /// (Scintilla feature 4010) /// - unsafe int GetPropertyInt(string key, int defaultValue); + unsafe int GetPropertyInt(string key); + + /// Retrieve the number of bits the current lexer needs for styling. (Scintilla feature 4011) + int GetStyleBitsNeeded(); /// /// Retrieve the name of the lexer. @@ -2553,7 +2464,7 @@ public interface IScintillaGateway unsafe string GetLexerLanguage(); /// For private communication between an application and a known lexer. (Scintilla feature 4013) - IntPtr PrivateLexerCall(int operation, IntPtr pointer); + int PrivateLexerCall(int operation, int pointer); /// /// Retrieve a '\n' separated list of properties understood by the current lexer. @@ -2563,7 +2474,7 @@ public interface IScintillaGateway unsafe string PropertyNames(); /// Retrieve the type of a property. (Scintilla feature 4015) - unsafe TypeProperty PropertyType(string name); + unsafe int PropertyType(string name); /// /// Describe a property. @@ -2621,64 +2532,19 @@ public interface IScintillaGateway /// unsafe string GetSubStyleBases(); - /// Retrieve the number of named styles for the lexer. (Scintilla feature 4029) - int GetNamedStyles(); - - /// - /// Retrieve the name of a style. - /// Result is NUL-terminated. - /// (Scintilla feature 4030) - /// - unsafe string NameOfStyle(int style); - - /// - /// Retrieve a ' ' separated list of style tags like "literal quoted string". - /// Result is NUL-terminated. - /// (Scintilla feature 4031) - /// - unsafe string TagsOfStyle(int style); - /// - /// Retrieve a description of a style. - /// Result is NUL-terminated. - /// (Scintilla feature 4032) + /// Deprecated in 2.30 + /// In palette mode? + /// (Scintilla feature 2139) /// - unsafe string DescriptionOfStyle(int style); - - /// Retrieve bidirectional text display state. (Scintilla feature 2708) - Bidirectional GetBidirectional(); - - /// Set bidirectional text display state. (Scintilla feature 2709) - void SetBidirectional(Bidirectional bidirectional); - - /// Retrieve line character index state. (Scintilla feature 2710) - LineCharacterIndexType GetLineCharacterIndex(); - - /// Request line character index be created or its use count increased. (Scintilla feature 2711) - void AllocateLineCharacterIndex(LineCharacterIndexType lineCharacterIndex); - - /// Decrease use count of line character index and remove if 0. (Scintilla feature 2712) - void ReleaseLineCharacterIndex(LineCharacterIndexType lineCharacterIndex); - - /// Retrieve the document line containing a position measured in index units. (Scintilla feature 2713) - int LineFromIndexPosition(int pos, LineCharacterIndexType lineCharacterIndex); - - /// Retrieve the position measured in index units at the start of a document line. (Scintilla feature 2714) - int IndexPositionFromLine(int line, LineCharacterIndexType lineCharacterIndex); + bool GetUsePalette(); /// - /// Divide each styling byte into lexical class bits (default: 5) and indicator - /// bits (default: 3). If a lexer requires more than 32 lexical states, then this - /// is used to expand the possible states. - /// (Scintilla feature 2090) + /// In palette mode, Scintilla uses the environment's palette calls to display + /// more colours. This may lead to ugly displays. + /// (Scintilla feature 2039) /// - void SetStyleBits(int bits); - - /// Retrieve number of bits in style bytes used to hold the lexical state. (Scintilla feature 2091) - int GetStyleBits(); - - /// Retrieve the number of bits the current lexer needs for styling. (Scintilla feature 4011) - int GetStyleBitsNeeded(); + void SetUsePalette(bool usePalette); /// /// Deprecated in 3.5.5 @@ -2690,16 +2556,6 @@ public interface IScintillaGateway /// Are keys always interpreted as Unicode? (Scintilla feature 2522) bool GetKeysUnicode(); - /// Is drawing done in two phases with backgrounds drawn before foregrounds? (Scintilla feature 2283) - bool GetTwoPhaseDraw(); - - /// - /// In twoPhaseDraw mode, drawing is performed in two phases, first the background - /// and then the foreground. This avoids chopping off characters that overlap the next run. - /// (Scintilla feature 2284) - /// - void SetTwoPhaseDraw(bool twoPhase); - /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ } } diff --git a/NppMarkdownPanel/PluginInfrastructure/MenuCmdID_h.cs b/NppMarkdownPanel/PluginInfrastructure/MenuCmdID_h.cs index 756c4e0..b4e2a28 100644 --- a/NppMarkdownPanel/PluginInfrastructure/MenuCmdID_h.cs +++ b/NppMarkdownPanel/PluginInfrastructure/MenuCmdID_h.cs @@ -20,7 +20,7 @@ public enum NppMenuCmd : uint IDM_FILE_SAVE = (IDM_FILE + 6), IDM_FILE_SAVEALL = (IDM_FILE + 7), IDM_FILE_SAVEAS = (IDM_FILE + 8), - //IDM_FILE_ASIAN_LANG = (IDM_FILE + 9), + //IDM_FILE_ASIAN_LANG = (IDM_FILE + 9), IDM_FILE_PRINT = (IDM_FILE + 10), IDM_FILE_PRINTNOW = 1001, IDM_FILE_EXIT = (IDM_FILE + 11), diff --git a/NppMarkdownPanel/PluginInfrastructure/Msgs_h.cs b/NppMarkdownPanel/PluginInfrastructure/Msgs_h.cs index 214a73c..b8ca6ba 100644 --- a/NppMarkdownPanel/PluginInfrastructure/Msgs_h.cs +++ b/NppMarkdownPanel/PluginInfrastructure/Msgs_h.cs @@ -166,7 +166,10 @@ public enum NppMsg : uint /// ///void WM_ADDTOOLBARICON(UINT funcItem[X]._cmdID, toolbarIcons icon) /// - NPPM_ADDTOOLBARICON = Constants.NPPMSG + 41, + NPPM_ADDTOOLBARICON_DEPRECATED = Constants.NPPMSG + 41, + + + NPPM_ADDTOOLBARICON_FORDARKMODE = Constants.NPPMSG + 101, /// ///winVer NPPM_GETWINDOWSVERSION(0, 0) @@ -191,11 +194,7 @@ public enum NppMsg : uint NPPM_GETENABLETHEMETEXTUREFUNC = Constants.NPPMSG + 45, /// - ///INT NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str) - /// Get user's plugin config directory path. It's useful if plugins want to save/load parameters for the current user - /// Returns the number of TCHAR copied/to copy. - /// Users should call it with "str" be NULL to get the required number of TCHAR (not including the terminating nul character), - /// allocate "str" buffer with the return value + 1, then call it again to get the path. + ///void NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str) /// NPPM_GETPLUGINSCONFIGDIR = Constants.NPPMSG + 46, @@ -243,7 +242,7 @@ public enum NppMsg : uint NPPM_ISTABBARHIDDEN = Constants.NPPMSG + 52, /// - /// INT NPPM_GETPOSFROMBUFFERID(UINT_PTR bufferID, INT priorityView) + /// INT NPPM_GETPOSFROMBUFFERID(INT bufferID, INT priorityView) /// Return VIEW|INDEX from a buffer ID. -1 if the bufferID non existing /// if priorityView set to SUB_VIEW, then SUB_VIEW will be search firstly /// @@ -255,11 +254,11 @@ public enum NppMsg : uint NPPM_GETPOSFROMBUFFERID = Constants.NPPMSG + 57, /// - /// INT NPPM_GETFULLPATHFROMBUFFERID(UINT_PTR bufferID, TCHAR *fullFilePath) + /// INT NPPM_GETFULLPATHFROMBUFFERID(INT bufferID, TCHAR *fullFilePath) /// Get full path file name from a bufferID. /// Return -1 if the bufferID non existing, otherwise the number of TCHAR copied/to copy /// User should call it with fullFilePath be NULL to get the number of TCHAR (not including the nul character), - /// allocate fullFilePath with the return values + 1, then call it again to get full path file name + /// allocate fullFilePath with the return values + 1, then call it again to get full path file name /// NPPM_GETFULLPATHFROMBUFFERID = Constants.NPPMSG + 58, @@ -278,7 +277,7 @@ public enum NppMsg : uint NPPM_GETCURRENTBUFFERID = Constants.NPPMSG + 60, /// - /// VOID NPPM_RELOADBUFFERID(UINT_PTR bufferID, BOOL alert) + /// VOID NPPM_RELOADBUFFERID(0, 0) /// Reloads Buffer /// wParam: Buffer to reload /// lParam: 0 if no alert, else alert @@ -286,7 +285,7 @@ public enum NppMsg : uint NPPM_RELOADBUFFERID = Constants.NPPMSG + 61, /// - /// INT NPPM_GETBUFFERLANGTYPE(UINT_PTR bufferID, 0) + /// INT NPPM_GETBUFFERLANGTYPE(INT bufferID, 0) /// wParam: BufferID to get LangType from /// lParam: 0 /// Returns as int, see LangType. -1 on error @@ -294,7 +293,7 @@ public enum NppMsg : uint NPPM_GETBUFFERLANGTYPE = Constants.NPPMSG + 64, /// - /// BOOL NPPM_SETBUFFERLANGTYPE(UINT_PTR bufferID, INT langType) + /// BOOL NPPM_SETBUFFERLANGTYPE(INT bufferID, INT langType) /// wParam: BufferID to set LangType of /// lParam: LangType /// Returns TRUE on success, FALSE otherwise @@ -304,7 +303,7 @@ public enum NppMsg : uint NPPM_SETBUFFERLANGTYPE = Constants.NPPMSG + 65, /// - /// INT NPPM_GETBUFFERENCODING(UINT_PTR bufferID, 0) + /// INT NPPM_GETBUFFERENCODING(INT bufferID, 0) /// wParam: BufferID to get encoding from /// lParam: 0 /// returns as int, see UniMode. -1 on error @@ -312,7 +311,7 @@ public enum NppMsg : uint NPPM_GETBUFFERENCODING = Constants.NPPMSG + 66, /// - /// BOOL NPPM_SETBUFFERENCODING(UINT_PTR bufferID, INT encoding) + /// BOOL NPPM_SETBUFFERENCODING(INT bufferID, INT encoding) /// wParam: BufferID to set encoding of /// lParam: encoding /// Returns TRUE on success, FALSE otherwise @@ -322,22 +321,40 @@ public enum NppMsg : uint NPPM_SETBUFFERENCODING = Constants.NPPMSG + 67, /// - /// INT NPPM_GETBUFFERFORMAT(UINT_PTR bufferID, 0) - /// wParam: BufferID to get EolType format from + /// INT NPPM_GETBUFFERFORMAT(INT bufferID, 0) + /// wParam: BufferID to get format from /// lParam: 0 - /// returns as int, see EolType format. -1 on error + /// returns as int, see formatType. -1 on error /// NPPM_GETBUFFERFORMAT = Constants.NPPMSG + 68, /// - /// BOOL NPPM_SETBUFFERFORMAT(UINT_PTR bufferID, INT format) - /// wParam: BufferID to set EolType format of + /// BOOL NPPM_SETBUFFERFORMAT(INT bufferID, INT format) + /// wParam: BufferID to set format of /// lParam: format /// Returns TRUE on success, FALSE otherwise - /// use int, see EolType format + /// use int, see formatType /// NPPM_SETBUFFERFORMAT = Constants.NPPMSG + 69, + /// + /// BOOL NPPM_ADDREBAR(0, REBARBANDINFO *) + /// Returns assigned ID in wID value of struct pointer + /// + NPPM_ADDREBAR = Constants.NPPMSG + 57, + + /// + /// BOOL NPPM_ADDREBAR(INT ID, REBARBANDINFO *) + ///Use ID assigned with NPPM_ADDREBAR + /// + NPPM_UPDATEREBAR = Constants.NPPMSG + 58, + + /// + /// BOOL NPPM_ADDREBAR(INT ID, 0) + ///Use ID assigned with NPPM_ADDREBAR + /// + NPPM_REMOVEREBAR = Constants.NPPMSG + 59, + /// /// BOOL NPPM_HIDETOOLBAR(0, BOOL hideOrNot) /// if hideOrNot is set as TRUE then tool bar will be hidden @@ -384,7 +401,7 @@ public enum NppMsg : uint /// BOOL NPPM_GETSHORTCUTBYCMDID(int cmdID, ShortcutKey *sk) /// get your plugin command current mapped shortcut into sk via cmdID /// You may need it after getting NPPN_READY notification - /// returned value : TRUE if this function call is successful and shortcut is enable, otherwise FALSE + /// returned value : TRUE if this function call is successful and shorcut is enable, otherwise FALSE /// NPPM_GETSHORTCUTBYCMDID = Constants.NPPMSG + 76, @@ -402,7 +419,7 @@ public enum NppMsg : uint /// /// INT NPPM_GETCURRENTNATIVELANGENCODING(0, 0) - /// returned value : the current native language encoding + /// returned value : the current native language enconding /// NPPM_GETCURRENTNATIVELANGENCODING = Constants.NPPMSG + 79, @@ -429,7 +446,7 @@ public enum NppMsg : uint /// /// INT NPPM_GETLANGUAGENAME(int langType, TCHAR *langName) - /// Get programming language name from the given language type (LangType) + /// Get programing language name from the given language type (LangType) /// Return value is the number of copied character / number of character to copy (\0 is not included) /// You should call this function 2 times - the first time you pass langName as NULL to get the number of characters to copy. /// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGENAME function the 2nd time @@ -439,7 +456,7 @@ public enum NppMsg : uint /// /// INT NPPM_GETLANGUAGEDESC(int langType, TCHAR *langDesc) - /// Get programming language short description from the given language type (LangType) + /// Get programing language short description from the given language type (LangType) /// Return value is the number of copied character / number of character to copy (\0 is not included) /// You should call this function 2 times - the first time you pass langDesc as NULL to get the number of characters to copy. /// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGEDESC function the 2nd time @@ -448,7 +465,7 @@ public enum NppMsg : uint NPPM_GETLANGUAGEDESC = Constants.NPPMSG + 84, /// - /// VOID NPPM_SHOWDOCSWITCHER(0, BOOL toShowOrNot) + /// VOID NPPM_ISDOCSWITCHERSHOWN(0, BOOL toShowOrNot) /// Send this message to show or hide doc switcher. /// if toShowOrNot is TRUE then show doc switcher, otherwise hide it. /// @@ -462,7 +479,7 @@ public enum NppMsg : uint /// /// BOOL NPPM_GETAPPDATAPLUGINSALLOWED(0, 0) - /// Check to see if loading plugins from "%APPDATA%\..\Local\Notepad++\plugins" is allowed. + /// Check to see if loading plugins from "%APPDATA%\Notepad++\plugins" is allowed. /// NPPM_GETAPPDATAPLUGINSALLOWED = Constants.NPPMSG + 87, @@ -505,61 +522,6 @@ public enum NppMsg : uint /// NPPM_SAVEFILE = Constants.NPPMSG + 94, - /// - /// VOID NPPM_DISABLEAUTOUPDATE(0, 0) - /// - NPPM_DISABLEAUTOUPDATE = Constants.NPPMSG + 95, - - /// - /// BOOL NPPM_REMOVESHORTCUTASSIGNMENT(int cmdID) - /// removes the assigned shortcut mapped to cmdID - /// returned value : TRUE if function call is successful, otherwise FALSE - /// - NPPM_REMOVESHORTCUTBYCMDID = Constants.NPPMSG + 96, - - /// - /// INT NPPM_GETPLUGINHOMEPATH(size_t strLen, TCHAR *pluginRootPath) - /// Get plugin home root path. It's useful if plugins want to get its own path - /// by appending which is the name of plugin without extension part. - /// Returns the number of TCHAR copied/to copy. - /// Users should call it with pluginRootPath be NULL to get the required number of TCHAR (not including the terminating nul character), - /// allocate pluginRootPath buffer with the return value + 1, then call it again to get the path. - /// - NPPM_GETPLUGINHOMEPATH = Constants.NPPMSG + 97, - - /// - /// INT NPPM_GETSETTINGSCLOUDPATH(size_t strLen, TCHAR *settingsOnCloudPath) - /// Get settings on cloud path. It's useful if plugins want to store its settings on Cloud, if this path is set. - /// Returns the number of TCHAR copied/to copy. If the return value is 0, then this path is not set, or the "strLen" is not enough to copy the path. - /// Users should call it with settingsCloudPath be NULL to get the required number of TCHAR (not including the terminating nul character), - /// allocate settingsCloudPath buffer with the return value + 1, then call it again to get the path. - /// - NPPM_GETSETTINGSONCLOUDPATH = Constants.NPPMSG + 98, - - /// - /// BOOL NPPM_SETLINENUMBERWIDTHMODE(0, INT widthMode) - /// Set line number margin width in dynamic width mode (LINENUMWIDTH_DYNAMIC) or constant width mode (LINENUMWIDTH_CONSTANT) - /// It may help some plugins to disable non-dynamic line number margins width to have a smoothly visual effect while vertical scrolling the content in Notepad++ - /// If calling is successful return TRUE, otherwise return FALSE. - /// - NPPM_SETLINENUMBERWIDTHMODE = Constants.NPPMSG + 99, - LINENUMWIDTH_DYNAMIC = 0, - LINENUMWIDTH_CONSTANT = 1, - - /// - /// INT NPPM_GETLINENUMBERWIDTHMODE(0, 0) - /// Get line number margin width in dynamic width mode (LINENUMWIDTH_DYNAMIC) or constant width mode (LINENUMWIDTH_CONSTANT) - /// - NPPM_GETLINENUMBERWIDTHMODE = Constants.NPPMSG + 100, - - /// - /// VOID NPPM_ADDTOOLBARICON_FORDARKMODE(UINT funcItem[X]._cmdID, toolbarIconsWithDarkMode iconHandles) - /// Use NPPM_ADDTOOLBARICON_FORDARKMODE instead obsolete NPPM_ADDTOOLBARICON which doesn't support the dark mode - /// 2 formats / 3 icons are needed: 1 * BMP + 2 * ICO - /// All 3 handles below should be set so the icon will be displayed correctly if toolbar icon sets are changed by users, also in dark mode - /// - NPPM_ADDTOOLBARICON_FORDARKMODE = Constants.NPPMSG + 101, - RUNCOMMAND_USER = Constants.WM_USER + 3000, NPPM_GETFULLCURRENTPATH = RUNCOMMAND_USER + FULL_CURRENT_PATH, NPPM_GETCURRENTDIRECTORY = RUNCOMMAND_USER + CURRENT_DIRECTORY, @@ -567,7 +529,6 @@ public enum NppMsg : uint NPPM_GETNAMEPART = RUNCOMMAND_USER + NAME_PART, NPPM_GETEXTPART = RUNCOMMAND_USER + EXT_PART, NPPM_GETCURRENTWORD = RUNCOMMAND_USER + CURRENT_WORD, - NPPM_GETNPPDIRECTORY = RUNCOMMAND_USER + NPP_DIRECTORY, /// /// BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str) /// where str is the allocated TCHAR array, @@ -575,7 +536,7 @@ public enum NppMsg : uint /// The return value is TRUE when get generic_string operation success /// Otherwise (allocated array size is too small) FALSE /// - NPPM_GETFILENAMEATCURSOR = RUNCOMMAND_USER + GETFILENAMEATCURSOR, + NPPM_GETNPPDIRECTORY = RUNCOMMAND_USER + NPP_DIRECTORY, /// /// INT NPPM_GETCURRENTLINE(0, 0) @@ -589,8 +550,6 @@ public enum NppMsg : uint /// NPPM_GETCURRENTCOLUMN = RUNCOMMAND_USER + CURRENT_COLUMN, - NPPM_GETNPPFULLFILEPATH = RUNCOMMAND_USER + NPP_FULL_FILE_PATH, - VAR_NOT_RECOGNIZED = 0, FULL_CURRENT_PATH = 1, CURRENT_DIRECTORY = 2, @@ -601,8 +560,6 @@ public enum NppMsg : uint NPP_DIRECTORY = 7, CURRENT_LINE = 8, CURRENT_COLUMN = 9, - NPP_FULL_FILE_PATH = 10, - GETFILENAMEATCURSOR = 11, /// /// To notify plugins that all the procedures of launchment of notepad++ are done. @@ -728,12 +685,12 @@ public enum NppMsg : uint ///scnNotification->nmhdr.hwndFrom = bufferID; ///scnNotification->nmhdr.idFrom = docStatus; /// where bufferID is BufferID - /// docStatus can be combined by DOCSTATUS_READONLY and DOCSTATUS_BUFFERDIRTY + /// docStatus can be combined by DOCSTAUS_READONLY and DOCSTAUS_BUFFERDIRTY /// NPPN_READONLYCHANGED = NPPN_FIRST + 16, - DOCSTATUS_READONLY = 1, - DOCSTATUS_BUFFERDIRTY = 2, + DOCSTAUS_READONLY = 1, + DOCSTAUS_BUFFERDIRTY = 2, /// ///scnNotification->nmhdr.code = NPPN_DOCORDERCHANGED; diff --git a/NppMarkdownPanel/PluginInfrastructure/NotepadPPGateway.cs b/NppMarkdownPanel/PluginInfrastructure/NotepadPPGateway.cs index 9ccaaa8..e1668df 100644 --- a/NppMarkdownPanel/PluginInfrastructure/NotepadPPGateway.cs +++ b/NppMarkdownPanel/PluginInfrastructure/NotepadPPGateway.cs @@ -1,7 +1,5 @@ // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. using System; -using System.Drawing; -using System.Runtime.InteropServices; using System.Text; using NppPluginNET.PluginInfrastructure; @@ -11,14 +9,9 @@ public interface INotepadPPGateway { void FileNew(); - void AddToolbarIcon(int funcItemsIndex, toolbarIcons icon); - void AddToolbarIcon(int funcItemsIndex, Bitmap icon); - string GetNppPath(); - string GetPluginConfigPath(); string GetCurrentFilePath(); unsafe string GetFilePath(int bufferId); void SetCurrentLanguage(LangType language); - bool OpenFile(string path); } /// @@ -34,73 +27,16 @@ public void FileNew() Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_NEW); } - public void AddToolbarIcon(int funcItemsIndex, toolbarIcons icon) - { - IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(icon)); - try { - Marshal.StructureToPtr(icon, pTbIcons, false); - _ = Win32.SendMessage( - PluginBase.nppData._nppHandle, - (uint) NppMsg.NPPM_ADDTOOLBARICON, - PluginBase._funcItems.Items[funcItemsIndex]._cmdID, - pTbIcons); - } finally { - Marshal.FreeHGlobal(pTbIcons); - } - } - - public void AddToolbarIcon(int funcItemsIndex, Bitmap icon) - { - var tbi = new toolbarIcons(); - tbi.hToolbarBmp = icon.GetHbitmap(); - AddToolbarIcon(funcItemsIndex, tbi); - } - /// /// Gets the path of the current document. /// public string GetCurrentFilePath() - => GetString(NppMsg.NPPM_GETFULLCURRENTPATH); - - /// - /// This method incapsulates a common pattern in the Notepad++ API: when - /// you need to retrieve a string, you can first query the buffer size. - /// This method queries the necessary buffer size, allocates the temporary - /// memory, then returns the string retrieved through that buffer. - /// - /// Message ID of the data string to query. - /// String returned by Notepad++. - public string GetString(NppMsg message) { - int len = Win32.SendMessage( - PluginBase.nppData._nppHandle, - (uint) message, Unused, Unused).ToInt32() - + 1; - var res = new StringBuilder(len); - _ = Win32.SendMessage( - PluginBase.nppData._nppHandle, (uint) message, len, res); - return res.ToString(); + var path = new StringBuilder(2000); + Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_GETFULLCURRENTPATH, 0, path); + return path.ToString(); } - /// The path to the Notepad++ executable. - public string GetNppPath() - => GetString(NppMsg.NPPM_GETNPPDIRECTORY); - - /// The path to the Config folder for plugins. - public string GetPluginConfigPath() - => GetString(NppMsg.NPPM_GETPLUGINSCONFIGDIR); - - /// - /// Open a file for editing in Notepad++, pretty much like using the app's - /// File - Open menu. - /// - /// The path to the file to open. - /// True on success. - public bool OpenFile(string path) - => Win32.SendMessage( - PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_DOOPEN, Unused, path).ToInt32() - != 0; - /// /// Gets the path of the current document. /// diff --git a/NppMarkdownPanel/PluginInfrastructure/NppPluginNETBase.cs b/NppMarkdownPanel/PluginInfrastructure/NppPluginNETBase.cs index 5994cda..250a901 100644 --- a/NppMarkdownPanel/PluginInfrastructure/NppPluginNETBase.cs +++ b/NppMarkdownPanel/PluginInfrastructure/NppPluginNETBase.cs @@ -12,17 +12,17 @@ internal static void SetCommand(int index, string commandName, NppFuncItemDelega { SetCommand(index, commandName, functionPointer, new ShortcutKey(), false); } - + internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut) { SetCommand(index, commandName, functionPointer, shortcut, false); } - + internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, bool checkOnInit) { SetCommand(index, commandName, functionPointer, new ShortcutKey(), checkOnInit); } - + internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut, bool checkOnInit) { FuncItem funcItem = new FuncItem(); @@ -36,15 +36,6 @@ internal static void SetCommand(int index, string commandName, NppFuncItemDelega _funcItems.Add(funcItem); } - // menuitem with checkmark, toggle visible checkmark on/off - internal static void CheckMenuItemToggle(int idx, ref bool value) - { - // toggle value - value = !value; - - Win32.CheckMenuItem(Win32.GetMenu(nppData._nppHandle), _funcItems.Items[idx]._cmdID, Win32.MF_BYCOMMAND | (value ? Win32.MF_CHECKED : Win32.MF_UNCHECKED)); - } - internal static IntPtr GetCurrentScintilla() { int curScintilla; diff --git a/NppMarkdownPanel/PluginInfrastructure/NppPluginNETHelper.cs b/NppMarkdownPanel/PluginInfrastructure/NppPluginNETHelper.cs index e1fc988..0984597 100644 --- a/NppMarkdownPanel/PluginInfrastructure/NppPluginNETHelper.cs +++ b/NppMarkdownPanel/PluginInfrastructure/NppPluginNETHelper.cs @@ -183,7 +183,14 @@ public enum DockMgrMsg : uint } [StructLayout(LayoutKind.Sequential)] - public struct toolbarIcons + public struct toolbarIconsOld + { + public IntPtr hToolbarBmp; // standard icon (color) + public IntPtr hToolbarIcon; // Fluent UI icon (black) + } + + [StructLayout(LayoutKind.Sequential)] + public struct toolbarIconsNew { public IntPtr hToolbarBmp; // standard icon (color) public IntPtr hToolbarIcon; // Fluent UI icon (black) diff --git a/NppMarkdownPanel/PluginInfrastructure/Preference_h.cs b/NppMarkdownPanel/PluginInfrastructure/Preference_h.cs index 403a85f..c72ed1c 100644 --- a/NppMarkdownPanel/PluginInfrastructure/Preference_h.cs +++ b/NppMarkdownPanel/PluginInfrastructure/Preference_h.cs @@ -4,6 +4,10 @@ // "notepad-plus-plus/scintilla/include/Scintilla.iface" // found at // https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.iface +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; namespace NppPluginNET.PluginInfrastructure { @@ -37,7 +41,7 @@ public enum Preference IDC_CHECK_TAB_HIDE = IDD_PREFERENCE_BAR_BOX + 18, IDC_CHECK_TAB_MULTILINE = IDD_PREFERENCE_BAR_BOX + 19, IDC_CHECK_TAB_VERTICAL = IDD_PREFERENCE_BAR_BOX + 20, - IDC_CHECK_TAB_LAST_EXIT = IDD_PREFERENCE_BAR_BOX + 21, + IDC_CHECK_HIDEMENUBAR = IDD_PREFERENCE_BAR_BOX + 22, IDC_LOCALIZATION_GB_STATIC = IDD_PREFERENCE_BAR_BOX + 23, IDC_COMBO_LOCALIZATION = IDD_PREFERENCE_BAR_BOX + 24, @@ -52,14 +56,6 @@ public enum Preference IDC_MONOINST_RADIO = IDD_PREFERENCE_MULTIINSTANCE_BOX + 4, IDD_STATIC_RESTARTNOTE = IDD_PREFERENCE_MULTIINSTANCE_BOX + 5, - IDD_PREFERENCE_WORDCHARLIST_BOX = 6160, - IDC_WORDCHARLIST_GB_STATIC = IDD_PREFERENCE_WORDCHARLIST_BOX + 1, - IDC_RADIO_WORDCHAR_DEFAULT = IDD_PREFERENCE_WORDCHARLIST_BOX + 2, - IDC_RADIO_WORDCHAR_CUSTOM = IDD_PREFERENCE_WORDCHARLIST_BOX + 3, - IDC_WORDCHAR_CUSTOM_EDIT = IDD_PREFERENCE_WORDCHARLIST_BOX + 4, - IDD_WORDCHAR_QUESTION_BUTTON = IDD_PREFERENCE_WORDCHARLIST_BOX + 5, - IDD_STATIC_WORDCHAR_WARNING = IDD_PREFERENCE_WORDCHARLIST_BOX + 6, - IDD_PREFERENCE_MARGEIN_BOX = 6200, IDC_FMS_GB_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 1, IDC_RADIO_SIMPLE = IDD_PREFERENCE_MARGEIN_BOX + 2, @@ -70,9 +66,13 @@ public enum Preference IDC_CHECK_LINENUMBERMARGE = IDD_PREFERENCE_MARGEIN_BOX + 6, IDC_CHECK_BOOKMARKMARGE = IDD_PREFERENCE_MARGEIN_BOX + 7, - IDC_VES_GB_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 11, + IDC_CHECK_SHOWVERTICALEDGE = IDD_PREFERENCE_MARGEIN_BOX + 8, + IDC_NBCOLONE_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 9, + IDC_COLONENUMBER_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 10, - IDC_CHECK_EDGEBGMODE = IDD_PREFERENCE_MARGEIN_BOX + 13, + IDC_VES_GB_STATIC = IDD_PREFERENCE_MARGEIN_BOX + 11, + IDC_RADIO_LNMODE = IDD_PREFERENCE_MARGEIN_BOX + 12, + IDC_RADIO_BGMODE = IDD_PREFERENCE_MARGEIN_BOX + 13, IDC_CHECK_CURRENTLINEHILITE = IDD_PREFERENCE_MARGEIN_BOX + 14, IDC_CHECK_SMOOTHFONT = IDD_PREFERENCE_MARGEIN_BOX + 15, @@ -99,11 +99,6 @@ public enum Preference IDC_BORDERWIDTH_SLIDER = IDD_PREFERENCE_MARGEIN_BOX + 33, IDC_CHECK_DISABLEADVANCEDSCROLL = IDD_PREFERENCE_MARGEIN_BOX + 34, IDC_CHECK_NOEDGE = IDD_PREFERENCE_MARGEIN_BOX + 35, - IDC_CHECK_SCROLLBEYONDLASTLINE = IDD_PREFERENCE_MARGEIN_BOX + 36, - - IDC_STATIC_MULTILNMODE_TIP = IDD_PREFERENCE_MARGEIN_BOX + 37, - IDC_COLUMNPOS_EDIT = IDD_PREFERENCE_MARGEIN_BOX + 38, - IDC_CHECK_RIGHTCLICKKEEPSSELECTION = IDD_PREFERENCE_MARGEIN_BOX + 39, IDD_PREFERENCE_DELIMITERSETTINGS_BOX = 6250, IDC_DELIMITERSETTINGS_GB_STATIC = IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 1, @@ -124,17 +119,6 @@ public enum Preference IDC_CLOUDPATH_EDIT = IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 8, IDD_CLOUDPATH_BROWSE_BUTTON = IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 9, - IDD_PREFERENCE_SEARCHENGINE_BOX = 6270, - IDC_SEARCHENGINES_GB_STATIC = IDD_PREFERENCE_SEARCHENGINE_BOX + 1, - IDC_SEARCHENGINE_DUCKDUCKGO_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 2, - IDC_SEARCHENGINE_GOOGLE_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 3, - IDC_SEARCHENGINE_BING_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 4, - IDC_SEARCHENGINE_YAHOO_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 5, - IDC_SEARCHENGINE_CUSTOM_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 6, - IDC_SEARCHENGINE_EDIT = IDD_PREFERENCE_SEARCHENGINE_BOX + 7, - IDD_SEARCHENGINE_NOTE_STATIC = IDD_PREFERENCE_SEARCHENGINE_BOX + 8, - IDC_SEARCHENGINE_STACKOVERFLOW_RADIO = IDD_PREFERENCE_SEARCHENGINE_BOX + 9, - IDD_PREFERENCE_SETTING_BOX = 6300, IDC_TABSETTING_GB_STATIC = IDD_PREFERENCE_SETTING_BOX + 1, IDC_CHECK_REPLACEBYSPACE = IDD_PREFERENCE_SETTING_BOX + 2, @@ -142,12 +126,14 @@ public enum Preference IDC_HISTORY_GB_STATIC = IDD_PREFERENCE_SETTING_BOX + 4, IDC_CHECK_DONTCHECKHISTORY = IDD_PREFERENCE_SETTING_BOX + 5, IDC_MAXNBFILE_STATIC = IDD_PREFERENCE_SETTING_BOX + 6, + IDC_CHECK_FILEAUTODETECTION = IDD_PREFERENCE_SETTING_BOX + 7, IDC_CHECK_MIN2SYSTRAY = IDD_PREFERENCE_SETTING_BOX + 8, IDC_CHECK_REMEMBERSESSION = IDD_PREFERENCE_SETTING_BOX + 9, IDC_TABSIZEVAL_STATIC = IDD_PREFERENCE_SETTING_BOX + 10, IDC_MAXNBFILEVAL_STATIC = IDD_PREFERENCE_SETTING_BOX + 11, IDC_FILEAUTODETECTION_STATIC = IDD_PREFERENCE_SETTING_BOX + 12, IDC_CHECK_UPDATESILENTLY = IDD_PREFERENCE_SETTING_BOX + 13, + IDC_RADIO_BKNONE = IDD_PREFERENCE_SETTING_BOX + 15, IDC_RADIO_BKSIMPLE = IDD_PREFERENCE_SETTING_BOX + 16, IDC_RADIO_BKVERBOSE = IDD_PREFERENCE_SETTING_BOX + 17, @@ -171,19 +157,11 @@ public enum Preference IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL = IDD_PREFERENCE_SETTING_BOX + 35, IDC_EDIT_WORKSPACEFILEEXT = IDD_PREFERENCE_SETTING_BOX + 36, IDC_WORKSPACEFILEEXT_STATIC = IDD_PREFERENCE_SETTING_BOX + 37, - IDC_CHECK_SMARTHILITEWHOLEWORDONLY = IDD_PREFERENCE_SETTING_BOX + 38, - IDC_CHECK_SMARTHILITEUSEFINDSETTINGS = IDD_PREFERENCE_SETTING_BOX + 39, - IDC_CHECK_SMARTHILITEANOTHERRVIEW = IDD_PREFERENCE_SETTING_BOX + 40, - IDC_CHECK_REMEMBEREDITVIEWPERFILE = IDD_PREFERENCE_SETTING_BOX + 41, - IDC_REMEMBEREDITVIEWPERFILE_STATIC = IDD_PREFERENCE_SETTING_BOX + 42, - IDC_EDIT_REMEMBEREDITVIEWPERFILE = IDD_PREFERENCE_SETTING_BOX + 43, - - IDC_DOCUMENTPEEK_STATIC = IDD_PREFERENCE_SETTING_BOX + 44, - IDC_CHECK_ENABLEDOCPEEKER = IDD_PREFERENCE_SETTING_BOX + 45, - IDC_CHECK_ENABLEDOCPEEKONMAP = IDD_PREFERENCE_SETTING_BOX + 46, - IDC_COMBO_FILEUPDATECHOICE = IDD_PREFERENCE_SETTING_BOX + 47, - IDC_CHECK_DIRECTWRITE_ENABLE = IDD_PREFERENCE_SETTING_BOX + 49, + IDC_PREFERENCE_OFFSET_FLS = 40, + IDC_CHECK_REMEMBEREDITVIEWPERFILE = IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 1, + IDC_REMEMBEREDITVIEWPERFILE_STATIC = IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 2, + IDC_EDIT_REMEMBEREDITVIEWPERFILE = IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 3, IDD_PREFERENCE_NEWDOCSETTING_BOX = 6400, IDC_FORMAT_GB_STATIC = IDD_PREFERENCE_NEWDOCSETTING_BOX + 1, @@ -216,7 +194,6 @@ public enum Preference IDC_CUSTOMIZELENGTHVAL_STATIC = IDD_PREFERENCE_NEWDOCSETTING_BOX + 28, IDC_DISPLAY_STATIC = IDD_PREFERENCE_NEWDOCSETTING_BOX + 29, IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG = IDD_PREFERENCE_NEWDOCSETTING_BOX + 30, - IDC_OPENSAVEDIR_CHECK_DRROPFOLDEROPENFILES = IDD_PREFERENCE_NEWDOCSETTING_BOX + 31, IDD_PREFERENCE_DEFAULTDIRECTORY_BOX = 6450, IDD_PREFERENCE_RECENTFILESHISTORY_BOX = 6460, @@ -234,7 +211,7 @@ public enum Preference IDC_CHECK_DEFAULTTABVALUE = IDD_PREFERENCE_LANG_BOX + 10, IDC_GR_TABVALUE_STATIC = IDD_PREFERENCE_LANG_BOX + 11, IDC_TABSIZEVAL_DISABLE_STATIC = IDD_PREFERENCE_LANG_BOX + 12, - IDD_PREFERENCE_HILITE_BOX = 6550, + IDD_PREFERENCE_TABSETTINGS_BOX = 6550, IDD_PREFERENCE_PRINT_BOX = 6600, IDC_CHECK_PRINTLINENUM = IDD_PREFERENCE_PRINT_BOX + 1, @@ -307,7 +284,6 @@ public enum Preference IDD_BACKUPDIR_RESTORESESSION_STATIC2 = IDD_PREFERENCE_BACKUP_BOX + 21, IDD_BACKUPDIR_RESTORESESSION_PATHLABEL_STATIC = IDD_PREFERENCE_BACKUP_BOX + 22, IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT = IDD_PREFERENCE_BACKUP_BOX + 23, - IDD_AUTOC_IGNORENUMBERS = IDD_PREFERENCE_BACKUP_BOX + 24, IDD_PREFERENCE_AUTOCOMPLETION_BOX = 6850, IDD_AUTOCINSERT_GRPSTATIC = IDD_PREFERENCE_AUTOCOMPLETION_BOX + 1, @@ -329,10 +305,6 @@ public enum Preference IDC_MACHEDPAIROPEN_EDIT3 = IDD_PREFERENCE_AUTOCOMPLETION_BOX + 17, IDC_MACHEDPAIRCLOSE_EDIT3 = IDD_PREFERENCE_AUTOCOMPLETION_BOX + 18, - IDD_PREFERENCE_SEARCHINGSETTINGS_BOX = 6900, - IDC_CHECK_STOPFILLINGFINDFIELD = IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 1, - IDC_CHECK_MONOSPACEDFONT_FINDDLG = IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 2, - /* --Autogenerated -- end of section automatically generated from preference_rc.h */ } } diff --git a/NppMarkdownPanel/PluginInfrastructure/Resource_h.cs b/NppMarkdownPanel/PluginInfrastructure/Resource_h.cs index 89634c4..f0b8361 100644 --- a/NppMarkdownPanel/PluginInfrastructure/Resource_h.cs +++ b/NppMarkdownPanel/PluginInfrastructure/Resource_h.cs @@ -4,6 +4,10 @@ // "notepad-plus-plus/scintilla/include/Scintilla.iface" // found at // https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.iface +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; using Kbg.NppPluginNET.PluginInfrastructure; namespace NppPluginNET.PluginInfrastructure @@ -100,7 +104,6 @@ public enum Resource IDI_UNSAVED_ICON = 502, IDI_READONLY_ICON = 503, IDI_FIND_RESULT_ICON = 504, - IDI_MONITORING_ICON = 505, IDI_PROJECT_WORKSPACE = 601, IDI_PROJECT_WORKSPACEDIRTY = 602, @@ -111,9 +114,6 @@ public enum Resource IDI_PROJECT_FILEINVALID = 607, IDI_FB_ROOTOPEN = 608, IDI_FB_ROOTCLOSE = 609, - IDI_FB_SELECTCURRENTFILE = 610, - IDI_FB_FOLDALL = 611, - IDI_FB_EXPANDALL = 612, IDI_FUNCLIST_ROOT = 620, IDI_FUNCLIST_NODE = 621, @@ -122,15 +122,6 @@ public enum Resource IDI_FUNCLIST_SORTBUTTON = 631, IDI_FUNCLIST_RELOADBUTTON = 632, - IDI_VIEW_DOC_MAP_ON_ICON = 633, - IDI_VIEW_DOC_MAP_OFF_ICON = 634, - IDI_VIEW_FILEBROWSER_ON_ICON = 635, - IDI_VIEW_FILEBROWSER_OFF_ICON = 636, - IDI_VIEW_FUNCLIST_ON_ICON = 637, - IDI_VIEW_FUNCLIST_OFF_ICON = 638, - IDI_VIEW_MONITORING_ON_ICON = 639, - IDI_VIEW_MONITORING_OFF_ICON = 640, - IDC_MY_CUR = 1402, IDC_UP_ARROW = 1403, IDC_DRAG_TAB = 1404, @@ -174,6 +165,7 @@ public enum Resource IDR_CLOSETAB_INACT = 1531, IDR_CLOSETAB_HOVER = 1532, IDR_CLOSETAB_PUSH = 1533, + IDR_FUNC_LIST_ICO = 1534, IDR_DOCMAP_ICO = 1535, IDR_PROJECTPANEL_ICO = 1536, @@ -181,8 +173,6 @@ public enum Resource IDR_ASCIIPANEL_ICO = 1538, IDR_DOCSWITCHER_ICO = 1539, IDR_FILEBROWSER_ICO = 1540, - IDR_FILEMONITORING = 1541, - ID_MACRO = 20000, ID_MACRO_LIMIT = 20200, @@ -253,15 +243,11 @@ public enum Resource IDC_ONLINEHELP_ADDR = 1704, IDC_AUTHOR_NAME = 1705, IDC_BUILD_DATETIME = 1706, - IDC_VERSION_BIT = 1707, IDD_DEBUGINFOBOX = 1750, IDC_DEBUGINFO_EDIT = 1751, IDC_DEBUGINFO_COPYLINK = 1752, - IDD_DOSAVEORNOTBOX = 1760, - IDC_DOSAVEORNOTTEX = 1761, - IDD_GOLINE = 2000, ID_GOLINE_EDIT = IDD_GOLINE + 1, ID_CURRLINE = IDD_GOLINE + 2, @@ -309,7 +295,7 @@ public enum Resource NPPM_INTERNAL_RELOADNATIVELANG = NOTEPADPLUS_USER_INTERNAL + 25, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED = NOTEPADPLUS_USER_INTERNAL + 26, NPPM_INTERNAL_SCINTILLAFINFERCLEARALL = NOTEPADPLUS_USER_INTERNAL + 27, - + NPPM_INTERNAL_SETTING_EDGE_SIZE = NOTEPADPLUS_USER_INTERNAL + 28, NPPM_INTERNAL_SETTING_TAB_REPLCESPACE = NOTEPADPLUS_USER_INTERNAL + 29, NPPM_INTERNAL_SETTING_TAB_SIZE = NOTEPADPLUS_USER_INTERNAL + 30, NPPM_INTERNAL_RELOADSTYLERS = NOTEPADPLUS_USER_INTERNAL + 31, @@ -323,17 +309,6 @@ public enum Resource NPPM_INTERNAL_SAVECURRENTSESSION = NOTEPADPLUS_USER_INTERNAL + 39, NPPM_INTERNAL_FINDINFINDERDLG = NOTEPADPLUS_USER_INTERNAL + 40, NPPM_INTERNAL_REMOVEFINDER = NOTEPADPLUS_USER_INTERNAL + 41, - NPPM_INTERNAL_RELOADSCROLLTOEND = NOTEPADPLUS_USER_INTERNAL + 42, - NPPM_INTERNAL_FINDKEYCONFLICTS = NOTEPADPLUS_USER_INTERNAL + 43, - NPPM_INTERNAL_SCROLLBEYONDLASTLINE = NOTEPADPLUS_USER_INTERNAL + 44, - NPPM_INTERNAL_SETWORDCHARS = NOTEPADPLUS_USER_INTERNAL + 45, - NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT = NOTEPADPLUS_USER_INTERNAL + 46, - NPPM_INTERNAL_PRNTANDQUIT = NOTEPADPLUS_USER_INTERNAL + 47, - NPPM_INTERNAL_SAVEBACKUP = NOTEPADPLUS_USER_INTERNAL + 48, - NPPM_INTERNAL_STOPMONITORING = NOTEPADPLUS_USER_INTERNAL + 49, - NPPM_INTERNAL_EDGEBACKGROUND = NOTEPADPLUS_USER_INTERNAL + 50, - NPPM_INTERNAL_EDGEMULTISETSIZE = NOTEPADPLUS_USER_INTERNAL + 51, - NPPM_INTERNAL_UPDATECLICKABLELINKS = NOTEPADPLUS_USER_INTERNAL + 52, NPPM_INTERNAL_CHECKDOCSTATUS = Constants.NPPMSG + 53, @@ -343,6 +318,10 @@ public enum Resource CHECKDOCOPT_UPDATESILENTLY = 1, CHECKDOCOPT_UPDATEGO2END = 2, + NPPM_INTERNAL_GETCHECKDOCOPT = Constants.NPPMSG + 55, + + NPPM_INTERNAL_SETCHECKDOCOPT = Constants.NPPMSG + 56, + NPPM_INTERNAL_SETFILENAME = Constants.NPPMSG + 63, SCINTILLA_USER = Constants.WM_USER + 2000, @@ -363,10 +342,9 @@ public enum Resource MENUINDEX_FORMAT = 4, MENUINDEX_LANGUAGE = 5, MENUINDEX_SETTINGS = 6, - MENUINDEX_TOOLS = 7, - MENUINDEX_MACRO = 8, - MENUINDEX_RUN = 9, - MENUINDEX_PLUGINS = 10, + MENUINDEX_MACRO = 7, + MENUINDEX_RUN = 8, + MENUINDEX_PLUGINS = 9, /* --Autogenerated -- end of section automatically generated from resource.h */ } } diff --git a/NppMarkdownPanel/PluginInfrastructure/ScintillaGateway.cs b/NppMarkdownPanel/PluginInfrastructure/ScintillaGateway.cs index 4483904..7b30a8d 100644 --- a/NppMarkdownPanel/PluginInfrastructure/ScintillaGateway.cs +++ b/NppMarkdownPanel/PluginInfrastructure/ScintillaGateway.cs @@ -35,20 +35,20 @@ public int GetSelectionLength() public void AppendTextAndMoveCursor(string text) { AppendText(text.Length, text); - GotoPos(GetCurrentPos() + text.Length); + GotoPos(new Position(GetCurrentPos().Value + text.Length)); } public void InsertTextAndMoveCursor(string text) { var currentPos = GetCurrentPos(); InsertText(currentPos, text); - GotoPos(currentPos + text.Length); + GotoPos(new Position(currentPos.Value + text.Length)); } public void SelectCurrentLine() { int line = GetCurrentLineNumber(); - SetSelection(PositionFromLine(line), PositionFromLine(line + 1)); + SetSelection(PositionFromLine(line).Value, PositionFromLine(line + 1).Value); } /// @@ -56,7 +56,7 @@ public void SelectCurrentLine() /// public void ClearSelectionToCursor() { - var pos = GetCurrentPos(); + var pos = GetCurrentPos().Value; SetSelection(pos, pos); } @@ -65,7 +65,7 @@ public void ClearSelectionToCursor() /// public int GetCurrentLineNumber() { - return LineFromPosition(GetCurrentPos()); + return LineFromPosition(GetCurrentPos()); } /// @@ -89,7 +89,7 @@ public unsafe void AddText(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_ADDTEXT, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDTEXT, length, (IntPtr) textPtr); } } @@ -98,16 +98,16 @@ public unsafe void AddStyledText(int length, Cells c) { fixed (char* cPtr = c.Value) { - Win32.SendMessage(scintilla, SciMsg.SCI_ADDSTYLEDTEXT, (IntPtr) length, (IntPtr) cPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDSTYLEDTEXT, length, (IntPtr) cPtr); } } /// Insert string at a position. (Scintilla feature 2003) - public unsafe void InsertText(int pos, string text) + public unsafe void InsertText(Position pos, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_INSERTTEXT, (IntPtr) pos, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INSERTTEXT, pos.Value, (IntPtr) textPtr); } } @@ -116,62 +116,67 @@ public unsafe void ChangeInsertion(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_CHANGEINSERTION, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHANGEINSERTION, length, (IntPtr) textPtr); } } /// Delete all text in the document. (Scintilla feature 2004) public void ClearAll() { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALL, Unused, Unused); } /// Delete a range of text in the document. (Scintilla feature 2645) - public void DeleteRange(int start, int lengthDelete) + public void DeleteRange(Position pos, int deleteLength) { - Win32.SendMessage(scintilla, SciMsg.SCI_DELETERANGE, (IntPtr) start, (IntPtr) lengthDelete); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETERANGE, pos.Value, deleteLength); } /// Set all style bytes to 0, remove all folding information. (Scintilla feature 2005) public void ClearDocumentStyle() { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEARDOCUMENTSTYLE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARDOCUMENTSTYLE, Unused, Unused); } /// Returns the number of bytes in the document. (Scintilla feature 2006) public int GetLength() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLENGTH, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLENGTH, Unused, Unused); + return (int) res; } /// Returns the character byte at the position. (Scintilla feature 2007) - public int GetCharAt(int pos) + public int GetCharAt(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARAT, (IntPtr) pos, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARAT, pos.Value, Unused); + return (int) res; } /// Returns the position of the caret. (Scintilla feature 2008) - public int GetCurrentPos() + public Position GetCurrentPos() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCURRENTPOS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURRENTPOS, Unused, Unused); + return new Position((int) res); } /// Returns the position of the opposite end of the selection to the caret. (Scintilla feature 2009) - public int GetAnchor() + public Position GetAnchor() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETANCHOR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETANCHOR, Unused, Unused); + return new Position((int) res); } /// Returns the style byte at the position. (Scintilla feature 2010) - public int GetStyleAt(int pos) + public int GetStyleAt(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEAT, (IntPtr) pos, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEAT, pos.Value, Unused); + return (int) res; } /// Redoes the next action on the undo history. (Scintilla feature 2011) public void Redo() { - Win32.SendMessage(scintilla, SciMsg.SCI_REDO, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REDO, Unused, Unused); } /// @@ -181,13 +186,13 @@ public void Redo() /// public void SetUndoCollection(bool collectUndo) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETUNDOCOLLECTION, new IntPtr(collectUndo ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUNDOCOLLECTION, collectUndo ? 1 : 0, Unused); } /// Select all the text in the document. (Scintilla feature 2013) public void SelectAll() { - Win32.SendMessage(scintilla, SciMsg.SCI_SELECTALL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTALL, Unused, Unused); } /// @@ -197,7 +202,7 @@ public void SelectAll() /// public void SetSavePoint() { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSAVEPOINT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSAVEPOINT, Unused, Unused); } /// @@ -207,31 +212,35 @@ public void SetSavePoint() /// public int GetStyledText(TextRange tr) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEDTEXT, (IntPtr) Unused, tr.NativePointer); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEDTEXT, Unused, tr.NativePointer); + return (int) res; } /// Are there any redoable actions in the undo history? (Scintilla feature 2016) public bool CanRedo() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_CANREDO, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANREDO, Unused, Unused); + return 1 == (int) res; } /// Retrieve the line number at which a particular marker is located. (Scintilla feature 2017) - public int MarkerLineFromHandle(int markerHandle) + public int MarkerLineFromHandle(int handle) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERLINEFROMHANDLE, (IntPtr) markerHandle, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERLINEFROMHANDLE, handle, Unused); + return (int) res; } /// Delete a marker. (Scintilla feature 2018) - public void MarkerDeleteHandle(int markerHandle) + public void MarkerDeleteHandle(int handle) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEHANDLE, (IntPtr) markerHandle, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEHANDLE, handle, Unused); } /// Is undo history being collected? (Scintilla feature 2019) public bool GetUndoCollection() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETUNDOCOLLECTION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUNDOCOLLECTION, Unused, Unused); + return 1 == (int) res; } /// @@ -239,37 +248,23 @@ public bool GetUndoCollection() /// Returns one of SCWS_* constants. /// (Scintilla feature 2020) /// - public WhiteSpace GetViewWS() + public int GetViewWS() { - return (WhiteSpace)Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWWS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWWS, Unused, Unused); + return (int) res; } /// Make white space characters invisible, always visible or visible outside indentation. (Scintilla feature 2021) - public void SetViewWS(WhiteSpace viewWS) + public void SetViewWS(int viewWS) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWWS, (IntPtr) viewWS, (IntPtr) Unused); - } - - /// - /// Retrieve the current tab draw mode. - /// Returns one of SCTD_* constants. - /// (Scintilla feature 2698) - /// - public TabDrawMode GetTabDrawMode() - { - return (TabDrawMode)Win32.SendMessage(scintilla, SciMsg.SCI_GETTABDRAWMODE, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Set how tabs are drawn when visible. (Scintilla feature 2699) - public void SetTabDrawMode(TabDrawMode tabDrawMode) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTABDRAWMODE, (IntPtr) tabDrawMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWWS, viewWS, Unused); } /// Find the position from a point within the window. (Scintilla feature 2022) - public int PositionFromPoint(int x, int y) + public Position PositionFromPoint(int x, int y) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINT, (IntPtr) x, (IntPtr) y); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINT, x, y); + return new Position((int) res); } /// @@ -277,21 +272,22 @@ public int PositionFromPoint(int x, int y) /// INVALID_POSITION if not close to text. /// (Scintilla feature 2023) /// - public int PositionFromPointClose(int x, int y) + public Position PositionFromPointClose(int x, int y) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINTCLOSE, (IntPtr) x, (IntPtr) y); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINTCLOSE, x, y); + return new Position((int) res); } /// Set caret to start of a line and ensure it is visible. (Scintilla feature 2024) public void GotoLine(int line) { - Win32.SendMessage(scintilla, SciMsg.SCI_GOTOLINE, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GOTOLINE, line, Unused); } /// Set caret to a position and ensure it is visible. (Scintilla feature 2025) - public void GotoPos(int caret) + public void GotoPos(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_GOTOPOS, (IntPtr) caret, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GOTOPOS, pos.Value, Unused); } /// @@ -299,9 +295,9 @@ public void GotoPos(int caret) /// end of the selection from the caret. /// (Scintilla feature 2026) /// - public void SetAnchor(int anchor) + public void SetAnchor(Position posAnchor) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETANCHOR, (IntPtr) anchor, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETANCHOR, posAnchor.Value, Unused); } /// @@ -315,43 +311,45 @@ public unsafe string GetCurLine(int length) byte[] textBuffer = new byte[10000]; fixed (byte* textPtr = textBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETCURLINE, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURLINE, length, (IntPtr) textPtr); return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); } } /// Retrieve the position of the last correctly styled character. (Scintilla feature 2028) - public int GetEndStyled() + public Position GetEndStyled() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETENDSTYLED, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETENDSTYLED, Unused, Unused); + return new Position((int) res); } /// Convert all line endings in the document to one mode. (Scintilla feature 2029) - public void ConvertEOLs(EndOfLine eolMode) + public void ConvertEOLs(int eolMode) { - Win32.SendMessage(scintilla, SciMsg.SCI_CONVERTEOLS, (IntPtr) eolMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CONVERTEOLS, eolMode, Unused); } /// Retrieve the current end of line mode - one of CRLF, CR, or LF. (Scintilla feature 2030) - public EndOfLine GetEOLMode() + public int GetEOLMode() { - return (EndOfLine)Win32.SendMessage(scintilla, SciMsg.SCI_GETEOLMODE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEOLMODE, Unused, Unused); + return (int) res; } /// Set the current end of line mode. (Scintilla feature 2031) - public void SetEOLMode(EndOfLine eolMode) + public void SetEOLMode(int eolMode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETEOLMODE, (IntPtr) eolMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEOLMODE, eolMode, Unused); } /// - /// Set the current styling position to start. - /// The unused parameter is no longer used and should be set to 0. + /// Set the current styling position to pos and the styling mask to mask. + /// The styling mask can be used to protect some bits in each styling byte from modification. /// (Scintilla feature 2032) /// - public void StartStyling(int start, int unused) + public void StartStyling(Position pos, int mask) { - Win32.SendMessage(scintilla, SciMsg.SCI_STARTSTYLING, (IntPtr) start, (IntPtr) unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STARTSTYLING, pos.Value, mask); } /// @@ -361,13 +359,14 @@ public void StartStyling(int start, int unused) /// public void SetStyling(int length, int style) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLING, (IntPtr) length, (IntPtr) style); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLING, length, style); } /// Is drawing done first into a buffer or direct to the screen? (Scintilla feature 2034) public bool GetBufferedDraw() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETBUFFEREDDRAW, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETBUFFEREDDRAW, Unused, Unused); + return 1 == (int) res; } /// @@ -377,37 +376,39 @@ public bool GetBufferedDraw() /// public void SetBufferedDraw(bool buffered) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETBUFFEREDDRAW, new IntPtr(buffered ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETBUFFEREDDRAW, buffered ? 1 : 0, Unused); } /// Change the visible size of a tab to be a multiple of the width of a space character. (Scintilla feature 2036) public void SetTabWidth(int tabWidth) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTABWIDTH, (IntPtr) tabWidth, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTABWIDTH, tabWidth, Unused); } /// Retrieve the visible size of a tab. (Scintilla feature 2121) public int GetTabWidth() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTABWIDTH, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTABWIDTH, Unused, Unused); + return (int) res; } /// Clear explicit tabstops on a line. (Scintilla feature 2675) public void ClearTabStops(int line) { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEARTABSTOPS, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARTABSTOPS, line, Unused); } /// Add an explicit tab stop for a line. (Scintilla feature 2676) public void AddTabStop(int line, int x) { - Win32.SendMessage(scintilla, SciMsg.SCI_ADDTABSTOP, (IntPtr) line, (IntPtr) x); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDTABSTOP, line, x); } /// Find the next explicit tab stop position on a line after a position. (Scintilla feature 2677) public int GetNextTabStop(int line, int x) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETNEXTTABSTOP, (IntPtr) line, (IntPtr) x); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETNEXTTABSTOP, line, x); + return (int) res; } /// @@ -417,73 +418,76 @@ public int GetNextTabStop(int line, int x) /// public void SetCodePage(int codePage) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCODEPAGE, (IntPtr) codePage, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCODEPAGE, codePage, Unused); } - /// Is the IME displayed in a window or inline? (Scintilla feature 2678) - public IMEInteraction GetIMEInteraction() + /// Is the IME displayed in a winow or inline? (Scintilla feature 2678) + public int GetIMEInteraction() { - return (IMEInteraction)Win32.SendMessage(scintilla, SciMsg.SCI_GETIMEINTERACTION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETIMEINTERACTION, Unused, Unused); + return (int) res; } /// Choose to display the the IME in a winow or inline. (Scintilla feature 2679) - public void SetIMEInteraction(IMEInteraction imeInteraction) + public void SetIMEInteraction(int imeInteraction) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETIMEINTERACTION, (IntPtr) imeInteraction, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIMEINTERACTION, imeInteraction, Unused); } /// Set the symbol used for a particular marker number. (Scintilla feature 2040) - public void MarkerDefine(int markerNumber, MarkerSymbol markerSymbol) + public void MarkerDefine(int markerNumber, int markerSymbol) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINE, (IntPtr) markerNumber, (IntPtr) markerSymbol); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINE, markerNumber, markerSymbol); } /// Set the foreground colour used for a particular marker number. (Scintilla feature 2041) public void MarkerSetFore(int markerNumber, Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETFORE, (IntPtr) markerNumber, fore.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETFORE, markerNumber, fore.Value); } /// Set the background colour used for a particular marker number. (Scintilla feature 2042) public void MarkerSetBack(int markerNumber, Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACK, (IntPtr) markerNumber, back.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACK, markerNumber, back.Value); } /// Set the background colour used for a particular marker number when its folding block is selected. (Scintilla feature 2292) public void MarkerSetBackSelected(int markerNumber, Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACKSELECTED, (IntPtr) markerNumber, back.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACKSELECTED, markerNumber, back.Value); } /// Enable/disable highlight for current folding bloc (smallest one that contains the caret) (Scintilla feature 2293) public void MarkerEnableHighlight(bool enabled) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERENABLEHIGHLIGHT, new IntPtr(enabled ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERENABLEHIGHLIGHT, enabled ? 1 : 0, Unused); } /// Add a marker to a line, returning an ID which can be used to find or delete the marker. (Scintilla feature 2043) public int MarkerAdd(int line, int markerNumber) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADD, (IntPtr) line, (IntPtr) markerNumber); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADD, line, markerNumber); + return (int) res; } /// Delete a marker from a line. (Scintilla feature 2044) public void MarkerDelete(int line, int markerNumber) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETE, (IntPtr) line, (IntPtr) markerNumber); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETE, line, markerNumber); } /// Delete all markers with a particular number from all lines. (Scintilla feature 2045) public void MarkerDeleteAll(int markerNumber) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEALL, (IntPtr) markerNumber, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEALL, markerNumber, Unused); } /// Get a bit mask of all the markers set on a line. (Scintilla feature 2046) public int MarkerGet(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERGET, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERGET, line, Unused); + return (int) res; } /// @@ -493,13 +497,15 @@ public int MarkerGet(int line) /// public int MarkerNext(int lineStart, int markerMask) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERNEXT, (IntPtr) lineStart, (IntPtr) markerMask); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERNEXT, lineStart, markerMask); + return (int) res; } /// Find the previous line before lineStart that includes a marker in mask. (Scintilla feature 2048) public int MarkerPrevious(int lineStart, int markerMask) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERPREVIOUS, (IntPtr) lineStart, (IntPtr) markerMask); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERPREVIOUS, lineStart, markerMask); + return (int) res; } /// Define a marker from a pixmap. (Scintilla feature 2049) @@ -507,140 +513,121 @@ public unsafe void MarkerDefinePixmap(int markerNumber, string pixmap) { fixed (byte* pixmapPtr = Encoding.UTF8.GetBytes(pixmap)) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINEPIXMAP, (IntPtr) markerNumber, (IntPtr) pixmapPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINEPIXMAP, markerNumber, (IntPtr) pixmapPtr); } } /// Add a set of markers to a line. (Scintilla feature 2466) - public void MarkerAddSet(int line, int markerSet) + public void MarkerAddSet(int line, int set) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADDSET, (IntPtr) line, (IntPtr) markerSet); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADDSET, line, set); } /// Set the alpha used for a marker that is drawn in the text area, not the margin. (Scintilla feature 2476) - public void MarkerSetAlpha(int markerNumber, Alpha alpha) + public void MarkerSetAlpha(int markerNumber, int alpha) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETALPHA, (IntPtr) markerNumber, (IntPtr) alpha); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETALPHA, markerNumber, alpha); } /// Set a margin to be either numeric or symbolic. (Scintilla feature 2240) - public void SetMarginTypeN(int margin, MarginType marginType) + public void SetMarginTypeN(int margin, int marginType) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINTYPEN, (IntPtr) margin, (IntPtr) marginType); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINTYPEN, margin, marginType); } /// Retrieve the type of a margin. (Scintilla feature 2241) - public MarginType GetMarginTypeN(int margin) + public int GetMarginTypeN(int margin) { - return (MarginType)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINTYPEN, (IntPtr) margin, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINTYPEN, margin, Unused); + return (int) res; } /// Set the width of a margin to a width expressed in pixels. (Scintilla feature 2242) public void SetMarginWidthN(int margin, int pixelWidth) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINWIDTHN, (IntPtr) margin, (IntPtr) pixelWidth); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINWIDTHN, margin, pixelWidth); } /// Retrieve the width of a margin in pixels. (Scintilla feature 2243) public int GetMarginWidthN(int margin) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINWIDTHN, (IntPtr) margin, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINWIDTHN, margin, Unused); + return (int) res; } /// Set a mask that determines which markers are displayed in a margin. (Scintilla feature 2244) public void SetMarginMaskN(int margin, int mask) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINMASKN, (IntPtr) margin, (IntPtr) mask); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINMASKN, margin, mask); } /// Retrieve the marker mask of a margin. (Scintilla feature 2245) public int GetMarginMaskN(int margin) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINMASKN, (IntPtr) margin, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINMASKN, margin, Unused); + return (int) res; } /// Make a margin sensitive or insensitive to mouse clicks. (Scintilla feature 2246) public void SetMarginSensitiveN(int margin, bool sensitive) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINSENSITIVEN, (IntPtr) margin, new IntPtr(sensitive ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINSENSITIVEN, margin, sensitive ? 1 : 0); } /// Retrieve the mouse click sensitivity of a margin. (Scintilla feature 2247) public bool GetMarginSensitiveN(int margin) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINSENSITIVEN, (IntPtr) margin, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINSENSITIVEN, margin, Unused); + return 1 == (int) res; } /// Set the cursor shown when the mouse is inside a margin. (Scintilla feature 2248) - public void SetMarginCursorN(int margin, CursorShape cursor) + public void SetMarginCursorN(int margin, int cursor) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINCURSORN, (IntPtr) margin, (IntPtr) cursor); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINCURSORN, margin, cursor); } /// Retrieve the cursor shown in a margin. (Scintilla feature 2249) - public CursorShape GetMarginCursorN(int margin) - { - return (CursorShape)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINCURSORN, (IntPtr) margin, (IntPtr) Unused); - } - - /// Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. (Scintilla feature 2250) - public void SetMarginBackN(int margin, Colour back) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINBACKN, (IntPtr) margin, back.Value); - } - - /// Retrieve the background colour of a margin (Scintilla feature 2251) - public Colour GetMarginBackN(int margin) - { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINBACKN, (IntPtr) margin, (IntPtr) Unused)); - } - - /// Allocate a non-standard number of margins. (Scintilla feature 2252) - public void SetMargins(int margins) + public int GetMarginCursorN(int margin) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINS, (IntPtr) margins, (IntPtr) Unused); - } - - /// How many margins are there?. (Scintilla feature 2253) - public int GetMargins() - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINCURSORN, margin, Unused); + return (int) res; } /// Clear all the styles and make equivalent to the global default style. (Scintilla feature 2050) public void StyleClearAll() { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLECLEARALL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLECLEARALL, Unused, Unused); } /// Set the foreground colour of a style. (Scintilla feature 2051) public void StyleSetFore(int style, Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFORE, (IntPtr) style, fore.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFORE, style, fore.Value); } /// Set the background colour of a style. (Scintilla feature 2052) public void StyleSetBack(int style, Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBACK, (IntPtr) style, back.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBACK, style, back.Value); } /// Set a style to be bold or not. (Scintilla feature 2053) public void StyleSetBold(int style, bool bold) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBOLD, (IntPtr) style, new IntPtr(bold ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBOLD, style, bold ? 1 : 0); } /// Set a style to be italic or not. (Scintilla feature 2054) public void StyleSetItalic(int style, bool italic) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETITALIC, (IntPtr) style, new IntPtr(italic ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETITALIC, style, italic ? 1 : 0); } /// Set the size of characters of a style. (Scintilla feature 2055) public void StyleSetSize(int style, int sizePoints) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZE, (IntPtr) style, (IntPtr) sizePoints); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZE, style, sizePoints); } /// Set the font of a style. (Scintilla feature 2056) @@ -648,56 +635,61 @@ public unsafe void StyleSetFont(int style, string fontName) { fixed (byte* fontNamePtr = Encoding.UTF8.GetBytes(fontName)) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFONT, (IntPtr) style, (IntPtr) fontNamePtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFONT, style, (IntPtr) fontNamePtr); } } /// Set a style to have its end of line filled or not. (Scintilla feature 2057) - public void StyleSetEOLFilled(int style, bool eolFilled) + public void StyleSetEOLFilled(int style, bool filled) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETEOLFILLED, (IntPtr) style, new IntPtr(eolFilled ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETEOLFILLED, style, filled ? 1 : 0); } /// Reset the default style to its state at startup (Scintilla feature 2058) public void StyleResetDefault() { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLERESETDEFAULT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLERESETDEFAULT, Unused, Unused); } /// Set a style to be underlined or not. (Scintilla feature 2059) public void StyleSetUnderline(int style, bool underline) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETUNDERLINE, (IntPtr) style, new IntPtr(underline ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETUNDERLINE, style, underline ? 1 : 0); } /// Get the foreground colour of a style. (Scintilla feature 2481) public Colour StyleGetFore(int style) { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFORE, (IntPtr) style, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFORE, style, Unused); + return new Colour((int) res); } /// Get the background colour of a style. (Scintilla feature 2482) public Colour StyleGetBack(int style) { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBACK, (IntPtr) style, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBACK, style, Unused); + return new Colour((int) res); } /// Get is a style bold or not. (Scintilla feature 2483) public bool StyleGetBold(int style) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBOLD, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBOLD, style, Unused); + return 1 == (int) res; } /// Get is a style italic or not. (Scintilla feature 2484) public bool StyleGetItalic(int style) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETITALIC, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETITALIC, style, Unused); + return 1 == (int) res; } /// Get the size of characters of a style. (Scintilla feature 2485) public int StyleGetSize(int style) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZE, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZE, style, Unused); + return (int) res; } /// @@ -711,7 +703,7 @@ public unsafe string StyleGetFont(int style) byte[] fontNameBuffer = new byte[10000]; fixed (byte* fontNamePtr = fontNameBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFONT, (IntPtr) style, (IntPtr) fontNamePtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFONT, style, (IntPtr) fontNamePtr); return Encoding.UTF8.GetString(fontNameBuffer).TrimEnd('\0'); } } @@ -719,31 +711,36 @@ public unsafe string StyleGetFont(int style) /// Get is a style to have its end of line filled or not. (Scintilla feature 2487) public bool StyleGetEOLFilled(int style) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETEOLFILLED, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETEOLFILLED, style, Unused); + return 1 == (int) res; } /// Get is a style underlined or not. (Scintilla feature 2488) public bool StyleGetUnderline(int style) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETUNDERLINE, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETUNDERLINE, style, Unused); + return 1 == (int) res; } /// Get is a style mixed case, or to force upper or lower case. (Scintilla feature 2489) - public CaseVisible StyleGetCase(int style) + public int StyleGetCase(int style) { - return (CaseVisible)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCASE, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCASE, style, Unused); + return (int) res; } /// Get the character get of the font in a style. (Scintilla feature 2490) - public CharacterSet StyleGetCharacterSet(int style) + public int StyleGetCharacterSet(int style) { - return (CharacterSet)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHARACTERSET, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHARACTERSET, style, Unused); + return (int) res; } /// Get is a style visible or not. (Scintilla feature 2491) public bool StyleGetVisible(int style) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETVISIBLE, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETVISIBLE, style, Unused); + return 1 == (int) res; } /// @@ -753,115 +750,121 @@ public bool StyleGetVisible(int style) /// public bool StyleGetChangeable(int style) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHANGEABLE, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHANGEABLE, style, Unused); + return 1 == (int) res; } /// Get is a style a hotspot or not. (Scintilla feature 2493) public bool StyleGetHotSpot(int style) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETHOTSPOT, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETHOTSPOT, style, Unused); + return 1 == (int) res; } /// Set a style to be mixed case, or to force upper or lower case. (Scintilla feature 2060) - public void StyleSetCase(int style, CaseVisible caseVisible) + public void StyleSetCase(int style, int caseForce) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCASE, (IntPtr) style, (IntPtr) caseVisible); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCASE, style, caseForce); } /// Set the size of characters of a style. Size is in points multiplied by 100. (Scintilla feature 2061) - public void StyleSetSizeFractional(int style, int sizeHundredthPoints) + public void StyleSetSizeFractional(int style, int caseForce) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZEFRACTIONAL, (IntPtr) style, (IntPtr) sizeHundredthPoints); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZEFRACTIONAL, style, caseForce); } /// Get the size of characters of a style in points multiplied by 100 (Scintilla feature 2062) public int StyleGetSizeFractional(int style) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZEFRACTIONAL, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZEFRACTIONAL, style, Unused); + return (int) res; } /// Set the weight of characters of a style. (Scintilla feature 2063) - public void StyleSetWeight(int style, FontWeight weight) + public void StyleSetWeight(int style, int weight) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETWEIGHT, (IntPtr) style, (IntPtr) weight); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETWEIGHT, style, weight); } /// Get the weight of characters of a style. (Scintilla feature 2064) - public FontWeight StyleGetWeight(int style) + public int StyleGetWeight(int style) { - return (FontWeight)Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETWEIGHT, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETWEIGHT, style, Unused); + return (int) res; } /// Set the character set of the font in a style. (Scintilla feature 2066) - public void StyleSetCharacterSet(int style, CharacterSet characterSet) + public void StyleSetCharacterSet(int style, int characterSet) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHARACTERSET, (IntPtr) style, (IntPtr) characterSet); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHARACTERSET, style, characterSet); } /// Set a style to be a hotspot or not. (Scintilla feature 2409) public void StyleSetHotSpot(int style, bool hotspot) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETHOTSPOT, (IntPtr) style, new IntPtr(hotspot ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETHOTSPOT, style, hotspot ? 1 : 0); } /// Set the foreground colour of the main and additional selections and whether to use this setting. (Scintilla feature 2067) public void SetSelFore(bool useSetting, Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELFORE, new IntPtr(useSetting ? 1 : 0), fore.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELFORE, useSetting ? 1 : 0, fore.Value); } /// Set the background colour of the main and additional selections and whether to use this setting. (Scintilla feature 2068) public void SetSelBack(bool useSetting, Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELBACK, new IntPtr(useSetting ? 1 : 0), back.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELBACK, useSetting ? 1 : 0, back.Value); } /// Get the alpha of the selection. (Scintilla feature 2477) - public Alpha GetSelAlpha() + public int GetSelAlpha() { - return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELALPHA, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELALPHA, Unused, Unused); + return (int) res; } /// Set the alpha of the selection. (Scintilla feature 2478) - public void SetSelAlpha(Alpha alpha) + public void SetSelAlpha(int alpha) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELALPHA, (IntPtr) alpha, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELALPHA, alpha, Unused); } /// Is the selection end of line filled? (Scintilla feature 2479) public bool GetSelEOLFilled() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELEOLFILLED, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELEOLFILLED, Unused, Unused); + return 1 == (int) res; } /// Set the selection to have its end of line filled or not. (Scintilla feature 2480) public void SetSelEOLFilled(bool filled) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELEOLFILLED, new IntPtr(filled ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELEOLFILLED, filled ? 1 : 0, Unused); } /// Set the foreground colour of the caret. (Scintilla feature 2069) public void SetCaretFore(Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETFORE, fore.Value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETFORE, fore.Value, Unused); } - /// When key+modifier combination keyDefinition is pressed perform sciCommand. (Scintilla feature 2070) - public void AssignCmdKey(KeyModifier keyDefinition, int sciCommand) + /// When key+modifier combination km is pressed perform msg. (Scintilla feature 2070) + public void AssignCmdKey(KeyModifier km, int msg) { - Win32.SendMessage(scintilla, SciMsg.SCI_ASSIGNCMDKEY, keyDefinition.Value, (IntPtr) sciCommand); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ASSIGNCMDKEY, km.Value, msg); } - /// When key+modifier combination keyDefinition is pressed do nothing. (Scintilla feature 2071) - public void ClearCmdKey(KeyModifier keyDefinition) + /// When key+modifier combination km is pressed do nothing. (Scintilla feature 2071) + public void ClearCmdKey(KeyModifier km) { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEARCMDKEY, keyDefinition.Value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARCMDKEY, km.Value, Unused); } /// Drop all key mappings. (Scintilla feature 2072) public void ClearAllCmdKeys() { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALLCMDKEYS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALLCMDKEYS, Unused, Unused); } /// Set the styles for a segment of the document. (Scintilla feature 2073) @@ -869,26 +872,27 @@ public unsafe void SetStylingEx(int length, string styles) { fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLINGEX, (IntPtr) length, (IntPtr) stylesPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLINGEX, length, (IntPtr) stylesPtr); } } /// Set a style to be visible or not. (Scintilla feature 2074) public void StyleSetVisible(int style, bool visible) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETVISIBLE, (IntPtr) style, new IntPtr(visible ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETVISIBLE, style, visible ? 1 : 0); } /// Get the time in milliseconds that the caret is on and off. (Scintilla feature 2075) public int GetCaretPeriod() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETPERIOD, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETPERIOD, Unused, Unused); + return (int) res; } /// Get the time in milliseconds that the caret is on and off. 0 = steady on. (Scintilla feature 2076) public void SetCaretPeriod(int periodMilliseconds) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETPERIOD, (IntPtr) periodMilliseconds, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETPERIOD, periodMilliseconds, Unused); } /// @@ -900,7 +904,7 @@ public unsafe void SetWordChars(string characters) { fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWORDCHARS, (IntPtr) Unused, (IntPtr) charactersPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWORDCHARS, Unused, (IntPtr) charactersPtr); } } @@ -914,23 +918,11 @@ public unsafe string GetWordChars() byte[] charactersBuffer = new byte[10000]; fixed (byte* charactersPtr = charactersBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETWORDCHARS, (IntPtr) Unused, (IntPtr) charactersPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWORDCHARS, Unused, (IntPtr) charactersPtr); return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0'); } } - /// Set the number of characters to have directly indexed categories (Scintilla feature 2720) - public void SetCharacterCategoryOptimization(int countCharacters) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCHARACTERCATEGORYOPTIMIZATION, (IntPtr) countCharacters, (IntPtr) Unused); - } - - /// Get the number of characters to have directly indexed categories (Scintilla feature 2721) - public int GetCharacterCategoryOptimization() - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERCATEGORYOPTIMIZATION, (IntPtr) Unused, (IntPtr) Unused); - } - /// /// Start a sequence of actions that is undone and redone as a unit. /// May be nested. @@ -938,171 +930,180 @@ public int GetCharacterCategoryOptimization() /// public void BeginUndoAction() { - Win32.SendMessage(scintilla, SciMsg.SCI_BEGINUNDOACTION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BEGINUNDOACTION, Unused, Unused); } /// End a sequence of actions that is undone and redone as a unit. (Scintilla feature 2079) public void EndUndoAction() { - Win32.SendMessage(scintilla, SciMsg.SCI_ENDUNDOACTION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENDUNDOACTION, Unused, Unused); } /// Set an indicator to plain, squiggle or TT. (Scintilla feature 2080) - public void IndicSetStyle(int indicator, IndicatorStyle indicatorStyle) + public void IndicSetStyle(int indic, int style) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETSTYLE, (IntPtr) indicator, (IntPtr) indicatorStyle); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETSTYLE, indic, style); } /// Retrieve the style of an indicator. (Scintilla feature 2081) - public IndicatorStyle IndicGetStyle(int indicator) + public int IndicGetStyle(int indic) { - return (IndicatorStyle)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETSTYLE, (IntPtr) indicator, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETSTYLE, indic, Unused); + return (int) res; } /// Set the foreground colour of an indicator. (Scintilla feature 2082) - public void IndicSetFore(int indicator, Colour fore) + public void IndicSetFore(int indic, Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFORE, (IntPtr) indicator, fore.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFORE, indic, fore.Value); } /// Retrieve the foreground colour of an indicator. (Scintilla feature 2083) - public Colour IndicGetFore(int indicator) + public Colour IndicGetFore(int indic) { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFORE, (IntPtr) indicator, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFORE, indic, Unused); + return new Colour((int) res); } /// Set an indicator to draw under text or over(default). (Scintilla feature 2510) - public void IndicSetUnder(int indicator, bool under) + public void IndicSetUnder(int indic, bool under) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETUNDER, (IntPtr) indicator, new IntPtr(under ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETUNDER, indic, under ? 1 : 0); } /// Retrieve whether indicator drawn under or over text. (Scintilla feature 2511) - public bool IndicGetUnder(int indicator) + public bool IndicGetUnder(int indic) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETUNDER, (IntPtr) indicator, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETUNDER, indic, Unused); + return 1 == (int) res; } /// Set a hover indicator to plain, squiggle or TT. (Scintilla feature 2680) - public void IndicSetHoverStyle(int indicator, IndicatorStyle indicatorStyle) + public void IndicSetHoverStyle(int indic, int style) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERSTYLE, (IntPtr) indicator, (IntPtr) indicatorStyle); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERSTYLE, indic, style); } /// Retrieve the hover style of an indicator. (Scintilla feature 2681) - public IndicatorStyle IndicGetHoverStyle(int indicator) + public int IndicGetHoverStyle(int indic) { - return (IndicatorStyle)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERSTYLE, (IntPtr) indicator, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERSTYLE, indic, Unused); + return (int) res; } /// Set the foreground hover colour of an indicator. (Scintilla feature 2682) - public void IndicSetHoverFore(int indicator, Colour fore) + public void IndicSetHoverFore(int indic, Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERFORE, (IntPtr) indicator, fore.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERFORE, indic, fore.Value); } /// Retrieve the foreground hover colour of an indicator. (Scintilla feature 2683) - public Colour IndicGetHoverFore(int indicator) + public Colour IndicGetHoverFore(int indic) { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERFORE, (IntPtr) indicator, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERFORE, indic, Unused); + return new Colour((int) res); } /// Set the attributes of an indicator. (Scintilla feature 2684) - public void IndicSetFlags(int indicator, IndicFlag flags) + public void IndicSetFlags(int indic, int flags) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFLAGS, (IntPtr) indicator, (IntPtr) flags); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFLAGS, indic, flags); } /// Retrieve the attributes of an indicator. (Scintilla feature 2685) - public IndicFlag IndicGetFlags(int indicator) + public int IndicGetFlags(int indic) { - return (IndicFlag)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFLAGS, (IntPtr) indicator, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFLAGS, indic, Unused); + return (int) res; } /// Set the foreground colour of all whitespace and whether to use this setting. (Scintilla feature 2084) public void SetWhitespaceFore(bool useSetting, Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEFORE, new IntPtr(useSetting ? 1 : 0), fore.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEFORE, useSetting ? 1 : 0, fore.Value); } /// Set the background colour of all whitespace and whether to use this setting. (Scintilla feature 2085) public void SetWhitespaceBack(bool useSetting, Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEBACK, new IntPtr(useSetting ? 1 : 0), back.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEBACK, useSetting ? 1 : 0, back.Value); } /// Set the size of the dots used to mark space characters. (Scintilla feature 2086) public void SetWhitespaceSize(int size) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACESIZE, (IntPtr) size, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACESIZE, size, Unused); } /// Get the size of the dots used to mark space characters. (Scintilla feature 2087) public int GetWhitespaceSize() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACESIZE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACESIZE, Unused, Unused); + return (int) res; + } + + /// + /// Divide each styling byte into lexical class bits (default: 5) and indicator + /// bits (default: 3). If a lexer requires more than 32 lexical states, then this + /// is used to expand the possible states. + /// (Scintilla feature 2090) + /// + public void SetStyleBits(int bits) + { + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLEBITS, bits, Unused); + } + + /// Retrieve number of bits in style bytes used to hold the lexical state. (Scintilla feature 2091) + public int GetStyleBits() + { + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITS, Unused, Unused); + return (int) res; } /// Used to hold extra styling information for each line. (Scintilla feature 2092) public void SetLineState(int line, int state) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETLINESTATE, (IntPtr) line, (IntPtr) state); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINESTATE, line, state); } /// Retrieve the extra styling information for a line. (Scintilla feature 2093) public int GetLineState(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESTATE, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESTATE, line, Unused); + return (int) res; } /// Retrieve the last line number that has line state. (Scintilla feature 2094) public int GetMaxLineState() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMAXLINESTATE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMAXLINESTATE, Unused, Unused); + return (int) res; } /// Is the background of the line containing the caret in a different colour? (Scintilla feature 2095) public bool GetCaretLineVisible() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLE, Unused, Unused); + return 1 == (int) res; } /// Display the background of the line containing the caret in a different colour. (Scintilla feature 2096) public void SetCaretLineVisible(bool show) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLE, new IntPtr(show ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLE, show ? 1 : 0, Unused); } /// Get the colour of the background of the line containing the caret. (Scintilla feature 2097) public Colour GetCaretLineBack() { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACK, (IntPtr) Unused, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACK, Unused, Unused); + return new Colour((int) res); } /// Set the colour of the background of the line containing the caret. (Scintilla feature 2098) public void SetCaretLineBack(Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACK, back.Value, (IntPtr) Unused); - } - - /// - /// Retrieve the caret line frame width. - /// Width = 0 means this option is disabled. - /// (Scintilla feature 2704) - /// - public int GetCaretLineFrame() - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEFRAME, (IntPtr) Unused, (IntPtr) Unused); - } - - /// - /// Display the caret line framed. - /// Set width != 0 to enable this option and width = 0 to disable it. - /// (Scintilla feature 2705) - /// - public void SetCaretLineFrame(int width) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEFRAME, (IntPtr) width, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACK, back.Value, Unused); } /// @@ -1112,45 +1113,47 @@ public void SetCaretLineFrame(int width) /// public void StyleSetChangeable(int style, bool changeable) { - Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHANGEABLE, (IntPtr) style, new IntPtr(changeable ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHANGEABLE, style, changeable ? 1 : 0); } /// /// Display a auto-completion list. - /// The lengthEntered parameter indicates how many characters before + /// The lenEntered parameter indicates how many characters before /// the caret should be used to provide context. /// (Scintilla feature 2100) /// - public unsafe void AutoCShow(int lengthEntered, string itemList) + public unsafe void AutoCShow(int lenEntered, string itemList) { fixed (byte* itemListPtr = Encoding.UTF8.GetBytes(itemList)) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSHOW, (IntPtr) lengthEntered, (IntPtr) itemListPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSHOW, lenEntered, (IntPtr) itemListPtr); } } /// Remove the auto-completion list from the screen. (Scintilla feature 2101) public void AutoCCancel() { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCANCEL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCANCEL, Unused, Unused); } /// Is there an auto-completion list visible? (Scintilla feature 2102) public bool AutoCActive() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCACTIVE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCACTIVE, Unused, Unused); + return 1 == (int) res; } /// Retrieve the position of the caret when the auto-completion list was displayed. (Scintilla feature 2103) - public int AutoCPosStart() + public Position AutoCPosStart() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCPOSSTART, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCPOSSTART, Unused, Unused); + return new Position((int) res); } /// User has selected an item so remove the list and insert the selection. (Scintilla feature 2104) public void AutoCComplete() { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCOMPLETE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCOMPLETE, Unused, Unused); } /// Define a set of character that when typed cancel the auto-completion list. (Scintilla feature 2105) @@ -1158,7 +1161,7 @@ public unsafe void AutoCStops(string characterSet) { fixed (byte* characterSetPtr = Encoding.UTF8.GetBytes(characterSet)) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSTOPS, (IntPtr) Unused, (IntPtr) characterSetPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSTOPS, Unused, (IntPtr) characterSetPtr); } } @@ -1169,21 +1172,22 @@ public unsafe void AutoCStops(string characterSet) /// public void AutoCSetSeparator(int separatorCharacter) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETSEPARATOR, (IntPtr) separatorCharacter, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETSEPARATOR, separatorCharacter, Unused); } /// Retrieve the auto-completion list separator character. (Scintilla feature 2107) public int AutoCGetSeparator() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETSEPARATOR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETSEPARATOR, Unused, Unused); + return (int) res; } /// Select the item in the auto-completion list that starts with a string. (Scintilla feature 2108) - public unsafe void AutoCSelect(string select) + public unsafe void AutoCSelect(string text) { - fixed (byte* selectPtr = Encoding.UTF8.GetBytes(select)) + fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSELECT, (IntPtr) Unused, (IntPtr) selectPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSELECT, Unused, (IntPtr) textPtr); } } @@ -1194,13 +1198,14 @@ public unsafe void AutoCSelect(string select) /// public void AutoCSetCancelAtStart(bool cancel) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCANCELATSTART, new IntPtr(cancel ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCANCELATSTART, cancel ? 1 : 0, Unused); } /// Retrieve whether auto-completion cancelled by backspacing before start. (Scintilla feature 2111) public bool AutoCGetCancelAtStart() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCANCELATSTART, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCANCELATSTART, Unused, Unused); + return 1 == (int) res; } /// @@ -1212,32 +1217,34 @@ public unsafe void AutoCSetFillUps(string characterSet) { fixed (byte* characterSetPtr = Encoding.UTF8.GetBytes(characterSet)) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETFILLUPS, (IntPtr) Unused, (IntPtr) characterSetPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETFILLUPS, Unused, (IntPtr) characterSetPtr); } } /// Should a single item auto-completion list automatically choose the item. (Scintilla feature 2113) public void AutoCSetChooseSingle(bool chooseSingle) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCHOOSESINGLE, new IntPtr(chooseSingle ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCHOOSESINGLE, chooseSingle ? 1 : 0, Unused); } /// Retrieve whether a single item auto-completion list automatically choose the item. (Scintilla feature 2114) public bool AutoCGetChooseSingle() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCHOOSESINGLE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCHOOSESINGLE, Unused, Unused); + return 1 == (int) res; } /// Set whether case is significant when performing auto-completion searches. (Scintilla feature 2115) public void AutoCSetIgnoreCase(bool ignoreCase) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETIGNORECASE, new IntPtr(ignoreCase ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETIGNORECASE, ignoreCase ? 1 : 0, Unused); } /// Retrieve state of ignore case flag. (Scintilla feature 2116) public bool AutoCGetIgnoreCase() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETIGNORECASE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETIGNORECASE, Unused, Unused); + return 1 == (int) res; } /// Display a list of strings and send notification when user chooses one. (Scintilla feature 2117) @@ -1245,20 +1252,21 @@ public unsafe void UserListShow(int listType, string itemList) { fixed (byte* itemListPtr = Encoding.UTF8.GetBytes(itemList)) { - Win32.SendMessage(scintilla, SciMsg.SCI_USERLISTSHOW, (IntPtr) listType, (IntPtr) itemListPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_USERLISTSHOW, listType, (IntPtr) itemListPtr); } } /// Set whether or not autocompletion is hidden automatically when nothing matches. (Scintilla feature 2118) public void AutoCSetAutoHide(bool autoHide) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETAUTOHIDE, new IntPtr(autoHide ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETAUTOHIDE, autoHide ? 1 : 0, Unused); } /// Retrieve whether or not autocompletion is hidden automatically when nothing matches. (Scintilla feature 2119) public bool AutoCGetAutoHide() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETAUTOHIDE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETAUTOHIDE, Unused, Unused); + return 1 == (int) res; } /// @@ -1268,7 +1276,7 @@ public bool AutoCGetAutoHide() /// public void AutoCSetDropRestOfWord(bool dropRestOfWord) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETDROPRESTOFWORD, new IntPtr(dropRestOfWord ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETDROPRESTOFWORD, dropRestOfWord ? 1 : 0, Unused); } /// @@ -1278,7 +1286,8 @@ public void AutoCSetDropRestOfWord(bool dropRestOfWord) /// public bool AutoCGetDropRestOfWord() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETDROPRESTOFWORD, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETDROPRESTOFWORD, Unused, Unused); + return 1 == (int) res; } /// Register an XPM image for use in autocompletion lists. (Scintilla feature 2405) @@ -1286,20 +1295,21 @@ public unsafe void RegisterImage(int type, string xpmData) { fixed (byte* xpmDataPtr = Encoding.UTF8.GetBytes(xpmData)) { - Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERIMAGE, (IntPtr) type, (IntPtr) xpmDataPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERIMAGE, type, (IntPtr) xpmDataPtr); } } /// Clear all the registered XPM images. (Scintilla feature 2408) public void ClearRegisteredImages() { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREGISTEREDIMAGES, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREGISTEREDIMAGES, Unused, Unused); } /// Retrieve the auto-completion list type-separator character. (Scintilla feature 2285) public int AutoCGetTypeSeparator() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETTYPESEPARATOR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETTYPESEPARATOR, Unused, Unused); + return (int) res; } /// @@ -1309,7 +1319,7 @@ public int AutoCGetTypeSeparator() /// public void AutoCSetTypeSeparator(int separatorCharacter) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETTYPESEPARATOR, (IntPtr) separatorCharacter, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETTYPESEPARATOR, separatorCharacter, Unused); } /// @@ -1319,13 +1329,14 @@ public void AutoCSetTypeSeparator(int separatorCharacter) /// public void AutoCSetMaxWidth(int characterCount) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXWIDTH, (IntPtr) characterCount, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXWIDTH, characterCount, Unused); } /// Get the maximum width, in characters, of auto-completion and user lists. (Scintilla feature 2209) public int AutoCGetMaxWidth() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXWIDTH, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXWIDTH, Unused, Unused); + return (int) res; } /// @@ -1335,25 +1346,27 @@ public int AutoCGetMaxWidth() /// public void AutoCSetMaxHeight(int rowCount) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXHEIGHT, (IntPtr) rowCount, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXHEIGHT, rowCount, Unused); } /// Set the maximum height, in rows, of auto-completion and user lists. (Scintilla feature 2211) public int AutoCGetMaxHeight() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXHEIGHT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXHEIGHT, Unused, Unused); + return (int) res; } /// Set the number of spaces used for one level of indentation. (Scintilla feature 2122) public void SetIndent(int indentSize) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENT, (IntPtr) indentSize, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENT, indentSize, Unused); } /// Retrieve indentation size. (Scintilla feature 2123) public int GetIndent() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENT, Unused, Unused); + return (int) res; } /// @@ -1363,73 +1376,74 @@ public int GetIndent() /// public void SetUseTabs(bool useTabs) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETUSETABS, new IntPtr(useTabs ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUSETABS, useTabs ? 1 : 0, Unused); } /// Retrieve whether tabs will be used in indentation. (Scintilla feature 2125) public bool GetUseTabs() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETUSETABS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUSETABS, Unused, Unused); + return 1 == (int) res; } /// Change the indentation of a line to a number of columns. (Scintilla feature 2126) - public void SetLineIndentation(int line, int indentation) + public void SetLineIndentation(int line, int indentSize) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEINDENTATION, (IntPtr) line, (IntPtr) indentation); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEINDENTATION, line, indentSize); } /// Retrieve the number of columns that a line is indented. (Scintilla feature 2127) public int GetLineIndentation(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTATION, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTATION, line, Unused); + return (int) res; } /// Retrieve the position before the first non indentation character on a line. (Scintilla feature 2128) - public int GetLineIndentPosition(int line) + public Position GetLineIndentPosition(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTPOSITION, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTPOSITION, line, Unused); + return new Position((int) res); } /// Retrieve the column number of a position, taking tab width into account. (Scintilla feature 2129) - public int GetColumn(int pos) + public int GetColumn(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCOLUMN, (IntPtr) pos, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCOLUMN, pos.Value, Unused); + return (int) res; } /// Count characters between two positions. (Scintilla feature 2633) - public int CountCharacters(int start, int end) - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_COUNTCHARACTERS, (IntPtr) start, (IntPtr) end); - } - - /// Count code units between two positions. (Scintilla feature 2715) - public int CountCodeUnits(int start, int end) + public int CountCharacters(int startPos, int endPos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_COUNTCODEUNITS, (IntPtr) start, (IntPtr) end); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COUNTCHARACTERS, startPos, endPos); + return (int) res; } /// Show or hide the horizontal scroll bar. (Scintilla feature 2130) - public void SetHScrollBar(bool visible) + public void SetHScrollBar(bool show) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETHSCROLLBAR, new IntPtr(visible ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHSCROLLBAR, show ? 1 : 0, Unused); } /// Is the horizontal scroll bar visible? (Scintilla feature 2131) public bool GetHScrollBar() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETHSCROLLBAR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHSCROLLBAR, Unused, Unused); + return 1 == (int) res; } /// Show or hide indentation guides. (Scintilla feature 2132) - public void SetIndentationGuides(IndentView indentView) + public void SetIndentationGuides(int indentView) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENTATIONGUIDES, (IntPtr) indentView, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENTATIONGUIDES, indentView, Unused); } /// Are the indentation guides visible? (Scintilla feature 2133) - public IndentView GetIndentationGuides() + public int GetIndentationGuides() { - return (IndentView)Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENTATIONGUIDES, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENTATIONGUIDES, Unused, Unused); + return (int) res; } /// @@ -1439,109 +1453,120 @@ public IndentView GetIndentationGuides() /// public void SetHighlightGuide(int column) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETHIGHLIGHTGUIDE, (IntPtr) column, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHIGHLIGHTGUIDE, column, Unused); } /// Get the highlighted indentation guide column. (Scintilla feature 2135) public int GetHighlightGuide() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETHIGHLIGHTGUIDE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHIGHLIGHTGUIDE, Unused, Unused); + return (int) res; } /// Get the position after the last visible characters on a line. (Scintilla feature 2136) - public int GetLineEndPosition(int line) + public Position GetLineEndPosition(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDPOSITION, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDPOSITION, line, Unused); + return new Position((int) res); } /// Get the code page used to interpret the bytes of the document as characters. (Scintilla feature 2137) public int GetCodePage() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCODEPAGE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCODEPAGE, Unused, Unused); + return (int) res; } /// Get the foreground colour of the caret. (Scintilla feature 2138) public Colour GetCaretFore() { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETFORE, (IntPtr) Unused, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETFORE, Unused, Unused); + return new Colour((int) res); } /// In read-only mode? (Scintilla feature 2140) public bool GetReadOnly() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETREADONLY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETREADONLY, Unused, Unused); + return 1 == (int) res; } /// Sets the position of the caret. (Scintilla feature 2141) - public void SetCurrentPos(int caret) + public void SetCurrentPos(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCURRENTPOS, (IntPtr) caret, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCURRENTPOS, pos.Value, Unused); } /// Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2142) - public void SetSelectionStart(int anchor) + public void SetSelectionStart(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONSTART, (IntPtr) anchor, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONSTART, pos.Value, Unused); } /// Returns the position at the start of the selection. (Scintilla feature 2143) - public int GetSelectionStart() + public Position GetSelectionStart() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONSTART, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONSTART, Unused, Unused); + return new Position((int) res); } - /// Sets the position that ends the selection - this becomes the caret. (Scintilla feature 2144) - public void SetSelectionEnd(int caret) + /// Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2144) + public void SetSelectionEnd(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONEND, (IntPtr) caret, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONEND, pos.Value, Unused); } /// Returns the position at the end of the selection. (Scintilla feature 2145) - public int GetSelectionEnd() + public Position GetSelectionEnd() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEND, Unused, Unused); + return new Position((int) res); } /// Set caret to a position, while removing any existing selection. (Scintilla feature 2556) - public void SetEmptySelection(int caret) + public void SetEmptySelection(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETEMPTYSELECTION, (IntPtr) caret, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEMPTYSELECTION, pos.Value, Unused); } /// Sets the print magnification added to the point size of each style for printing. (Scintilla feature 2146) public void SetPrintMagnification(int magnification) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTMAGNIFICATION, (IntPtr) magnification, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTMAGNIFICATION, magnification, Unused); } /// Returns the print magnification. (Scintilla feature 2147) public int GetPrintMagnification() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTMAGNIFICATION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTMAGNIFICATION, Unused, Unused); + return (int) res; } /// Modify colours when printing for clearer printed text. (Scintilla feature 2148) - public void SetPrintColourMode(PrintOption mode) + public void SetPrintColourMode(int mode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTCOLOURMODE, (IntPtr) mode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTCOLOURMODE, mode, Unused); } /// Returns the print colour mode. (Scintilla feature 2149) - public PrintOption GetPrintColourMode() + public int GetPrintColourMode() { - return (PrintOption)Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTCOLOURMODE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTCOLOURMODE, Unused, Unused); + return (int) res; } /// Find some text in the document. (Scintilla feature 2150) - public int FindText(FindOption searchFlags, TextToFind ft) + public Position FindText(int flags, TextToFind ft) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_FINDTEXT, (IntPtr) searchFlags, ft.NativePointer); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDTEXT, flags, ft.NativePointer); + return new Position((int) res); } /// Retrieve the display line at the top of the display. (Scintilla feature 2152) public int GetFirstVisibleLine() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETFIRSTVISIBLELINE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFIRSTVISIBLELINE, Unused, Unused); + return (int) res; } /// @@ -1554,7 +1579,7 @@ public unsafe string GetLine(int line) byte[] textBuffer = new byte[10000]; fixed (byte* textPtr = textBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETLINE, (IntPtr) line, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINE, line, (IntPtr) textPtr); return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); } } @@ -1562,43 +1587,47 @@ public unsafe string GetLine(int line) /// Returns the number of lines in the document. There is always at least one. (Scintilla feature 2154) public int GetLineCount() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINECOUNT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINECOUNT, Unused, Unused); + return (int) res; } /// Sets the size in pixels of the left margin. (Scintilla feature 2155) public void SetMarginLeft(int pixelWidth) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINLEFT, (IntPtr) Unused, (IntPtr) pixelWidth); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINLEFT, Unused, pixelWidth); } /// Returns the size in pixels of the left margin. (Scintilla feature 2156) public int GetMarginLeft() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINLEFT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINLEFT, Unused, Unused); + return (int) res; } /// Sets the size in pixels of the right margin. (Scintilla feature 2157) public void SetMarginRight(int pixelWidth) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINRIGHT, (IntPtr) Unused, (IntPtr) pixelWidth); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINRIGHT, Unused, pixelWidth); } /// Returns the size in pixels of the right margin. (Scintilla feature 2158) public int GetMarginRight() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINRIGHT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINRIGHT, Unused, Unused); + return (int) res; } /// Is the document different from when it was last saved? (Scintilla feature 2159) public bool GetModify() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMODIFY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMODIFY, Unused, Unused); + return 1 == (int) res; } /// Select a range of text. (Scintilla feature 2160) - public void SetSel(int anchor, int caret) + public void SetSel(Position start, Position end) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSEL, (IntPtr) anchor, (IntPtr) caret); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSEL, start.Value, end.Value); } /// @@ -1612,7 +1641,7 @@ public unsafe string GetSelText() byte[] textBuffer = new byte[10000]; fixed (byte* textPtr = textBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETSELTEXT, (IntPtr) Unused, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELTEXT, Unused, (IntPtr) textPtr); return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); } } @@ -1624,49 +1653,54 @@ public unsafe string GetSelText() /// public int GetTextRange(TextRange tr) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTRANGE, (IntPtr) Unused, tr.NativePointer); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTRANGE, Unused, tr.NativePointer); + return (int) res; } - /// Draw the selection either highlighted or in normal (non-highlighted) style. (Scintilla feature 2163) - public void HideSelection(bool hide) + /// Draw the selection in normal style or with selection highlighted. (Scintilla feature 2163) + public void HideSelection(bool normal) { - Win32.SendMessage(scintilla, SciMsg.SCI_HIDESELECTION, new IntPtr(hide ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HIDESELECTION, normal ? 1 : 0, Unused); } /// Retrieve the x value of the point in the window where a position is displayed. (Scintilla feature 2164) - public int PointXFromPosition(int pos) + public int PointXFromPosition(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POINTXFROMPOSITION, (IntPtr) Unused, (IntPtr) pos); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POINTXFROMPOSITION, Unused, pos.Value); + return (int) res; } /// Retrieve the y value of the point in the window where a position is displayed. (Scintilla feature 2165) - public int PointYFromPosition(int pos) + public int PointYFromPosition(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POINTYFROMPOSITION, (IntPtr) Unused, (IntPtr) pos); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POINTYFROMPOSITION, Unused, pos.Value); + return (int) res; } /// Retrieve the line containing a position. (Scintilla feature 2166) - public int LineFromPosition(int pos) + public int LineFromPosition(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_LINEFROMPOSITION, (IntPtr) pos, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEFROMPOSITION, pos.Value, Unused); + return (int) res; } /// Retrieve the position at the start of a line. (Scintilla feature 2167) - public int PositionFromLine(int line) + public Position PositionFromLine(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMLINE, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMLINE, line, Unused); + return new Position((int) res); } /// Scroll horizontally and vertically. (Scintilla feature 2168) public void LineScroll(int columns, int lines) { - Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLL, (IntPtr) columns, (IntPtr) lines); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLL, columns, lines); } /// Ensure the caret is visible. (Scintilla feature 2169) public void ScrollCaret() { - Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLCARET, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLCARET, Unused, Unused); } /// @@ -1675,9 +1709,9 @@ public void ScrollCaret() /// This may be used to make a search match visible. /// (Scintilla feature 2569) /// - public void ScrollRange(int secondary, int primary) + public void ScrollRange(Position secondary, Position primary) { - Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLRANGE, (IntPtr) secondary, (IntPtr) primary); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLRANGE, secondary.Value, primary.Value); } /// Replace the selected text with the argument text. (Scintilla feature 2170) @@ -1685,68 +1719,70 @@ public unsafe void ReplaceSel(string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_REPLACESEL, (IntPtr) Unused, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACESEL, Unused, (IntPtr) textPtr); } } /// Set to read only or read write. (Scintilla feature 2171) public void SetReadOnly(bool readOnly) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETREADONLY, new IntPtr(readOnly ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETREADONLY, readOnly ? 1 : 0, Unused); } /// Null operation. (Scintilla feature 2172) public void Null() { - Win32.SendMessage(scintilla, SciMsg.SCI_NULL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_NULL, Unused, Unused); } /// Will a paste succeed? (Scintilla feature 2173) public bool CanPaste() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_CANPASTE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANPASTE, Unused, Unused); + return 1 == (int) res; } /// Are there any undoable actions in the undo history? (Scintilla feature 2174) public bool CanUndo() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_CANUNDO, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANUNDO, Unused, Unused); + return 1 == (int) res; } /// Delete the undo history. (Scintilla feature 2175) public void EmptyUndoBuffer() { - Win32.SendMessage(scintilla, SciMsg.SCI_EMPTYUNDOBUFFER, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EMPTYUNDOBUFFER, Unused, Unused); } /// Undo one action in the undo history. (Scintilla feature 2176) public void Undo() { - Win32.SendMessage(scintilla, SciMsg.SCI_UNDO, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_UNDO, Unused, Unused); } /// Cut the selection to the clipboard. (Scintilla feature 2177) public void Cut() { - Win32.SendMessage(scintilla, SciMsg.SCI_CUT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CUT, Unused, Unused); } /// Copy the selection to the clipboard. (Scintilla feature 2178) public void Copy() { - Win32.SendMessage(scintilla, SciMsg.SCI_COPY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPY, Unused, Unused); } /// Paste the contents of the clipboard into the document replacing the selection. (Scintilla feature 2179) public void Paste() { - Win32.SendMessage(scintilla, SciMsg.SCI_PASTE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PASTE, Unused, Unused); } /// Clear the selection. (Scintilla feature 2180) public void Clear() { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEAR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEAR, Unused, Unused); } /// Replace the contents of the document with the argument text. (Scintilla feature 2181) @@ -1754,7 +1790,7 @@ public unsafe void SetText(string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTEXT, (IntPtr) Unused, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTEXT, Unused, (IntPtr) textPtr); } } @@ -1769,7 +1805,7 @@ public unsafe string GetText(int length) byte[] textBuffer = new byte[10000]; fixed (byte* textPtr = textBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXT, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXT, length, (IntPtr) textPtr); return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); } } @@ -1777,13 +1813,14 @@ public unsafe string GetText(int length) /// Retrieve the number of characters in the document. (Scintilla feature 2183) public int GetTextLength() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTLENGTH, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTLENGTH, Unused, Unused); + return (int) res; } /// Retrieve a pointer to a function that processes messages for this Scintilla. (Scintilla feature 2184) public IntPtr GetDirectFunction() { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTFUNCTION, (IntPtr) Unused, (IntPtr) Unused); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTFUNCTION, Unused, Unused); } /// @@ -1793,31 +1830,33 @@ public IntPtr GetDirectFunction() /// public IntPtr GetDirectPointer() { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTPOINTER, (IntPtr) Unused, (IntPtr) Unused); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTPOINTER, Unused, Unused); } /// Set to overtype (true) or insert mode. (Scintilla feature 2186) - public void SetOvertype(bool overType) + public void SetOvertype(bool overtype) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETOVERTYPE, new IntPtr(overType ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETOVERTYPE, overtype ? 1 : 0, Unused); } /// Returns true if overtype mode is active otherwise false is returned. (Scintilla feature 2187) public bool GetOvertype() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETOVERTYPE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETOVERTYPE, Unused, Unused); + return 1 == (int) res; } /// Set the width of the insert mode caret. (Scintilla feature 2188) public void SetCaretWidth(int pixelWidth) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETWIDTH, (IntPtr) pixelWidth, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETWIDTH, pixelWidth, Unused); } /// Returns the width of the insert mode caret. (Scintilla feature 2189) public int GetCaretWidth() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETWIDTH, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETWIDTH, Unused, Unused); + return (int) res; } /// @@ -1825,15 +1864,16 @@ public int GetCaretWidth() /// document without affecting the scroll position. /// (Scintilla feature 2190) /// - public void SetTargetStart(int start) + public void SetTargetStart(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETSTART, (IntPtr) start, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETSTART, pos.Value, Unused); } /// Get the position that starts the target. (Scintilla feature 2191) - public int GetTargetStart() + public Position GetTargetStart() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETSTART, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETSTART, Unused, Unused); + return new Position((int) res); } /// @@ -1841,46 +1881,35 @@ public int GetTargetStart() /// document without affecting the scroll position. /// (Scintilla feature 2192) /// - public void SetTargetEnd(int end) + public void SetTargetEnd(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETEND, (IntPtr) end, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETEND, pos.Value, Unused); } /// Get the position that ends the target. (Scintilla feature 2193) - public int GetTargetEnd() + public Position GetTargetEnd() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETEND, Unused, Unused); + return new Position((int) res); } /// Sets both the start and end of the target in one call. (Scintilla feature 2686) - public void SetTargetRange(int start, int end) + public void SetTargetRange(Position start, Position end) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETRANGE, (IntPtr) start, (IntPtr) end); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETRANGE, start.Value, end.Value); } /// Retrieve the text in the target. (Scintilla feature 2687) public unsafe string GetTargetText() { - byte[] textBuffer = new byte[10000]; - fixed (byte* textPtr = textBuffer) + byte[] charactersBuffer = new byte[10000]; + fixed (byte* charactersPtr = charactersBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETTEXT, (IntPtr) Unused, (IntPtr) textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETTEXT, Unused, (IntPtr) charactersPtr); + return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0'); } } - /// Make the target range start and end be the same as the selection range start and end. (Scintilla feature 2287) - public void TargetFromSelection() - { - Win32.SendMessage(scintilla, SciMsg.SCI_TARGETFROMSELECTION, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Sets the target to the whole document. (Scintilla feature 2690) - public void TargetWholeDocument() - { - Win32.SendMessage(scintilla, SciMsg.SCI_TARGETWHOLEDOCUMENT, (IntPtr) Unused, (IntPtr) Unused); - } - /// /// Replace the target text with the argument text. /// Text is counted so it can contain NULs. @@ -1891,7 +1920,8 @@ public unsafe int ReplaceTarget(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGET, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGET, length, (IntPtr) textPtr); + return (int) res; } } @@ -1908,121 +1938,129 @@ public unsafe int ReplaceTargetRE(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGETRE, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGETRE, length, (IntPtr) textPtr); + return (int) res; } } /// /// 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. + /// Returns length of range or -1 for failure in which case target is not moved. /// (Scintilla feature 2197) /// public unsafe int SearchInTarget(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHINTARGET, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHINTARGET, length, (IntPtr) textPtr); + return (int) res; } } /// Set the search flags used by SearchInTarget. (Scintilla feature 2198) - public void SetSearchFlags(FindOption searchFlags) + public void SetSearchFlags(int flags) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSEARCHFLAGS, (IntPtr) searchFlags, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSEARCHFLAGS, flags, Unused); } /// Get the search flags used by SearchInTarget. (Scintilla feature 2199) - public FindOption GetSearchFlags() + public int GetSearchFlags() { - return (FindOption)Win32.SendMessage(scintilla, SciMsg.SCI_GETSEARCHFLAGS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSEARCHFLAGS, Unused, Unused); + return (int) res; } /// Show a call tip containing a definition near position pos. (Scintilla feature 2200) - public unsafe void CallTipShow(int pos, string definition) + public unsafe void CallTipShow(Position pos, string definition) { fixed (byte* definitionPtr = Encoding.UTF8.GetBytes(definition)) { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSHOW, (IntPtr) pos, (IntPtr) definitionPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSHOW, pos.Value, (IntPtr) definitionPtr); } } /// Remove the call tip from the screen. (Scintilla feature 2201) public void CallTipCancel() { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPCANCEL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPCANCEL, Unused, Unused); } /// Is there an active call tip? (Scintilla feature 2202) public bool CallTipActive() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPACTIVE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPACTIVE, Unused, Unused); + return 1 == (int) res; } /// Retrieve the position where the caret was before displaying the call tip. (Scintilla feature 2203) - public int CallTipPosStart() + public Position CallTipPosStart() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPPOSSTART, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPPOSSTART, Unused, Unused); + return new Position((int) res); } /// Set the start position in order to change when backspacing removes the calltip. (Scintilla feature 2214) public void CallTipSetPosStart(int posStart) { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSSTART, (IntPtr) posStart, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSSTART, posStart, Unused); } /// Highlight a segment of the definition. (Scintilla feature 2204) - public void CallTipSetHlt(int highlightStart, int highlightEnd) + public void CallTipSetHlt(int start, int end) { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETHLT, (IntPtr) highlightStart, (IntPtr) highlightEnd); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETHLT, start, end); } /// Set the background colour for the call tip. (Scintilla feature 2205) public void CallTipSetBack(Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETBACK, back.Value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETBACK, back.Value, Unused); } /// Set the foreground colour for the call tip. (Scintilla feature 2206) public void CallTipSetFore(Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFORE, fore.Value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFORE, fore.Value, Unused); } /// Set the foreground colour for the highlighted part of the call tip. (Scintilla feature 2207) public void CallTipSetForeHlt(Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFOREHLT, fore.Value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFOREHLT, fore.Value, Unused); } /// Enable use of STYLE_CALLTIP and set call tip tab size in pixels. (Scintilla feature 2212) public void CallTipUseStyle(int tabSize) { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPUSESTYLE, (IntPtr) tabSize, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPUSESTYLE, tabSize, Unused); } /// Set position of calltip, above or below text. (Scintilla feature 2213) public void CallTipSetPosition(bool above) { - Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSITION, new IntPtr(above ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSITION, above ? 1 : 0, Unused); } /// Find the display line of a document line taking hidden lines into account. (Scintilla feature 2220) - public int VisibleFromDocLine(int docLine) + public int VisibleFromDocLine(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_VISIBLEFROMDOCLINE, (IntPtr) docLine, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VISIBLEFROMDOCLINE, line, Unused); + return (int) res; } /// Find the document line of a display line taking hidden lines into account. (Scintilla feature 2221) - public int DocLineFromVisible(int displayLine) + public int DocLineFromVisible(int lineDisplay) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_DOCLINEFROMVISIBLE, (IntPtr) displayLine, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCLINEFROMVISIBLE, lineDisplay, Unused); + return (int) res; } /// The number of display lines needed to wrap a document line (Scintilla feature 2235) - public int WrapCount(int docLine) + public int WrapCount(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_WRAPCOUNT, (IntPtr) docLine, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WRAPCOUNT, line, Unused); + return (int) res; } /// @@ -2031,158 +2069,124 @@ public int WrapCount(int docLine) /// line is a header and whether it is effectively white space. /// (Scintilla feature 2222) /// - public void SetFoldLevel(int line, FoldLevel level) + public void SetFoldLevel(int line, int level) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDLEVEL, (IntPtr) line, (IntPtr) level); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDLEVEL, line, level); } /// Retrieve the fold level of a line. (Scintilla feature 2223) - public FoldLevel GetFoldLevel(int line) + public int GetFoldLevel(int line) { - return (FoldLevel)Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDLEVEL, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDLEVEL, line, Unused); + return (int) res; } /// Find the last child line of a header line. (Scintilla feature 2224) - public int GetLastChild(int line, FoldLevel level) + public int GetLastChild(int line, int level) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLASTCHILD, (IntPtr) line, (IntPtr) level); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLASTCHILD, line, level); + return (int) res; } /// Find the parent line of a child line. (Scintilla feature 2225) public int GetFoldParent(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDPARENT, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDPARENT, line, Unused); + return (int) res; } /// Make a range of lines visible. (Scintilla feature 2226) public void ShowLines(int lineStart, int lineEnd) { - Win32.SendMessage(scintilla, SciMsg.SCI_SHOWLINES, (IntPtr) lineStart, (IntPtr) lineEnd); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SHOWLINES, lineStart, lineEnd); } /// Make a range of lines invisible. (Scintilla feature 2227) public void HideLines(int lineStart, int lineEnd) { - Win32.SendMessage(scintilla, SciMsg.SCI_HIDELINES, (IntPtr) lineStart, (IntPtr) lineEnd); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HIDELINES, lineStart, lineEnd); } /// Is a line visible? (Scintilla feature 2228) public bool GetLineVisible(int line) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEVISIBLE, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEVISIBLE, line, Unused); + return 1 == (int) res; } /// Are all lines visible? (Scintilla feature 2236) public bool GetAllLinesVisible() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETALLLINESVISIBLE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETALLLINESVISIBLE, Unused, Unused); + return 1 == (int) res; } /// Show the children of a header line. (Scintilla feature 2229) public void SetFoldExpanded(int line, bool expanded) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDEXPANDED, (IntPtr) line, new IntPtr(expanded ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDEXPANDED, line, expanded ? 1 : 0); } /// Is a header line expanded? (Scintilla feature 2230) public bool GetFoldExpanded(int line) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDEXPANDED, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDEXPANDED, line, Unused); + return 1 == (int) res; } /// Switch a header line between expanded and contracted. (Scintilla feature 2231) public void ToggleFold(int line) { - Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLEFOLD, (IntPtr) line, (IntPtr) Unused); - } - - /// Switch a header line between expanded and contracted and show some text after the line. (Scintilla feature 2700) - public unsafe void ToggleFoldShowText(int line, string text) - { - fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) - { - Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLEFOLDSHOWTEXT, (IntPtr) line, (IntPtr) textPtr); - } - } - - /// Set the style of fold display text. (Scintilla feature 2701) - public void FoldDisplayTextSetStyle(FoldDisplayTextStyle style) - { - Win32.SendMessage(scintilla, SciMsg.SCI_FOLDDISPLAYTEXTSETSTYLE, (IntPtr) style, (IntPtr) Unused); - } - - /// Get the style of fold display text. (Scintilla feature 2707) - public FoldDisplayTextStyle FoldDisplayTextGetStyle() - { - return (FoldDisplayTextStyle)Win32.SendMessage(scintilla, SciMsg.SCI_FOLDDISPLAYTEXTGETSTYLE, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Set the default fold display text. (Scintilla feature 2722) - public unsafe void SetDefaultFoldDisplayText(string text) - { - fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETDEFAULTFOLDDISPLAYTEXT, (IntPtr) Unused, (IntPtr) textPtr); - } - } - - /// Get the default fold display text. (Scintilla feature 2723) - public unsafe string GetDefaultFoldDisplayText() - { - byte[] textBuffer = new byte[10000]; - fixed (byte* textPtr = textBuffer) - { - Win32.SendMessage(scintilla, SciMsg.SCI_GETDEFAULTFOLDDISPLAYTEXT, (IntPtr) Unused, (IntPtr) textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); - } + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLEFOLD, line, Unused); } /// Expand or contract a fold header. (Scintilla feature 2237) - public void FoldLine(int line, FoldAction action) + public void FoldLine(int line, int action) { - Win32.SendMessage(scintilla, SciMsg.SCI_FOLDLINE, (IntPtr) line, (IntPtr) action); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDLINE, line, action); } /// Expand or contract a fold header and its children. (Scintilla feature 2238) - public void FoldChildren(int line, FoldAction action) + public void FoldChildren(int line, int action) { - Win32.SendMessage(scintilla, SciMsg.SCI_FOLDCHILDREN, (IntPtr) line, (IntPtr) action); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDCHILDREN, line, action); } /// Expand a fold header and all children. Use the level argument instead of the line's current level. (Scintilla feature 2239) - public void ExpandChildren(int line, FoldLevel level) + public void ExpandChildren(int line, int level) { - Win32.SendMessage(scintilla, SciMsg.SCI_EXPANDCHILDREN, (IntPtr) line, (IntPtr) level); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EXPANDCHILDREN, line, level); } /// Expand or contract all fold headers. (Scintilla feature 2662) - public void FoldAll(FoldAction action) + public void FoldAll(int action) { - Win32.SendMessage(scintilla, SciMsg.SCI_FOLDALL, (IntPtr) action, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDALL, action, Unused); } /// Ensure a particular line is visible by expanding any header line hiding it. (Scintilla feature 2232) public void EnsureVisible(int line) { - Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLE, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLE, line, Unused); } /// Set automatic folding behaviours. (Scintilla feature 2663) - public void SetAutomaticFold(AutomaticFold automaticFold) + public void SetAutomaticFold(int automaticFold) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETAUTOMATICFOLD, (IntPtr) automaticFold, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETAUTOMATICFOLD, automaticFold, Unused); } /// Get automatic folding behaviours. (Scintilla feature 2664) - public AutomaticFold GetAutomaticFold() + public int GetAutomaticFold() { - return (AutomaticFold)Win32.SendMessage(scintilla, SciMsg.SCI_GETAUTOMATICFOLD, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETAUTOMATICFOLD, Unused, Unused); + return (int) res; } /// Set some style options for folding. (Scintilla feature 2233) - public void SetFoldFlags(FoldFlag flags) + public void SetFoldFlags(int flags) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDFLAGS, (IntPtr) flags, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDFLAGS, flags, Unused); } /// @@ -2192,169 +2196,164 @@ public void SetFoldFlags(FoldFlag flags) /// public void EnsureVisibleEnforcePolicy(int line) { - Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLEENFORCEPOLICY, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLEENFORCEPOLICY, line, Unused); } /// Sets whether a tab pressed when caret is within indentation indents. (Scintilla feature 2260) public void SetTabIndents(bool tabIndents) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTABINDENTS, new IntPtr(tabIndents ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTABINDENTS, tabIndents ? 1 : 0, Unused); } /// Does a tab pressed when caret is within indentation indent? (Scintilla feature 2261) public bool GetTabIndents() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTABINDENTS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTABINDENTS, Unused, Unused); + return 1 == (int) res; } /// Sets whether a backspace pressed when caret is within indentation unindents. (Scintilla feature 2262) public void SetBackSpaceUnIndents(bool bsUnIndents) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETBACKSPACEUNINDENTS, new IntPtr(bsUnIndents ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETBACKSPACEUNINDENTS, bsUnIndents ? 1 : 0, Unused); } /// Does a backspace pressed when caret is within indentation unindent? (Scintilla feature 2263) public bool GetBackSpaceUnIndents() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETBACKSPACEUNINDENTS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETBACKSPACEUNINDENTS, Unused, Unused); + return 1 == (int) res; } /// Sets the time the mouse must sit still to generate a mouse dwell event. (Scintilla feature 2264) public void SetMouseDwellTime(int periodMilliseconds) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDWELLTIME, (IntPtr) periodMilliseconds, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDWELLTIME, periodMilliseconds, Unused); } /// Retrieve the time the mouse must sit still to generate a mouse dwell event. (Scintilla feature 2265) public int GetMouseDwellTime() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDWELLTIME, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDWELLTIME, Unused, Unused); + return (int) res; } /// Get position of start of word. (Scintilla feature 2266) - public int WordStartPosition(int pos, bool onlyWordCharacters) + public int WordStartPosition(Position pos, bool onlyWordCharacters) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_WORDSTARTPOSITION, (IntPtr) pos, new IntPtr(onlyWordCharacters ? 1 : 0)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDSTARTPOSITION, pos.Value, onlyWordCharacters ? 1 : 0); + return (int) res; } /// Get position of end of word. (Scintilla feature 2267) - public int WordEndPosition(int pos, bool onlyWordCharacters) - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_WORDENDPOSITION, (IntPtr) pos, new IntPtr(onlyWordCharacters ? 1 : 0)); - } - - /// Is the range start..end considered a word? (Scintilla feature 2691) - public bool IsRangeWord(int start, int end) + public int WordEndPosition(Position pos, bool onlyWordCharacters) { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_ISRANGEWORD, (IntPtr) start, (IntPtr) end); - } - - /// Sets limits to idle styling. (Scintilla feature 2692) - public void SetIdleStyling(IdleStyling idleStyling) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETIDLESTYLING, (IntPtr) idleStyling, (IntPtr) Unused); - } - - /// Retrieve the limits to idle styling. (Scintilla feature 2693) - public IdleStyling GetIdleStyling() - { - return (IdleStyling)Win32.SendMessage(scintilla, SciMsg.SCI_GETIDLESTYLING, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDENDPOSITION, pos.Value, onlyWordCharacters ? 1 : 0); + return (int) res; } /// Sets whether text is word wrapped. (Scintilla feature 2268) - public void SetWrapMode(Wrap wrapMode) + public void SetWrapMode(int mode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPMODE, (IntPtr) wrapMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPMODE, mode, Unused); } /// Retrieve whether text is word wrapped. (Scintilla feature 2269) - public Wrap GetWrapMode() + public int GetWrapMode() { - return (Wrap)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPMODE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPMODE, Unused, Unused); + return (int) res; } /// Set the display mode of visual flags for wrapped lines. (Scintilla feature 2460) - public void SetWrapVisualFlags(WrapVisualFlag wrapVisualFlags) + public void SetWrapVisualFlags(int wrapVisualFlags) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGS, (IntPtr) wrapVisualFlags, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, Unused); } /// Retrive the display mode of visual flags for wrapped lines. (Scintilla feature 2461) - public WrapVisualFlag GetWrapVisualFlags() + public int GetWrapVisualFlags() { - return (WrapVisualFlag)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGS, Unused, Unused); + return (int) res; } /// Set the location of visual flags for wrapped lines. (Scintilla feature 2462) - public void SetWrapVisualFlagsLocation(WrapVisualLocation wrapVisualFlagsLocation) + public void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGSLOCATION, (IntPtr) wrapVisualFlagsLocation, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, Unused); } /// Retrive the location of visual flags for wrapped lines. (Scintilla feature 2463) - public WrapVisualLocation GetWrapVisualFlagsLocation() + public int GetWrapVisualFlagsLocation() { - return (WrapVisualLocation)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGSLOCATION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGSLOCATION, Unused, Unused); + return (int) res; } /// Set the start indent for wrapped lines. (Scintilla feature 2464) public void SetWrapStartIndent(int indent) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPSTARTINDENT, (IntPtr) indent, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPSTARTINDENT, indent, Unused); } /// Retrive the start indent for wrapped lines. (Scintilla feature 2465) public int GetWrapStartIndent() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPSTARTINDENT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPSTARTINDENT, Unused, Unused); + return (int) res; } /// Sets how wrapped sublines are placed. Default is fixed. (Scintilla feature 2472) - public void SetWrapIndentMode(WrapIndentMode wrapIndentMode) + public void SetWrapIndentMode(int mode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPINDENTMODE, (IntPtr) wrapIndentMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPINDENTMODE, mode, Unused); } /// Retrieve how wrapped sublines are placed. Default is fixed. (Scintilla feature 2473) - public WrapIndentMode GetWrapIndentMode() + public int GetWrapIndentMode() { - return (WrapIndentMode)Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPINDENTMODE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPINDENTMODE, Unused, Unused); + return (int) res; } /// Sets the degree of caching of layout information. (Scintilla feature 2272) - public void SetLayoutCache(LineCache cacheMode) + public void SetLayoutCache(int mode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETLAYOUTCACHE, (IntPtr) cacheMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLAYOUTCACHE, mode, Unused); } /// Retrieve the degree of caching of layout information. (Scintilla feature 2273) - public LineCache GetLayoutCache() + public int GetLayoutCache() { - return (LineCache)Win32.SendMessage(scintilla, SciMsg.SCI_GETLAYOUTCACHE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLAYOUTCACHE, Unused, Unused); + return (int) res; } /// Sets the document width assumed for scrolling. (Scintilla feature 2274) public void SetScrollWidth(int pixelWidth) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTH, (IntPtr) pixelWidth, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTH, pixelWidth, Unused); } /// Retrieve the document width assumed for scrolling. (Scintilla feature 2275) public int GetScrollWidth() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTH, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTH, Unused, Unused); + return (int) res; } /// Sets whether the maximum width line displayed is used to set scroll width. (Scintilla feature 2516) public void SetScrollWidthTracking(bool tracking) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTHTRACKING, new IntPtr(tracking ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTHTRACKING, tracking ? 1 : 0, Unused); } /// Retrieve whether the scroll width tracks wide lines. (Scintilla feature 2517) public bool GetScrollWidthTracking() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTHTRACKING, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTHTRACKING, Unused, Unused); + return 1 == (int) res; } /// @@ -2367,7 +2366,8 @@ public unsafe int TextWidth(int style, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_TEXTWIDTH, (IntPtr) style, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TEXTWIDTH, style, (IntPtr) textPtr); + return (int) res; } } @@ -2379,7 +2379,7 @@ public unsafe int TextWidth(int style, string text) /// public void SetEndAtLastLine(bool endAtLastLine) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETENDATLASTLINE, new IntPtr(endAtLastLine ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETENDATLASTLINE, endAtLastLine ? 1 : 0, Unused); } /// @@ -2389,25 +2389,28 @@ public void SetEndAtLastLine(bool endAtLastLine) /// public bool GetEndAtLastLine() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETENDATLASTLINE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETENDATLASTLINE, Unused, Unused); + return 1 == (int) res; } /// Retrieve the height of a particular line of text in pixels. (Scintilla feature 2279) public int TextHeight(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_TEXTHEIGHT, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TEXTHEIGHT, line, Unused); + return (int) res; } /// Show or hide the vertical scroll bar. (Scintilla feature 2280) - public void SetVScrollBar(bool visible) + public void SetVScrollBar(bool show) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETVSCROLLBAR, new IntPtr(visible ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVSCROLLBAR, show ? 1 : 0, Unused); } /// Is the vertical scroll bar visible? (Scintilla feature 2281) public bool GetVScrollBar() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETVSCROLLBAR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVSCROLLBAR, Unused, Unused); + return 1 == (int) res; } /// Append a string to the end of the document without changing the selection. (Scintilla feature 2282) @@ -2415,14 +2418,32 @@ public unsafe void AppendText(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_APPENDTEXT, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_APPENDTEXT, length, (IntPtr) textPtr); } } + /// Is drawing done in two phases with backgrounds drawn before foregrounds? (Scintilla feature 2283) + public bool GetTwoPhaseDraw() + { + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTWOPHASEDRAW, Unused, Unused); + return 1 == (int) res; + } + + /// + /// In twoPhaseDraw mode, drawing is performed in two phases, first the background + /// and then the foreground. This avoids chopping off characters that overlap the next run. + /// (Scintilla feature 2284) + /// + public void SetTwoPhaseDraw(bool twoPhase) + { + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTWOPHASEDRAW, twoPhase ? 1 : 0, Unused); + } + /// How many phases is drawing done in? (Scintilla feature 2673) - public PhasesDraw GetPhasesDraw() + public int GetPhasesDraw() { - return (PhasesDraw)Win32.SendMessage(scintilla, SciMsg.SCI_GETPHASESDRAW, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPHASESDRAW, Unused, Unused); + return (int) res; } /// @@ -2432,39 +2453,41 @@ public PhasesDraw GetPhasesDraw() /// to overlap from one line to the next. /// (Scintilla feature 2674) /// - public void SetPhasesDraw(PhasesDraw phases) + public void SetPhasesDraw(int phases) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETPHASESDRAW, (IntPtr) phases, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPHASESDRAW, phases, Unused); } /// Choose the quality level for text from the FontQuality enumeration. (Scintilla feature 2611) - public void SetFontQuality(FontQuality fontQuality) + public void SetFontQuality(int fontQuality) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETFONTQUALITY, (IntPtr) fontQuality, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFONTQUALITY, fontQuality, Unused); } /// Retrieve the quality level for text. (Scintilla feature 2612) - public FontQuality GetFontQuality() + public int GetFontQuality() { - return (FontQuality)Win32.SendMessage(scintilla, SciMsg.SCI_GETFONTQUALITY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFONTQUALITY, Unused, Unused); + return (int) res; } /// Scroll so that a display line is at the top of the display. (Scintilla feature 2613) - public void SetFirstVisibleLine(int displayLine) + public void SetFirstVisibleLine(int lineDisplay) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETFIRSTVISIBLELINE, (IntPtr) displayLine, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFIRSTVISIBLELINE, lineDisplay, Unused); } /// Change the effect of pasting when there are multiple selections. (Scintilla feature 2614) - public void SetMultiPaste(MultiPaste multiPaste) + public void SetMultiPaste(int multiPaste) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPASTE, (IntPtr) multiPaste, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPASTE, multiPaste, Unused); } - /// Retrieve the effect of pasting when there are multiple selections. (Scintilla feature 2615) - public MultiPaste GetMultiPaste() + /// Retrieve the effect of pasting when there are multiple selections.. (Scintilla feature 2615) + public int GetMultiPaste() { - return (MultiPaste)Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPASTE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPASTE, Unused, Unused); + return (int) res; } /// @@ -2477,15 +2500,21 @@ public unsafe string GetTag(int tagNumber) byte[] tagValueBuffer = new byte[10000]; fixed (byte* tagValuePtr = tagValueBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETTAG, (IntPtr) tagNumber, (IntPtr) tagValuePtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTAG, tagNumber, (IntPtr) tagValuePtr); return Encoding.UTF8.GetString(tagValueBuffer).TrimEnd('\0'); } } + /// Make the target range start and end be the same as the selection range start and end. (Scintilla feature 2287) + public void TargetFromSelection() + { + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TARGETFROMSELECTION, Unused, Unused); + } + /// Join the lines in the target. (Scintilla feature 2288) public void LinesJoin() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINESJOIN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESJOIN, Unused, Unused); } /// @@ -2495,193 +2524,181 @@ public void LinesJoin() /// public void LinesSplit(int pixelWidth) { - Win32.SendMessage(scintilla, SciMsg.SCI_LINESSPLIT, (IntPtr) pixelWidth, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESSPLIT, pixelWidth, Unused); } - /// Set one of the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2290) + /// Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2290) public void SetFoldMarginColour(bool useSetting, Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINCOLOUR, new IntPtr(useSetting ? 1 : 0), back.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINCOLOUR, useSetting ? 1 : 0, back.Value); } - /// Set the other colour used as a chequerboard pattern in the fold margin (Scintilla feature 2291) + /// Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2291) public void SetFoldMarginHiColour(bool useSetting, Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINHICOLOUR, new IntPtr(useSetting ? 1 : 0), fore.Value); - } - - /// Enable or disable accessibility. (Scintilla feature 2702) - public void SetAccessibility(Accessibility accessibility) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETACCESSIBILITY, (IntPtr) accessibility, (IntPtr) Unused); - } - - /// Report accessibility status. (Scintilla feature 2703) - public Accessibility GetAccessibility() - { - return (Accessibility)Win32.SendMessage(scintilla, SciMsg.SCI_GETACCESSIBILITY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINHICOLOUR, useSetting ? 1 : 0, fore.Value); } /// Move caret down one line. (Scintilla feature 2300) public void LineDown() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWN, Unused, Unused); } /// Move caret down one line extending selection to new caret position. (Scintilla feature 2301) public void LineDownExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNEXTEND, Unused, Unused); } /// Move caret up one line. (Scintilla feature 2302) public void LineUp() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEUP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUP, Unused, Unused); } /// Move caret up one line extending selection to new caret position. (Scintilla feature 2303) public void LineUpExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPEXTEND, Unused, Unused); } /// Move caret left one character. (Scintilla feature 2304) public void CharLeft() { - Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFT, Unused, Unused); } /// Move caret left one character extending selection to new caret position. (Scintilla feature 2305) public void CharLeftExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTEXTEND, Unused, Unused); } /// Move caret right one character. (Scintilla feature 2306) public void CharRight() { - Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHT, Unused, Unused); } /// Move caret right one character extending selection to new caret position. (Scintilla feature 2307) public void CharRightExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTEXTEND, Unused, Unused); } /// Move caret left one word. (Scintilla feature 2308) public void WordLeft() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFT, Unused, Unused); } /// Move caret left one word extending selection to new caret position. (Scintilla feature 2309) public void WordLeftExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEXTEND, Unused, Unused); } /// Move caret right one word. (Scintilla feature 2310) public void WordRight() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHT, Unused, Unused); } /// Move caret right one word extending selection to new caret position. (Scintilla feature 2311) public void WordRightExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEXTEND, Unused, Unused); } /// Move caret to first position on line. (Scintilla feature 2312) public void Home() { - Win32.SendMessage(scintilla, SciMsg.SCI_HOME, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOME, Unused, Unused); } /// Move caret to first position on line extending selection to new caret position. (Scintilla feature 2313) public void HomeExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_HOMEEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEEXTEND, Unused, Unused); } /// Move caret to last position on line. (Scintilla feature 2314) public void LineEnd() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEEND, Unused, Unused); } /// Move caret to last position on line extending selection to new caret position. (Scintilla feature 2315) public void LineEndExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDEXTEND, Unused, Unused); } /// Move caret to first position in document. (Scintilla feature 2316) public void DocumentStart() { - Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTART, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTART, Unused, Unused); } /// Move caret to first position in document extending selection to new caret position. (Scintilla feature 2317) public void DocumentStartExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTARTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTARTEXTEND, Unused, Unused); } /// Move caret to last position in document. (Scintilla feature 2318) public void DocumentEnd() { - Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTEND, Unused, Unused); } /// Move caret to last position in document extending selection to new caret position. (Scintilla feature 2319) public void DocumentEndExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTENDEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTENDEXTEND, Unused, Unused); } /// Move caret one page up. (Scintilla feature 2320) public void PageUp() { - Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUP, Unused, Unused); } /// Move caret one page up extending selection to new caret position. (Scintilla feature 2321) public void PageUpExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPEXTEND, Unused, Unused); } /// Move caret one page down. (Scintilla feature 2322) public void PageDown() { - Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWN, Unused, Unused); } /// Move caret one page down extending selection to new caret position. (Scintilla feature 2323) public void PageDownExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNEXTEND, Unused, Unused); } /// Switch from insert to overtype mode or the reverse. (Scintilla feature 2324) public void EditToggleOvertype() { - Win32.SendMessage(scintilla, SciMsg.SCI_EDITTOGGLEOVERTYPE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EDITTOGGLEOVERTYPE, Unused, Unused); } /// Cancel any modes such as call tip or auto-completion list display. (Scintilla feature 2325) public void Cancel() { - Win32.SendMessage(scintilla, SciMsg.SCI_CANCEL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANCEL, Unused, Unused); } /// Delete the selection or if no selection, the character before the caret. (Scintilla feature 2326) public void DeleteBack() { - Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACK, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACK, Unused, Unused); } /// @@ -2691,25 +2708,25 @@ public void DeleteBack() /// public void Tab() { - Win32.SendMessage(scintilla, SciMsg.SCI_TAB, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TAB, Unused, Unused); } /// Dedent the selected lines. (Scintilla feature 2328) public void BackTab() { - Win32.SendMessage(scintilla, SciMsg.SCI_BACKTAB, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BACKTAB, Unused, Unused); } /// Insert a new line, may use a CRLF, CR or LF depending on EOL mode. (Scintilla feature 2329) public void NewLine() { - Win32.SendMessage(scintilla, SciMsg.SCI_NEWLINE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_NEWLINE, Unused, Unused); } /// Insert a Form Feed character. (Scintilla feature 2330) public void FormFeed() { - Win32.SendMessage(scintilla, SciMsg.SCI_FORMFEED, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FORMFEED, Unused, Unused); } /// @@ -2719,97 +2736,91 @@ public void FormFeed() /// public void VCHome() { - Win32.SendMessage(scintilla, SciMsg.SCI_VCHOME, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOME, Unused, Unused); } /// Like VCHome but extending selection to new caret position. (Scintilla feature 2332) public void VCHomeExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEEXTEND, Unused, Unused); } /// Magnify the displayed text by increasing the sizes by 1 point. (Scintilla feature 2333) public void ZoomIn() { - Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMIN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMIN, Unused, Unused); } /// Make the displayed text smaller by decreasing the sizes by 1 point. (Scintilla feature 2334) public void ZoomOut() { - Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMOUT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMOUT, Unused, Unused); } /// Delete the word to the left of the caret. (Scintilla feature 2335) public void DelWordLeft() { - Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDLEFT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDLEFT, Unused, Unused); } /// Delete the word to the right of the caret. (Scintilla feature 2336) public void DelWordRight() { - Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHT, Unused, Unused); } /// Delete the word to the right of the caret, but not the trailing non-word characters. (Scintilla feature 2518) public void DelWordRightEnd() { - Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHTEND, Unused, Unused); } /// Cut the line containing the caret. (Scintilla feature 2337) public void LineCut() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINECUT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINECUT, Unused, Unused); } /// Delete the line containing the caret. (Scintilla feature 2338) public void LineDelete() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEDELETE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDELETE, Unused, Unused); } /// Switch the current line with the previous. (Scintilla feature 2339) public void LineTranspose() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINETRANSPOSE, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Reverse order of selected lines. (Scintilla feature 2354) - public void LineReverse() - { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEREVERSE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINETRANSPOSE, Unused, Unused); } /// Duplicate the current line. (Scintilla feature 2404) public void LineDuplicate() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEDUPLICATE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDUPLICATE, Unused, Unused); } /// Transform the selection to lower case. (Scintilla feature 2340) public void LowerCase() { - Win32.SendMessage(scintilla, SciMsg.SCI_LOWERCASE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LOWERCASE, Unused, Unused); } /// Transform the selection to upper case. (Scintilla feature 2341) public void UpperCase() { - Win32.SendMessage(scintilla, SciMsg.SCI_UPPERCASE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_UPPERCASE, Unused, Unused); } /// Scroll the document down, keeping the caret visible. (Scintilla feature 2342) public void LineScrollDown() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLDOWN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLDOWN, Unused, Unused); } /// Scroll the document up, keeping the caret visible. (Scintilla feature 2343) public void LineScrollUp() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLUP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLUP, Unused, Unused); } /// @@ -2819,13 +2830,13 @@ public void LineScrollUp() /// public void DeleteBackNotLine() { - Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACKNOTLINE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACKNOTLINE, Unused, Unused); } /// Move caret to first position on display line. (Scintilla feature 2345) public void HomeDisplay() { - Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAY, Unused, Unused); } /// @@ -2835,13 +2846,13 @@ public void HomeDisplay() /// public void HomeDisplayExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAYEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAYEXTEND, Unused, Unused); } /// Move caret to last position on display line. (Scintilla feature 2347) public void LineEndDisplay() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAY, Unused, Unused); } /// @@ -2851,155 +2862,173 @@ public void LineEndDisplay() /// public void LineEndDisplayExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAYEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAYEXTEND, Unused, Unused); } /// - /// Like Home but when word-wrap is enabled goes first to start of display line - /// HomeDisplay, then to start of document line Home. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2349) /// public void HomeWrap() { - Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAP, Unused, Unused); } /// - /// Like HomeExtend but when word-wrap is enabled extends first to start of display line - /// HomeDisplayExtend, then to start of document line HomeExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2450) /// public void HomeWrapExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAPEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAPEXTEND, Unused, Unused); } /// - /// Like LineEnd but when word-wrap is enabled goes first to end of display line - /// LineEndDisplay, then to start of document line LineEnd. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2451) /// public void LineEndWrap() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAP, Unused, Unused); } /// - /// Like LineEndExtend but when word-wrap is enabled extends first to end of display line - /// LineEndDisplayExtend, then to start of document line LineEndExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2452) /// public void LineEndWrapExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAPEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAPEXTEND, Unused, Unused); } /// - /// Like VCHome but when word-wrap is enabled goes first to start of display line - /// VCHomeDisplay, then behaves like VCHome. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2453) /// public void VCHomeWrap() { - Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAP, Unused, Unused); } /// - /// Like VCHomeExtend but when word-wrap is enabled extends first to start of display line - /// VCHomeDisplayExtend, then behaves like VCHomeExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. /// (Scintilla feature 2454) /// public void VCHomeWrapExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAPEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAPEXTEND, Unused, Unused); } /// Copy the line containing the caret. (Scintilla feature 2455) public void LineCopy() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINECOPY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINECOPY, Unused, Unused); } /// Move the caret inside current view if it's not there already. (Scintilla feature 2401) public void MoveCaretInsideView() { - Win32.SendMessage(scintilla, SciMsg.SCI_MOVECARETINSIDEVIEW, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVECARETINSIDEVIEW, Unused, Unused); } /// How many characters are on a line, including end of line characters? (Scintilla feature 2350) public int LineLength(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_LINELENGTH, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINELENGTH, line, Unused); + return (int) res; } /// Highlight the characters at two positions. (Scintilla feature 2351) - public void BraceHighlight(int posA, int posB) + public void BraceHighlight(Position pos1, Position pos2) { - Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHT, (IntPtr) posA, (IntPtr) posB); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHT, pos1.Value, pos2.Value); } /// Use specified indicator to highlight matching braces instead of changing their style. (Scintilla feature 2498) - public void BraceHighlightIndicator(bool useSetting, int indicator) + public void BraceHighlightIndicator(bool useBraceHighlightIndicator, int indicator) { - Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHTINDICATOR, new IntPtr(useSetting ? 1 : 0), (IntPtr) indicator); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHTINDICATOR, useBraceHighlightIndicator ? 1 : 0, indicator); } /// Highlight the character at a position indicating there is no matching brace. (Scintilla feature 2352) - public void BraceBadLight(int pos) + public void BraceBadLight(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHT, (IntPtr) pos, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHT, pos.Value, Unused); } /// Use specified indicator to highlight non matching brace instead of changing its style. (Scintilla feature 2499) - public void BraceBadLightIndicator(bool useSetting, int indicator) + public void BraceBadLightIndicator(bool useBraceBadLightIndicator, int indicator) { - Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHTINDICATOR, new IntPtr(useSetting ? 1 : 0), (IntPtr) indicator); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHTINDICATOR, useBraceBadLightIndicator ? 1 : 0, 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. - /// (Scintilla feature 2353) - /// - public int BraceMatch(int pos, int maxReStyle) + /// Find the position of a matching brace or INVALID_POSITION if no match. (Scintilla feature 2353) + public Position BraceMatch(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_BRACEMATCH, (IntPtr) pos, (IntPtr) maxReStyle); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEMATCH, pos.Value, Unused); + return new Position((int) res); } /// Are the end of line characters visible? (Scintilla feature 2355) public bool GetViewEOL() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWEOL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWEOL, Unused, Unused); + return 1 == (int) res; } /// Make the end of line characters visible or invisible. (Scintilla feature 2356) public void SetViewEOL(bool visible) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWEOL, new IntPtr(visible ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWEOL, visible ? 1 : 0, Unused); } /// Retrieve a pointer to the document object. (Scintilla feature 2357) public IntPtr GetDocPointer() { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCPOINTER, (IntPtr) Unused, (IntPtr) Unused); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCPOINTER, Unused, Unused); } /// Change the document object used. (Scintilla feature 2358) - public void SetDocPointer(IntPtr doc) + public void SetDocPointer(IntPtr pointer) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETDOCPOINTER, (IntPtr) Unused, (IntPtr) doc); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETDOCPOINTER, Unused, pointer); } /// Set which document modification events are sent to the container. (Scintilla feature 2359) - public void SetModEventMask(ModificationFlags eventMask) + public void SetModEventMask(int mask) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMODEVENTMASK, (IntPtr) eventMask, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMODEVENTMASK, mask, Unused); } /// Retrieve the column number which text should be kept within. (Scintilla feature 2360) public int GetEdgeColumn() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLUMN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLUMN, Unused, Unused); + return (int) res; } /// @@ -3009,53 +3038,43 @@ public int GetEdgeColumn() /// public void SetEdgeColumn(int column) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLUMN, (IntPtr) column, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLUMN, column, Unused); } /// Retrieve the edge highlight mode. (Scintilla feature 2362) - public EdgeVisualStyle GetEdgeMode() + public int GetEdgeMode() { - return (EdgeVisualStyle)Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGEMODE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGEMODE, Unused, Unused); + return (int) res; } /// - /// The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that + /// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that /// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). /// (Scintilla feature 2363) /// - public void SetEdgeMode(EdgeVisualStyle edgeMode) + public void SetEdgeMode(int mode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGEMODE, (IntPtr) edgeMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGEMODE, mode, Unused); } /// Retrieve the colour used in edge indication. (Scintilla feature 2364) public Colour GetEdgeColour() { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLOUR, (IntPtr) Unused, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLOUR, Unused, Unused); + return new Colour((int) res); } /// Change the colour used in edge indication. (Scintilla feature 2365) public void SetEdgeColour(Colour edgeColour) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLOUR, edgeColour.Value, (IntPtr) Unused); - } - - /// Add a new vertical edge to the view. (Scintilla feature 2694) - public void MultiEdgeAddLine(int column, Colour edgeColour) - { - Win32.SendMessage(scintilla, SciMsg.SCI_MULTIEDGEADDLINE, (IntPtr) column, edgeColour.Value); - } - - /// Clear all vertical edges. (Scintilla feature 2695) - public void MultiEdgeClearAll() - { - Win32.SendMessage(scintilla, SciMsg.SCI_MULTIEDGECLEARALL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLOUR, edgeColour.Value, Unused); } /// Sets the current caret position to be the search anchor. (Scintilla feature 2366) public void SearchAnchor() { - Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHANCHOR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHANCHOR, Unused, Unused); } /// @@ -3063,11 +3082,12 @@ public void SearchAnchor() /// Does not ensure the selection is visible. /// (Scintilla feature 2367) /// - public unsafe int SearchNext(FindOption searchFlags, string text) + public unsafe int SearchNext(int flags, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHNEXT, (IntPtr) searchFlags, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHNEXT, flags, (IntPtr) textPtr); + return (int) res; } } @@ -3076,34 +3096,37 @@ public unsafe int SearchNext(FindOption searchFlags, string text) /// Does not ensure the selection is visible. /// (Scintilla feature 2368) /// - public unsafe int SearchPrev(FindOption searchFlags, string text) + public unsafe int SearchPrev(int flags, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHPREV, (IntPtr) searchFlags, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHPREV, flags, (IntPtr) textPtr); + return (int) res; } } /// Retrieves the number of lines completely visible. (Scintilla feature 2370) public int LinesOnScreen() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_LINESONSCREEN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESONSCREEN, Unused, Unused); + return (int) res; } /// /// Set whether a pop up menu is displayed automatically when the user presses - /// the wrong mouse button on certain areas. + /// the wrong mouse button. /// (Scintilla feature 2371) /// - public void UsePopUp(PopUp popUpMode) + public void UsePopUp(bool allowPopUp) { - Win32.SendMessage(scintilla, SciMsg.SCI_USEPOPUP, (IntPtr) popUpMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_USEPOPUP, allowPopUp ? 1 : 0, Unused); } /// Is the selection rectangular? The alternative is the more common stream selection. (Scintilla feature 2372) public bool SelectionIsRectangle() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONISRECTANGLE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONISRECTANGLE, Unused, Unused); + return 1 == (int) res; } /// @@ -3111,15 +3134,16 @@ public bool SelectionIsRectangle() /// It may be positive to magnify or negative to reduce. /// (Scintilla feature 2373) /// - public void SetZoom(int zoomInPoints) + public void SetZoom(int zoom) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETZOOM, (IntPtr) zoomInPoints, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETZOOM, zoom, Unused); } /// Retrieve the zoom level. (Scintilla feature 2374) public int GetZoom() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETZOOM, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETZOOM, Unused, Unused); + return (int) res; } /// @@ -3127,105 +3151,81 @@ public int GetZoom() /// Starts with reference count of 1 and not selected into editor. /// (Scintilla feature 2375) /// - public IntPtr CreateDocument(int bytes, DocumentOption documentOptions) + public int CreateDocument() { - return Win32.SendMessage(scintilla, SciMsg.SCI_CREATEDOCUMENT, (IntPtr) bytes, (IntPtr) documentOptions); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CREATEDOCUMENT, Unused, Unused); + return (int) res; } /// Extend life of document. (Scintilla feature 2376) - public void AddRefDocument(IntPtr doc) + public void AddRefDocument(int doc) { - Win32.SendMessage(scintilla, SciMsg.SCI_ADDREFDOCUMENT, (IntPtr) Unused, (IntPtr) doc); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDREFDOCUMENT, Unused, doc); } /// Release a reference to the document, deleting document if it fades to black. (Scintilla feature 2377) - public void ReleaseDocument(IntPtr doc) - { - Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEDOCUMENT, (IntPtr) Unused, (IntPtr) doc); - } - - /// Get which document options are set. (Scintilla feature 2379) - public DocumentOption GetDocumentOptions() + public void ReleaseDocument(int doc) { - return (DocumentOption)Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCUMENTOPTIONS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEDOCUMENT, Unused, doc); } /// Get which document modification events are sent to the container. (Scintilla feature 2378) - public ModificationFlags GetModEventMask() + public int GetModEventMask() { - return (ModificationFlags)Win32.SendMessage(scintilla, SciMsg.SCI_GETMODEVENTMASK, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Set whether command events are sent to the container. (Scintilla feature 2717) - public void SetCommandEvents(bool commandEvents) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCOMMANDEVENTS, new IntPtr(commandEvents ? 1 : 0), (IntPtr) Unused); - } - - /// Get whether command events are sent to the container. (Scintilla feature 2718) - public bool GetCommandEvents() - { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCOMMANDEVENTS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMODEVENTMASK, Unused, Unused); + return (int) res; } /// Change internal focus flag. (Scintilla feature 2380) public void SetFocus(bool focus) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETFOCUS, new IntPtr(focus ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOCUS, focus ? 1 : 0, Unused); } /// Get internal focus flag. (Scintilla feature 2381) public bool GetFocus() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETFOCUS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOCUS, Unused, Unused); + return 1 == (int) res; } /// Change error status - 0 = OK. (Scintilla feature 2382) - public void SetStatus(Status status) + public void SetStatus(int statusCode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSTATUS, (IntPtr) status, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTATUS, statusCode, Unused); } /// Get error status. (Scintilla feature 2383) - public Status GetStatus() + public int GetStatus() { - return (Status)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTATUS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTATUS, Unused, Unused); + return (int) res; } /// Set whether the mouse is captured when its button is pressed. (Scintilla feature 2384) public void SetMouseDownCaptures(bool captures) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDOWNCAPTURES, new IntPtr(captures ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDOWNCAPTURES, captures ? 1 : 0, Unused); } /// Get whether mouse gets captured. (Scintilla feature 2385) public bool GetMouseDownCaptures() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDOWNCAPTURES, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Set whether the mouse wheel can be active outside the window. (Scintilla feature 2696) - public void SetMouseWheelCaptures(bool captures) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEWHEELCAPTURES, new IntPtr(captures ? 1 : 0), (IntPtr) Unused); - } - - /// Get whether mouse wheel can be active outside the window. (Scintilla feature 2697) - public bool GetMouseWheelCaptures() - { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEWHEELCAPTURES, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDOWNCAPTURES, Unused, Unused); + return 1 == (int) res; } /// Sets the cursor to one of the SC_CURSOR* values. (Scintilla feature 2386) - public void SetCursor(CursorShape cursorType) + public void SetCursor(int cursorType) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCURSOR, (IntPtr) cursorType, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCURSOR, cursorType, Unused); } /// Get cursor type. (Scintilla feature 2387) - public CursorShape GetCursor() + public int GetCursor() { - return (CursorShape)Win32.SendMessage(scintilla, SciMsg.SCI_GETCURSOR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURSOR, Unused, Unused); + return (int) res; } /// @@ -3235,19 +3235,20 @@ public CursorShape GetCursor() /// public void SetControlCharSymbol(int symbol) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCONTROLCHARSYMBOL, (IntPtr) symbol, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCONTROLCHARSYMBOL, symbol, Unused); } /// Get the way control characters are displayed. (Scintilla feature 2389) public int GetControlCharSymbol() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCONTROLCHARSYMBOL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCONTROLCHARSYMBOL, Unused, Unused); + return (int) res; } /// Move to the previous change in capitalisation. (Scintilla feature 2390) public void WordPartLeft() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFT, Unused, Unused); } /// @@ -3257,13 +3258,13 @@ public void WordPartLeft() /// public void WordPartLeftExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFTEXTEND, Unused, Unused); } /// Move to the change next in capitalisation. (Scintilla feature 2392) public void WordPartRight() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHT, Unused, Unused); } /// @@ -3273,7 +3274,7 @@ public void WordPartRight() /// public void WordPartRightExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHTEXTEND, Unused, Unused); } /// @@ -3281,45 +3282,46 @@ public void WordPartRightExtend() /// is to be moved to by Find, FindNext, GotoLine, etc. /// (Scintilla feature 2394) /// - public void SetVisiblePolicy(VisiblePolicy visiblePolicy, int visibleSlop) + public void SetVisiblePolicy(int visiblePolicy, int visibleSlop) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETVISIBLEPOLICY, (IntPtr) visiblePolicy, (IntPtr) visibleSlop); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVISIBLEPOLICY, visiblePolicy, visibleSlop); } /// Delete back from the current position to the start of the line. (Scintilla feature 2395) public void DelLineLeft() { - Win32.SendMessage(scintilla, SciMsg.SCI_DELLINELEFT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELLINELEFT, Unused, Unused); } /// Delete forwards from the current position to the end of the line. (Scintilla feature 2396) public void DelLineRight() { - Win32.SendMessage(scintilla, SciMsg.SCI_DELLINERIGHT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELLINERIGHT, Unused, Unused); } - /// Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2397) - public void SetXOffset(int xOffset) + /// Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2397) + public void SetXOffset(int newOffset) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETXOFFSET, (IntPtr) xOffset, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETXOFFSET, newOffset, Unused); } - /// Get the xOffset (ie, horizontal scroll position). (Scintilla feature 2398) + /// Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2398) public int GetXOffset() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETXOFFSET, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETXOFFSET, Unused, Unused); + return (int) res; } /// Set the last x chosen value to be the caret x position. (Scintilla feature 2399) public void ChooseCaretX() { - Win32.SendMessage(scintilla, SciMsg.SCI_CHOOSECARETX, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHOOSECARETX, Unused, Unused); } /// Set the focus to this Scintilla widget. (Scintilla feature 2400) public void GrabFocus() { - Win32.SendMessage(scintilla, SciMsg.SCI_GRABFOCUS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GRABFOCUS, Unused, Unused); } /// @@ -3327,9 +3329,9 @@ public void GrabFocus() /// The exclusion zone is given in pixels. /// (Scintilla feature 2402) /// - public void SetXCaretPolicy(CaretPolicy caretPolicy, int caretSlop) + public void SetXCaretPolicy(int caretPolicy, int caretSlop) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETXCARETPOLICY, (IntPtr) caretPolicy, (IntPtr) caretSlop); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETXCARETPOLICY, caretPolicy, caretSlop); } /// @@ -3337,93 +3339,98 @@ public void SetXCaretPolicy(CaretPolicy caretPolicy, int caretSlop) /// The exclusion zone is given in lines. /// (Scintilla feature 2403) /// - public void SetYCaretPolicy(CaretPolicy caretPolicy, int caretSlop) + public void SetYCaretPolicy(int caretPolicy, int caretSlop) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETYCARETPOLICY, (IntPtr) caretPolicy, (IntPtr) caretSlop); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETYCARETPOLICY, caretPolicy, caretSlop); } /// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). (Scintilla feature 2406) - public void SetPrintWrapMode(Wrap wrapMode) + public void SetPrintWrapMode(int mode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTWRAPMODE, (IntPtr) wrapMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTWRAPMODE, mode, Unused); } /// Is printing line wrapped? (Scintilla feature 2407) - public Wrap GetPrintWrapMode() + public int GetPrintWrapMode() { - return (Wrap)Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTWRAPMODE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTWRAPMODE, Unused, Unused); + return (int) res; } /// Set a fore colour for active hotspots. (Scintilla feature 2410) public void SetHotspotActiveFore(bool useSetting, Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEFORE, new IntPtr(useSetting ? 1 : 0), fore.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEFORE, useSetting ? 1 : 0, fore.Value); } /// Get the fore colour for active hotspots. (Scintilla feature 2494) public Colour GetHotspotActiveFore() { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEFORE, (IntPtr) Unused, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEFORE, Unused, Unused); + return new Colour((int) res); } /// Set a back colour for active hotspots. (Scintilla feature 2411) public void SetHotspotActiveBack(bool useSetting, Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEBACK, new IntPtr(useSetting ? 1 : 0), back.Value); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEBACK, useSetting ? 1 : 0, back.Value); } /// Get the back colour for active hotspots. (Scintilla feature 2495) public Colour GetHotspotActiveBack() { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEBACK, (IntPtr) Unused, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEBACK, Unused, Unused); + return new Colour((int) res); } /// Enable / Disable underlining active hotspots. (Scintilla feature 2412) public void SetHotspotActiveUnderline(bool underline) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEUNDERLINE, new IntPtr(underline ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEUNDERLINE, underline ? 1 : 0, Unused); } /// Get whether underlining for active hotspots. (Scintilla feature 2496) public bool GetHotspotActiveUnderline() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEUNDERLINE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEUNDERLINE, Unused, Unused); + return 1 == (int) res; } /// Limit hotspots to single line so hotspots on two lines don't merge. (Scintilla feature 2421) public void SetHotspotSingleLine(bool singleLine) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTSINGLELINE, new IntPtr(singleLine ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTSINGLELINE, singleLine ? 1 : 0, Unused); } /// Get the HotspotSingleLine property (Scintilla feature 2497) public bool GetHotspotSingleLine() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTSINGLELINE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTSINGLELINE, Unused, Unused); + return 1 == (int) res; } - /// Move caret down one paragraph (delimited by empty lines). (Scintilla feature 2413) + /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2413) public void ParaDown() { - Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWN, Unused, Unused); } - /// Extend selection down one paragraph (delimited by empty lines). (Scintilla feature 2414) + /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2414) public void ParaDownExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWNEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWNEXTEND, Unused, Unused); } - /// Move caret up one paragraph (delimited by empty lines). (Scintilla feature 2415) + /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2415) public void ParaUp() { - Win32.SendMessage(scintilla, SciMsg.SCI_PARAUP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARAUP, Unused, Unused); } - /// Extend selection up one paragraph (delimited by empty lines). (Scintilla feature 2416) + /// Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2416) public void ParaUpExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_PARAUPEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARAUPEXTEND, Unused, Unused); } /// @@ -3431,9 +3438,10 @@ public void ParaUpExtend() /// page into account. Returns 0 if passed 0. /// (Scintilla feature 2417) /// - public int PositionBefore(int pos) + public Position PositionBefore(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONBEFORE, (IntPtr) pos, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONBEFORE, pos.Value, Unused); + return new Position((int) res); } /// @@ -3441,9 +3449,10 @@ public int PositionBefore(int pos) /// page into account. Maximum value returned is the last position in the document. /// (Scintilla feature 2418) /// - public int PositionAfter(int pos) + public Position PositionAfter(Position pos) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONAFTER, (IntPtr) pos, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONAFTER, pos.Value, Unused); + return new Position((int) res); } /// @@ -3451,26 +3460,16 @@ public int PositionAfter(int pos) /// of characters. Returned value is always between 0 and last position in document. /// (Scintilla feature 2670) /// - public int PositionRelative(int pos, int relative) + public Position PositionRelative(Position pos, int relative) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONRELATIVE, (IntPtr) pos, (IntPtr) relative); - } - - /// - /// Given a valid document position, return a position that differs in a number - /// of UTF-16 code units. Returned value is always between 0 and last position in document. - /// The result may point half way (2 bytes) inside a non-BMP character. - /// (Scintilla feature 2716) - /// - public int PositionRelativeCodeUnits(int pos, int relative) - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONRELATIVECODEUNITS, (IntPtr) pos, (IntPtr) relative); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONRELATIVE, pos.Value, relative); + return new Position((int) res); } /// Copy a range of text to the clipboard. Positions are clipped into the document. (Scintilla feature 2419) - public void CopyRange(int start, int end) + public void CopyRange(Position start, Position end) { - Win32.SendMessage(scintilla, SciMsg.SCI_COPYRANGE, (IntPtr) start, (IntPtr) end); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYRANGE, start.Value, end.Value); } /// Copy argument text to the clipboard. (Scintilla feature 2420) @@ -3478,7 +3477,7 @@ public unsafe void CopyText(int length, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_COPYTEXT, (IntPtr) length, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYTEXT, length, (IntPtr) textPtr); } } @@ -3487,63 +3486,60 @@ public unsafe void CopyText(int length, string text) /// by lines (SC_SEL_LINES). /// (Scintilla feature 2422) /// - public void SetSelectionMode(SelectionMode selectionMode) + public void SetSelectionMode(int mode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONMODE, (IntPtr) selectionMode, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONMODE, mode, Unused); } /// Get the mode of the current selection. (Scintilla feature 2423) - public SelectionMode GetSelectionMode() + public int GetSelectionMode() { - return (SelectionMode)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONMODE, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Get whether or not regular caret moves will extend or reduce the selection. (Scintilla feature 2706) - public bool GetMoveExtendsSelection() - { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOVEEXTENDSSELECTION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONMODE, Unused, Unused); + return (int) res; } /// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2424) - public int GetLineSelStartPosition(int line) + public Position GetLineSelStartPosition(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELSTARTPOSITION, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELSTARTPOSITION, line, Unused); + return new Position((int) res); } /// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2425) - public int GetLineSelEndPosition(int line) + public Position GetLineSelEndPosition(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELENDPOSITION, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELENDPOSITION, line, Unused); + return new Position((int) res); } /// Move caret down one line, extending rectangular selection to new caret position. (Scintilla feature 2426) public void LineDownRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNRECTEXTEND, Unused, Unused); } /// Move caret up one line, extending rectangular selection to new caret position. (Scintilla feature 2427) public void LineUpRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPRECTEXTEND, Unused, Unused); } /// Move caret left one character, extending rectangular selection to new caret position. (Scintilla feature 2428) public void CharLeftRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTRECTEXTEND, Unused, Unused); } /// Move caret right one character, extending rectangular selection to new caret position. (Scintilla feature 2429) public void CharRightRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTRECTEXTEND, Unused, Unused); } /// Move caret to first position on line, extending rectangular selection to new caret position. (Scintilla feature 2430) public void HomeRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_HOMERECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMERECTEXTEND, Unused, Unused); } /// @@ -3554,73 +3550,73 @@ public void HomeRectExtend() /// public void VCHomeRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMERECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMERECTEXTEND, Unused, Unused); } /// Move caret to last position on line, extending rectangular selection to new caret position. (Scintilla feature 2432) public void LineEndRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDRECTEXTEND, Unused, Unused); } /// Move caret one page up, extending rectangular selection to new caret position. (Scintilla feature 2433) public void PageUpRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPRECTEXTEND, Unused, Unused); } /// Move caret one page down, extending rectangular selection to new caret position. (Scintilla feature 2434) public void PageDownRectExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNRECTEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNRECTEXTEND, Unused, Unused); } /// Move caret to top of page, or one page up if already at top of page. (Scintilla feature 2435) public void StutteredPageUp() { - Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUP, Unused, Unused); } /// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. (Scintilla feature 2436) public void StutteredPageUpExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUPEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUPEXTEND, Unused, Unused); } /// Move caret to bottom of page, or one page down if already at bottom of page. (Scintilla feature 2437) public void StutteredPageDown() { - Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWN, Unused, Unused); } /// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. (Scintilla feature 2438) public void StutteredPageDownExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWNEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWNEXTEND, Unused, Unused); } /// Move caret left one word, position cursor at end of word. (Scintilla feature 2439) public void WordLeftEnd() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEND, Unused, Unused); } /// Move caret left one word, position cursor at end of word, extending selection to new caret position. (Scintilla feature 2440) public void WordLeftEndExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTENDEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTENDEXTEND, Unused, Unused); } /// Move caret right one word, position cursor at end of word. (Scintilla feature 2441) public void WordRightEnd() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEND, Unused, Unused); } /// Move caret right one word, position cursor at end of word, extending selection to new caret position. (Scintilla feature 2442) public void WordRightEndExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTENDEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTENDEXTEND, Unused, Unused); } /// @@ -3632,7 +3628,7 @@ public unsafe void SetWhitespaceChars(string characters) { fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACECHARS, (IntPtr) Unused, (IntPtr) charactersPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACECHARS, Unused, (IntPtr) charactersPtr); } } @@ -3642,7 +3638,7 @@ public unsafe string GetWhitespaceChars() byte[] charactersBuffer = new byte[10000]; fixed (byte* charactersPtr = charactersBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACECHARS, (IntPtr) Unused, (IntPtr) charactersPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACECHARS, Unused, (IntPtr) charactersPtr); return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0'); } } @@ -3656,7 +3652,7 @@ public unsafe void SetPunctuationChars(string characters) { fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETPUNCTUATIONCHARS, (IntPtr) Unused, (IntPtr) charactersPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPUNCTUATIONCHARS, Unused, (IntPtr) charactersPtr); } } @@ -3666,7 +3662,7 @@ public unsafe string GetPunctuationChars() byte[] charactersBuffer = new byte[10000]; fixed (byte* charactersPtr = charactersBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETPUNCTUATIONCHARS, (IntPtr) Unused, (IntPtr) charactersPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPUNCTUATIONCHARS, Unused, (IntPtr) charactersPtr); return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0'); } } @@ -3674,13 +3670,14 @@ public unsafe string GetPunctuationChars() /// Reset the set of characters for whitespace and word characters to the defaults. (Scintilla feature 2444) public void SetCharsDefault() { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCHARSDEFAULT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCHARSDEFAULT, Unused, Unused); } /// Get currently selected item position in the auto-completion list (Scintilla feature 2445) public int AutoCGetCurrent() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENT, Unused, Unused); + return (int) res; } /// @@ -3691,54 +3688,57 @@ public int AutoCGetCurrent() /// public unsafe string AutoCGetCurrentText() { - byte[] textBuffer = new byte[10000]; - fixed (byte* textPtr = textBuffer) + byte[] sBuffer = new byte[10000]; + fixed (byte* sPtr = sBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENTTEXT, (IntPtr) Unused, (IntPtr) textPtr); - return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENTTEXT, Unused, (IntPtr) sPtr); + return Encoding.UTF8.GetString(sBuffer).TrimEnd('\0'); } } /// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. (Scintilla feature 2634) - public void AutoCSetCaseInsensitiveBehaviour(CaseInsensitiveBehaviour behaviour) + public void AutoCSetCaseInsensitiveBehaviour(int behaviour) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, (IntPtr) behaviour, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, behaviour, Unused); } /// Get auto-completion case insensitive behaviour. (Scintilla feature 2635) - public CaseInsensitiveBehaviour AutoCGetCaseInsensitiveBehaviour() + public int AutoCGetCaseInsensitiveBehaviour() { - return (CaseInsensitiveBehaviour)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, Unused, Unused); + return (int) res; } /// Change the effect of autocompleting when there are multiple selections. (Scintilla feature 2636) - public void AutoCSetMulti(MultiAutoComplete multi) + public void AutoCSetMulti(int multi) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMULTI, (IntPtr) multi, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMULTI, multi, Unused); } - /// Retrieve the effect of autocompleting when there are multiple selections. (Scintilla feature 2637) - public MultiAutoComplete AutoCGetMulti() + /// Retrieve the effect of autocompleting when there are multiple selections.. (Scintilla feature 2637) + public int AutoCGetMulti() { - return (MultiAutoComplete)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMULTI, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMULTI, Unused, Unused); + return (int) res; } /// Set the way autocompletion lists are ordered. (Scintilla feature 2660) - public void AutoCSetOrder(Ordering order) + public void AutoCSetOrder(int order) { - Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETORDER, (IntPtr) order, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETORDER, order, Unused); } /// Get the way autocompletion lists are ordered. (Scintilla feature 2661) - public Ordering AutoCGetOrder() + public int AutoCGetOrder() { - return (Ordering)Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETORDER, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETORDER, Unused, Unused); + return (int) res; } /// Enlarge the document to a particular size of text bytes. (Scintilla feature 2446) public void Allocate(int bytes) { - Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATE, (IntPtr) bytes, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATE, bytes, Unused); } /// @@ -3751,7 +3751,7 @@ public unsafe string TargetAsUTF8() byte[] sBuffer = new byte[10000]; fixed (byte* sPtr = sBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_TARGETASUTF8, (IntPtr) Unused, (IntPtr) sPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TARGETASUTF8, Unused, (IntPtr) sPtr); return Encoding.UTF8.GetString(sBuffer).TrimEnd('\0'); } } @@ -3763,7 +3763,7 @@ public unsafe string TargetAsUTF8() /// public void SetLengthForEncode(int bytes) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETLENGTHFORENCODE, (IntPtr) bytes, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLENGTHFORENCODE, bytes, Unused); } /// @@ -3779,7 +3779,7 @@ public unsafe string EncodedFromUTF8(string utf8) byte[] encodedBuffer = new byte[10000]; fixed (byte* encodedPtr = encodedBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_ENCODEDFROMUTF8, (IntPtr) utf8Ptr, (IntPtr) encodedPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENCODEDFROMUTF8, (IntPtr) utf8Ptr, (IntPtr) encodedPtr); return Encoding.UTF8.GetString(encodedBuffer).TrimEnd('\0'); } } @@ -3792,145 +3792,157 @@ public unsafe string EncodedFromUTF8(string utf8) /// public int FindColumn(int line, int column) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_FINDCOLUMN, (IntPtr) line, (IntPtr) column); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDCOLUMN, line, column); + return (int) res; } /// Can the caret preferred x position only be changed by explicit movement commands? (Scintilla feature 2457) - public CaretSticky GetCaretSticky() + public int GetCaretSticky() { - return (CaretSticky)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTICKY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTICKY, Unused, Unused); + return (int) res; } /// Stop the caret preferred x position changing when the user types. (Scintilla feature 2458) - public void SetCaretSticky(CaretSticky useCaretStickyBehaviour) + public void SetCaretSticky(int useCaretStickyBehaviour) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTICKY, (IntPtr) useCaretStickyBehaviour, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTICKY, useCaretStickyBehaviour, Unused); } /// Switch between sticky and non-sticky: meant to be bound to a key. (Scintilla feature 2459) public void ToggleCaretSticky() { - Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLECARETSTICKY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLECARETSTICKY, Unused, Unused); } /// Enable/Disable convert-on-paste for line endings (Scintilla feature 2467) public void SetPasteConvertEndings(bool convert) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETPASTECONVERTENDINGS, new IntPtr(convert ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPASTECONVERTENDINGS, convert ? 1 : 0, Unused); } /// Get convert-on-paste setting (Scintilla feature 2468) public bool GetPasteConvertEndings() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPASTECONVERTENDINGS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPASTECONVERTENDINGS, Unused, Unused); + return 1 == (int) res; } /// Duplicate the selection. If selection empty duplicate the line containing the caret. (Scintilla feature 2469) public void SelectionDuplicate() { - Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONDUPLICATE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONDUPLICATE, Unused, Unused); } /// Set background alpha of the caret line. (Scintilla feature 2470) - public void SetCaretLineBackAlpha(Alpha alpha) + public void SetCaretLineBackAlpha(int alpha) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACKALPHA, (IntPtr) alpha, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACKALPHA, alpha, Unused); } /// Get the background alpha of the caret line. (Scintilla feature 2471) - public Alpha GetCaretLineBackAlpha() + public int GetCaretLineBackAlpha() { - return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACKALPHA, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACKALPHA, Unused, Unused); + return (int) res; } /// Set the style of the caret to be drawn. (Scintilla feature 2512) - public void SetCaretStyle(CaretStyle caretStyle) + public void SetCaretStyle(int caretStyle) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTYLE, (IntPtr) caretStyle, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTYLE, caretStyle, Unused); } /// Returns the current style of the caret. (Scintilla feature 2513) - public CaretStyle GetCaretStyle() + public int GetCaretStyle() { - return (CaretStyle)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTYLE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTYLE, Unused, Unused); + return (int) res; } /// Set the indicator used for IndicatorFillRange and IndicatorClearRange (Scintilla feature 2500) public void SetIndicatorCurrent(int indicator) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORCURRENT, (IntPtr) indicator, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORCURRENT, indicator, Unused); } /// Get the current indicator (Scintilla feature 2501) public int GetIndicatorCurrent() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORCURRENT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORCURRENT, Unused, Unused); + return (int) res; } /// Set the value used for IndicatorFillRange (Scintilla feature 2502) public void SetIndicatorValue(int value) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORVALUE, (IntPtr) value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORVALUE, value, Unused); } /// Get the current indicator value (Scintilla feature 2503) public int GetIndicatorValue() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORVALUE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORVALUE, Unused, Unused); + return (int) res; } /// Turn a indicator on over a range. (Scintilla feature 2504) - public void IndicatorFillRange(int start, int lengthFill) + public void IndicatorFillRange(int position, int fillLength) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORFILLRANGE, (IntPtr) start, (IntPtr) lengthFill); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORFILLRANGE, position, fillLength); } /// Turn a indicator off over a range. (Scintilla feature 2505) - public void IndicatorClearRange(int start, int lengthClear) + public void IndicatorClearRange(int position, int clearLength) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORCLEARRANGE, (IntPtr) start, (IntPtr) lengthClear); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORCLEARRANGE, position, clearLength); } - /// Are any indicators present at pos? (Scintilla feature 2506) - public int IndicatorAllOnFor(int pos) + /// Are any indicators present at position? (Scintilla feature 2506) + public int IndicatorAllOnFor(int position) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORALLONFOR, (IntPtr) pos, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORALLONFOR, position, Unused); + return (int) res; } - /// What value does a particular indicator have at a position? (Scintilla feature 2507) - public int IndicatorValueAt(int indicator, int pos) + /// What value does a particular indicator have at at a position? (Scintilla feature 2507) + public int IndicatorValueAt(int indicator, int position) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORVALUEAT, (IntPtr) indicator, (IntPtr) pos); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORVALUEAT, indicator, position); + return (int) res; } /// Where does a particular indicator start? (Scintilla feature 2508) - public int IndicatorStart(int indicator, int pos) + public int IndicatorStart(int indicator, int position) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORSTART, (IntPtr) indicator, (IntPtr) pos); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORSTART, indicator, position); + return (int) res; } /// Where does a particular indicator end? (Scintilla feature 2509) - public int IndicatorEnd(int indicator, int pos) + public int IndicatorEnd(int indicator, int position) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDICATOREND, (IntPtr) indicator, (IntPtr) pos); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATOREND, indicator, position); + return (int) res; } /// Set number of entries in position cache (Scintilla feature 2514) public void SetPositionCache(int size) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETPOSITIONCACHE, (IntPtr) size, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPOSITIONCACHE, size, Unused); } /// How many entries are allocated to the position cache? (Scintilla feature 2515) public int GetPositionCache() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPOSITIONCACHE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPOSITIONCACHE, Unused, Unused); + return (int) res; } /// Copy the selection, if selection empty copy the line with the caret (Scintilla feature 2519) public void CopyAllowLine() { - Win32.SendMessage(scintilla, SciMsg.SCI_COPYALLOWLINE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYALLOWLINE, Unused, Unused); } /// @@ -3940,18 +3952,18 @@ public void CopyAllowLine() /// public IntPtr GetCharacterPointer() { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERPOINTER, (IntPtr) Unused, (IntPtr) Unused); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERPOINTER, Unused, Unused); } /// /// Return a read-only pointer to a range of characters in the document. /// May move the gap so that the range is contiguous, but will only move up - /// to lengthRange bytes. + /// to rangeLength bytes. /// (Scintilla feature 2643) /// - public IntPtr GetRangePointer(int start, int lengthRange) + public IntPtr GetRangePointer(int position, int rangeLength) { - return Win32.SendMessage(scintilla, SciMsg.SCI_GETRANGEPOINTER, (IntPtr) start, (IntPtr) lengthRange); + return Win32.SendMessage(scintilla, SciMsg.SCI_GETRANGEPOINTER, position, rangeLength); } /// @@ -3959,63 +3971,69 @@ public IntPtr GetRangePointer(int start, int lengthRange) /// the range of a call to GetRangePointer. /// (Scintilla feature 2644) /// - public int GetGapPosition() + public Position GetGapPosition() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETGAPPOSITION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETGAPPOSITION, Unused, Unused); + return new Position((int) res); } /// Set the alpha fill colour of the given indicator. (Scintilla feature 2523) - public void IndicSetAlpha(int indicator, Alpha alpha) + public void IndicSetAlpha(int indicator, int alpha) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETALPHA, (IntPtr) indicator, (IntPtr) alpha); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETALPHA, indicator, alpha); } /// Get the alpha fill colour of the given indicator. (Scintilla feature 2524) - public Alpha IndicGetAlpha(int indicator) + public int IndicGetAlpha(int indicator) { - return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETALPHA, (IntPtr) indicator, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETALPHA, indicator, Unused); + return (int) res; } /// Set the alpha outline colour of the given indicator. (Scintilla feature 2558) - public void IndicSetOutlineAlpha(int indicator, Alpha alpha) + public void IndicSetOutlineAlpha(int indicator, int alpha) { - Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETOUTLINEALPHA, (IntPtr) indicator, (IntPtr) alpha); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETOUTLINEALPHA, indicator, alpha); } /// Get the alpha outline colour of the given indicator. (Scintilla feature 2559) - public Alpha IndicGetOutlineAlpha(int indicator) + public int IndicGetOutlineAlpha(int indicator) { - return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETOUTLINEALPHA, (IntPtr) indicator, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETOUTLINEALPHA, indicator, Unused); + return (int) res; } /// Set extra ascent for each line (Scintilla feature 2525) public void SetExtraAscent(int extraAscent) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRAASCENT, (IntPtr) extraAscent, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRAASCENT, extraAscent, Unused); } /// Get extra ascent for each line (Scintilla feature 2526) public int GetExtraAscent() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRAASCENT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRAASCENT, Unused, Unused); + return (int) res; } /// Set extra descent for each line (Scintilla feature 2527) public void SetExtraDescent(int extraDescent) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRADESCENT, (IntPtr) extraDescent, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRADESCENT, extraDescent, Unused); } /// Get extra descent for each line (Scintilla feature 2528) public int GetExtraDescent() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRADESCENT, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRADESCENT, Unused, Unused); + return (int) res; } /// Which symbol was defined for markerNumber with MarkerDefine (Scintilla feature 2529) public int MarkerSymbolDefined(int markerNumber) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSYMBOLDEFINED, (IntPtr) markerNumber, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSYMBOLDEFINED, markerNumber, Unused); + return (int) res; } /// Set the text in the text margin for a line (Scintilla feature 2530) @@ -4023,7 +4041,7 @@ public unsafe void MarginSetText(int line, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETTEXT, (IntPtr) line, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETTEXT, line, (IntPtr) textPtr); } } @@ -4033,7 +4051,7 @@ public unsafe string MarginGetText(int line) byte[] textBuffer = new byte[10000]; fixed (byte* textPtr = textBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETTEXT, (IntPtr) line, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETTEXT, line, (IntPtr) textPtr); return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); } } @@ -4041,13 +4059,14 @@ public unsafe string MarginGetText(int line) /// Set the style number for the text margin for a line (Scintilla feature 2532) public void MarginSetStyle(int line, int style) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLE, (IntPtr) line, (IntPtr) style); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLE, line, style); } /// Get the style number for the text margin for a line (Scintilla feature 2533) public int MarginGetStyle(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLE, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLE, line, Unused); + return (int) res; } /// Set the style in the text margin for a line (Scintilla feature 2534) @@ -4055,7 +4074,7 @@ public unsafe void MarginSetStyles(int line, string styles) { fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles)) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLES, (IntPtr) line, (IntPtr) stylesPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLES, line, (IntPtr) stylesPtr); } } @@ -4065,7 +4084,7 @@ public unsafe string MarginGetStyles(int line) byte[] stylesBuffer = new byte[10000]; fixed (byte* stylesPtr = stylesBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLES, (IntPtr) line, (IntPtr) stylesPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLES, line, (IntPtr) stylesPtr); return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0'); } } @@ -4073,31 +4092,33 @@ public unsafe string MarginGetStyles(int line) /// Clear the margin text on all lines (Scintilla feature 2536) public void MarginTextClearAll() { - Win32.SendMessage(scintilla, SciMsg.SCI_MARGINTEXTCLEARALL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINTEXTCLEARALL, Unused, Unused); } /// Get the start of the range of style numbers used for margin text (Scintilla feature 2537) public void MarginSetStyleOffset(int style) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLEOFFSET, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLEOFFSET, style, Unused); } /// Get the start of the range of style numbers used for margin text (Scintilla feature 2538) public int MarginGetStyleOffset() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLEOFFSET, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLEOFFSET, Unused, Unused); + return (int) res; } /// Set the margin options. (Scintilla feature 2539) - public void SetMarginOptions(MarginOption marginOptions) + public void SetMarginOptions(int marginOptions) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINOPTIONS, (IntPtr) marginOptions, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINOPTIONS, marginOptions, Unused); } /// Get the margin options. (Scintilla feature 2557) - public MarginOption GetMarginOptions() + public int GetMarginOptions() { - return (MarginOption)Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINOPTIONS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINOPTIONS, Unused, Unused); + return (int) res; } /// Set the annotation text for a line (Scintilla feature 2540) @@ -4105,7 +4126,7 @@ public unsafe void AnnotationSetText(int line, string text) { fixed (byte* textPtr = Encoding.UTF8.GetBytes(text)) { - Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETTEXT, (IntPtr) line, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETTEXT, line, (IntPtr) textPtr); } } @@ -4115,7 +4136,7 @@ public unsafe string AnnotationGetText(int line) byte[] textBuffer = new byte[10000]; fixed (byte* textPtr = textBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETTEXT, (IntPtr) line, (IntPtr) textPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETTEXT, line, (IntPtr) textPtr); return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); } } @@ -4123,13 +4144,14 @@ public unsafe string AnnotationGetText(int line) /// Set the style number for the annotations for a line (Scintilla feature 2542) public void AnnotationSetStyle(int line, int style) { - Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLE, (IntPtr) line, (IntPtr) style); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLE, line, style); } /// Get the style number for the annotations for a line (Scintilla feature 2543) public int AnnotationGetStyle(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLE, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLE, line, Unused); + return (int) res; } /// Set the annotation styles for a line (Scintilla feature 2544) @@ -4137,7 +4159,7 @@ public unsafe void AnnotationSetStyles(int line, string styles) { fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles)) { - Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLES, (IntPtr) line, (IntPtr) stylesPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLES, line, (IntPtr) stylesPtr); } } @@ -4147,7 +4169,7 @@ public unsafe string AnnotationGetStyles(int line) byte[] stylesBuffer = new byte[10000]; fixed (byte* stylesPtr = stylesBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLES, (IntPtr) line, (IntPtr) stylesPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLES, line, (IntPtr) stylesPtr); return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0'); } } @@ -4155,61 +4177,66 @@ public unsafe string AnnotationGetStyles(int line) /// Get the number of annotation lines for a line (Scintilla feature 2546) public int AnnotationGetLines(int line) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETLINES, (IntPtr) line, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETLINES, line, Unused); + return (int) res; } /// Clear the annotations from all lines (Scintilla feature 2547) public void AnnotationClearAll() { - Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONCLEARALL, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONCLEARALL, Unused, Unused); } /// Set the visibility for the annotations for a view (Scintilla feature 2548) - public void AnnotationSetVisible(AnnotationVisible visible) + public void AnnotationSetVisible(int visible) { - Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETVISIBLE, (IntPtr) visible, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETVISIBLE, visible, Unused); } /// Get the visibility for the annotations for a view (Scintilla feature 2549) - public AnnotationVisible AnnotationGetVisible() + public int AnnotationGetVisible() { - return (AnnotationVisible)Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETVISIBLE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETVISIBLE, Unused, Unused); + return (int) res; } /// Get the start of the range of style numbers used for annotations (Scintilla feature 2550) public void AnnotationSetStyleOffset(int style) { - Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLEOFFSET, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLEOFFSET, style, Unused); } /// Get the start of the range of style numbers used for annotations (Scintilla feature 2551) public int AnnotationGetStyleOffset() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLEOFFSET, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLEOFFSET, Unused, Unused); + return (int) res; } /// Release all extended (>255) style numbers (Scintilla feature 2552) public void ReleaseAllExtendedStyles() { - Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEALLEXTENDEDSTYLES, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEALLEXTENDEDSTYLES, Unused, Unused); } /// Allocate some extended (>255) style numbers and return the start of the range (Scintilla feature 2553) public int AllocateExtendedStyles(int numberStyles) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATEEXTENDEDSTYLES, (IntPtr) numberStyles, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATEEXTENDEDSTYLES, numberStyles, Unused); + return (int) res; } /// Add a container action to the undo stack (Scintilla feature 2560) - public void AddUndoAction(int token, UndoFlags flags) + public void AddUndoAction(int token, int flags) { - Win32.SendMessage(scintilla, SciMsg.SCI_ADDUNDOACTION, (IntPtr) token, (IntPtr) flags); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDUNDOACTION, token, flags); } /// Find the position of a character from a point within the window. (Scintilla feature 2561) - public int CharPositionFromPoint(int x, int y) + public Position CharPositionFromPoint(int x, int y) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINT, (IntPtr) x, (IntPtr) y); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINT, x, y); + return new Position((int) res); } /// @@ -4217,253 +4244,275 @@ public int CharPositionFromPoint(int x, int y) /// Return INVALID_POSITION if not close to text. /// (Scintilla feature 2562) /// - public int CharPositionFromPointClose(int x, int y) + public Position CharPositionFromPointClose(int x, int y) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINTCLOSE, (IntPtr) x, (IntPtr) y); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINTCLOSE, x, y); + return new Position((int) res); } /// Set whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2668) public void SetMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSESELECTIONRECTANGULARSWITCH, new IntPtr(mouseSelectionRectangularSwitch ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSESELECTIONRECTANGULARSWITCH, mouseSelectionRectangularSwitch ? 1 : 0, Unused); } /// Whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2669) public bool GetMouseSelectionRectangularSwitch() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSESELECTIONRECTANGULARSWITCH, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSESELECTIONRECTANGULARSWITCH, Unused, Unused); + return 1 == (int) res; } /// Set whether multiple selections can be made (Scintilla feature 2563) public void SetMultipleSelection(bool multipleSelection) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPLESELECTION, new IntPtr(multipleSelection ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPLESELECTION, multipleSelection ? 1 : 0, Unused); } /// Whether multiple selections can be made (Scintilla feature 2564) public bool GetMultipleSelection() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPLESELECTION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPLESELECTION, Unused, Unused); + return 1 == (int) res; } /// Set whether typing can be performed into multiple selections (Scintilla feature 2565) public void SetAdditionalSelectionTyping(bool additionalSelectionTyping) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELECTIONTYPING, new IntPtr(additionalSelectionTyping ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELECTIONTYPING, additionalSelectionTyping ? 1 : 0, Unused); } /// Whether typing can be performed into multiple selections (Scintilla feature 2566) public bool GetAdditionalSelectionTyping() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELECTIONTYPING, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELECTIONTYPING, Unused, Unused); + return 1 == (int) res; } /// Set whether additional carets will blink (Scintilla feature 2567) public void SetAdditionalCaretsBlink(bool additionalCaretsBlink) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSBLINK, new IntPtr(additionalCaretsBlink ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSBLINK, additionalCaretsBlink ? 1 : 0, Unused); } /// Whether additional carets will blink (Scintilla feature 2568) public bool GetAdditionalCaretsBlink() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSBLINK, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSBLINK, Unused, Unused); + return 1 == (int) res; } /// Set whether additional carets are visible (Scintilla feature 2608) - public void SetAdditionalCaretsVisible(bool additionalCaretsVisible) + public void SetAdditionalCaretsVisible(bool additionalCaretsBlink) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSVISIBLE, new IntPtr(additionalCaretsVisible ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSVISIBLE, additionalCaretsBlink ? 1 : 0, Unused); } /// Whether additional carets are visible (Scintilla feature 2609) public bool GetAdditionalCaretsVisible() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSVISIBLE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSVISIBLE, Unused, Unused); + return 1 == (int) res; } /// How many selections are there? (Scintilla feature 2570) public int GetSelections() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONS, Unused, Unused); + return (int) res; } /// Is every selected range empty? (Scintilla feature 2650) public bool GetSelectionEmpty() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEMPTY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEMPTY, Unused, Unused); + return 1 == (int) res; } /// Clear selections to a single empty stream selection (Scintilla feature 2571) public void ClearSelections() { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEARSELECTIONS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARSELECTIONS, Unused, Unused); } /// Set a simple selection (Scintilla feature 2572) - public void SetSelection(int caret, int anchor) + public int SetSelection(int caret, int anchor) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTION, (IntPtr) caret, (IntPtr) anchor); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTION, caret, anchor); + return (int) res; } /// Add a selection (Scintilla feature 2573) - public void AddSelection(int caret, int anchor) + public int AddSelection(int caret, int anchor) { - Win32.SendMessage(scintilla, SciMsg.SCI_ADDSELECTION, (IntPtr) caret, (IntPtr) anchor); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDSELECTION, caret, anchor); + return (int) res; } /// Drop one selection (Scintilla feature 2671) public void DropSelectionN(int selection) { - Win32.SendMessage(scintilla, SciMsg.SCI_DROPSELECTIONN, (IntPtr) selection, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DROPSELECTIONN, selection, Unused); } /// Set the main selection (Scintilla feature 2574) public void SetMainSelection(int selection) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETMAINSELECTION, (IntPtr) selection, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMAINSELECTION, selection, Unused); } /// Which selection is the main selection (Scintilla feature 2575) public int GetMainSelection() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETMAINSELECTION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMAINSELECTION, Unused, Unused); + return (int) res; } - /// Set the caret position of the nth selection. (Scintilla feature 2576) - public void SetSelectionNCaret(int selection, int caret) + /// Which selection is the main selection (Scintilla feature 2576) + public void SetSelectionNCaret(int selection, Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARET, (IntPtr) selection, (IntPtr) caret); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARET, selection, pos.Value); } - /// Return the caret position of the nth selection. (Scintilla feature 2577) - public int GetSelectionNCaret(int selection) + /// Which selection is the main selection (Scintilla feature 2577) + public Position GetSelectionNCaret(int selection) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARET, (IntPtr) selection, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARET, selection, Unused); + return new Position((int) res); } - /// Set the anchor position of the nth selection. (Scintilla feature 2578) - public void SetSelectionNAnchor(int selection, int anchor) + /// Which selection is the main selection (Scintilla feature 2578) + public void SetSelectionNAnchor(int selection, Position posAnchor) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHOR, (IntPtr) selection, (IntPtr) anchor); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHOR, selection, posAnchor.Value); } - /// Return the anchor position of the nth selection. (Scintilla feature 2579) - public int GetSelectionNAnchor(int selection) + /// Which selection is the main selection (Scintilla feature 2579) + public Position GetSelectionNAnchor(int selection) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHOR, (IntPtr) selection, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHOR, selection, Unused); + return new Position((int) res); } - /// Set the virtual space of the caret of the nth selection. (Scintilla feature 2580) + /// Which selection is the main selection (Scintilla feature 2580) public void SetSelectionNCaretVirtualSpace(int selection, int space) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARETVIRTUALSPACE, (IntPtr) selection, (IntPtr) space); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARETVIRTUALSPACE, selection, space); } - /// Return the virtual space of the caret of the nth selection. (Scintilla feature 2581) + /// Which selection is the main selection (Scintilla feature 2581) public int GetSelectionNCaretVirtualSpace(int selection) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARETVIRTUALSPACE, (IntPtr) selection, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARETVIRTUALSPACE, selection, Unused); + return (int) res; } - /// Set the virtual space of the anchor of the nth selection. (Scintilla feature 2582) + /// Which selection is the main selection (Scintilla feature 2582) public void SetSelectionNAnchorVirtualSpace(int selection, int space) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHORVIRTUALSPACE, (IntPtr) selection, (IntPtr) space); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHORVIRTUALSPACE, selection, space); } - /// Return the virtual space of the anchor of the nth selection. (Scintilla feature 2583) + /// Which selection is the main selection (Scintilla feature 2583) public int GetSelectionNAnchorVirtualSpace(int selection) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHORVIRTUALSPACE, (IntPtr) selection, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHORVIRTUALSPACE, selection, Unused); + return (int) res; } /// Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2584) - public void SetSelectionNStart(int selection, int anchor) + public void SetSelectionNStart(int selection, Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNSTART, (IntPtr) selection, (IntPtr) anchor); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNSTART, selection, pos.Value); } /// Returns the position at the start of the selection. (Scintilla feature 2585) - public int GetSelectionNStart(int selection) + public Position GetSelectionNStart(int selection) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNSTART, (IntPtr) selection, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNSTART, selection, Unused); + return new Position((int) res); } /// Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2586) - public void SetSelectionNEnd(int selection, int caret) + public void SetSelectionNEnd(int selection, Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNEND, (IntPtr) selection, (IntPtr) caret); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNEND, selection, pos.Value); } /// Returns the position at the end of the selection. (Scintilla feature 2587) - public int GetSelectionNEnd(int selection) + public Position GetSelectionNEnd(int selection) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNEND, (IntPtr) selection, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNEND, selection, Unused); + return new Position((int) res); } - /// Set the caret position of the rectangular selection. (Scintilla feature 2588) - public void SetRectangularSelectionCaret(int caret) + /// Returns the position at the end of the selection. (Scintilla feature 2588) + public void SetRectangularSelectionCaret(Position pos) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARET, (IntPtr) caret, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARET, pos.Value, Unused); } - /// Return the caret position of the rectangular selection. (Scintilla feature 2589) - public int GetRectangularSelectionCaret() + /// Returns the position at the end of the selection. (Scintilla feature 2589) + public Position GetRectangularSelectionCaret() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARET, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARET, Unused, Unused); + return new Position((int) res); } - /// Set the anchor position of the rectangular selection. (Scintilla feature 2590) - public void SetRectangularSelectionAnchor(int anchor) + /// Returns the position at the end of the selection. (Scintilla feature 2590) + public void SetRectangularSelectionAnchor(Position posAnchor) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHOR, (IntPtr) anchor, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHOR, posAnchor.Value, Unused); } - /// Return the anchor position of the rectangular selection. (Scintilla feature 2591) - public int GetRectangularSelectionAnchor() + /// Returns the position at the end of the selection. (Scintilla feature 2591) + public Position GetRectangularSelectionAnchor() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHOR, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHOR, Unused, Unused); + return new Position((int) res); } - /// Set the virtual space of the caret of the rectangular selection. (Scintilla feature 2592) + /// Returns the position at the end of the selection. (Scintilla feature 2592) public void SetRectangularSelectionCaretVirtualSpace(int space) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, (IntPtr) space, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, space, Unused); } - /// Return the virtual space of the caret of the rectangular selection. (Scintilla feature 2593) + /// Returns the position at the end of the selection. (Scintilla feature 2593) public int GetRectangularSelectionCaretVirtualSpace() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, Unused, Unused); + return (int) res; } - /// Set the virtual space of the anchor of the rectangular selection. (Scintilla feature 2594) + /// Returns the position at the end of the selection. (Scintilla feature 2594) public void SetRectangularSelectionAnchorVirtualSpace(int space) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, (IntPtr) space, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, space, Unused); } - /// Return the virtual space of the anchor of the rectangular selection. (Scintilla feature 2595) + /// Returns the position at the end of the selection. (Scintilla feature 2595) public int GetRectangularSelectionAnchorVirtualSpace() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, Unused, Unused); + return (int) res; } - /// Set options for virtual space behaviour. (Scintilla feature 2596) - public void SetVirtualSpaceOptions(VirtualSpace virtualSpaceOptions) + /// Returns the position at the end of the selection. (Scintilla feature 2596) + public void SetVirtualSpaceOptions(int virtualSpaceOptions) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETVIRTUALSPACEOPTIONS, (IntPtr) virtualSpaceOptions, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions, Unused); } - /// Return options for virtual space behaviour. (Scintilla feature 2597) - public VirtualSpace GetVirtualSpaceOptions() + /// Returns the position at the end of the selection. (Scintilla feature 2597) + public int GetVirtualSpaceOptions() { - return (VirtualSpace)Win32.SendMessage(scintilla, SciMsg.SCI_GETVIRTUALSPACEOPTIONS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIRTUALSPACEOPTIONS, Unused, Unused); + return (int) res; } /// - /// On GTK, allow selecting the modifier key to use for mouse-based + /// On GTK+, allow selecting the modifier key to use for mouse-based /// rectangular selection. Often the window manager requires Alt+Mouse Drag /// for moving windows. /// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. @@ -4471,13 +4520,14 @@ public VirtualSpace GetVirtualSpaceOptions() /// public void SetRectangularSelectionModifier(int modifier) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONMODIFIER, (IntPtr) modifier, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONMODIFIER, modifier, Unused); } /// Get the modifier key used for rectangular selection. (Scintilla feature 2599) public int GetRectangularSelectionModifier() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONMODIFIER, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONMODIFIER, Unused, Unused); + return (int) res; } /// @@ -4487,7 +4537,7 @@ public int GetRectangularSelectionModifier() /// public void SetAdditionalSelFore(Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELFORE, fore.Value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELFORE, fore.Value, Unused); } /// @@ -4497,63 +4547,45 @@ public void SetAdditionalSelFore(Colour fore) /// public void SetAdditionalSelBack(Colour back) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELBACK, back.Value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELBACK, back.Value, Unused); } /// Set the alpha of the selection. (Scintilla feature 2602) - public void SetAdditionalSelAlpha(Alpha alpha) + public void SetAdditionalSelAlpha(int alpha) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELALPHA, (IntPtr) alpha, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELALPHA, alpha, Unused); } /// Get the alpha of the selection. (Scintilla feature 2603) - public Alpha GetAdditionalSelAlpha() + public int GetAdditionalSelAlpha() { - return (Alpha)Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELALPHA, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELALPHA, Unused, Unused); + return (int) res; } /// Set the foreground colour of additional carets. (Scintilla feature 2604) public void SetAdditionalCaretFore(Colour fore) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETFORE, fore.Value, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETFORE, fore.Value, Unused); } /// Get the foreground colour of additional carets. (Scintilla feature 2605) public Colour GetAdditionalCaretFore() { - return new Colour((int) Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETFORE, (IntPtr) Unused, (IntPtr) Unused)); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETFORE, Unused, Unused); + return new Colour((int) res); } /// Set the main selection to the next selection. (Scintilla feature 2606) public void RotateSelection() { - Win32.SendMessage(scintilla, SciMsg.SCI_ROTATESELECTION, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ROTATESELECTION, Unused, Unused); } /// Swap that caret and anchor of the main selection. (Scintilla feature 2607) public void SwapMainAnchorCaret() { - Win32.SendMessage(scintilla, SciMsg.SCI_SWAPMAINANCHORCARET, (IntPtr) Unused, (IntPtr) Unused); - } - - /// - /// Add the next occurrence of the main selection to the set of selections as main. - /// If the current selection is empty then select word around caret. - /// (Scintilla feature 2688) - /// - public void MultipleSelectAddNext() - { - Win32.SendMessage(scintilla, SciMsg.SCI_MULTIPLESELECTADDNEXT, (IntPtr) Unused, (IntPtr) Unused); - } - - /// - /// Add each occurrence of the main selection in the target to the set of selections. - /// If the current selection is empty then select word around caret. - /// (Scintilla feature 2689) - /// - public void MultipleSelectAddEach() - { - Win32.SendMessage(scintilla, SciMsg.SCI_MULTIPLESELECTADDEACH, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SWAPMAINANCHORCARET, Unused, Unused); } /// @@ -4561,9 +4593,10 @@ public void MultipleSelectAddEach() /// there may be a need to redraw. /// (Scintilla feature 2617) /// - public int ChangeLexerState(int start, int end) + public int ChangeLexerState(Position start, Position end) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CHANGELEXERSTATE, (IntPtr) start, (IntPtr) end); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHANGELEXERSTATE, start.Value, end.Value); + return (int) res; } /// @@ -4573,55 +4606,57 @@ public int ChangeLexerState(int start, int end) /// public int ContractedFoldNext(int lineStart) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_CONTRACTEDFOLDNEXT, (IntPtr) lineStart, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CONTRACTEDFOLDNEXT, lineStart, Unused); + return (int) res; } /// Centre current line in window. (Scintilla feature 2619) public void VerticalCentreCaret() { - Win32.SendMessage(scintilla, SciMsg.SCI_VERTICALCENTRECARET, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VERTICALCENTRECARET, Unused, Unused); } /// Move the selected lines up one line, shifting the line above after the selection (Scintilla feature 2620) public void MoveSelectedLinesUp() { - Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESUP, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESUP, Unused, Unused); } /// Move the selected lines down one line, shifting the line below before the selection (Scintilla feature 2621) public void MoveSelectedLinesDown() { - Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESDOWN, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESDOWN, Unused, Unused); } - /// Set the identifier reported as idFrom in notification messages. (Scintilla feature 2622) + /// Set the identifier reported as IdFrom in notification messages. (Scintilla feature 2622) public void SetIdentifier(int identifier) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIER, (IntPtr) identifier, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIER, identifier, Unused); } /// Get the identifier. (Scintilla feature 2623) public int GetIdentifier() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETIDENTIFIER, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETIDENTIFIER, Unused, Unused); + return (int) res; } /// Set the width for future RGBA image data. (Scintilla feature 2624) public void RGBAImageSetWidth(int width) { - Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETWIDTH, (IntPtr) width, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETWIDTH, width, Unused); } /// Set the height for future RGBA image data. (Scintilla feature 2625) public void RGBAImageSetHeight(int height) { - Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETHEIGHT, (IntPtr) height, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETHEIGHT, height, Unused); } /// Set the scale factor in percent for future RGBA image data. (Scintilla feature 2651) public void RGBAImageSetScale(int scalePercent) { - Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETSCALE, (IntPtr) scalePercent, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETSCALE, scalePercent, Unused); } /// @@ -4633,7 +4668,7 @@ public unsafe void MarkerDefineRGBAImage(int markerNumber, string pixels) { fixed (byte* pixelsPtr = Encoding.UTF8.GetBytes(pixels)) { - Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINERGBAIMAGE, (IntPtr) markerNumber, (IntPtr) pixelsPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINERGBAIMAGE, markerNumber, (IntPtr) pixelsPtr); } } @@ -4646,56 +4681,58 @@ public unsafe void RegisterRGBAImage(int type, string pixels) { fixed (byte* pixelsPtr = Encoding.UTF8.GetBytes(pixels)) { - Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERRGBAIMAGE, (IntPtr) type, (IntPtr) pixelsPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERRGBAIMAGE, type, (IntPtr) pixelsPtr); } } /// Scroll to start of document. (Scintilla feature 2628) public void ScrollToStart() { - Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOSTART, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOSTART, Unused, Unused); } /// Scroll to end of document. (Scintilla feature 2629) public void ScrollToEnd() { - Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOEND, Unused, Unused); } /// Set the technology used. (Scintilla feature 2630) - public void SetTechnology(Technology technology) + public void SetTechnology(int technology) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTECHNOLOGY, (IntPtr) technology, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTECHNOLOGY, technology, Unused); } /// Get the tech. (Scintilla feature 2631) - public Technology GetTechnology() + public int GetTechnology() { - return (Technology)Win32.SendMessage(scintilla, SciMsg.SCI_GETTECHNOLOGY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTECHNOLOGY, Unused, Unused); + return (int) res; } /// Create an ILoader*. (Scintilla feature 2632) - public IntPtr CreateLoader(int bytes, DocumentOption documentOptions) + public int CreateLoader(int bytes) { - return Win32.SendMessage(scintilla, SciMsg.SCI_CREATELOADER, (IntPtr) bytes, (IntPtr) documentOptions); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CREATELOADER, bytes, Unused); + return (int) res; } /// On OS X, show a find indicator. (Scintilla feature 2640) - public void FindIndicatorShow(int start, int end) + public void FindIndicatorShow(Position start, Position end) { - Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORSHOW, (IntPtr) start, (IntPtr) end); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORSHOW, start.Value, end.Value); } /// On OS X, flash a find indicator, then fade out. (Scintilla feature 2641) - public void FindIndicatorFlash(int start, int end) + public void FindIndicatorFlash(Position start, Position end) { - Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORFLASH, (IntPtr) start, (IntPtr) end); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORFLASH, start.Value, end.Value); } /// On OS X, hide the find indicator. (Scintilla feature 2642) public void FindIndicatorHide() { - Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORHIDE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORHIDE, Unused, Unused); } /// @@ -4705,43 +4742,46 @@ public void FindIndicatorHide() /// public void VCHomeDisplay() { - Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAY, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAY, Unused, Unused); } /// Like VCHomeDisplay but extending selection to new caret position. (Scintilla feature 2653) public void VCHomeDisplayExtend() { - Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAYEXTEND, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAYEXTEND, Unused, Unused); } /// Is the caret line always visible? (Scintilla feature 2654) public bool GetCaretLineVisibleAlways() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLEALWAYS, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLEALWAYS, Unused, Unused); + return 1 == (int) res; } /// Sets the caret line to always visible. (Scintilla feature 2655) public void SetCaretLineVisibleAlways(bool alwaysVisible) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLEALWAYS, new IntPtr(alwaysVisible ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLEALWAYS, alwaysVisible ? 1 : 0, Unused); } /// Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. (Scintilla feature 2656) - public void SetLineEndTypesAllowed(LineEndType lineEndBitSet) + public void SetLineEndTypesAllowed(int lineEndBitSet) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEENDTYPESALLOWED, (IntPtr) lineEndBitSet, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEENDTYPESALLOWED, lineEndBitSet, Unused); } /// Get the line end types currently allowed. (Scintilla feature 2657) - public LineEndType GetLineEndTypesAllowed() + public int GetLineEndTypesAllowed() { - return (LineEndType)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESALLOWED, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESALLOWED, Unused, Unused); + return (int) res; } /// Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. (Scintilla feature 2658) - public LineEndType GetLineEndTypesActive() + public int GetLineEndTypesActive() { - return (LineEndType)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESACTIVE, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESACTIVE, Unused, Unused); + return (int) res; } /// Set the way a character is drawn. (Scintilla feature 2665) @@ -4751,7 +4791,7 @@ public unsafe void SetRepresentation(string encodedCharacter, string representat { fixed (byte* representationPtr = Encoding.UTF8.GetBytes(representation)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) representationPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) representationPtr); } } } @@ -4768,7 +4808,7 @@ public unsafe string GetRepresentation(string encodedCharacter) byte[] representationBuffer = new byte[10000]; fixed (byte* representationPtr = representationBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) representationPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) representationPtr); return Encoding.UTF8.GetString(representationBuffer).TrimEnd('\0'); } } @@ -4779,38 +4819,39 @@ public unsafe void ClearRepresentation(string encodedCharacter) { fixed (byte* encodedCharacterPtr = Encoding.UTF8.GetBytes(encodedCharacter)) { - Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREPRESENTATION, (IntPtr) encodedCharacterPtr, Unused); } } /// Start notifying the container of all key presses and commands. (Scintilla feature 3001) public void StartRecord() { - Win32.SendMessage(scintilla, SciMsg.SCI_STARTRECORD, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STARTRECORD, Unused, Unused); } /// Stop notifying the container of all key presses and commands. (Scintilla feature 3002) public void StopRecord() { - Win32.SendMessage(scintilla, SciMsg.SCI_STOPRECORD, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STOPRECORD, Unused, Unused); } /// Set the lexing language of the document. (Scintilla feature 4001) public void SetLexer(int lexer) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXER, (IntPtr) lexer, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXER, lexer, Unused); } /// Retrieve the lexing language of the document. (Scintilla feature 4002) public int GetLexer() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXER, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXER, Unused, Unused); + return (int) res; } /// Colourise a segment of the document using the current lexing language. (Scintilla feature 4003) - public void Colourise(int start, int end) + public void Colourise(Position start, Position end) { - Win32.SendMessage(scintilla, SciMsg.SCI_COLOURISE, (IntPtr) start, (IntPtr) end); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COLOURISE, start.Value, end.Value); } /// Set up a value that may be used by a lexer for some optional feature. (Scintilla feature 4004) @@ -4820,17 +4861,17 @@ public unsafe void SetProperty(string key, string value) { fixed (byte* valuePtr = Encoding.UTF8.GetBytes(value)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETPROPERTY, (IntPtr) keyPtr, (IntPtr) valuePtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPROPERTY, (IntPtr) keyPtr, (IntPtr) valuePtr); } } } /// Set up the key words used by the lexer. (Scintilla feature 4005) - public unsafe void SetKeyWords(int keyWordSet, string keyWords) + public unsafe void SetKeyWords(int keywordSet, string keyWords) { fixed (byte* keyWordsPtr = Encoding.UTF8.GetBytes(keyWords)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYWORDS, (IntPtr) keyWordSet, (IntPtr) keyWordsPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYWORDS, keywordSet, (IntPtr) keyWordsPtr); } } @@ -4839,7 +4880,7 @@ public unsafe void SetLexerLanguage(string language) { fixed (byte* languagePtr = Encoding.UTF8.GetBytes(language)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXERLANGUAGE, (IntPtr) Unused, (IntPtr) languagePtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXERLANGUAGE, Unused, (IntPtr) languagePtr); } } @@ -4848,7 +4889,7 @@ public unsafe void LoadLexerLibrary(string path) { fixed (byte* pathPtr = Encoding.UTF8.GetBytes(path)) { - Win32.SendMessage(scintilla, SciMsg.SCI_LOADLEXERLIBRARY, (IntPtr) Unused, (IntPtr) pathPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LOADLEXERLIBRARY, Unused, (IntPtr) pathPtr); } } @@ -4861,11 +4902,11 @@ public unsafe string GetProperty(string key) { fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key)) { - byte[] valueBuffer = new byte[10000]; - fixed (byte* valuePtr = valueBuffer) + byte[] bufBuffer = new byte[10000]; + fixed (byte* bufPtr = bufBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTY, (IntPtr) keyPtr, (IntPtr) valuePtr); - return Encoding.UTF8.GetString(valueBuffer).TrimEnd('\0'); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTY, (IntPtr) keyPtr, (IntPtr) bufPtr); + return Encoding.UTF8.GetString(bufBuffer).TrimEnd('\0'); } } } @@ -4880,11 +4921,11 @@ public unsafe string GetPropertyExpanded(string key) { fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key)) { - byte[] valueBuffer = new byte[10000]; - fixed (byte* valuePtr = valueBuffer) + byte[] bufBuffer = new byte[10000]; + fixed (byte* bufPtr = bufBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYEXPANDED, (IntPtr) keyPtr, (IntPtr) valuePtr); - return Encoding.UTF8.GetString(valueBuffer).TrimEnd('\0'); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYEXPANDED, (IntPtr) keyPtr, (IntPtr) bufPtr); + return Encoding.UTF8.GetString(bufBuffer).TrimEnd('\0'); } } } @@ -4894,14 +4935,22 @@ public unsafe string GetPropertyExpanded(string key) /// interpreted as an int AFTER any "$()" variable replacement. /// (Scintilla feature 4010) /// - public unsafe int GetPropertyInt(string key, int defaultValue) + public unsafe int GetPropertyInt(string key) { fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key)) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYINT, (IntPtr) keyPtr, (IntPtr) defaultValue); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYINT, (IntPtr) keyPtr, Unused); + return (int) res; } } + /// Retrieve the number of bits the current lexer needs for styling. (Scintilla feature 4011) + public int GetStyleBitsNeeded() + { + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITSNEEDED, Unused, Unused); + return (int) res; + } + /// /// Retrieve the name of the lexer. /// Return the length of the text. @@ -4910,18 +4959,19 @@ public unsafe int GetPropertyInt(string key, int defaultValue) /// public unsafe string GetLexerLanguage() { - byte[] languageBuffer = new byte[10000]; - fixed (byte* languagePtr = languageBuffer) + byte[] textBuffer = new byte[10000]; + fixed (byte* textPtr = textBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXERLANGUAGE, (IntPtr) Unused, (IntPtr) languagePtr); - return Encoding.UTF8.GetString(languageBuffer).TrimEnd('\0'); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXERLANGUAGE, Unused, (IntPtr) textPtr); + return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0'); } } /// For private communication between an application and a known lexer. (Scintilla feature 4013) - public IntPtr PrivateLexerCall(int operation, IntPtr pointer) + public int PrivateLexerCall(int operation, int pointer) { - return Win32.SendMessage(scintilla, SciMsg.SCI_PRIVATELEXERCALL, (IntPtr) operation, (IntPtr) pointer); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PRIVATELEXERCALL, operation, pointer); + return (int) res; } /// @@ -4934,17 +4984,18 @@ public unsafe string PropertyNames() byte[] namesBuffer = new byte[10000]; fixed (byte* namesPtr = namesBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYNAMES, (IntPtr) Unused, (IntPtr) namesPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYNAMES, Unused, (IntPtr) namesPtr); return Encoding.UTF8.GetString(namesBuffer).TrimEnd('\0'); } } /// Retrieve the type of a property. (Scintilla feature 4015) - public unsafe TypeProperty PropertyType(string name) + public unsafe int PropertyType(string name) { fixed (byte* namePtr = Encoding.UTF8.GetBytes(name)) { - return (TypeProperty)Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYTYPE, (IntPtr) namePtr, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYTYPE, (IntPtr) namePtr, Unused); + return (int) res; } } @@ -4960,7 +5011,7 @@ public unsafe string DescribeProperty(string name) byte[] descriptionBuffer = new byte[10000]; fixed (byte* descriptionPtr = descriptionBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIBEPROPERTY, (IntPtr) namePtr, (IntPtr) descriptionPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIBEPROPERTY, (IntPtr) namePtr, (IntPtr) descriptionPtr); return Encoding.UTF8.GetString(descriptionBuffer).TrimEnd('\0'); } } @@ -4976,7 +5027,7 @@ public unsafe string DescribeKeyWordSets() byte[] descriptionsBuffer = new byte[10000]; fixed (byte* descriptionsPtr = descriptionsBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIBEKEYWORDSETS, (IntPtr) Unused, (IntPtr) descriptionsPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIBEKEYWORDSETS, Unused, (IntPtr) descriptionsPtr); return Encoding.UTF8.GetString(descriptionsBuffer).TrimEnd('\0'); } } @@ -4988,43 +5039,49 @@ public unsafe string DescribeKeyWordSets() /// public int GetLineEndTypesSupported() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESSUPPORTED, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESSUPPORTED, Unused, Unused); + return (int) res; } /// Allocate a set of sub styles for a particular base style, returning start of range (Scintilla feature 4020) public int AllocateSubStyles(int styleBase, int numberStyles) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATESUBSTYLES, (IntPtr) styleBase, (IntPtr) numberStyles); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATESUBSTYLES, styleBase, numberStyles); + return (int) res; } /// The starting style number for the sub styles associated with a base style (Scintilla feature 4021) public int GetSubStylesStart(int styleBase) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESSTART, (IntPtr) styleBase, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESSTART, styleBase, Unused); + return (int) res; } /// The number of sub styles associated with a base style (Scintilla feature 4022) public int GetSubStylesLength(int styleBase) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESLENGTH, (IntPtr) styleBase, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESLENGTH, styleBase, Unused); + return (int) res; } /// For a sub style, return the base style, else return the argument. (Scintilla feature 4027) public int GetStyleFromSubStyle(int subStyle) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEFROMSUBSTYLE, (IntPtr) subStyle, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEFROMSUBSTYLE, subStyle, Unused); + return (int) res; } /// For a secondary style, return the primary style, else return the argument. (Scintilla feature 4028) public int GetPrimaryStyleFromStyle(int style) { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETPRIMARYSTYLEFROMSTYLE, (IntPtr) style, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRIMARYSTYLEFROMSTYLE, style, Unused); + return (int) res; } /// Free allocated sub styles (Scintilla feature 4023) public void FreeSubStyles() { - Win32.SendMessage(scintilla, SciMsg.SCI_FREESUBSTYLES, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FREESUBSTYLES, Unused, Unused); } /// Set the identifiers that are shown in a particular style (Scintilla feature 4024) @@ -5032,7 +5089,7 @@ public unsafe void SetIdentifiers(int style, string identifiers) { fixed (byte* identifiersPtr = Encoding.UTF8.GetBytes(identifiers)) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIERS, (IntPtr) style, (IntPtr) identifiersPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIERS, style, (IntPtr) identifiersPtr); } } @@ -5043,7 +5100,8 @@ public unsafe void SetIdentifiers(int style, string identifiers) /// public int DistanceToSecondaryStyles() { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_DISTANCETOSECONDARYSTYLES, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DISTANCETOSECONDARYSTYLES, Unused, Unused); + return (int) res; } /// @@ -5056,125 +5114,30 @@ public unsafe string GetSubStyleBases() byte[] stylesBuffer = new byte[10000]; fixed (byte* stylesPtr = stylesBuffer) { - Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLEBASES, (IntPtr) Unused, (IntPtr) stylesPtr); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLEBASES, Unused, (IntPtr) stylesPtr); return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0'); } } - /// Retrieve the number of named styles for the lexer. (Scintilla feature 4029) - public int GetNamedStyles() - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETNAMEDSTYLES, (IntPtr) Unused, (IntPtr) Unused); - } - - /// - /// Retrieve the name of a style. - /// Result is NUL-terminated. - /// (Scintilla feature 4030) - /// - public unsafe string NameOfStyle(int style) - { - byte[] nameBuffer = new byte[10000]; - fixed (byte* namePtr = nameBuffer) - { - Win32.SendMessage(scintilla, SciMsg.SCI_NAMEOFSTYLE, (IntPtr) style, (IntPtr) namePtr); - return Encoding.UTF8.GetString(nameBuffer).TrimEnd('\0'); - } - } - /// - /// Retrieve a ' ' separated list of style tags like "literal quoted string". - /// Result is NUL-terminated. - /// (Scintilla feature 4031) + /// Deprecated in 2.30 + /// In palette mode? + /// (Scintilla feature 2139) /// - public unsafe string TagsOfStyle(int style) + public bool GetUsePalette() { - byte[] tagsBuffer = new byte[10000]; - fixed (byte* tagsPtr = tagsBuffer) - { - Win32.SendMessage(scintilla, SciMsg.SCI_TAGSOFSTYLE, (IntPtr) style, (IntPtr) tagsPtr); - return Encoding.UTF8.GetString(tagsBuffer).TrimEnd('\0'); - } + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUSEPALETTE, Unused, Unused); + return 1 == (int) res; } /// - /// Retrieve a description of a style. - /// Result is NUL-terminated. - /// (Scintilla feature 4032) + /// In palette mode, Scintilla uses the environment's palette calls to display + /// more colours. This may lead to ugly displays. + /// (Scintilla feature 2039) /// - public unsafe string DescriptionOfStyle(int style) + public void SetUsePalette(bool usePalette) { - byte[] descriptionBuffer = new byte[10000]; - fixed (byte* descriptionPtr = descriptionBuffer) - { - Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIPTIONOFSTYLE, (IntPtr) style, (IntPtr) descriptionPtr); - return Encoding.UTF8.GetString(descriptionBuffer).TrimEnd('\0'); - } - } - - /// Retrieve bidirectional text display state. (Scintilla feature 2708) - public Bidirectional GetBidirectional() - { - return (Bidirectional)Win32.SendMessage(scintilla, SciMsg.SCI_GETBIDIRECTIONAL, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Set bidirectional text display state. (Scintilla feature 2709) - public void SetBidirectional(Bidirectional bidirectional) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETBIDIRECTIONAL, (IntPtr) bidirectional, (IntPtr) Unused); - } - - /// Retrieve line character index state. (Scintilla feature 2710) - public LineCharacterIndexType GetLineCharacterIndex() - { - return (LineCharacterIndexType)Win32.SendMessage(scintilla, SciMsg.SCI_GETLINECHARACTERINDEX, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Request line character index be created or its use count increased. (Scintilla feature 2711) - public void AllocateLineCharacterIndex(LineCharacterIndexType lineCharacterIndex) - { - Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATELINECHARACTERINDEX, (IntPtr) lineCharacterIndex, (IntPtr) Unused); - } - - /// Decrease use count of line character index and remove if 0. (Scintilla feature 2712) - public void ReleaseLineCharacterIndex(LineCharacterIndexType lineCharacterIndex) - { - Win32.SendMessage(scintilla, SciMsg.SCI_RELEASELINECHARACTERINDEX, (IntPtr) lineCharacterIndex, (IntPtr) Unused); - } - - /// Retrieve the document line containing a position measured in index units. (Scintilla feature 2713) - public int LineFromIndexPosition(int pos, LineCharacterIndexType lineCharacterIndex) - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_LINEFROMINDEXPOSITION, (IntPtr) pos, (IntPtr) lineCharacterIndex); - } - - /// Retrieve the position measured in index units at the start of a document line. (Scintilla feature 2714) - public int IndexPositionFromLine(int line, LineCharacterIndexType lineCharacterIndex) - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_INDEXPOSITIONFROMLINE, (IntPtr) line, (IntPtr) lineCharacterIndex); - } - - /// - /// Divide each styling byte into lexical class bits (default: 5) and indicator - /// bits (default: 3). If a lexer requires more than 32 lexical states, then this - /// is used to expand the possible states. - /// (Scintilla feature 2090) - /// - public void SetStyleBits(int bits) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLEBITS, (IntPtr) bits, (IntPtr) Unused); - } - - /// Retrieve number of bits in style bytes used to hold the lexical state. (Scintilla feature 2091) - public int GetStyleBits() - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITS, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Retrieve the number of bits the current lexer needs for styling. (Scintilla feature 4011) - public int GetStyleBitsNeeded() - { - return (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITSNEEDED, (IntPtr) Unused, (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUSEPALETTE, usePalette ? 1 : 0, Unused); } /// @@ -5184,29 +5147,14 @@ public int GetStyleBitsNeeded() /// public void SetKeysUnicode(bool keysUnicode) { - Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYSUNICODE, new IntPtr(keysUnicode ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYSUNICODE, keysUnicode ? 1 : 0, Unused); } /// Are keys always interpreted as Unicode? (Scintilla feature 2522) public bool GetKeysUnicode() { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETKEYSUNICODE, (IntPtr) Unused, (IntPtr) Unused); - } - - /// Is drawing done in two phases with backgrounds drawn before foregrounds? (Scintilla feature 2283) - public bool GetTwoPhaseDraw() - { - return 1 == (int)Win32.SendMessage(scintilla, SciMsg.SCI_GETTWOPHASEDRAW, (IntPtr) Unused, (IntPtr) Unused); - } - - /// - /// In twoPhaseDraw mode, drawing is performed in two phases, first the background - /// and then the foreground. This avoids chopping off characters that overlap the next run. - /// (Scintilla feature 2284) - /// - public void SetTwoPhaseDraw(bool twoPhase) - { - Win32.SendMessage(scintilla, SciMsg.SCI_SETTWOPHASEDRAW, new IntPtr(twoPhase ? 1 : 0), (IntPtr) Unused); + IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETKEYSUNICODE, Unused, Unused); + return 1 == (int) res; } /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ diff --git a/NppMarkdownPanel/PluginInfrastructure/Scintilla_iface.cs b/NppMarkdownPanel/PluginInfrastructure/Scintilla_iface.cs index 945c0cf..cc84383 100644 --- a/NppMarkdownPanel/PluginInfrastructure/Scintilla_iface.cs +++ b/NppMarkdownPanel/PluginInfrastructure/Scintilla_iface.cs @@ -21,7 +21,7 @@ public struct ScNotificationHeader /// /// environment specific window handle/pointer /// - public IntPtr hwndFrom; + public IntPtr hwndFrom; /// /// CtrlID of the window issuing the notification @@ -31,7 +31,7 @@ public struct ScNotificationHeader /// /// The SCN_* notification Code /// - public uint Code; + public uint Code; } [StructLayout(LayoutKind.Sequential)] @@ -160,8 +160,6 @@ public enum SciMsg : uint SCWS_VISIBLEAFTERINDENT = 2, - SCWS_VISIBLEONLYININDENT = 3, - /// Are white space characters currently visible? /// Returns one of SCWS_* constants. SCI_GETVIEWWS = 2020, @@ -169,17 +167,6 @@ public enum SciMsg : uint /// Make white space characters invisible, always visible or visible outside indentation. SCI_SETVIEWWS = 2021, - SCTD_LONGARROW = 0, - - SCTD_STRIKEOUT = 1, - - /// Retrieve the current tab draw mode. - /// Returns one of SCTD_* constants. - SCI_GETTABDRAWMODE = 2698, - - /// Set how tabs are drawn when visible. - SCI_SETTABDRAWMODE = 2699, - /// Find the position from a point within the window. SCI_POSITIONFROMPOINT = 2022, @@ -220,8 +207,8 @@ public enum SciMsg : uint /// Set the current end of line mode. SCI_SETEOLMODE = 2031, - /// Set the current styling position to start. - /// The unused parameter is no longer used and should be set to 0. + /// Set the current styling position to pos and the styling mask to mask. + /// The styling mask can be used to protect some bits in each styling byte from modification. SCI_STARTSTYLING = 2032, /// Change style from current styling position for length characters to a style @@ -260,7 +247,7 @@ public enum SciMsg : uint SC_IME_INLINE = 1, - /// Is the IME displayed in a window or inline? + /// Is the IME displayed in a winow or inline? SCI_GETIMEINTERACTION = 2678, /// Choose to display the the IME in a winow or inline. @@ -332,8 +319,6 @@ public enum SciMsg : uint SC_MARK_BOOKMARK = 31, - SC_MARK_VERTICALBOOKMARK = 32, - SC_MARK_CHARACTER = 10000, SC_MARKNUM_FOLDEREND = 25, @@ -409,8 +394,6 @@ public enum SciMsg : uint SC_MARGIN_RTEXT = 5, - SC_MARGIN_COLOUR = 6, - /// Set a margin to be either numeric or symbolic. SCI_SETMARGINTYPEN = 2240, @@ -441,18 +424,6 @@ public enum SciMsg : uint /// Retrieve the cursor shown in a margin. SCI_GETMARGINCURSORN = 2249, - /// Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. - SCI_SETMARGINBACKN = 2250, - - /// Retrieve the background colour of a margin - SCI_GETMARGINBACKN = 2251, - - /// Allocate a non-standard number of margins. - SCI_SETMARGINS = 2252, - - /// How many margins are there?. - SCI_GETMARGINS = 2253, - STYLE_DEFAULT = 32, STYLE_LINENUMBER = 33, @@ -467,8 +438,6 @@ public enum SciMsg : uint STYLE_CALLTIP = 38, - STYLE_FOLDDISPLAYTEXT = 39, - STYLE_LASTPREDEFINED = 39, STYLE_MAX = 255, @@ -495,8 +464,6 @@ public enum SciMsg : uint SC_CHARSET_RUSSIAN = 204, - SC_CHARSET_OEM866 = 866, - SC_CHARSET_CYRILLIC = 1251, SC_CHARSET_SHIFTJIS = 128, @@ -553,8 +520,6 @@ public enum SciMsg : uint SC_CASE_LOWER = 2, - SC_CASE_CAMEL = 3, - /// Get the foreground colour of a style. SCI_STYLEGETFORE = 2481, @@ -647,10 +612,10 @@ public enum SciMsg : uint /// Set the foreground colour of the caret. SCI_SETCARETFORE = 2069, - /// When key+modifier combination keyDefinition is pressed perform sciCommand. + /// When key+modifier combination km is pressed perform msg. SCI_ASSIGNCMDKEY = 2070, - /// When key+modifier combination keyDefinition is pressed do nothing. + /// When key+modifier combination km is pressed do nothing. SCI_CLEARCMDKEY = 2071, /// Drop all key mappings. @@ -676,12 +641,6 @@ public enum SciMsg : uint /// Returns the number of characters SCI_GETWORDCHARS = 2646, - /// Set the number of characters to have directly indexed categories - SCI_SETCHARACTERCATEGORYOPTIMIZATION = 2720, - - /// Get the number of characters to have directly indexed categories - SCI_GETCHARACTERCATEGORYOPTIMIZATION = 2721, - /// Start a sequence of actions that is undone and redone as a unit. /// May be nested. SCI_BEGINUNDOACTION = 2078, @@ -725,29 +684,21 @@ public enum SciMsg : uint INDIC_TEXTFORE = 17, - INDIC_POINT = 18, - - INDIC_POINTCHARACTER = 19, - - INDIC_GRADIENT = 20, - - INDIC_GRADIENTCENTRE = 21, - - INDIC_CONTAINER = 8, - INDIC_IME = 32, INDIC_IME_MAX = 35, INDIC_MAX = 35, - INDICATOR_CONTAINER = 8, + INDIC_CONTAINER = 8, - INDICATOR_IME = 32, + INDIC0_MASK = 0x20, + + INDIC1_MASK = 0x40, - INDICATOR_IME_MAX = 35, + INDIC2_MASK = 0x80, - INDICATOR_MAX = 35, + INDICS_MASK = 0xE0, /// Set an indicator to plain, squiggle or TT. SCI_INDICSETSTYLE = 2080, @@ -803,6 +754,14 @@ public enum SciMsg : uint /// Get the size of the dots used to mark space characters. SCI_GETWHITESPACESIZE = 2087, + /// Divide each styling byte into lexical class bits (default: 5) and indicator + /// bits (default: 3). If a lexer requires more than 32 lexical states, then this + /// is used to expand the possible states. + SCI_SETSTYLEBITS = 2090, + + /// Retrieve number of bits in style bytes used to hold the lexical state. + SCI_GETSTYLEBITS = 2091, + /// Used to hold extra styling information for each line. SCI_SETLINESTATE = 2092, @@ -824,20 +783,12 @@ public enum SciMsg : uint /// Set the colour of the background of the line containing the caret. SCI_SETCARETLINEBACK = 2098, - /// Retrieve the caret line frame width. - /// Width = 0 means this option is disabled. - SCI_GETCARETLINEFRAME = 2704, - - /// Display the caret line framed. - /// Set width != 0 to enable this option and width = 0 to disable it. - SCI_SETCARETLINEFRAME = 2705, - /// Set a style to be changeable or not (read only). /// Experimental feature, currently buggy. SCI_STYLESETCHANGEABLE = 2099, /// Display a auto-completion list. - /// The lengthEntered parameter indicates how many characters before + /// The lenEntered parameter indicates how many characters before /// the caret should be used to provide context. SCI_AUTOCSHOW = 2100, @@ -961,9 +912,6 @@ public enum SciMsg : uint /// Count characters between two positions. SCI_COUNTCHARACTERS = 2633, - /// Count code units between two positions. - SCI_COUNTCODEUNITS = 2715, - /// Show or hide the horizontal scroll bar. SCI_SETHSCROLLBAR = 2130, @@ -1012,7 +960,7 @@ public enum SciMsg : uint /// Returns the position at the start of the selection. SCI_GETSELECTIONSTART = 2143, - /// Sets the position that ends the selection - this becomes the caret. + /// Sets the position that ends the selection - this becomes the currentPosition. SCI_SETSELECTIONEND = 2144, /// Returns the position at the end of the selection. @@ -1037,16 +985,12 @@ public enum SciMsg : uint SC_PRINT_COLOURONWHITEDEFAULTBG = 4, - SC_PRINT_SCREENCOLOURS = 5, - /// Modify colours when printing for clearer printed text. SCI_SETPRINTCOLOURMODE = 2148, /// Returns the print colour mode. SCI_GETPRINTCOLOURMODE = 2149, - SCFIND_NONE = 0x0, - SCFIND_WHOLEWORD = 0x2, SCFIND_MATCHCASE = 0x4, @@ -1102,7 +1046,7 @@ public enum SciMsg : uint /// Return the length of the text. SCI_GETTEXTRANGE = 2162, - /// Draw the selection either highlighted or in normal (non-highlighted) style. + /// Draw the selection in normal style or with selection highlighted. SCI_HIDESELECTION = 2163, /// Retrieve the x value of the point in the window where a position is displayed. @@ -1211,12 +1155,6 @@ public enum SciMsg : uint /// Retrieve the text in the target. SCI_GETTARGETTEXT = 2687, - /// Make the target range start and end be the same as the selection range start and end. - SCI_TARGETFROMSELECTION = 2287, - - /// Sets the target to the whole document. - SCI_TARGETWHOLEDOCUMENT = 2690, - /// Replace the target text with the argument text. /// Text is counted so it can contain NULs. /// Returns the length of the replacement text. @@ -1232,7 +1170,7 @@ public enum SciMsg : uint /// Search for a counted string in the target and set the target to the found /// range. Text is counted so it can contain NULs. - /// Returns start of found range or -1 for failure in which case target is not moved. + /// Returns length of range or -1 for failure in which case target is not moved. SCI_SEARCHINTARGET = 2197, /// Set the search flags used by SearchInTarget. @@ -1326,27 +1264,6 @@ public enum SciMsg : uint /// Switch a header line between expanded and contracted. SCI_TOGGLEFOLD = 2231, - /// Switch a header line between expanded and contracted and show some text after the line. - SCI_TOGGLEFOLDSHOWTEXT = 2700, - - SC_FOLDDISPLAYTEXT_HIDDEN = 0, - - SC_FOLDDISPLAYTEXT_STANDARD = 1, - - SC_FOLDDISPLAYTEXT_BOXED = 2, - - /// Set the style of fold display text. - SCI_FOLDDISPLAYTEXTSETSTYLE = 2701, - - /// Get the style of fold display text. - SCI_FOLDDISPLAYTEXTGETSTYLE = 2707, - - /// Set the default fold display text. - SCI_SETDEFAULTFOLDDISPLAYTEXT = 2722, - - /// Get the default fold display text. - SCI_GETDEFAULTFOLDDISPLAYTEXT = 2723, - SC_FOLDACTION_CONTRACT = 0, SC_FOLDACTION_EXPAND = 1, @@ -1425,23 +1342,6 @@ public enum SciMsg : uint /// Get position of end of word. SCI_WORDENDPOSITION = 2267, - /// Is the range start..end considered a word? - SCI_ISRANGEWORD = 2691, - - SC_IDLESTYLING_NONE = 0, - - SC_IDLESTYLING_TOVISIBLE = 1, - - SC_IDLESTYLING_AFTERVISIBLE = 2, - - SC_IDLESTYLING_ALL = 3, - - /// Sets limits to idle styling. - SCI_SETIDLESTYLING = 2692, - - /// Retrieve the limits to idle styling. - SCI_GETIDLESTYLING = 2693, - SC_WRAP_NONE = 0, SC_WRAP_WORD = 1, @@ -1494,8 +1394,6 @@ public enum SciMsg : uint SC_WRAPINDENT_INDENT = 2, - SC_WRAPINDENT_DEEPINDENT = 3, - /// Sets how wrapped sublines are placed. Default is fixed. SCI_SETWRAPINDENTMODE = 2472, @@ -1554,6 +1452,13 @@ public enum SciMsg : uint /// Append a string to the end of the document without changing the selection. SCI_APPENDTEXT = 2282, + /// Is drawing done in two phases with backgrounds drawn before foregrounds? + SCI_GETTWOPHASEDRAW = 2283, + + /// In twoPhaseDraw mode, drawing is performed in two phases, first the background + /// and then the foreground. This avoids chopping off characters that overlap the next run. + SCI_SETTWOPHASEDRAW = 2284, + SC_PHASES_ONE = 0, SC_PHASES_TWO = 1, @@ -1595,13 +1500,16 @@ public enum SciMsg : uint /// Change the effect of pasting when there are multiple selections. SCI_SETMULTIPASTE = 2614, - /// Retrieve the effect of pasting when there are multiple selections. + /// Retrieve the effect of pasting when there are multiple selections.. SCI_GETMULTIPASTE = 2615, /// Retrieve the value of a tag from a regular expression search. /// Result is NUL-terminated. SCI_GETTAG = 2616, + /// Make the target range start and end be the same as the selection range start and end. + SCI_TARGETFROMSELECTION = 2287, + /// Join the lines in the target. SCI_LINESJOIN = 2288, @@ -1609,22 +1517,12 @@ public enum SciMsg : uint /// where possible. SCI_LINESSPLIT = 2289, - /// Set one of the colours used as a chequerboard pattern in the fold margin + /// Set the colours used as a chequerboard pattern in the fold margin SCI_SETFOLDMARGINCOLOUR = 2290, - /// Set the other colour used as a chequerboard pattern in the fold margin + /// Set the colours used as a chequerboard pattern in the fold margin SCI_SETFOLDMARGINHICOLOUR = 2291, - SC_ACCESSIBILITY_DISABLED = 0, - - SC_ACCESSIBILITY_ENABLED = 1, - - /// Enable or disable accessibility. - SCI_SETACCESSIBILITY = 2702, - - /// Report accessibility status. - SCI_GETACCESSIBILITY = 2703, - /// Move caret down one line. SCI_LINEDOWN = 2300, @@ -1750,9 +1648,6 @@ public enum SciMsg : uint /// Switch the current line with the previous. SCI_LINETRANSPOSE = 2339, - /// Reverse order of selected lines. - SCI_LINEREVERSE = 2354, - /// Duplicate the current line. SCI_LINEDUPLICATE = 2404, @@ -1786,28 +1681,46 @@ public enum SciMsg : uint /// caret position. SCI_LINEENDDISPLAYEXTEND = 2348, - /// Like Home but when word-wrap is enabled goes first to start of display line - /// HomeDisplay, then to start of document line Home. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. SCI_HOMEWRAP = 2349, - /// Like HomeExtend but when word-wrap is enabled extends first to start of display line - /// HomeDisplayExtend, then to start of document line HomeExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. SCI_HOMEWRAPEXTEND = 2450, - /// Like LineEnd but when word-wrap is enabled goes first to end of display line - /// LineEndDisplay, then to start of document line LineEnd. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. SCI_LINEENDWRAP = 2451, - /// Like LineEndExtend but when word-wrap is enabled extends first to end of display line - /// LineEndDisplayExtend, then to start of document line LineEndExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. SCI_LINEENDWRAPEXTEND = 2452, - /// Like VCHome but when word-wrap is enabled goes first to start of display line - /// VCHomeDisplay, then behaves like VCHome. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. SCI_VCHOMEWRAP = 2453, - /// Like VCHomeExtend but when word-wrap is enabled extends first to start of display line - /// VCHomeDisplayExtend, then behaves like VCHomeExtend. + /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? + /// except they behave differently when word-wrap is enabled: + /// They go first to the start / end of the display line, like (Home|LineEnd)Display + /// The difference is that, the cursor is already at the point, it goes on to the start + /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. SCI_VCHOMEWRAPEXTEND = 2454, /// Copy the line containing the caret. @@ -1832,7 +1745,6 @@ public enum SciMsg : uint SCI_BRACEBADLIGHTINDICATOR = 2499, /// Find the position of a matching brace or INVALID_POSITION if no match. - /// The maxReStyle must be 0 for now. It may be defined in a future release. SCI_BRACEMATCH = 2353, /// Are the end of line characters visible? @@ -1856,8 +1768,6 @@ public enum SciMsg : uint EDGE_BACKGROUND = 2, - EDGE_MULTILINE = 3, - /// Retrieve the column number which text should be kept within. SCI_GETEDGECOLUMN = 2360, @@ -1868,7 +1778,7 @@ public enum SciMsg : uint /// Retrieve the edge highlight mode. SCI_GETEDGEMODE = 2362, - /// The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that + /// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that /// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). SCI_SETEDGEMODE = 2363, @@ -1878,12 +1788,6 @@ public enum SciMsg : uint /// Change the colour used in edge indication. SCI_SETEDGECOLOUR = 2365, - /// Add a new vertical edge to the view. - SCI_MULTIEDGEADDLINE = 2694, - - /// Clear all vertical edges. - SCI_MULTIEDGECLEARALL = 2695, - /// Sets the current caret position to be the search anchor. SCI_SEARCHANCHOR = 2366, @@ -1898,14 +1802,8 @@ public enum SciMsg : uint /// Retrieves the number of lines completely visible. SCI_LINESONSCREEN = 2370, - SC_POPUP_NEVER = 0, - - SC_POPUP_ALL = 1, - - SC_POPUP_TEXT = 2, - /// Set whether a pop up menu is displayed automatically when the user presses - /// the wrong mouse button on certain areas. + /// the wrong mouse button. SCI_USEPOPUP = 2371, /// Is the selection rectangular? The alternative is the more common stream selection. @@ -1918,12 +1816,6 @@ public enum SciMsg : uint /// Retrieve the zoom level. SCI_GETZOOM = 2374, - SC_DOCUMENTOPTION_DEFAULT = 0, - - SC_DOCUMENTOPTION_STYLES_NONE = 0x1, - - SC_DOCUMENTOPTION_TEXT_LARGE = 0x100, - /// Create a new document object. /// Starts with reference count of 1 and not selected into editor. SCI_CREATEDOCUMENT = 2375, @@ -1934,18 +1826,9 @@ public enum SciMsg : uint /// Release a reference to the document, deleting document if it fades to black. SCI_RELEASEDOCUMENT = 2377, - /// Get which document options are set. - SCI_GETDOCUMENTOPTIONS = 2379, - /// Get which document modification events are sent to the container. SCI_GETMODEVENTMASK = 2378, - /// Set whether command events are sent to the container. - SCI_SETCOMMANDEVENTS = 2717, - - /// Get whether command events are sent to the container. - SCI_GETCOMMANDEVENTS = 2718, - /// Change internal focus flag. SCI_SETFOCUS = 2380, @@ -1974,12 +1857,6 @@ public enum SciMsg : uint /// Get whether mouse gets captured. SCI_GETMOUSEDOWNCAPTURES = 2385, - /// Set whether the mouse wheel can be active outside the window. - SCI_SETMOUSEWHEELCAPTURES = 2696, - - /// Get whether mouse wheel can be active outside the window. - SCI_GETMOUSEWHEELCAPTURES = 2697, - SC_CURSORNORMAL = 0xFFFFFFFF, SC_CURSORARROW = 2, @@ -2029,10 +1906,10 @@ public enum SciMsg : uint /// Delete forwards from the current position to the end of the line. SCI_DELLINERIGHT = 2396, - /// Set the xOffset (ie, horizontal scroll position). + /// Get and Set the xOffset (ie, horizontal scroll position). SCI_SETXOFFSET = 2397, - /// Get the xOffset (ie, horizontal scroll position). + /// Get and Set the xOffset (ie, horizontal scroll position). SCI_GETXOFFSET = 2398, /// Set the last x chosen value to be the caret x position. @@ -2087,16 +1964,16 @@ public enum SciMsg : uint /// Get the HotspotSingleLine property SCI_GETHOTSPOTSINGLELINE = 2497, - /// Move caret down one paragraph (delimited by empty lines). + /// Move caret between paragraphs (delimited by empty lines). SCI_PARADOWN = 2413, - /// Extend selection down one paragraph (delimited by empty lines). + /// Move caret between paragraphs (delimited by empty lines). SCI_PARADOWNEXTEND = 2414, - /// Move caret up one paragraph (delimited by empty lines). + /// Move caret between paragraphs (delimited by empty lines). SCI_PARAUP = 2415, - /// Extend selection up one paragraph (delimited by empty lines). + /// Move caret between paragraphs (delimited by empty lines). SCI_PARAUPEXTEND = 2416, /// Given a valid document position, return the previous position taking code @@ -2111,11 +1988,6 @@ public enum SciMsg : uint /// of characters. Returned value is always between 0 and last position in document. SCI_POSITIONRELATIVE = 2670, - /// Given a valid document position, return a position that differs in a number - /// of UTF-16 code units. Returned value is always between 0 and last position in document. - /// The result may point half way (2 bytes) inside a non-BMP character. - SCI_POSITIONRELATIVECODEUNITS = 2716, - /// Copy a range of text to the clipboard. Positions are clipped into the document. SCI_COPYRANGE = 2419, @@ -2137,9 +2009,6 @@ public enum SciMsg : uint /// Get the mode of the current selection. SCI_GETSELECTIONMODE = 2423, - /// Get whether or not regular caret moves will extend or reduce the selection. - SCI_GETMOVEEXTENDSSELECTION = 2706, - /// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). SCI_GETLINESELSTARTPOSITION = 2424, @@ -2241,7 +2110,7 @@ public enum SciMsg : uint /// Change the effect of autocompleting when there are multiple selections. SCI_AUTOCSETMULTI = 2636, - /// Retrieve the effect of autocompleting when there are multiple selections. + /// Retrieve the effect of autocompleting when there are multiple selections.. SCI_AUTOCGETMULTI = 2637, SC_ORDER_PRESORTED = 0, @@ -2318,14 +2187,6 @@ public enum SciMsg : uint CARETSTYLE_BLOCK = 2, - CARETSTYLE_OVERSTRIKE_BAR = 0, - - CARETSTYLE_OVERSTRIKE_BLOCK = 0x10, - - CARETSTYLE_INS_MASK = 0xF, - - CARETSTYLE_BLOCK_AFTER = 0x100, - /// Set the style of the caret to be drawn. SCI_SETCARETSTYLE = 2512, @@ -2350,10 +2211,10 @@ public enum SciMsg : uint /// Turn a indicator off over a range. SCI_INDICATORCLEARRANGE = 2505, - /// Are any indicators present at pos? + /// Are any indicators present at position? SCI_INDICATORALLONFOR = 2506, - /// What value does a particular indicator have at a position? + /// What value does a particular indicator have at at a position? SCI_INDICATORVALUEAT = 2507, /// Where does a particular indicator start? @@ -2377,7 +2238,7 @@ public enum SciMsg : uint /// Return a read-only pointer to a range of characters in the document. /// May move the gap so that the range is contiguous, but will only move up - /// to lengthRange bytes. + /// to rangeLength bytes. SCI_GETRANGEPOINTER = 2643, /// Return a position which, to avoid performance costs, should not be within @@ -2498,8 +2359,6 @@ public enum SciMsg : uint /// Allocate some extended (>255) style numbers and return the start of the range SCI_ALLOCATEEXTENDEDSTYLES = 2553, - UNDO_NONE = 0, - UNDO_MAY_COALESCE = 1, /// Add a container action to the undo stack @@ -2566,28 +2425,28 @@ public enum SciMsg : uint /// Which selection is the main selection SCI_GETMAINSELECTION = 2575, - /// Set the caret position of the nth selection. + /// Which selection is the main selection SCI_SETSELECTIONNCARET = 2576, - /// Return the caret position of the nth selection. + /// Which selection is the main selection SCI_GETSELECTIONNCARET = 2577, - /// Set the anchor position of the nth selection. + /// Which selection is the main selection SCI_SETSELECTIONNANCHOR = 2578, - /// Return the anchor position of the nth selection. + /// Which selection is the main selection SCI_GETSELECTIONNANCHOR = 2579, - /// Set the virtual space of the caret of the nth selection. + /// Which selection is the main selection SCI_SETSELECTIONNCARETVIRTUALSPACE = 2580, - /// Return the virtual space of the caret of the nth selection. + /// Which selection is the main selection SCI_GETSELECTIONNCARETVIRTUALSPACE = 2581, - /// Set the virtual space of the anchor of the nth selection. + /// Which selection is the main selection SCI_SETSELECTIONNANCHORVIRTUALSPACE = 2582, - /// Return the virtual space of the anchor of the nth selection. + /// Which selection is the main selection SCI_GETSELECTIONNANCHORVIRTUALSPACE = 2583, /// Sets the position that starts the selection - this becomes the anchor. @@ -2602,28 +2461,28 @@ public enum SciMsg : uint /// Returns the position at the end of the selection. SCI_GETSELECTIONNEND = 2587, - /// Set the caret position of the rectangular selection. + /// Returns the position at the end of the selection. SCI_SETRECTANGULARSELECTIONCARET = 2588, - /// Return the caret position of the rectangular selection. + /// Returns the position at the end of the selection. SCI_GETRECTANGULARSELECTIONCARET = 2589, - /// Set the anchor position of the rectangular selection. + /// Returns the position at the end of the selection. SCI_SETRECTANGULARSELECTIONANCHOR = 2590, - /// Return the anchor position of the rectangular selection. + /// Returns the position at the end of the selection. SCI_GETRECTANGULARSELECTIONANCHOR = 2591, - /// Set the virtual space of the caret of the rectangular selection. + /// Returns the position at the end of the selection. SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE = 2592, - /// Return the virtual space of the caret of the rectangular selection. + /// Returns the position at the end of the selection. SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE = 2593, - /// Set the virtual space of the anchor of the rectangular selection. + /// Returns the position at the end of the selection. SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE = 2594, - /// Return the virtual space of the anchor of the rectangular selection. + /// Returns the position at the end of the selection. SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE = 2595, SCVS_NONE = 0, @@ -2632,15 +2491,13 @@ public enum SciMsg : uint SCVS_USERACCESSIBLE = 2, - SCVS_NOWRAPLINESTART = 4, - - /// Set options for virtual space behaviour. + /// Returns the position at the end of the selection. SCI_SETVIRTUALSPACEOPTIONS = 2596, - /// Return options for virtual space behaviour. + /// Returns the position at the end of the selection. SCI_GETVIRTUALSPACEOPTIONS = 2597, - /// On GTK, allow selecting the modifier key to use for mouse-based + /// On GTK+, allow selecting the modifier key to use for mouse-based /// rectangular selection. Often the window manager requires Alt+Mouse Drag /// for moving windows. /// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. @@ -2675,14 +2532,6 @@ public enum SciMsg : uint /// Swap that caret and anchor of the main selection. SCI_SWAPMAINANCHORCARET = 2607, - /// Add the next occurrence of the main selection to the set of selections as main. - /// If the current selection is empty then select word around caret. - SCI_MULTIPLESELECTADDNEXT = 2688, - - /// Add each occurrence of the main selection in the target to the set of selections. - /// If the current selection is empty then select word around caret. - SCI_MULTIPLESELECTADDEACH = 2689, - /// Indicate that the internal state of a lexer has changed over a range and therefore /// there may be a need to redraw. SCI_CHANGELEXERSTATE = 2617, @@ -2700,7 +2549,7 @@ public enum SciMsg : uint /// Move the selected lines down one line, shifting the line below before the selection SCI_MOVESELECTEDLINESDOWN = 2621, - /// Set the identifier reported as idFrom in notification messages. + /// Set the identifier reported as IdFrom in notification messages. SCI_SETIDENTIFIER = 2622, /// Get the identifier. @@ -2833,6 +2682,9 @@ public enum SciMsg : uint /// interpreted as an int AFTER any "$()" variable replacement. SCI_GETPROPERTYINT = 4010, + /// Retrieve the number of bits the current lexer needs for styling. + SCI_GETSTYLEBITSNEEDED = 4011, + /// Retrieve the name of the lexer. /// Return the length of the text. /// Result is NUL-terminated. @@ -2895,23 +2747,6 @@ public enum SciMsg : uint /// Result is NUL-terminated. SCI_GETSUBSTYLEBASES = 4026, - /// Retrieve the number of named styles for the lexer. - SCI_GETNAMEDSTYLES = 4029, - - /// Retrieve the name of a style. - /// Result is NUL-terminated. - SCI_NAMEOFSTYLE = 4030, - - /// Retrieve a ' ' separated list of style tags like "literal quoted string". - /// Result is NUL-terminated. - SCI_TAGSOFSTYLE = 4031, - - /// Retrieve a description of a style. - /// Result is NUL-terminated. - SCI_DESCRIPTIONOFSTYLE = 4032, - - SC_MOD_NONE = 0x0, - SC_MOD_INSERTTEXT = 0x1, SC_MOD_DELETETEXT = 0x2, @@ -3024,22 +2859,6 @@ public enum SciMsg : uint SCMOD_META = 16, - SC_AC_FILLUP = 1, - - SC_AC_DOUBLECLICK = 2, - - SC_AC_TAB = 3, - - SC_AC_NEWLINE = 4, - - SC_AC_COMMAND = 5, - - SC_CHARACTERSOURCE_DIRECT_INPUT = 0, - - SC_CHARACTERSOURCE_TENTATIVE_INPUT = 1, - - SC_CHARACTERSOURCE_IME_RESULT = 2, - /// Events SCN_STYLENEEDED = 2000, @@ -3055,130 +2874,87 @@ public enum SciMsg : uint /// Events SCN_MODIFYATTEMPTRO = 2004, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_KEY = 2005, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_DOUBLECLICK = 2006, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_UPDATEUI = 2007, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_MODIFIED = 2008, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_MACRORECORD = 2009, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_MARGINCLICK = 2010, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_NEEDSHOWN = 2011, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_PAINTED = 2013, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_USERLISTSELECTION = 2014, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_URIDROPPED = 2015, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_DWELLSTART = 2016, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_DWELLEND = 2017, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_ZOOM = 2018, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_HOTSPOTCLICK = 2019, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_HOTSPOTDOUBLECLICK = 2020, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_CALLTIPCLICK = 2021, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_AUTOCSELECTION = 2022, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_INDICATORCLICK = 2023, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_INDICATORRELEASE = 2024, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_AUTOCCANCELLED = 2025, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_AUTOCCHARDELETED = 2026, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_HOTSPOTRELEASECLICK = 2027, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_FOCUSIN = 2028, - /// GTK Specific to work around focus and accelerator problems: + /// GTK+ Specific to work around focus and accelerator problems: SCN_FOCUSOUT = 2029, - /// GTK Specific to work around focus and accelerator problems: - SCN_AUTOCCOMPLETED = 2030, - - /// GTK Specific to work around focus and accelerator problems: - SCN_MARGINRIGHTCLICK = 2031, - - /// GTK Specific to work around focus and accelerator problems: - SCN_AUTOCSELECTIONCHANGE = 2032, - - SC_BIDIRECTIONAL_DISABLED = 0, - - SC_BIDIRECTIONAL_L2R = 1, - - SC_BIDIRECTIONAL_R2L = 2, - - /// Retrieve bidirectional text display state. - SCI_GETBIDIRECTIONAL = 2708, - - /// Set bidirectional text display state. - SCI_SETBIDIRECTIONAL = 2709, - - SC_LINECHARACTERINDEX_NONE = 0, - - SC_LINECHARACTERINDEX_UTF32 = 1, - - SC_LINECHARACTERINDEX_UTF16 = 2, - - /// Retrieve line character index state. - SCI_GETLINECHARACTERINDEX = 2710, - - /// Request line character index be created or its use count increased. - SCI_ALLOCATELINECHARACTERINDEX = 2711, - - /// Decrease use count of line character index and remove if 0. - SCI_RELEASELINECHARACTERINDEX = 2712, - - /// Retrieve the document line containing a position measured in index units. - SCI_LINEFROMINDEXPOSITION = 2713, - - /// Retrieve the position measured in index units at the start of a document line. - SCI_INDEXPOSITIONFROMLINE = 2714, - - /// Divide each styling byte into lexical class bits (default: 5) and indicator - /// bits (default: 3). If a lexer requires more than 32 lexical states, then this - /// is used to expand the possible states. - SCI_SETSTYLEBITS = 2090, + SC_CP_DBCS = 1, - /// Retrieve number of bits in style bytes used to hold the lexical state. - SCI_GETSTYLEBITS = 2091, + /// Deprecated in 2.30 + /// In palette mode? + SCI_GETUSEPALETTE = 2139, - /// Retrieve the number of bits the current lexer needs for styling. - SCI_GETSTYLEBITSNEEDED = 4011, + /// In palette mode, Scintilla uses the environment's palette calls to display + /// more colours. This may lead to ugly displays. + SCI_SETUSEPALETTE = 2039, /// Deprecated in 3.5.5 /// Always interpret keyboard input as Unicode @@ -3187,21 +2963,6 @@ public enum SciMsg : uint /// Are keys always interpreted as Unicode? SCI_GETKEYSUNICODE = 2522, - /// Is drawing done in two phases with backgrounds drawn before foregrounds? - SCI_GETTWOPHASEDRAW = 2283, - - /// In twoPhaseDraw mode, drawing is performed in two phases, first the background - /// and then the foreground. This avoids chopping off characters that overlap the next run. - SCI_SETTWOPHASEDRAW = 2284, - - INDIC0_MASK = 0x20, - - INDIC1_MASK = 0x40, - - INDIC2_MASK = 0x80, - - INDICS_MASK = 0xE0, - /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ SC_SEARCHRESULT_LINEBUFFERMAXLENGTH = 1024 diff --git a/NppMarkdownPanel/Properties/AssemblyInfo.cs b/NppMarkdownPanel/Properties/AssemblyInfo.cs index 58d83df..aa7b84d 100644 --- a/NppMarkdownPanel/Properties/AssemblyInfo.cs +++ b/NppMarkdownPanel/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.6.0.*")] -[assembly: AssemblyFileVersion("0.6.0.0")] +[assembly: AssemblyVersion("0.6.1.*")] +[assembly: AssemblyFileVersion("0.6.1.0")]