=head1 NAME Win32::GUI::Scintilla - Add Scintilla edit control to Win32::GUI =head1 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"; } =head1 DESCRIPTION Scintilla is a free source code editing component. L =head2 Scintilla creation =over =item C (...) 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 =item C (...) 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. =back =head2 Scintilla Event =over =item C (%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 =item C Fire when Scintilla edit control text change. See also Notify SCN_MODIFIED event. =item C Fire when Scintilla edit control got focus. =item C Fire when Scintilla edit control lost focus. =back =head2 Scintilla utility method =over =item C Clean control for editing a new file. - Clear Text - Clear Undo buffer - Set save point =item C (filename) Load a text file. - Clear undo buffer - Set save point Return : bool =item C (filename) Save text in file. - Set save point Return : bool =item C (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" =item C (bracematch = "[](){}") A standard brace highlighting event manager. =item C (%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 =item C Folding or Unfolding all text. =item C (line, doExpand, force=0, visLevel=0, level=-1) Manage Folder Expanding =item C (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. =back =head2 Scintilla standard method For full documentation of Scintilla control see L =over =item C (text) Add text to the document. =item C (styledtext) Add array of cells to document. =item C (position, text) Insert string at a position. =item C Delete all text in the document. =item C Set all style bytes to 0, remove all folding information. =item C Return the number of characters in the document. =item C (position) Returns the character byte at the position. =item C Returns the position of the caret. =item C Returns the position of the opposite end of the selection to the caret. =item C (position) Returns the style byte at the position. =item C Redoes the next action on the undo history. =item C (collectUndo) Choose between collecting actions into the undo history and discarding them. =item C Select all the text in the document. =item C Remember the current position in the undo history as the position at which the document was saved. =item C (start=0, end=TextLength) Returns the number of bytes in the buffer not including terminating NULs. =item C Are there any redoable actions in the undo history? =item C (handle) Retrieve the line number at which a particular marker is located. =item C (handle) Delete a marker. =item C Is undo history being collected? =item C SCWS_INVISIBLE, SCWS_VISIBLEALWAYS, SCWS_VISIBLEAFTERINDENT =item C Are white space characters currently visible? =item C (viewWS) Make white space characters invisible, always visible or visible outside indentation. =item C (x, y) Find the position from a point within the window. =item C (x, y) Find the position from a point within the window but return INVALID_POSITION if not close to text. =item C (line) Set caret to start of a line and ensure it is visible. =item C (position) Set caret to a position and ensure it is visible. =item C (position) Set the selection anchor to a position. The anchor is the opposite end of the selection from the caret. =item C Return the text of the line containing the caret. =item C Retrieve the position of the last correctly styled character. =item C SC_EOL_CRLF, SC_EOL_CR, SC_EOL_LF. =item C (eolMode) Convert all line endings in the document to one mode. =item C Retrieve the current end of line mode - one of CRLF, CR, or LF. =item C (eolMode) Set the current end of line mode. =item C (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. =item C (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. =item C Is drawing done first into a buffer or direct to the screen? =item C (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. =item C (tabWidth) Change the visible size of a tab to be a multiple of the width of a space character. =item C Retrieve the visible size of a tab. =item C SC_CP_UTF8, SC_CP_DBCS =item C (codepage) Set the code page used to interpret the bytes of the document as characters. =item C (usePalette) In palette mode, Scintilla uses the environment's palette calls to display more colours. This may lead to ugly displays. =item C 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 =item C (markerNumber, markerSymbol) Set the symbol used for a particular marker number. =item C (markerNumber, fore) Set the foreground colour used for a particular marker number. =item C (markerNumber, back) Set the background colour used for a particular marker number. =item C (line, markerNumber) Add a marker to a line, returning an ID which can be used to find or delete the marker. =item C (line, markerNumber) Delete a marker from a line. =item C (markerNumber) Delete all markers with a particular number from all lines. =item C (line) Get a bit mask of all the markers set on a line. =item C (lineStart, markerMask) Find the next line after lineStart that includes a marker in mask. =item C (lineStart, markerMask) Find the previous line before lineStart that includes a marker in mask. =item C (markerNumber, pixmap) Define a marker from a pixmap. =item C (line, set) Add a set of markers to a line. =item C SC_MARGIN_SYMBOL, SC_MARGIN_NUMBER =item C (margin, marginType) Set a margin to be either numeric or symbolic. =item C (margin) Retrieve the type of a margin. =item C (margin, pixelWidth) Set the width of a margin to a width expressed in pixels. =item C (margin) Retrieve the width of a margin in pixels. =item C (margin, mask) Set a mask that determines which markers are displayed in a margin. =item C (margin) Retrieve the marker mask of a margin. =item C (margin, sensitive) Make a margin sensitive or insensitive to mouse clicks. =item C (margin) Retrieve the mouse click sensitivity of a margin. =item C