NAME

Win32::GUI::Scintilla - Add Scintilla edit control to Win32::GUI

SYNOPSIS

use Win32::GUI;
use Win32::GUI::Scintilla;

# main Window
$Window = new Win32::GUI::Window (
    -name     => "Window",
    -title    => "Scintilla test",
    -pos      => [100, 100],
    -size     => [400, 400],
) or die "new Window";


# Create Scintilla Edit Window
# $Edit = new Win32::GUI::Scintilla  (
#               -parent  => $Window,
# Or
$Edit = $Window->AddScintilla  (
               -name    => "Edit",
               -pos     => [0, 0],
               -size    => [400, 400],
               -text    => "Test\n",
) or die "new Edit";

# Call Some method
$Edit->AddText ("add\n");
$Edit->AppendText ("append\n");

# Event loop
$Window->Show();
Win32::GUI::Dialog();

# Main window event handler
sub Window_Terminate {
 # Call Some method
 print "GetText = ", $Edit->GetText(), "\n";
 print "GetSelText = ", $Edit->GetSelText(), "\n";
 print "GetTextRange(2) = ", $Edit->GetTextRange(2), "\n";
 print "GetTextRange(2, 6) = ", $Edit->GetTextRange(2, 6), "\n";
 return -1;
}
# Main window resize
sub Window_Resize {

  if (defined $Window) {
    ($width, $height) = ($Window->GetClientRect)[2..3];
    $Edit->Move   (0, 0);
    $Edit->Resize ($width, $height);
  }
}

# Scintilla Event Notification
sub Edit_Notify {

  my (%evt) = @_;
  print "Edit Notify = ", %evt, "\n";
}

DESCRIPTION

Scintilla is a free source code editing component. http://www.scintilla.org/

Scintilla creation

new (...)

Create a new Scintilla control.

Parameter : -name : Window name -parent : Parent window

-left        : Left position
-top         : Top  position
-width       : Width
-height      : Height

-pos         : [x, y] position
-size        : [w, h] size

-text        : Text
-visible     : Visible
-readonly    : ReadOnly
-hscroll     : Horizontal scroll
-vscroll     : Vertical scroll

-pushstyle   : Push style
-addstyle    : Add style
-popstyle    : Pop style
-remstyle    : Remove style
-notstyle    : Not style
-negstyle    : Negation style
-exstyle     : Extended style
-pushexstyle : Push extended style
-addexstyle  : Add extended style
-popexstyle  : Pop extended style
-remexstyle  : Remove extended style
-notexstyle  : Not extended style
-negexstyle  : Negation extended style
Win32::GUI::Window::AddScintilla (...)

Add a scintilla control in a Win32::GUI::Window. Parent window is automaticly add to new method. See Win32::GUI::Scintilla new method for parameters.

Scintilla Event

Notify (%evt)
-code : Event Code

  SCN_STYLENEEDED
    -position
  SCN_CHARADDED
    -ch                : Character
  SCN_KEY
    -ch                : Character
    -modifiers         : Key mask
    -shift             : Shift key
    -control           : Control key
    -alt               : Alt key
  SCN_MODIFIED
    -position          : Position
    -modificationType  :
    -length            : Length
    -linesAdded        : Line added
    -line              : Line
    -foldLevelNow      :
    -foldLevelPrev     :
  SCN_MACRORECORD
    -message           : Message
  SCN_MARGINCLICK
    -position
    -modifiers         : Key mask
    -shift             : Shift key
    -control           : Control key
    -alt               : Alt key
    -margin            : Margin number
  SCN_USERLISTSELECTION
    -listType          : List item
  SCN_DWELLSTART
    -position          : Position
    -x                 : X position
    -y                 : Y position
  SCN_DWELLEND
    -position          : Position
    -x                 : X position
    -y                 : Y position
  SCN_SAVEPOINTREACHED
  SCN_SAVEPOINTLEFT
  SCN_MODIFYATTEMPTRO
  SCN_DOUBLECLICK
  SCN_UPDATEUI
  SCN_ZOOM
  SCN_URIDROPPED
  SCN_NEEDSHOWN
  SCN_PAINTED
  SCN_HOTSPOTCLICK & SCN_HOTSPOTDOUBLECLICK
    -position          : Position
    -modifiers         : Key mask
    -shift             : Shift key
    -control           : Control key
    -alt               : Alt key
  SCN_CALLTIPCLICK
    -position          : Position
Change

Fire when Scintilla edit control text change. See also Notify SCN_MODIFIED event.

GotFocus

Fire when Scintilla edit control got focus.

LostFocus

Fire when Scintilla edit control lost focus.

Scintilla utility method

NewFile

Clean control for editing a new file. - Clear Text - Clear Undo buffer - Set save point

LoadFile (filename)

Load a text file. - Clear undo buffer - Set save point

Return : bool

SaveFile (filename)

Save text in file. - Set save point

Return : bool

StyleSetSpec (style, stringstyle)

Set a style from a string style.

A string style is a comma separated property string. Each property, is compose a property name, an optional value separate by a ':'.

Property : - fore:#RRGGBB = Set foreground color (RRGGBB is a hexadecimal value) - back:#RRGGBB = Set background color - face:name = Set font - size:N = Set font size (N is a numeric value) - bold = Bold font - notbold = Not Bold font - italic = Italic font - notitalic = Not Italic font - underline = Underline font - notunderline = Not Underline font - eolfilled = eolfilled - noteolfilled = Not eolfilled

Sample : "face:Times New Roman,size:12,fore:#0000FF,back#FF0000,bold,italic"

BraceHighEvent (bracematch = "[](){}")

A standard brace highlighting event manager.

FolderEvent (%evt)

A standard event manager.

If Shift and Control are pressed, open or close all folder
Else
  If Shift is pressed, Toggle 1 level of current folder
  Else If Control is pressed, expand all subfolder of current folder
  Else Toggle current folder
FolderAll

Folding or Unfolding all text.

FolderExpand (line, doExpand, force=0, visLevel=0, level=-1)

