PageRenderTime 105ms CodeModel.GetById 88ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/lib/sci.ahk

http://github.com/Skiouros/Macro
AutoHotKey | 2820 lines | 490 code | 191 blank | 2139 comment | 21 complexity | 2728862b27df57b342fabef7e1f2edee MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1; Title: Scintilla Wrapper for AHK
   2
   3; Group: Helper Functions
   4
   5/*
   6    Function: Add
   7    Creates a Scintilla component and adds it to the Parent GUI.
   8
   9    This function initializes the Scintilla Component.
  10    See <http://www.scintilla.org/Steps.html> for more information on how to add the component to a GUI/Control.
  11
  12    Parameters:
  13    SCI_Add(hParent, [x, y, w, h, Styles, MsgHandler, DllPath])
  14
  15    hParent     -   Hwnd of the parent control who will host the Scintilla Component
  16    x           -   x position for the control (default 5)
  17    y           -   y position for the control (default 15)
  18    w           -   Width of the control (default 390)
  19    h           -   Height of the control (default 270)
  20    Styles      -   List of window style variable names separated by spaces.
  21                    The WS_ prefix for the variables is optional.
  22                    Full list of Style names can be found at
  23                    <http://msdn.microsoft.com/en-us/library/ms632600%28v=vs.85%29.aspx>.
  24
  25    MsgHandler  -   Name of the function that will handle the window messages sent by the control.
  26                    This is very useful for when creating personalized lexing or folding for your control.
  27    DllPath     -   Path to the SciLexer.dll file, if omitted the function looks for it in *a_scriptdir*.
  28
  29    Returns:
  30    HWND - Component handle.
  31
  32    Examples:
  33    (start code)
  34    ; Add a component with default values.
  35    ; It expects scilexer.dll to be on the script's location.
  36    ; The default values are calculated to fit optimally on a 400x300 GUI/Control
  37
  38    Gui +LastFound
  39    hwnd:=WinExist()
  40    hSci:=SCI_Add(hwnd)
  41    Gui, show, w400 h300
  42    return
  43
  44    ;---------------------
  45    ; Add a component with default values.
  46    ; It expects scilexer.dll to be on the script's location.
  47    ; This script also adds some styles.
  48    ; If variables "x,y,w,h" are empty the default values are used.
  49
  50    Gui +LastFound
  51    hwnd:=WinExist()
  52    hSci:=SCI_Add(hwnd, x, y, w, h, "WS_CHILD WS_BORDER WS_VISIBLE")
  53    Gui, show, w400 h300
  54    return
  55
  56    ;---------------------
  57    ; Add a component embedded in a tab with additional code for
  58    ; hiding/showing the component depending on which tab is open.
  59    ; If variables "x,w,h" are empty the default values are used.
  60
  61    Gui, add, Tab2, HWNDhwndtab x0 y0 w400 h300 gtabHandler vtabLast,one|two
  62    hSci:=SCI_Add(hwndtab,x,25,w,h,"Child Border Visible","",a_desktop "\scilexer.dll")
  63    Gui, show, w400 h300
  64    return
  65
  66    tabHandler:                             ; Tab Handler for the Scintilla Control
  67    Gui, submit, Nohide
  68    action := tabLast = "one" ? "Show" : "Hide" ; decide which action to take
  69    Control,%action%,,,ahk_id %hSci%
  70    return
  71    (end)
  72*/
  73SCI_Add(hParent, x=5, y=15, w=390, h=270, Styles="", MsgHandler="", DllPath=""){
  74    static WS_OVERLAPPED:=0x00000000,WS_POPUP:=0x80000000,WS_CHILD:=0x40000000,WS_MINIMIZE:=0x20000000
  75    ,WS_VISIBLE:=0x10000000,WS_DISABLED:=0x08000000,WS_CLIPSIBLINGS:=0x04000000,WS_CLIPCHILDREN:=0x02000000
  76    ,WS_MAXIMIZE:=0x01000000,WS_CAPTION:=0x00C00000,WS_BORDER:=0x00800000,WS_DLGFRAME:=0x00400000
  77    ,WS_VSCROLL:=0x00200000,WS_HSCROLL:=0x00100000,WS_SYSMENU:=0x00080000,WS_THICKFRAME:=0x00040000
  78    ,WS_GROUP:=0x00020000,WS_TABSTOP:=0x00010000,WS_MINIMIZEBOX:=0x00020000,WS_MAXIMIZEBOX:=0x00010000
  79    ,WS_TILED:=0x00000000,WS_ICONIC:=0x20000000,WS_SIZEBOX:=0x00040000,WS_EX_CLIENTEDGE:=0x00000200
  80    ,GuiID:=311210,init:=False, NULL:=0
  81
  82    if !init        ;  WM_NOTIFY = 0x4E
  83        old:=OnMessage(0x4E,"SCI_onNotify"),init:=True,old!="SCI_onNotify" ? SCI("oldNotify", RegisterCallback(old))
  84
  85    if !SCIModule:=DllCall("LoadLibrary", "Str", DllPath ? DllPath : "SciLexer.dll")
  86        return debug ? A_ThisFunc "> Could not load library: " DllPath : -1
  87
  88    hStyle := WS_CHILD | (VISIBILITY := InStr(Styles, "Hidden") ? 0 : WS_VISIBLE) | WS_TABSTOP
  89
  90    if Styles
  91        Loop, Parse, Styles, %a_tab%%a_space%, %a_tab%%a_space%
  92            hStyle |= %a_loopfield%+0 ? %a_loopfield% : WS_%a_loopfield% ? WS_%a_loopfield% : 0
  93
  94    hSci:=DllCall("CreateWindowEx"
  95                 ,Uint ,WS_EX_CLIENTEDGE        ; Ex Style
  96                 ,Str  ,"Scintilla"             ; Class Name
  97                 ,Str  ,""                      ; Window Name
  98                 ,UInt ,hStyle                  ; Window Styles
  99                 ,Int  ,x ? x : 5               ; x
 100                 ,Int  ,y ? y : 15              ; y
 101                 ,Int  ,w ? w : 390             ; Width
 102                 ,Int  ,h ? h : 270             ; Height
 103                 ,UInt ,hParent                 ; Parent HWND
 104                 ,UInt ,GuiID                   ; (HMENU)GuiID
 105                 ,UInt ,NULL                    ; hInstance
 106                 ,UInt ,NULL, "UInt")           ; lpParam
 107
 108                 ,SCI(hSci, True)               ; used to check if that handle exist.
 109                 ,SCI_sendEditor(hSci)          ; initialize SCI_sendEditor function
 110                 ,IsFunc(MsgHandler) ? SCI(hSci "MsgHandler", MsgHandler)
 111
 112    return hSci
 113}
 114
 115/*  Group: Text
 116    Group of funtions that handle the text in the scintilla component.
 117
 118    <http://www.scintilla.org/ScintillaDoc.html#TextRetrievalAndModification>
 119
 120    Each byte in a Scintilla document is followed by an associated byte of styling information. The combination of
 121    a character byte and a style byte is called a cell. Style bytes are interpreted an index into an array of
 122    styles.
 123
 124    Style bytes may be split into an index and a set of indicator bits but this use is discouraged and indicators
 125    should now use *SCI_INDICATORFILLRANGE* and related calls. The default split is with the index in the low 5
 126    bits and 3 high bits as indicators. This allows 32 fundamental styles, which is enough for most languages, and
 127    three independent indicators so that, for example, syntax errors, deprecated names and bad indentation could
 128    all be displayed at once. The number of bits used for styles can be altered with *SCI_SETSTYLEBITS* up to a
 129    maximum of 8 bits. The remaining bits can be used for indicators.
 130
 131    In this document, 'character' normally refers to a byte even when multi-byte characters are used. Lengths
 132    measure the numbers of bytes, not the amount of characters in those bytes.
 133
 134    Positions within the Scintilla document refer to a character or the gap before that character. The first
 135    character in a document is 0, the second 1 and so on. If a document contains nLen characters, the last
 136    character is numbered nLen-1. The caret exists between character positions and can be located from before the
 137    first character (0) to after the last character (nLen).
 138
 139    There are places where the caret can not go where two character bytes make up one character. This occurs when a
 140    DBCS character from a language like Japanese is included in the document or when line ends are marked with the
 141    CP/M standard of a carriage return followed by a line feed. The *INVALID_POSITION* constant (-1) represents an
 142    invalid position within the document.
 143
 144    All lines of text in Scintilla are the same height, and this height is calculated from the largest font in any
 145    current style. This restriction is for performance; if lines differed in height then calculations involving
 146    positioning of text would require the text to be styled first.
 147*/
 148
 149; Group: General Text Functions
 150
 151/*
 152    Function: ReplaceSel
 153    <http://www.scintilla.org/ScintillaDoc.html#SCI_REPLACESEL>
 154
 155    The currently selected text between the anchor and the current position is replaced by the 0 terminated text
 156    string. If the anchor and current position are the same, the text is inserted at the caret position. The caret
 157    is positioned after the inserted text and the caret is scrolled into view.
 158
 159    Parameters:
 160    SCI_ReplaceSel(rStr[, hwnd])
 161
 162    rStr    -   String of text to use for replacing the current selection.
 163    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 164                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 165                so you can specify it once and only specify it again when you want to operate on a different
 166                component.
 167
 168    Returns:
 169    Zero - Nothing is returned by this function.
 170
 171    Examples:
 172    >SCI_ReplaceSel("replace currently selected text with this", hSci)
 173*/
 174SCI_ReplaceSel(rStr, hwnd=0){
 175    
 176    a_isunicode ? (VarSetCapacity(rStrA, StrPut(rStr, "CP0")), StrPut(rStr, &rStrA, "CP0"))
 177    return SCI_sendEditor(hwnd, "SCI_REPLACESEL", 0, a_isunicode ? &rStrA : &rStr)
 178}
 179
 180/* 
 181    Function: Allocate
 182    <http://www.scintilla.org/ScintillaDoc.html#SCI_ALLOCATE>
 183
 184    Allocate a document buffer large enough to store a given number of bytes. The document will not be made
 185    smaller than its current contents.
 186
 187    Parameters:
 188    SCI_Allocate(nBytes[, hwnd])
 189
 190    nBytes  -   Number of bytes to allocate for the document buffer.
 191    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 192                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 193                so you can specify it once and only specify it again when you want to operate on a different
 194                component.
 195
 196    Returns:
 197    Zero - Nothing is returned by this function.
 198
 199    Examples:
 200    >SCI_Allocate(1024, hSci)
 201*/
 202SCI_Allocate(nBytes, hwnd=0){
 203    
 204    return SCI_sendEditor(hwnd, "SCI_ALLOCATE", nBytes)
 205}
 206
 207/*
 208    Function: AddText
 209    <http://www.scintilla.org/ScintillaDoc.html#SCI_ADDTEXT>
 210
 211    This inserts the first *len* characters from the string *aStr* at the current position.
 212    The current position is set at the end of the inserted text, but it is *not* scrolled into view.
 213
 214    Parameters:
 215    SCI_AddText(aStr[, len, hwnd])
 216
 217    aStr    -   The string to be added to the component at current caret position.
 218    len     -   Lenght of the string that will be added to the component. If 0 or blank it will be calculated
 219                automatically using StrLen()
 220    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 221                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 222                so you can specify it once and only specify it again when you want to operate on a different
 223                component.
 224
 225    Returns:
 226    Zero - Nothing is returned by this function.
 227
 228    Examples:
 229    (start code)
 230    #include ../SCI.ahk
 231    
 232    Gui +LastFound
 233    hwnd:=WinExist()
 234    hSci1:=SCI_Add(hwnd, x, y, w, h)
 235    Gui, show, w400 h300
 236    SCI_SetWrapMode(True, hSci1)
 237    SCI_AddText(x:="my text",StrLen(x), hSci)
 238    return
 239    ;---------------------
 240
 241    #include ../SCI.ahk
 242    
 243    Gui +LastFound
 244    hwnd:=WinExist()
 245    hSci1:=SCI_Add(hwnd, x, y, w, h)
 246    Gui, show, w400 h300
 247    SCI_SetWrapMode(True, hSci1)
 248    
 249    ; stores "This is my truncated text".
 250    SCI_AddText("This is my truncated text, this is not added!",25)
 251    return
 252    ;---------------------
 253
 254    #include ../SCI.ahk
 255    
 256    Gui +LastFound
 257    hwnd:=WinExist()
 258    hSci1:=SCI_Add(hwnd, x, y, w, h)
 259    Gui, show, w400 h300
 260    SCI_SetWrapMode(True, hSci1)
 261    
 262    ; In this example the whole text is stored because the length is calculated internally.
 263    SCI_AddText("This is my truncated text, this is added!")
 264    return
 265    (end)
 266*/
 267SCI_AddText(aStr, len=0, hwnd=0){
 268
 269    a_isunicode ? (VarSetCapacity(aStrA, StrPut(aStr, "CP0")), StrPut(aStr, &aStrA, "CP0"))
 270    return SCI_sendEditor(hwnd, "SCI_ADDTEXT", len ? len : strLen(aStr), a_isunicode ?  &aStrA : &aStr)
 271}
 272
 273; /* needs work
 274    ; Function: AddStyledText
 275    ; <http://www.scintilla.org/ScintillaDoc.html#SCI_ADDSTYLEDTEXT>
 276
 277    ; This behaves just like <AddText()>, but inserts styled text.
 278
 279    ; Parameters:
 280    ; SCI_AddText(cell[, len, hwnd])
 281
 282    ; cell    -   The styled string cell to be added to the component at current caret position.
 283    ; len     -   lenght of the string that will be added to the component. If 0 or blank it will be calculated
 284                ; automatically using StrLen()
 285    ; hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 286                ; Scintilla components in the same script. The wrapper will remember the last used hwnd,
 287                ; so you can specify it once and only specify it again when you want to operate on a different
 288                ; component.
 289
 290    ; Returns:
 291    ; Zero - Nothing is returned by this function.
 292
 293    ; Examples:
 294; */
 295; SCI_AddStyledText(cell, len=0, hwnd=0){
 296
 297    ; a_isunicode ? (VarSetCapacity(cellA, StrPut(cell, "CP0")), StrPut(cell, &cellA, "CP0"))
 298    ; return SCI_sendEditor(hwnd, "SCI_ADDSTYLEDTEXT", len ? len : strLen(cell), a_isunicode ?  &cellA : &cell)
 299; }
 300
 301/*
 302    Function: AppendText
 303    <http://www.scintilla.org/ScintillaDoc.html#SCI_APPENDTEXT>
 304    
 305    This adds the first *len* characters from the string *aStr* to the end of the document. 
 306    The current selection is not changed and the new text is *not* scrolled into view.
 307    
 308    Parameters:
 309    SCI_AppendText(aStr[, len, hwnd])
 310
 311    aStr    -   The string to be appended to the end  of the current document on the selected component.
 312    len     -   Lenght of the string that will be added to the component. If 0 or blank it will be calculated
 313                automatically using StrLen()
 314    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 315                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 316                so you can specify it once and only specify it again when you want to operate on a different
 317                component.
 318
 319    Returns:
 320    Zero - Nothing is returned by this function.
 321
 322    Examples:
 323    (start code)
 324    #include ../SCI.ahk
 325    
 326    Gui +LastFound
 327    hwnd:=WinExist()
 328    hSci1:=SCI_Add(hwnd, x, y, w, h)
 329    Gui, show, w400 h300
 330    SCI_SetWrapMode(True, hSci1)
 331    SCI_AppendText(x:="my text",StrLen(x), hSci)
 332    return
 333    ;---------------------
 334
 335    #include ../SCI.ahk
 336    
 337    Gui +LastFound
 338    hwnd:=WinExist()
 339    hSci1:=SCI_Add(hwnd, x, y, w, h)
 340    Gui, show, w400 h300
 341    SCI_SetWrapMode(True, hSci1)
 342    
 343    ; stores "This is my truncated text".
 344    SCI_AppendText("This is my truncated text, this is not added!",25)
 345    return
 346    ;---------------------
 347
 348    #include ../SCI.ahk
 349    
 350    Gui +LastFound
 351    hwnd:=WinExist()
 352    hSci1:=SCI_Add(hwnd, x, y, w, h)
 353    Gui, show, w400 h300
 354    SCI_SetWrapMode(True, hSci1)
 355    
 356    ; In this example the whole text is stored because the length is calculated internally.
 357    SCI_AppendText("This is my truncated text, this is added!")
 358    return
 359    (end)
 360*/
 361SCI_AppendText(aStr, len=0, hwnd=0){
 362    
 363    a_isunicode ? (VarSetCapacity(aStrA, StrPut(aStr, "CP0")), StrPut(aStr, &aStrA, "CP0"))
 364    return SCI_sendEditor(hwnd, "SCI_APPENDTEXT", len ? len : strLen(aStr), a_isunicode ?  &aStrA : &aStr)
 365}
 366
 367/*
 368    Function: InsertText
 369    <http://www.scintilla.org/ScintillaDoc.html#SCI_INSERTTEXT>
 370    
 371    This inserts the text string at position *pos* or at the current position  if pos is not specified. 
 372    If the current position is after the insertion point then it is moved along  with its surrounding text 
 373    but no scrolling is performed.
 374    
 375    Parameters:
 376    SCI_InsertText(iStr[, pos,hwnd])
 377    
 378    iStr    -   String of text to be inserted.
 379    pos     -   Position where the text is to be inserted. If not specified it defaults to current caret position.
 380    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 381                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 382                so you can specify it once and only specify it again when you want to operate on a different
 383                component.
 384
 385    Returns:
 386    Zero - Nothing is returned by this function.
 387    
 388    Examples:
 389*/
 390SCI_InsertText(iStr, pos=-1,hwnd=0){
 391    
 392    a_isunicode ? (VarSetCapacity(iStrA, StrPut(iStr, "CP0")), StrPut(iStr, &iStrA, "CP0"))
 393    return SCI_sendEditor(hwnd, "SCI_INSERTTEXT", pos, a_isunicode ? &iStrA : &iStr)
 394}
 395
 396/*
 397    Function: ClearAll
 398    <http://www.scintilla.org/ScintillaDoc.html#SCI_CLEARALL>
 399    
 400    Unless the document is read-only, this deletes all the text.
 401    
 402    Parameters:
 403    SCI_ClearAll([hwnd])
 404    
 405    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 406                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 407                so you can specify it once and only specify it again when you want to operate on a different
 408                component.
 409    
 410    Returns:
 411    Zero - Nothing is returned by this function.
 412    
 413    Examples:
 414    >SCI_ClearAll(hSci)
 415*/
 416SCI_ClearAll(hwnd=0){
 417    
 418    return SCI_sendEditor(hwnd, "SCI_CLEARALL")
 419}
 420
 421/*
 422    Function: ClearDocumentStyle
 423    <http://www.scintilla.org/ScintillaDoc.html#SCI_CLEARDOCUMENTSTYLE>
 424    
 425    When wanting to completely restyle the document, for example after choosing a lexer, the 
 426    *ClearDocumentStyle()* can be used to clear all styling information and reset the folding state.
 427    
 428    Parameters:
 429    SCI_ClearDocumentStyle([hwnd])
 430    
 431    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 432                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 433                so you can specify it once and only specify it again when you want to operate on a different
 434                component.
 435                
 436    Returns:
 437    Zero - Nothing is returned by this function.
 438    
 439    Examples:
 440    >SCI_ClearDocumentStyle(hSci)
 441*/
 442SCI_ClearDocumentStyle(hwnd=0){
 443    
 444    return SCI_sendEditor(hwnd, "SCI_CLEARDOCUMENTSTYLE")
 445}
 446
 447; /* needs work
 448    ; Function: TargetAsUTF8
 449    ; <http://www.scintilla.org/ScintillaDoc.html#SCI_TARGETASUTF8>
 450    
 451    ; This function retrieves the value of the target encoded as UTF-8, so is useful for retrieving text for use in 
 452    ; other parts of the user interface, such as find and replace dialogs. The length of the encoded text in bytes 
 453    ; is returned. 
 454    
 455    ; Parameters:
 456    ; SCI_TargetAsUTF8(tStr[, hwnd])
 457    
 458    ; tStr    -   Target string that will be converted to UTF-8 encoding.
 459    ; hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 460                ; Scintilla components in the same script. The wrapper will remember the last used hwnd,
 461                ; so you can specify it once and only specify it again when you want to operate on a different
 462                ; component.
 463                
 464    ; Returns:
 465    ; utfLen  -   Length of the encoded text in bytes. 
 466    
 467    ; Example:
 468; */
 469; SCI_TargetAsUTF8(tStr, hwnd=0){
 470    
 471    ; a_isunicode ? (VarSetCapacity(tStrA, StrPut(tStr, "CP0")), StrPut(tStr, &tStrA, "CP0"))
 472    ; return SCI_sendEditor(hwnd, "SCI_TARGETASUTF8", 0, a_isunicode ? &tStrA : &tStr)
 473; }
 474
 475; /* needs work
 476    ; Function: EncodedFromUTF8
 477    ; <http://www.scintilla.org/ScintillaDoc.html#SCI_ENCODEDFROMUTF8>
 478    
 479    ; *EncodedFromUTF8()* converts a UTF-8 string into the document's encoding which is useful for taking the 
 480    ; results of a find dialog, for example, and receiving a string of bytes that can be searched for in the 
 481    ; document. Since the text can contain nul bytes, the <SetLengthForEncode()> function can be used to set the 
 482    ; length that will be converted. If set to -1, the length is determined by finding a nul byte. The length of the 
 483    ; converted string is returned.
 484    
 485    ; Parameters:
 486    ; SCI_EncodedFromUTF8(utf8Str, encStr[, hwnd])
 487    
 488    ; utf8Str -
 489    ; encStr  -
 490    ; hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 491                ; Scintilla components in the same script. The wrapper will remember the last used hwnd,
 492                ; so you can specify it once and only specify it again when you want to operate on a different
 493                ; component.
 494    
 495    ; Examples:
 496; */
 497; SCI_EncodedFromUTF8(utf8Str, encStr, hwnd=0){
 498    ; return
 499; }
 500
 501; Group: Text Set Functions
 502
 503/*
 504    Function: SetText
 505    <http://www.scintilla.org/ScintillaDoc.html#SCI_SETTEXT>
 506    
 507    Replaces all the text in the document with the zero terminated text string you pass in.
 508    
 509    Parameters:
 510    SCI_SetText(sStr[, hwnd])
 511    
 512    sStr    -   String of text to be set on the Scintilla component.
 513    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 514                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 515                so you can specify it once and only specify it again when you want to operate on a different
 516                component.
 517                
 518    Returns:
 519    Zero - Nothing is returned by this function.
 520    
 521    Examples:
 522*/
 523SCI_SetText(sStr, hwnd=0){
 524    
 525    a_isunicode ? (VarSetCapacity(sStrA, StrPut(sStr, "CP0")), StrPut(sStr, &sStrA, "CP0"))
 526    return SCI_sendEditor(hwnd, "SCI_SETTEXT", 0, a_isunicode ? &sStrA : &sStr)
 527}
 528
 529/*
 530    Function: SetSavePoint
 531    <http://www.scintilla.org/ScintillaDoc.html#SCI_SETSAVEPOINT>
 532    
 533    This message tells Scintilla that the current state of the document is unmodified. This is usually done when 
 534    the file is saved or loaded, hence the name "save point". As Scintilla performs undo and redo operations, it 
 535    notifies the container that it has entered or left the save point with *SCN_SAVEPOINTREACHED* and 
 536    *SCN_SAVEPOINTLEFT* notification messages, allowing the container to know if the file should be considered 
 537    dirty or not.
 538    
 539    Parameters:
 540    SCI_SetSavePoint([hwnd])
 541    
 542    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 543                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 544                so you can specify it once and only specify it again when you want to operate on a different
 545                component.
 546                
 547    Returns:
 548    Zero - Nothing is returned by this function.
 549    
 550    Examples:
 551*/
 552SCI_SetSavePoint(hwnd=0){
 553    
 554    return SCI_sendEditor(hwnd, "SCI_SETSAVEPOINT")
 555}
 556
 557/*
 558    Function: SetReadOnly
 559    <http://www.scintilla.org/ScintillaDoc.html#SCI_SETREADONLY>
 560    
 561    These messages set and get the read-only flag for the document. If you mark a document as read only, attempts to modify the text cause the *SCN_MODIFYATTEMPTRO* notification.
 562    
 563    Parameters:
 564    SCI_SetReadOnly(roMode[, hwnd])
 565    
 566    roMode  -   True (1) or False (0).
 567    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 568                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 569                so you can specify it once and only specify it again when you want to operate on a different
 570                component.
 571    
 572    Returns:
 573    Zero - Nothing is returned by this function.
 574    
 575    Examples:
 576*/
 577SCI_SetReadOnly(roMode, hwnd=0){
 578    
 579    return SCI_sendEditor(hwnd, "SCI_SETREADONLY", roMode)
 580}
 581
 582/*
 583    Function: SetStyleBits
 584    <http://www.scintilla.org/ScintillaDoc.html#SCI_SETSTYLEBITS>
 585    
 586    This Routine sets the number of bits in each cell to use for styling, to a maximum of 8 style bits. The remaining bits can be used as indicators. The standard setting is *SCI_SETSTYLEBITS(5)*. The number of styling bits needed by the current lexer can be found with <GetStyleBitsNeeded>.
 587    
 588    Parameters:
 589    SCI_SetStyleBits(bits[, hwnd])
 590    
 591    bits    -   
 592    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 593                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 594                so you can specify it once and only specify it again when you want to operate on a different
 595                component.
 596                
 597    Returns:
 598    Zero - Nothing is returned by this function.
 599    
 600    Examples:
 601*/
 602SCI_SetStyleBits(bits, hwnd=0){
 603    
 604    return SCI_sendEditor(hwnd, "SCI_SETSTYLEBITS", bits)
 605}
 606
 607/*
 608    Function: SetLengthForEncode
 609    http://www.scintilla.org/ScintillaDoc.html#SCI_SETLENGTHFORENCODE
 610    
 611    <EncodedFromUTF8()> converts a UTF-8 string into the document's encoding which is useful for taking the 
 612    results of a find dialog, for example, and receiving a string of bytes that can be searched for in the 
 613    document. Since the text can contain nul bytes, the *SetLengthForEncode()* method can be used to set the 
 614    length that will be converted. If set to -1, the length is determined by finding a nul byte. The length of the 
 615    converted string is returned.
 616    
 617    Parameters:
 618    SCI_SetLengthForEncode(bytes[, hwnd])
 619    
 620    bytes   -   Length of the string that will be converted with <EncodedFromUTF8()>
 621    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 622                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 623                so you can specify it once and only specify it again when you want to operate on a different
 624                component.
 625                
 626    Returns:
 627    Zero - Nothing is returned by this function.
 628    
 629    Examples:
 630*/
 631SCI_SetLengthForEncode(bytes, hwnd=0){
 632    
 633    return SCI_sendEditor(hwnd, "SCI_SETLENGTHFORENCODE", bytes)
 634}
 635
 636; Group: Text Get Functions
 637
 638/*
 639    Function: GetText
 640    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETTEXT>
 641    
 642    This returns len-1 characters of text from the start of the document plus one terminating 0 character. 
 643    To collect all the text in a document, use <GetLength()> to get the number of characters in the document 
 644    (nLen), allocate a character buffer of length nLen+1 bytes, then call *GetText*(nLen+1, vText).
 645    If the vText argument is 0 then the length that should be allocated to store the entire document is returned.
 646    If you then save the text, you should use <SetSavePoint()> to mark the text as unmodified.
 647    
 648    See also: <GetSelText()>, <GetCurLine()>, <GetLine()>, <GetStyledText()>, <GetTextRange()>
 649    
 650    Parameters:
 651    len     -
 652    vText   -
 653    
 654    Returns:
 655    
 656    Examples:    
 657*/
 658SCI_GetText(len=0, Byref vText=0, hwnd=0){
 659    
 660    VarSetCapacity(str, len * (a_isunicode ? 2 : 1)), cLen := SCI_sendEditor(hwnd, "SCI_GETTEXT", len, &str)
 661    vText := StrGet(&str, "CP0")
 662    return cLen
 663}
 664
 665; /* needs work (LineLenght() from selection and information)
 666    ; Function: GetLine
 667    ; <http://www.scintilla.org/ScintillaDoc.html#SCI_GETLINE>
 668    
 669    ; This fills the buffer defined by text with the contents of the nominated line (lines start at 0). The buffer 
 670    ; is not terminated by a 0 character. It is up to you to make sure that the buffer is long enough for the text, 
 671    ; use <LineLength()> for that. The returned value is the number of characters copied to the buffer. 
 672    ; The returned text includes any end of line characters. If you ask for a line number outside the range of lines 
 673    ; in the document, 0 characters are copied. If the text argument is 0 then the length that should be allocated 
 674    ; to store the entire line is returned.
 675    
 676    ; See also: <GetCurLine()>, <GetSelText()>, <GetTextRange()>, <GetStyledText()>, <GetText()>
 677    
 678; */
 679; SCI_GetLine(line, vText, hwnd=0){
 680
 681    ; VarSetCapacity(str, SCI_LineLength(hwnd) * (a_isunicode ? 2 : 1))
 682    ; cLen := SCI_sendEditor(hwnd, "SCI_GETLINE", len, &str)
 683    ; vText := StrGet(&str, "CP0")
 684    ; return cLen
 685; }
 686
 687/*
 688    Function: GetReadonly
 689    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETREADONLY>
 690    
 691    This function gets the read-only flag for the document. If you mark a document as read only, attempts to 
 692    modify the text cause the *SCN_MODIFYATTEMPTRO* notification.
 693    
 694    Parameters:
 695    
 696*/
 697SCI_GetReadonly(){
 698
 699    return
 700}
 701
 702/*
 703    Function: GetTextRange
 704    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETTEXTRANGE>
 705    
 706    This collects the text between the positions cpMin and cpMax and copies it to lpstrText (see struct 
 707    <SCI_TextRange>). If cpMax is -1, text is returned to the end of the document. The text is 0 terminated, so 
 708    you must supply a buffer that is at least 1 character longer than the number of characters you wish to read. 
 709    The return value is the length of the returned text not including the terminating 0.
 710    
 711    See also: <SCI_GetSelText()>, <SCI_GetLine()>, <SCI_GetCurLine()>, <SCI_GetStyledText()>, <SCI_GetText()>
 712*/
 713SCI_GetTextRange(){
 714}
 715
 716/*
 717    Function: GetCharAt
 718    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETCHARAT>
 719    
 720    This returns the character at pos in the document or 0 if pos is negative or past the end of the document.
 721*/
 722SCI_GetCharAt(){
 723    
 724    return
 725}
 726
 727/*
 728    Function: GetStyleAt
 729    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETSTYLEAT>
 730    
 731    This returns the style at pos in the document, or 0 if pos is negative or past the end of the document.
 732*/
 733SCI_GetStyleAt(){
 734    
 735    return
 736}
 737
 738/*
 739    Function: GetStyledText
 740    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETSTYLEDTEXT>
 741    
 742    This collects styled text into a buffer using two bytes for each cell, with the character at the lower address 
 743    of each pair and the style byte at the upper address. Characters between the positions cpMin and cpMax are 
 744    copied to lpstrText (see struct <SCI_TextRange>). Two 0 bytes are added to the end of the text, so the buffer 
 745    that lpstrText points at must be at least 2*(cpMax-cpMin)+2 bytes long. No check is made for sensible values 
 746    of cpMin or cpMax. Positions outside the document return character codes and style bytes of 0.
 747
 748See also: <GetSelText()>, <GetLine()>, <GetCurLine()>, <GetTextRange()>, <GetText()>
 749*/
 750SCI_GetStyledText(){
 751    
 752    return
 753}
 754
 755/*
 756    Function: GetStyleBits
 757    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETSTYLEBITS>
 758    
 759    This routine reads back the number of bits in each cell to use for styling, to a maximum of 8 style bits. The 
 760    remaining bits can be used as indicators. The standard setting is *SetStyleBits(5)*. The number of styling 
 761    bits needed by the current lexer can be found with <GetStyleBitsNeeded()>.
 762*/
 763SCI_GetStyleBits(){
 764    
 765    return
 766}
 767
 768/* Group: Selection and information
 769*/
 770
 771/*
 772    Function: GetTextLength
 773    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETTEXTLENGTH>
 774    
 775    Returns the length of the document in bytes.
 776    
 777    Parameters:
 778    SCI_GetTextLength([hwnd])
 779    
 780    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 781                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 782                so you can specify it once and only specify it again when you want to operate on a different
 783                component.
 784    
 785    Returns
 786    nLen    -   Length of the document in bytes.
 787    
 788    Examples
 789*/
 790SCI_GetTextLength(hwnd=0){
 791    
 792    return SCI_sendEditor(hwnd, "SCI_GETTEXTLENGTH")
 793}
 794
 795/*
 796    Function: GetLength
 797    <http://www.scintilla.org/ScintillaDoc.html#SCI_GETLENGTH>
 798    
 799    Returns the length of the document in bytes.
 800    
 801    Parameters:
 802    SCI_GetLength([hwnd])
 803    
 804    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 805                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 806                so you can specify it once and only specify it again when you want to operate on a different
 807                component.
 808    
 809    Returns
 810    nLen    -   Length of the document in bytes.
 811    
 812    Examples
 813*/
 814SCI_GetLength(hwnd=0){
 815    
 816    return SCI_sendEditor(hwnd, "SCI_GETLENGTH")
 817}
 818
 819/* Group: Style Definition
 820    <http://www.scintilla.org/ScintillaDoc.html#StyleDefinition>
 821
 822    While the style setting messages mentioned above change the style numbers associated with text, these messages
 823    define how those style numbers are interpreted visually. There are 256 lexer styles that can be set, numbered 0
 824    to *STYLE_MAX* (255). Unless you use *SCI_SETSTYLEBITS* to change the number of style bits,
 825    styles 0 to 31 are used to set the text attributes. There are also some predefined numbered styles starting at
 826    32, The following *STYLE_** constants are defined:
 827
 828    - *STYLE_DEFAULT*       (32) This style defines the attributes that all styles receive when the
 829    *SCI_STYLECLEARALL* message is used.
 830
 831    - *STYLE_LINENUMBER*    (33) This style sets the attributes of the text used to display line numbers in a line
 832    number margin. The background colour set for this style also sets the background colour for all margins that do
 833    not have any folding mask bits set. That is, any margin for which mask & *SC_MASK_FOLDERS* is 0. See
 834    *SCI_SETMARGINMASKN* for more about masks.
 835
 836    - *STYLE_BRACELIGHT*    (34) This style sets the attributes used when highlighting braces with the
 837    *SCI_BRACEHIGHLIGHT* message and when highlighting the corresponding indentation with *SCI_SETHIGHLIGHTGUIDE*.
 838
 839    - *STYLE_BRACEBAD*      (35) This style sets the display attributes used when marking an unmatched brace with the
 840    *SCI_BRACEBADLIGHT* message.
 841
 842    - *STYLE_CONTROLCHAR*   (36) This style sets the font used when drawing control characters. Only the font, size,
 843    bold, italics, and character set attributes are used and not the colour attributes. See also:
 844    *SCI_SETCONTROLCHARSYMBOL*.
 845
 846    - *STYLE_INDENTGUIDE*   (37) This style sets the foreground and background colours used when drawing the
 847    indentation guides.
 848
 849    - *STYLE_CALLTIP*       (38) Call tips normally use the font attributes defined by *STYLE_DEFAULT*. Use of
 850    *SCI_CALLTIPUSESTYLE* causes call tips to use this style instead. Only the font face name, font size, foreground
 851    and background colours and character set attributes are used.
 852
 853    - *STYLE_LASTPREDEFINED* (39) To make it easier for client code to discover the range of styles that are
 854    predefined, this is set to the style number of the last predefined style. This is currently set to 39 and the
 855    last style with an identifier is 38, which reserves space for one future predefined style.
 856
 857    - *STYLE_MAX*           (255) This is not a style but is the number of the maximum style that can be set. Styles
 858    between *STYLE_LASTPREDEFINED* and *STYLE_MAX* would be appropriate if you used *SCI_SETSTYLEBITS* to set more
 859    than 5 style bits.
 860
 861    For each style you can set the font name, size and use of bold, italic and underline, foreground and background colour and the character set. You can also choose to hide text with a given style, display all characters as upper or lower case and fill from the last character on a line to the end of the line (for embedded languages). There is also an experimental attribute to make text read-only.
 862
 863    It is entirely up to you how you use styles. If you want to use syntax colouring you might use style 0 for white space, style 1 for numbers, style 2 for keywords, style 3 for strings, style 4 for preprocessor, style 5 for operators, and so on.
 864*/
 865
 866; Group: General Style Functions
 867
 868/*
 869    Function: StyleResetDefault
 870    <http://www.scintilla.org/ScintillaDoc.html#SCI_STYLERESETDEFAULT>
 871
 872    This message resets STYLE_DEFAULT to its state when Scintilla was initialised.
 873
 874    Parameters:
 875    SCI_StyleResetDefault([hwnd])
 876
 877    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 878                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 879                so you can specify it once and only specify it again when you want to operate on a different
 880                component.
 881
 882    Returns:
 883    Zero - Nothing is returned by this function.
 884
 885    Examples:
 886    >SCI_StyleResetDefault(hSci)
 887*/
 888SCI_StyleResetDefault(hwnd=0){
 889
 890    return SCI_sendEditor(hwnd, "SCI_STYLERESETDEFAULT")
 891}
 892
 893/*
 894    Function: StyleClearAll
 895    <http://www.scintilla.org/ScintillaDoc.html#SCI_STYLECLEARALL>
 896
 897    This message sets all styles to have the same attributes as STYLE_DEFAULT.
 898    If you are setting up Scintilla for syntax coloring, it is likely that the lexical styles you set
 899    will be very similar. One way to set the styles is to:
 900
 901    - Set STYLE_DEFAULT to the common features of all styles.
 902    - Use SCI_STYLECLEARALL to copy this to all styles.
 903    - Set the style attributes that make your lexical styles different.
 904
 905    Parameters:
 906    SCI_StyleClearAll([hwnd])
 907
 908    hwnd    -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 909                Scintilla components in the same script. The wrapper will remember the last used hwnd,
 910                so you can specify it once and only specify it again when you want to operate on a different
 911                component.
 912
 913    Returns:
 914    Zero - Nothing is returned by this function.
 915
 916    Examples:
 917    >SCI_StyleClearAll(hSci)
 918*/
 919SCI_StyleClearAll(hwnd=0){
 920
 921    return SCI_sendEditor(hwnd, "SCI_STYLECLEARALL")
 922}
 923
 924; Group: Set Style Functions
 925
 926/*
 927    Function: StyleSetFont
 928    <http://www.scintilla.org/ScintillaDoc.html#SCI_STYLESETFONT>
 929
 930    These functions (plus SCI_StyleSetCharacterset) set the font attributes that are used to match
 931    the fonts you request to those available. The fName parameter is a zero terminated string holding
 932    the name of a font. Under Windows, only the first 32 characters of the name are used and
 933    the name is not case sensitive. For internal caching, Scintilla tracks fonts by name
 934    and does care about the casing of font names, so please be consistent.
 935
 936    Parameters:
 937    SCI_StyleSetFont(stNumber, fName[, hwnd])
 938
 939    stNumber    -   Style Number on which to operate.
 940                    There are 256 lexer styles that can be set, numbered 0 to *STYLE_MAX* (255)
 941                    See: <http://www.scintilla.org/ScintillaDoc.html#StyleDefinition>.
 942    fName       -   Name of the font to apply.
 943    hwnd        -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 944                    Scintilla components in the same script. The wrapper will remember the last used hwnd,
 945                    so you can specify it once and only specify it again when you want to operate on a different
 946                    component.
 947
 948    Returns:
 949    Zero - Nothing is returned by this function.
 950
 951    Examples:
 952    (Start Code)
 953    #include ../SCI.ahk
 954
 955    Gui +LastFound
 956    hwnd:=WinExist()
 957    hSci1:=SCI_Add(hwnd, x, y, w, h, "WS_CHILD WS_VISIBLE")
 958    hSci2:=SCI_Add(hwnd, x, 290, w, h, "WS_CHILD WS_VISIBLE")
 959    Gui, show, w400 h570
 960
 961    ; Each component will have its own font
 962    SCI_StyleSetFont("STYLE_DEFAULT", "Courier New", hSci1)
 963    SCI_StyleSetFont("STYLE_DEFAULT", "Arial Black", hSci2)
 964    return
 965    (End)
 966*/
 967SCI_StyleSetFont(stNumber, fName, hwnd=0){
 968
 969    a_isunicode ? (VarSetCapacity(fNameA, StrPut(fName, "CP0")), StrPut(fName, &fNameA, "CP0"))
 970    return SCI_sendEditor(hwnd, "SCI_STYLESETFONT", stNumber, a_isunicode ?  &fNameA : &fName)
 971}
 972
 973/*
 974    Function: StyleSetSize
 975    <http://www.scintilla.org/ScintillaDoc.html#SCI_STYLESETSIZE>
 976
 977    Parameters:
 978    SCI_StyleSetSize(stNumber, fSize[, hwnd])
 979
 980    stNumber    -   Style Number on which to operate.
 981                    There are 256 lexer styles that can be set, numbered 0 to *STYLE_MAX* (255)
 982                    See: <http://www.scintilla.org/ScintillaDoc.html#StyleDefinition>.
 983    fSize       -   Size in points of the font to apply.
 984    hwnd        -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
 985                    Scintilla components in the same script. The wrapper will remember the last used hwnd,
 986                    so you can specify it once and only specify it again when you want to operate on a different
 987                    component.
 988
 989    Returns:
 990    Zero - Nothing is returned by this function.
 991
 992    Examples:
 993    (Start Code)
 994    #include ../SCI.ahk
 995
 996    Gui +LastFound
 997    hwnd:=WinExist()
 998    hSci1:=SCI_Add(hwnd, x, y, w, h, "WS_CHILD WS_VISIBLE")
 999    hSci2:=SCI_Add(hwnd, x, 290, w, h, "WS_CHILD WS_VISIBLE")
1000    Gui, show, w400 h570
1001
1002    ; Each component will have its own font size
1003    SCI_StyleSetSize("STYLE_DEFAULT", 12, hSci1)
1004    SCI_StyleSetSize("STYLE_DEFAULT", 32, hSci2)
1005    return
1006    (End)
1007*/
1008SCI_StyleSetSize(stNumber, fSize, hwnd=0){
1009
1010    return SCI_sendEditor(hwnd, "SCI_STYLESETSIZE", stNumber, fSize)
1011}
1012
1013/*
1014    Function: StyleSetBold
1015    <http://www.scintilla.org/ScintillaDoc.html#SCI_STYLESETBOLD>
1016
1017    Parameters:
1018    SCI_StyleSetBold(stNumber, bMode[, hwnd])
1019
1020    stNumber    -   Style Number on which to operate.
1021                    There are 256 lexer styles that can be set, numbered 0 to *STYLE_MAX* (255)
1022                    See: <http://www.scintilla.org/ScintillaDoc.html#StyleDefinition>.
1023    bMode       -   True (1) or False (0).
1024    hwnd        -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
1025                    Scintilla components in the same script. The wrapper will remember the last used hwnd,
1026                    so you can specify it once and only specify it again when you want to operate on a different
1027                    component.
1028
1029    Returns:
1030    Zero - Nothing is returned by this function.
1031
1032    Examples:
1033    (Start Code)
1034    #include ../SCI.ahk
1035
1036    Gui +LastFound
1037    hwnd:=WinExist()
1038    hSci1:=SCI_Add(hwnd, x, y, w, h, "WS_CHILD WS_VISIBLE")
1039    hSci2:=SCI_Add(hwnd, x, 290, w, h, "WS_CHILD WS_VISIBLE")
1040    Gui, show, w400 h570
1041
1042    ; Each component will have its own bold status
1043    SCI_StyleSetBold("STYLE_DEFAULT", True, hSci1)
1044    SCI_StyleSetBold("STYLE_DEFAULT", False, hSci2)
1045    return
1046    (End)
1047*/
1048SCI_StyleSetBold(stNumber, bMode, hwnd=0){
1049
1050    return SCI_sendEditor(hwnd, "SCI_STYLESETBOLD", stNumber, bMode)
1051}
1052
1053/*
1054    Function: StyleSetItalic
1055    <http://www.scintilla.org/ScintillaDoc.html#SCI_STYLESETITALIC>
1056
1057    Parameters:
1058    SCI_StyleSetItalic(stNumber, iMode[, hwnd])
1059
1060    stNumber    -   Style Number on which to operate.
1061                    There are 256 lexer styles that can be set, numbered 0 to *STYLE_MAX* (255)
1062                    See: <http://www.scintilla.org/ScintillaDoc.html#StyleDefinition>.
1063    iMode       -   True (1) or False (0).
1064    hwnd        -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
1065                    Scintilla components in the same script. The wrapper will remember the last used hwnd,
1066                    so you can specify it once and only specify it again when you want to operate on a different
1067                    component.
1068
1069    Returns:
1070    Zero - Nothing is returned by this function.
1071
1072    Examples:
1073    (Start Code)
1074    #include ../SCI.ahk
1075
1076    Gui +LastFound
1077    hwnd:=WinExist()
1078    hSci1:=SCI_Add(hwnd, x, y, w, h, "WS_CHILD WS_VISIBLE")
1079    hSci2:=SCI_Add(hwnd, x, 290, w, h, "WS_CHILD WS_VISIBLE")
1080    Gui, show, w400 h570
1081
1082    ; Each component will have its own bold status
1083    SCI_StyleSetItalic("STYLE_DEFAULT", True, hSci1)
1084    SCI_StyleSetItalic("STYLE_DEFAULT", False, hSci2)
1085    return
1086    (End)
1087*/
1088SCI_StyleSetItalic(stNumber, iMode, hwnd=0){
1089
1090    return SCI_sendEditor(hwnd, "SCI_STYLESETITALIC", stNumber, iMode)
1091}
1092
1093/*
1094    Function: StyleSetUnderline
1095    <http://www.scintilla.org/ScintillaDoc.html#SCI_STYLESETUNDERLINE>
1096
1097    Parameters:
1098    SCI_StyleSetUnderline(stNumber, uMode[, hwnd])
1099
1100    stNumber    -   Style Number on which to operate.
1101                    There are 256 lexer styles that can be set, numbered 0 to *STYLE_MAX* (255)
1102                    See: <http://www.scintilla.org/ScintillaDoc.html#StyleDefinition>.
1103    uMode       -   True (1) or False (0).
1104    hwnd        -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
1105                    Scintilla components in the same script. The wrapper will remember the last used hwnd,
1106                    so you can specify it once and only specify it again when you want to operate on a different
1107                    component.
1108
1109    Returns:
1110    Zero - Nothing is returned by this function.
1111
1112    Note:
1113    - If you set the underline option for the *STYLE_DEFAULT* style
1114    you *have* to call <StyleClearAll()> for the changes to take effect.
1115
1116    Examples:
1117    (Start Code)
1118    #include ../SCI.ahk
1119
1120    Gui +LastFound
1121    hwnd:=WinExist()
1122    hSci1:=SCI_Add(hwnd, x, y, w, h, "WS_CHILD WS_VISIBLE")
1123    hSci2:=SCI_Add(hwnd, x, 290, w, h, "WS_CHILD WS_VISIBLE")
1124    Gui, show, w400 h570
1125
1126    ; Each component will have its own underline status
1127    SCI_StyleSetUnderline("STYLE_DEFAULT", True, hSci1)
1128    SCI_StyleClearAll() ; the last hwnd is remembered by the wrapper, so no need to put it here.
1129    SCI_StyleSetUnderline("STYLE_DEFAULT", False, hSci2)
1130    SCI_StyleClearAll() ; the last hwnd is remembered by the wrapper, so no need to put it here.
1131    return
1132    (End)
1133*/
1134SCI_StyleSetUnderline(stNumber, uMode, hwnd=0){
1135
1136    return SCI_sendEditor(hwnd, "SCI_STYLESETUNDERLINE", stNumber, uMode)
1137}
1138
1139/*
1140    Function: StyleSetFore
1141    <http://www.scintilla.org/ScintillaDoc.html#SCI_STYLESETFORE>
1142
1143    Sets the foreground color of the specified style number.
1144
1145    Parameters:
1146    SCI_StyleSetFore(stNumber, r, [g, b, hwnd])
1147
1148    stNumber    -   Style Number on which to operate.
1149                    There are 256 lexer styles that can be set, numbered 0 to *STYLE_MAX* (255)
1150                    See: <http://www.scintilla.org/ScintillaDoc.html#StyleDefinition>.
1151    r,g,b       -   Colors are set using the RGB format (Red, Green, Blue). The intensity of each color
1152                    is set in the range 0 to 255.
1153
1154                -   *Note 1:* If you set all intensities to 255, the color is white.
1155                    If you set all intensities to 0, the color is black.
1156                    When you set a color, you are making a request.
1157                    What you will get depends on the capabilities of the system and the current screen mode.
1158
1159                -   *Note 2:* If you omit *g* and *b* you can specify the hex value of the color as
1160                    well as one of the many predefined names available.
1161                    You can take a look at the available color names with their hex values here:
1162                    <http://www.w3schools.com/html/html_colornames.asp>.
1163
1164                -   *Note 3:* the parameter *g* can be used to specify the hwnd of the component you want
1165                    to control, only if you are using *r* to specify a hex value or a color name.
1166                    See the examples below for more information.
1167
1168    hwnd        -   The hwnd of the control that you want to operate on. Useful for when you have more than 1
1169                    Scintilla components in the same script. The wrapper will remember the last used hwnd,
1170                    so you can specify it once and only specify it again when you want to operate on a different
1171                    component.
1172
1173    Note:
1174    - If you change the color of the *STYLE_DEFAULT* style
1175    you *have* to call <StyleClearAll()> for the changes to take effect.
1176    This is not true for setting the background color though.
1177
1178
1179    Returns:
1180    Zero - Nothing is returned by this function.
1181
1182    Examples:
1183    (Start Code)
1184    ; This all mean the same
1185    SCI_StyleSetFore("STYLE_DEFAULT", 0xFF0000, hSci) ; using the parameter g to specify the hwnd.
1186    SCI_StyleSetFore("STYLE_DEFAULT", "red", hSci)
1187    SCI_StyleSetFore("STYLE_DEFAULT", 255,0,0, hSci) ; using the last parameter to specify the hwnd.
1188
1189    ; Remember to always call SCI_StyleClearAll()
1190    ; if you are setting the foreground color of the STYLE_DEFAULT style
1191    SCI_StyleClearAll()
1192
1193    ;---------------------
1194    #include ../SCI.ahk
1195
1196    Gui +LastFound
1197    hwnd:=WinExist()
1198    hSci1:=SCI_Add(hwnd, x, y, w, h, "WS_CHILD WS_VISIBLE")
1199    hSci2:=SCI_Add(hwnd, x, 290, w, h, "WS_CHILD WS_VISIBLE")
1200    Gui, show, w400 h570
1201
1202    SCI_StyleSetFore("STYLE_DEFAULT", 0xFF0000, hSci1)
1203    SCI_StyleClearAll() ; the last hwnd is remembered by the wrapper, so no need to put it here.
1204    SCI_StyleSetFore("STYLE_DEFAULT", "blue", hSci2)
1205    SCI_StyleClearAll() ; the last hwnd is remembered by the wrapper, so no need to put it here.
1206    return
1207    (End)
1208*/
1209SCI_StyleSetFore(stNumber, r, g=0, b=0, hwnd=0){
1210
1211

Large files files are truncated, but you can click here to view the full file