Manage Folder Expanding

FindAndSelect (text, flag = SCFIND_WHOLEWORD, direction=1, wrap=1)

Find a text and select it.

Parameter: - text : Text to find (or regular expression). - flag : A Scintilla Find constante. SCFIND_WHOLEWORD SCFIND_MATCHCASE SCFIND_WORDSTART SCFIND_REGEXP

- direction : ForWard >= 0, Backward < 0
- wrap : Use Wrap mode.

Scintilla standard method

For full documentation of Scintilla control see http://www.scintilla.org/

AddText (text)

Add text to the document.

AddStyledText (styledtext)

Add array of cells to document.

InsertText (position, text)

Insert string at a position.

ClearAll

Delete all text in the document.

ClearDocumentStyle

Set all style bytes to 0, remove all folding information.

GetLength

Return the number of characters in the document.

GetCharAt (position)

Returns the character byte at the position.

GetCurrentPos

Returns the position of the caret.

GetAnchor

Returns the position of the opposite end of the selection to the caret.

GetStyleAt (position)

Returns the style byte at the position.

Redo

Redoes the next action on the undo history.

SetUndoCollection (collectUndo)

Choose between collecting actions into the undo history and discarding them.

SelectAll

Select all the text in the document.

SetSavePoint

Remember the current position in the undo history as the position at which the document was saved.

GetStyledText (start=0, end=TextLength)

Returns the number of bytes in the buffer not including terminating NULs.

CanRedo

Are there any redoable actions in the undo history?

MarkerLineFromHandle (handle)

Retrieve the line number at which a particular marker is located.

MarkerDeleteHandle (handle)

Delete a marker.

GetUndoCollection

Is undo history being collected?

WS Constant
SCWS_INVISIBLE, SCWS_VISIBLEALWAYS, SCWS_VISIBLEAFTERINDENT
GetViewWS

Are white space characters currently visible?

SetViewWS (viewWS)

Make white space characters invisible, always visible or visible outside indentation.

PositionFromPoint (x, y)

Find the position from a point within the window.

PositionFromPointClose (x, y)

Find the position from a point within the window but return INVALID_POSITION if not close to text.

GotoLine (line)

Set caret to start of a line and ensure it is visible.

GotoPos (position)

Set caret to a position and ensure it is visible.

SetAnchor (position)

Set the selection anchor to a position. The anchor is the opposite end of the selection from the caret.

GetCurLine

Return the text of the line containing the caret.

GetEndStyled

Retrieve the position of the last correctly styled character.

EOL constant

SC_EOL_CRLF, SC_EOL_CR, SC_EOL_LF.

ConvertEOLs (eolMode)

Convert all line endings in the document to one mode.

GetEOLMode

Retrieve the current end of line mode - one of CRLF, CR, or LF.

SetEOLMode (eolMode)

Set the current end of line mode.

StartStyling (position, mask)

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.

SetStyling (length, style)

Change style from current styling position for length characters to a style and move the current styling position to after this newly styled segment.

GetBufferedDraw

Is drawing done first into a buffer or direct to the screen?

SetBufferedDraw (buffered)

If drawing is buffered then each line of text is drawn into a bitmap buffer before drawing it to the screen to avoid flicker.

SetTabWidth (tabWidth)

Change the visible size of a tab to be a multiple of the width of a space character.

GetTabWidth

Retrieve the visible size of a tab.

Constant code page
SC_CP_UTF8, SC_CP_DBCS
SetCodePage (codepage)

Set the code page used to interpret the bytes of the document as characters.

SetUsePalette (usePalette)

In palette mode, Scintilla uses the environment's palette calls to display more colours. This may lead to ugly displays.

MARK constant

Shapes SC_MARK_CIRCLE SC_MARK_ROUNDRECT SC_MARK_ARROW SC_MARK_SMALLRECT SC_MARK_SHORTARROW SC_MARK_EMPTY SC_MARK_ARROWDOWN SC_MARK_MINUS SC_MARK_PLUS Shapes used for outlining column. SC_MARK_VLINE SC_MARK_LCORNER SC_MARK_TCORNER SC_MARK_BOXPLUS SC_MARK_BOXPLUSCONNECTED SC_MARK_BOXMINUS SC_MARK_BOXMINUSCONNECTED SC_MARK_LCORNERCURVE SC_MARK_TCORNERCURVE SC_MARK_CIRCLEPLUS SC_MARK_CIRCLEPLUSCONNECTED SC_MARK_CIRCLEMINUS SC_MARK_CIRCLEMINUSCONNECTED Invisible mark that only sets the line background color. SC_MARK_BACKGROUND SC_MARK_DOTDOTDOT SC_MARK_ARROWS SC_MARK_PIXMAP SC_MARK_CHARACTER Markers used for outlining column. SC_MARKNUM_FOLDEREND SC_MARKNUM_FOLDEROPENMID SC_MARKNUM_FOLDERMIDTAIL SC_MARKNUM_FOLDERTAIL SC_MARKNUM_FOLDERSUB SC_MARKNUM_FOLDER SC_MARKNUM_FOLDEROPEN Mask folder SC_MASK_FOLDERS

MarkerDefine (markerNumber, markerSymbol)

Set the symbol used for a particular marker number.

MarkerSetFore (markerNumber, fore)

Set the foreground colour used for a particular marker number.

MarkerSetBack (markerNumber, back)

Set the background colour used for a particular marker number.

MarkerAdd (line, markerNumber)

Add a marker to a line, returning an ID which can be used to find or delete the marker.

MarkerDelete (line, markerNumber)

Delete a marker from a line.

MarkerDeleteAll (markerNumber)

Delete all markers with a particular number from all lines.

MarkerGet (line)

Get a bit mask of all the markers set on a line.

MarkerNext (lineStart, markerMask)

Find the next line after lineStart that includes a marker in mask.

MarkerPrevious (lineStart, markerMask)

Find the previous line before lineStart that includes a marker in mask.

MarkerDefinePixmap (markerNumber, pixmap)

Define a marker from a pixmap.

MarkerAddSet (line, set)

Add a set of markers to a line.

MARGIN constant
SC_MARGIN_SYMBOL, SC_MARGIN_NUMBER
SetMarginTypeN (margin, marginType)

Set a margin to be either numeric or symbolic.

GetMarginTypeN (margin)

Retrieve the type of a margin.

SetMarginWidthN (margin, pixelWidth)

Set the width of a margin to a width expressed in pixels.

GetMarginWidthN (margin)

Retrieve the width of a margin in pixels.

SetMarginMaskN (margin, mask)

Set a mask that determines which markers are displayed in a margin.

GetMarginMaskN (margin)

Retrieve the marker mask of a margin.

SetMarginSensitiveN (margin, sensitive)

Make a margin sensitive or insensitive to mouse clicks.

GetMarginSensitiveN (margin)

Retrieve the mouse click sensitivity of a margin.

Style constant

Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles. Styles 38 and 39 are for future use. STYLE_DEFAULT STYLE_LINENUMBER STYLE_BRACELIGHT STYLE_BRACEBAD STYLE_CONTROLCHAR STYLE_INDENTGUIDE STYLE_LASTPREDEFINED STYLE_MAX

StyleClearAll

Clear all the styles and make equivalent to the global default style.

StyleSetFore (style, color)

Set the foreground colour of a style. Color format : '#RRGGBB'

StyleSetBack (style, color)

Set the background colour of a style. Color format : '#RRGGBB'

StyleSetBold (style, bool)

Set a style to be bold or not.

StyleSetItalic (style, bool)

Set a style to be italic or not.

StyleSetSize (style, size)

Set the size of characters of a style.

StyleSetFont (style, fontname)

Set the font of a style.

StyleSetEOLFilled (style, bool)

Set a style to have its end of line filled or not.

StyleResetDefault

Reset the default style to its state at startup

StyleSetUnderline (style, bool)

Set a style to be underlined or not.

CASE constant
SC_CASE_MIXED
SC_CASE_UPPER
SC_CASE_LOWER
StyleSetCase (style, case)

Set a style to be mixed case, or to force upper or lower case.

CHARSET constant
SC_CHARSET_ANSI
SC_CHARSET_DEFAULT
SC_CHARSET_BALTIC
SC_CHARSET_CHINESEBIG5
SC_CHARSET_EASTEUROPE
SC_CHARSET_GB2312
SC_CHARSET_GREEK
SC_CHARSET_HANGUL
SC_CHARSET_MAC
SC_CHARSET_OEM
SC_CHARSET_RUSSIAN
SC_CHARSET_SHIFTJIS
SC_CHARSET_SYMBOL
SC_CHARSET_TURKISH
SC_CHARSET_JOHAB
SC_CHARSET_HEBREW
SC_CHARSET_ARABIC
SC_CHARSET_VIETNAMESE
SC_CHARSET_THAI
StyleSetCharacterSet (style, characterSet)

Set the character set of the font in a style.

StyleSetHotSpot (style, hotspot)

Set a style to be a hotspot or not.

SetSelFore (useSetting, color)

Set the foreground colour of the selection and whether to use this setting.

SetSelBack (useSetting, color)

Set the background colour of the selection and whether to use this setting.

SetCaretFore (color)

Set the foreground colour of the caret.

AssignCmdKey (key, modifiers, msg)

When key+modifier combination km is pressed perform msg.

ClearCmdKey (key, modifiers)

When key+modifier combination km is pressed do nothing.

ClearAllCmdKeys

Drop all key mappings.

SetStylingEx (length, styles)

Set the styles for a segment of the document.

StyleSetVisible (style, bool)

Set a style to be visible or not.

GetCaretPeriod

Get the time in milliseconds that the caret is on and off.

SetCaretPeriod (period)

Set the time in milliseconds that the caret is on and off. 0 = steady on.

SetWordChars (characters)

Set the set of characters making up words for when moving or selecting by word. First sets defaults like SetCharsDefault.

BeginUndoAction

Start a sequence of actions that is undone and redone as a unit.

EndUndoAction

End a sequence of actions that is undone and redone as a unit.

STYLE constant
INDIC_PLAIN
INDIC_SQUIGGLE
INDIC_TT
INDIC_DIAGONAL
INDIC_STRIKE
INDIC_HIDDEN
INDIC_BOX
INDIC0_MASK
INDIC1_MASK
INDIC2_MASK
INDICS_MASK
IndicSetStyle (indic, style)

Set an indicator to plain, squiggle or TT.

IndicGetStyle (indic)

Retrieve the style of an indicator.

IndicSetFore (indic, color)

Set the foreground colour of an indicator

IndicGetFore (indic)

Retrieve the foreground colour of an indicator.

SetWhitespaceFore (useSetting, color)

Set the foreground colour of all whitespace and whether to use this setting.

SetWhitespaceBack (useSetting, color)

Set the background colour of all whitespace and whether to use this setting.

SetStyleBits (bits)

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.

GetStyleBits

Retrieve number of bits in style bytes used to hold the lexical state.

SetLineState (line, state)

Used to hold extra styling information for each line.

GetLineState (line)

Retrieve the extra styling information for a line.

GetMaxLineState

Retrieve the last line number that has line state.

GetCaretLineVisible

Is the background of the line containing the caret in a different colour?

SetCaretLineVisible (show)

Display the background of the line containing the caret in a different colour.

GetCaretLineBack

Get the colour of the background of the line containing the caret.

SetCaretLineBack (color)

Set the colour of the background of the line containing the caret.

StyleSetChangeable (style, bool)

Set a style to be changeable or not (read only).

AutoCShow (lenEntered, itemList))

Display a auto-completion list. The lenEntered parameter indicates how many characters before the caret should be used to provide context.

AutoCCancel

Remove the auto-completion list from the screen.

AutoCActive

Is there an auto-completion list visible?

AutoCPosStart

Retrieve the position of the caret when the auto-completion list was displayed.

AutoCComplete

User has selected an item so remove the list and insert the selection.

AutoCStops (characterSet)

Define a set of character that when typed cancel the auto-completion list.

AutoCSetSeparator (characterSet)

Change the separator character in the string setting up an auto-completion list. Default is space but can be changed if items contain space.

AutoCGetSeparator

Retrieve the auto-completion list separator character.

AutoCSelect (text)

Select the item in the auto-completion list that starts with a string.

AutoCSetCancelAtStart (cancel)

Should the auto-completion list be cancelled if the user backspaces to a position before where the box was created.

AutoCGetCancelAtStart

Retrieve whether auto-completion cancelled by backspacing before start.

AutoCSetFillUps (characterSet)

Define a set of characters that when typed will cause the autocompletion to choose the selected item.

AutoCSetChooseSingle (chooseSingle)

Should a single item auto-completion list automatically choose the item.

AutoCGetChooseSingle

Retrieve whether a single item auto-completion list automatically choose the item.

AutoCSetIgnoreCase (ignoreCase)

Set whether case is significant when performing auto-completion searches.

AutoCGetIgnoreCase

Retrieve state of ignore case flag.

UserListShow (listType, itemList)

Display a list of strings and send notification when user chooses one.

AutoCSetAutoHide (autoHide)

Set whether or not autocompletion is hidden automatically when nothing matches.

AutoCGetAutoHide

Retrieve whether or not autocompletion is hidden automatically when nothing matches.

AutoCSetDropRestOfWord (auutoHide)

Retrieve whether or not autocompletion is hidden automatically when nothing matches.

AutoCGetDropRestOfWord

Retrieve whether or not autocompletion is hidden automatically when nothing matches.

RegisterImage (type, xpmData)

Register an XPM image for use in autocompletion lists.

ClearRegisteredImages

Clear all the registered XPM images.

AutoCGetTypeSeparator

Retrieve the auto-completion list type-separator character.

AutoCSetTypeSeparator

Change the type-separator character in the string setting up an auto-completion list. Default is '?' but can be changed if items contain '?'.

AutoCGetMaxHeight

Set the maximum height, in rows, of auto-completion and user lists.

AutoCSetMaxHeight (rowCount)

Set the maximum height, in rows, of auto-completion and user lists. The default is 5 rows.

AutoCGetMaxWidth

Get the maximum width, in characters, of auto-completion and user lists.

AutoCSetMaxWidth (characterCount)

Set the maximum width, in characters, of auto-completion and user lists. Set to 0 to autosize to fit longest item, which is the default.

SetIndent (indentSize)

Set the number of spaces used for one level of indentation.

GetIndent

Retrieve indentation size.

SetUseTabs (useTabs)

Indentation will only use space characters if useTabs is false, otherwise it will use a combination of tabs and spaces.

GetUseTabs

Retrieve whether tabs will be used in indentation.

SetLineIndentation (line, indentSize)

Change the indentation of a line to a number of columns.

GetLineIndentation (line)

Retrieve the number of columns that a line is indented.

GetLineIndentPosition (line)

Retrieve the position before the first non indentation character on a line.

GetColumn (pos)

Retrieve the column number of a position, taking tab width into account.

SetHScrollBar (show)

Show or hide the horizontal scroll bar.

GetHScrollBar

Is the horizontal scroll bar visible?

SetIndentationGuides (bool)

Show or hide indentation guides.

GetIndentationGuides

Are the indentation guides visible?

SetHighlightGuide (column)

Set the highlighted indentation guide column. 0 = no highlighted guide.

GetHighlightGuide

Get the highlighted indentation guide column.

GetLineEndPosition (line)

Get the position after the last visible characters on a line.

GetCodePage

Get the code page used to interpret the bytes of the document as characters.

GetCaretFore (color)

Get the foreground colour of the caret.

GetUsePalette

In palette mode?

GetReadOnly

In read-only mode?

SetCurrentPos (position)

Sets the position of the caret.

SetSelectionStart (position)

Sets the position that starts the selection - this becomes the anchor.

GetSelectionStart

Returns the position at the start of the selection.

SetSelectionEnd (position)

Sets the position that ends the selection - this becomes the currentPosition.

GetSelectionEnd

Returns the position at the start of the selection.

SetPrintMagnification (magnification)

Sets the print magnification added to the point size of each style for printing.

GetPrintMagnification

Returns the print magnification.

PrintColourMode - use same colours as screen. SC_PRINT_NORMAL PrintColourMode - invert the light value of each style for printing. SC_PRINT_INVERTLIGHT PrintColourMode - force black text on white background for printing. SC_PRINT_BLACKONWHITE PrintColourMode - text stays coloured, but all background is forced to be white for printing. SC_PRINT_COLOURONWHITE PrintColourMode - only the default-background is forced to be white for printing. SC_PRINT_COLOURONWHITEDEFAULTBG

SetPrintColourMode (mode)

Modify colours when printing for clearer printed text.

GetPrintColourMode

Returns the print colour mode.

FIND constant
SCFIND_WHOLEWORD
SCFIND_MATCHCASE
SCFIND_WORDSTART
SCFIND_REGEXP
SCFIND_POSIX
FindText (textToFind, start=0, end=GetLength(), flag = SCFIND_WHOLEWORD)

Find some text in the document.

FormatRange (start=0, end=GetLength(), draw=1)

On Windows, will draw the document into a display context such as a printer.

GetFirstVisibleLine

Retrieve the display line at the top of the display.

GetLine (line)

Return text of line.

GetLineCount

Returns the number of lines in the document. There is always at least one.

SetMarginLeft (pixelWidth)

Sets the size in pixels of the left margin.

GetMarginLeft

Returns the size in pixels of the left margin.

SetMarginRight (pixelWidth)

Sets the size in pixels of the right margin.

GetMarginRight

Returns the size in pixels of the right margin.

GetModify

Is the document different from when it was last saved?

SetSel (start, end)

Select a range of text.

GetSelText

Retrieve the selected text.

GetTextRange (start=0, end=Length)

Retrieve a range of text.

HideSelection (normal)

Draw the selection in normal style or with selection highlighted.

PointXFromPosition (position)

Retrieve the x value of the point in the window where a position is displayed.

PointYFromPosition (position)

Retrieve the y value of the point in the window where a position is displayed.

LineFromPosition (position)

Retrieve the line containing a position.

PositionFromLine (line)

Retrieve the position at the start of a line.

LineScroll (columns, lines)

Scroll horizontally and vertically.

ScrollCaret

Ensure the caret is visible.

ReplaceSel (text)

Replace the selected text with the argument text.

SetReadOnly (bool)

Set to read only or read write.

Null

Null operation.

CanPaste

Will a paste succeed?

CanUndo

Are there any undoable actions in the undo history?

EmptyUndoBuffer

Delete the undo history.

Undo

Undo one action in the undo history.

Cut

Cut the selection to the clipboard.

Copy

Copy the selection to the clipboard.

Paste

Paste the contents of the clipboard into the document replacing the selection.

Clear

Clear the selection.

SetText (text)

Replace the contents of the document with the argument text.

GetText

Retrieve all the text in the document.

GetTextLength

Retrieve the number of characters in the document.

GetDirectFunction

Retrieve a pointer to a function that processes messages for this Scintilla.

GetDirectPointer

Retrieve a pointer to a function that processes messages for this Scintilla.

SetOvertype (overtype)

Set to overtype (true) or insert mode.

GetOvertype

Returns true if overtype mode is active otherwise false is returned.

SetCaretWidth (pixelWidth)

Set the width of the insert mode caret.

GetCaretWidth

Returns the width of the insert mode caret.

SetTargetStart (position)

Sets the position that starts the target which is used for updating the document without affecting the scroll position.

GetTargetStart

Get the position that starts the target.

SetTargetEnd (position)

Sets the position that ends the target which is used for updating the document without affecting the scroll position.

GetTargetEnd

Get the position that ends the target.

ReplaceTarget (text)

Replace the target text with the argument text. Text is counted so it can contain NULs. Returns the length of the replacement text.

ReplaceTargetRE ($text)

Replace the target text with the argument text after \d processing. Text is counted so it can contain NULs. Looks for \d where d is between 1 and 9 and replaces these with the strings matched in the last search operation which were surrounded by \( and \). Returns the length of the replacement text including any change caused by processing the \d patterns

SearchInTarget (text)

Search for a counted string in the target and set the target to the found range. Text is counted so it can contain NULs. Returns length of range or -1 for failure in which case target is not moved.

SetSearchFlags (flags)

Set the search flags used by SearchInTarget.

GetSearchFlags

Get the search flags used by SearchInTarget.

CallTipShow (position, definition)

Show a call tip containing a definition near position pos.

CallTipCancel

Remove the call tip from the screen.

CallTipActive

Is there an active call tip?

CallTipPosStart

Retrieve the position where the caret was before displaying the call tip.

CallTipSetHlt (start, end)

Highlight a segment of the definition.

CallTipSetBack (color)

Set the background colour for the call tip.

CallTipSetFore (color)

Set the foreground colour for the call tip.

CallTipSetForeHlt (color)

Set the foreground colour for the highlighted part of the call tip.

CallTipUseStyle (tabSize)

Enable use of STYLE_CALLTIP and set call tip tab size in pixels.

VisibleFromDocLine (line)

Find the display line of a document line taking hidden lines into account.

DocLineFromVisible (lineDisplay)

Find the document line of a display line taking hidden lines into account.

WrapCount (line)

The number of display lines needed to wrap a document line

FOLDERLEVEL constant
SC_FOLDLEVELBASE
SC_FOLDLEVELWHITEFLAG
SC_FOLDLEVELHEADERFLAG
SC_FOLDLEVELBOXHEADERFLAG
SC_FOLDLEVELBOXFOOTERFLAG
SC_FOLDLEVELCONTRACTED
SC_FOLDLEVELUNINDENT
SC_FOLDLEVELNUMBERMASK
SetFoldLevel (line, level)

Set the fold level of a line. This encodes an integer level along with flags indicating whether the line is a header and whether it is effectively white space.

GetFoldLevel (line)

Retrieve the fold level of a line.

GetLastChild (line, level)

Find the last child line of a header line.

GetFoldParent (line)

Find the parent line of a child line.

ShowLines (lineStart, lineEnd)

Make a range of lines visible.

HideLines (lineStart, lineEnd)

Make a range of lines invisible.

GetLineVisible (line)

Is a line visible?

SetFoldExpanded (line, expanded)

Show the children of a header line.

GetFoldExpanded (line)

Is a header line expanded ?

ToggleFold (line)

Switch a header line between expanded and contracted.

EnsureVisible (line)

Ensure a particular line is visible by expanding any header line hiding it.

FOLDFLAG constant
SC_FOLDFLAG_LINEBEFORE_EXPANDED
SC_FOLDFLAG_LINEBEFORE_CONTRACTED
SC_FOLDFLAG_LINEAFTER_EXPANDED
SC_FOLDFLAG_LINEAFTER_CONTRACTED
SC_FOLDFLAG_LEVELNUMBERS
SC_FOLDFLAG_BOX
SetFoldFlags (flags)

Set some style options for folding.

EnsureVisibleEnforcePolicy (line)

Ensure a particular line is visible by expanding any header line hiding it. Use the currently set visibility policy to determine which range to display.

SetTabIndents (tabIndents)

Sets whether a tab pressed when caret is within indentation indents.

GetTabIndents

Does a tab pressed when caret is within indentation indent?

SetBackSpaceUnIndents (bsUnIndents)

Sets whether a backspace pressed when caret is within indentation unindents.

GetBackSpaceUnIndents

Does a backspace pressed when caret is within indentation unindent?

TIME constant
SC_TIME_FOREVER
SetMouseDwellTime (period)

Sets the time the mouse must sit still to generate a mouse dwell event.

GetMouseDwellTime

Retrieve the time the mouse must sit still to generate a mouse dwell event.

WordStartPosition (pos, onlyWordCharacters)

Get position of start of word.

WordEndPosition (pos, onlyWordCharacters)

Get position of end of word.

WRAP constant
SC_WRAP_NONE
SC_WRAP_WORD
SC_WRAP_CHAR
SetWrapMode (mode)

Sets whether text is word wrapped.

GetWrapMode

Retrieve whether text is word wrapped.

WRAPVISUALFLAG constant
SC_WRAPVISUALFLAG_NONE
SC_WRAPVISUALFLAG_END
SC_WRAPVISUALFLAG_START
SetWrapVisualFlags (wrapVisualFlags)

Set the display mode of visual flags for wrapped lines.

GetWrapVisualFlags

Retrive the display mode of visual flags for wrapped lines.

WRAPVISUALFLAGLOC constant
SC_WRAPVISUALFLAGLOC_DEFAULT
SC_WRAPVISUALFLAGLOC_END_BY_TEXT
SC_WRAPVISUALFLAGLOC_START_BY_TEXT
SetWrapVisualFlagsLocation (wrapVisualFlagsLocation)

Set the location of visual flags for wrapped lines.

GetWrapVisualFlagsLocation

Retrive the location of visual flags for wrapped lines.

SetWrapStartIndent (indent)

Set the start indent for wrapped lines.

GetWrapStartIndent

Retrive the start indent for wrapped lines.

CACHE constant
SC_CACHE_NONE
SC_CACHE_CARET
SC_CACHE_PAGE
SC_CACHE_DOCUMENT
SetLayoutCache (mode)

Sets the degree of caching of layout information.

GetLayoutCache

Retrieve the degree of caching of layout information.

SetScrollWidth (pixelWidth)

Sets the document width assumed for scrolling.

GetScrollWidth

Retrieve the document width assumed for scrolling.

TextWidth (style, text)

Measure the pixel width of some text in a particular style. NUL terminated text argument. Does not handle tab or control characters.

SetEndAtLastLine (endAtLastLine)

Sets the scroll range so that maximum scroll position has the last line at the bottom of the view (default). Setting this to false allows scrolling one page below the last line.

GetEndAtLastLine

Retrieve whether the maximum scroll position has the last line at the bottom of the view.

TextHeight (line)

Retrieve the height of a particular line of text in pixels.

SetVScrollBar (bool)

Show or hide the vertical scroll bar.

GetVScrollBar

Is the vertical scroll bar visible?

AppendText (text)

Append a string to the end of the document without changing the selection.

GetTwoPhaseDraw

Is drawing done in two phases with backgrounds drawn before faoregrounds?

SetTwoPhaseDraw(bool twoPhase)

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.

TargetFromSelection

Make the target range start and end be the same as the selection range start and end.

LinesJoin

Join the lines in the target. This is an experimental feature and may be changed or removed.

LinesSplit(pixelWidth)

Split the lines in the target into lines that are less wide than pixelWidth where possible.

SetFoldMarginColour(bool useSetting, color back)

Set the colours used as a chequerboard pattern in the fold margin

SetFoldMarginHiColour(bool useSetting, color back)

Set the colours used as a chequerboard pattern in the fold margin

LineDown

Move caret down one line.

LineDownExtend

Move caret down one line extending selection to new caret position.

LineUp

Move caret up one line.

LineUpExtend

Move caret up one line extending selection to new caret position.

CharLeft

Move caret left one character.

CharLeftExtend

Move caret left one character extending selection to new caret position.

CharRight

Move caret right one character.

CharRightExtend

Move caret right one character extending selection to new caret position.

WordLeft

Move caret left one word.

WordLeftExtend

Move caret left one word extending selection to new caret position.

WordRight

Move caret right one word.

WordRightExtend

Move caret right one word extending selection to new caret position.

Home

Move caret to first position on line.

HomeExtend

Move caret to first position on line extending selection to new caret position.

LineEnd

Move caret to last position on line.

LineEndExtend

Move caret to last position on line extending selection to new caret position.

DocumentStart

Move caret to first position in document.

DocumentStartExtend

Move caret to first position in document extending selection to new caret position.

DocumentEnd

Move caret to last position in document.

DocumentEndExtend

Move caret to last position in document extending selection to new caret position.

PageUp

Move caret one page up.

PageUpExtend

Move caret one page up extending selection to new caret position.

PageDown

Move caret one page down.

PageDownExtend

Move caret one page down extending selection to new caret position.

EditToggleOvertype

Switch from insert to overtype mode or the reverse.

Cancel

Cancel any modes such as call tip or auto-completion list display.

DeleteBack

Delete the selection or if no selection, the character before the caret.

Tab

If selection is empty or all on one line replace the selection with a tab character. If more than one line selected, indent the lines.

BackTab

Dedent the selected lines.

NewLine

Insert a new line, may use a CRLF, CR or LF depending on EOL mode.

FormFeed

Insert a Form Feed character.

VCHome

Move caret to before first visible character on line. If already there move to first character on line.

VCHomeExtend

Like VCHome but extending selection to new caret position.

ZoomIn

Magnify the displayed text by increasing the sizes by 1 point.

ZoomOut

Make the displayed text smaller by decreasing the sizes by 1 point.

DelWordLeft

Delete the word to the left of the caret.

DelWordRight

Delete the word to the right of the caret.

LineCut

Cut the line containing the caret.

LineDelete

Delete the line containing the caret.

LineTranspose

Switch the current line with the previous.

LineDuplicate

Duplicate the current line.

LowerCase

Transform the selection to lower case.

UpperCase

Transform the selection to upper case.

LineScrollDown

Scroll the document down, keeping the caret visible.

LineScrollUp

Scroll the document up, keeping the caret visible.

DeleteBackNotLine

Delete the selection or if no selection, the character before the caret. Will not delete the character before at the start of a line.

HomeDisplay

Move caret to first position on display line.

HomeDisplayExtend

Move caret to first position on display line extending selection to new caret position.

LineEndDisplay

Move caret to last position on display line.

LineEndDisplayExtend

Move caret to last position on display line extending selection to new caret position.

HomeWrap

These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like (Home|LineEnd)Display The difference is that, the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.

HomeWrapExtend

See HomeWrap

LineEndWrap

See HomeWrap

LineEndWrapExtend

See HomeWrap

VCHomeWrap

See HomeWrap

VCHomeWrapExtend

See HomeWrap

LineCopy

Copy the line containing the caret.

MoveCaretInsideView

Move the caret inside current view if it's not there already.

LineLength (line)

How many characters are on a line, not including end of line characters?

BraceHighlight (pos1, pos2)

Highlight the characters at two positions.

BraceBadLight (pos)

Highlight the character at a position indicating there is no matching brace.

BraceMatch (pos)

Find the position of a matching brace or INVALID_POSITION if no match.

GetViewEOL

Are the end of line characters visible?

SetViewEOL (visible)

Make the end of line characters visible or invisible.

GetDocPointer

Retrieve a pointer to the document object.

SetDocPointer (pointer)

Change the document object used.

SetModEventMask (mask)

Set which document modification events are sent to the container.

EDGE constant
EDGE_NONE
EDGE_LINE
EDGE_BACKGROUND
GetEdgeColumn

Retrieve the column number which text should be kept within.

SetEdgeColumn (column)

Set the column number of the edge. If text goes past the edge then it is highlighted.

GetEdgeMode

Retrieve the edge highlight mode.

SetEdgeMode (mode)

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).

GetEdgeColour

Retrieve the colour used in edge indication.

SetEdgeColour (color)

Change the colour used in edge indication.

SearchAnchor

Sets the current caret position to be the search anchor.

SearchNext (flags, text)

Find some text starting at the search anchor. Does not ensure the selection is visible.

SearchPrev (flags, text)

Find some text starting at the search anchor and moving backwards. Does not ensure the selection is visible.

LinesOnScreen

Retrieves the number of lines completely visible.

UsePopUp (allowPopUp)

Set whether a pop up menu is displayed automatically when the user presses the wrong mouse button

SelectionIsRectangle

Is the selection rectangular? The alternative is the more common stream selection.

SetZoom (zoom)

Set the zoom level. This number of points is added to the size of all fonts. It may be positive to magnify or negative to reduce.

GetZoom

Retrieve the zoom level.

CreateDocument

Create a new document object. Starts with reference count of 1 and not selected into editor.

AddRefDocument (doc)

Extend life of document.

ReleaseDocument (doc)

Release a reference to the document, deleting document if it fades to black.

GetModEventMask

Get which document modification events are sent to the container.

SetFocus (flag)

Change internal focus flag.

GetFocus

Get internal focus flag.

SetStatus

Change error status - 0 = OK.

GetStatus

Get error status.

SetMouseDownCaptures (capture)

Set whether the mouse is captured when its button is pressed.

GetMouseDownCaptures

Get whether mouse gets captured.

CURSOR constant
SC_CURSORNORMAL
SC_CURSORWAIT
SetCursor (cursorType)

Sets the cursor to one of the SC_CURSOR* values.

GetCursor

Get cursor type.

SetControlCharSymbol (symbol)

Change the way control characters are displayed: If symbol is < 32, keep the drawn way, else, use the given character.

GetControlCharSymbol

Get the way control characters are displayed.

WordPartLeft

Move to the previous change in capitalisation.

WordPartLeftExtend

Move to the previous change in capitalisation extending selection to new caret position.

WordPartRight

Move to the change next in capitalisation.

WordPartRightExtend

Move to the next change in capitalisation extending selection to new caret position.

VISIBLE constant
VISIBLE_SLOP
VISIBLE_STRICT
SetVisiblePolicy (visiblePolicy, visibleSlop)

Set the way the display area is determined when a particular line is to be moved to by Find, FindNext, GotoLine, etc.

DelLineLeft

Delete back from the current position to the start of the line.

DelLineRight

Delete forwards from the current position to the end of the line.

SetXOffset

Set the xOffset (ie, horizonal scroll position).

GetXOffset

Get the xOffset (ie, horizonal scroll position).

ChooseCaretX

Set the last x chosen value to be the caret x position.

GrabFocus

Set the focus to this Scintilla widget.

CARET constant
CARET_SLOP
If CARET_SLOP is set, we can define a slop value: caretSlop.
This value defines an unwanted zone (UZ) where the caret is... unwanted.
This zone is defined as a number of pixels near the vertical margins,
and as a number of lines near the horizontal margins.
By keeping the caret away from the edges, it is seen within its context,
so it is likely that the identifier that the caret is on can be completely seen,
and that the current line is seen with some of the lines following it which are
often dependent on that line.

CARET_STRICT
If CARET_STRICT is set, the policy is enforced... strictly.
The caret is centred on the display if slop is not set,
and cannot go in the UZ if slop is set.

CARET_JUMPS
If CARET_JUMPS is set, the display is moved more energetically
so the caret can move in the same direction longer before the policy is applied again.

CARET_EVEN
If CARET_EVEN is not set, instead of having symmetrical UZs,
the left and bottom UZs are extended up to right and top UZs respectively.
This way, we favour the displaying of useful information: the begining of lines,
where most code reside, and the lines after the caret, eg. the body of a function.
SetXCaretPolicy (caretPolicy, caretSlop)

Set the way the caret is kept visible when going sideway. The exclusion zone is given in pixels.

SetYCaretPolicy (caretPolicy, caretSlop)

Set the way the line the caret is on is kept visible. The exclusion zone is given in lines.

SetPrintWrapMode (mode)

Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).

GetPrintWrapMode

Is printing line wrapped?

SetHotspotActiveFore (useSetting, color)

Set a fore colour for active hotspots.

SetHotspotActiveBack (useSetting, color)

Set a back colour for active hotspots.

SetHotspotActiveUnderline (underline)

Enable / Disable underlining active hotspots.

SetHotspotSingleLine (singleLine)

Limit hotspots to single line so hotspots on two lines don't merge.

ParaDown

Move caret between paragraphs (delimited by empty lines).

ParaDownExtend

Move caret between paragraphs (delimited by empty lines).

ParaUp

Move caret between paragraphs (delimited by empty lines).

ParaUpExtend

Move caret between paragraphs (delimited by empty lines).

PositionBefore (pos)

Given a valid document position, return the previous position taking code page into account. Returns 0 if passed 0.

PositionAfter(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.

CopyRange(start, end)

Copy a range of text to the clipboard. Positions are clipped into the document.

CopyText (length, text)

Copy argument text to the clipboard.

SetSelectionMode (mode)

Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or by lines (SC_SEL_LINES).

GetSelectionMode

Get the mode of the current selection.

GetLineSelStartPosition (line)

Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).

GetLineSelEndPosition (line)

Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).

LineDownRectExtend

Move caret down one line, extending rectangular selection to new caret position.

LineUpRectExtend

Move caret up one line, extending rectangular selection to new caret position.

CharLeftRectExtend

Move caret left one character, extending rectangular selection to new caret position.

CharRightRectExtend

Move caret right one character, extending rectangular selection to new caret position.

HomeRectExtend

Move caret to first position on line, extending rectangular selection to new caret position.

VCHomeRectExtend

Move caret to before first visible character on line. If already there move to first character on line. In either case, extend rectangular selection to new caret position.

LineEndRectExtend

Move caret to last position on line, extending rectangular selection to new caret position.

PageUpRectExtend

Move caret one page up, extending rectangular selection to new caret position.

PageDownRectExtend

Move caret one page down, extending rectangular selection to new caret position.

StutteredPageUp

Move caret to top of page, or one page up if already at top of page.

StutteredPageUpExtend

Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.

StutteredPageDown

Move caret to bottom of page, or one page down if already at bottom of page.

StutteredPageDownExtend

Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.

WordLeftEnd

Move caret left one word, position cursor at end of word.

WordLeftEndExtend

Move caret left one word, position cursor at end of word, extending selection to new caret position.

WordRightEnd

Move caret right one word, position cursor at end of word.

WordRightEndExtend

Move caret right one word, position cursor at end of word, extending selection to new caret position.

SetWhitespaceChars (characters)

Set the set of characters making up whitespace for when moving or selecting by word. Should be called after SetWordChars.

SetCharsDefault

Reset the set of characters for whitespace and word characters to the defaults.

AutoCGetCurrent

Get currently selected item position in the auto-completion list.

Allocate (bytes)

Enlarge the document to a particular size of text bytes.

TargetAsUTF8

Returns the target converted to UTF8.

SetLengthForEncode (num_bytes)

Set the length of the utf8 argument for calling EncodedFromUTF8. Set to -1 and the string will be measured to the first nul.

EncodedFromUTF8 (utf8string)

Translates a UTF8 string into the document encoding. On error returns undef.

FindColumn (line, column)

Find the position of a column on a line taking into account tabs and multi-byte characters. If beyond end of line, return line end position.

GetCaretSticky

Can the caret preferred x position only be changed by explicit movement commands?

SetCaretSticky (useCaretStickyBehaviour)

Stop the caret preferred x position changing when the user types.

ToggleCaretSticky

Switch between sticky and non-sticky: meant to be bound to a key.

SetPasteConvertEndings (convert)

Enable/Disable convert-on-paste for line endings

GetPasteConvertEndings

Get convert-on-paste setting

SelectionDuplicate

Duplicate the selection. If selection empty duplicate the line containing the caret.

SetCaretLineBackAlpha (alpha)

Set background alpha of the caret line.

GetCaretLineBackAlpha

Get the background alpha of the caret line.

StartRecord

Start notifying the container of all key presses and commands.

StopRecord

Stop notifying the container of all key presses and commands.

SetLexer (lexer)

Set the lexing language of the document.

GetLexer

Retrieve the lexing language of the document.

Colourise (start, end)

Colourise a segment of the document using the current lexing language.

SetProperty (key, value)

Set up a value that may be used by a lexer for some optional feature.

GetProperty (key)

Retrieve a "property" value previously set with SetProperty.

GetPropertyExpanded (key)

Retrieve a "property" value previously set with SetProperty, with "$()" variable replacement on returned buffer.

GetPropertyInt (key)

Retrieve a "property" value previously set with SetProperty, interpreted as an int AFTER any "$()" variable replacement.

GetStyleBitsNeeded

Retrieve the number of bits the current lexer needs for styling.

SetKeyWords (keywordSet, keyWords)

Set up the key words used by the lexer.

Maximum value of keywordSet parameter of SetKeyWordsis defined by KEYWORDSET_MAX.

SetLexerLanguage (language)

Set the lexing language of the document based on string name.

LoadLexerLibrary (path)

Load a lexer library (dll / so).

Lexer constant

See Scintilla.pm

SCLEX_* contant for lexer language.
SCE_* for lexer constant.

See comment for relation between Lexer language and lexer constant.

Scintilla deprecated method

SetCaretPolicy (path)

CARET_POLICY changed in 1.47

DEPENDENCIES

This module requires these other modules and libraries:

Win32::GUI - L<http://perl-win32-gui.sourceforge.net/>
Scintilla  - L<http://www.scintilla.org/>

SEE ALSO

Win32::GUI

AUTHOR

Laurent Rocher (lrocher@cpan.org). Additional Coding: Robert May (robertemay@users.sourceforge.net).

COPYRIGHT AND LICENCE

Copyright 2003..2005 by Laurent Rocher (lrocher@cpan.org).

Copyright 2006..2008 by Robert May (robertemay@users.sourceforge.net).

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This program distributes the dynamic link library SciLexer.dll from the Scintilla distribution. Source distributions include header files and interface definitions from the same project. These components come with the following copyright and licence:

Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>. All Rights Reserved.

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that 
both that copyright notice and this permission notice appear in 
supporting documentation. 

NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY 
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE 
OR PERFORMANCE OF THIS SOFTWARE.