#define wxSTC_OPTIONAL_START 3000
#define wxSTC_LEXER_START 4000
-// Redoes the next action on the undo history
+// Redoes the next action on the undo history.
#define wxSTC_CMD_REDO 2011
// Select all the text in the document.
#define wxSTC_MARK_MINUS 7
#define wxSTC_MARK_PLUS 8
-// Shapes used for outlining column
+// Shapes used for outlining column.
#define wxSTC_MARK_VLINE 9
#define wxSTC_MARK_LCORNER 10
#define wxSTC_MARK_TCORNER 11
#define wxSTC_MARK_CIRCLEMINUS 20
#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
-// Invisible mark that only sets the line background color
+// Invisible mark that only sets the line background color.
#define wxSTC_MARK_BACKGROUND 22
#define wxSTC_MARK_CHARACTER 10000
-// Markers used for outlining column
+// Markers used for outlining column.
#define wxSTC_MARKNUM_FOLDEREND 25
#define wxSTC_MARKNUM_FOLDEROPENMID 26
#define wxSTC_MARKNUM_FOLDERMIDTAIL 27
// Delete the selection or if no selection, the character before the caret.
#define wxSTC_CMD_DELETEBACK 2326
-// If selection is empty or all on one line replace the selection with a tab
-// character.
+// 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.
#define wxSTC_CMD_TAB 2327
#define wxSTC_CMD_LINESCROLLUP 2343
// Delete the selection or if no selection, the character before the caret.
-// Will not delete the chraacter before at the start of a line.
+// Will not delete the character before at the start of a line.
#define wxSTC_CMD_DELETEBACKNOTLINE 2344
#define wxSTC_EDGE_NONE 0
#define wxSTC_EDGE_LINE 1
#define wxSTC_EDGE_BACKGROUND 2
+#define wxSTC_CURSORNORMAL -1
+#define wxSTC_CURSORWAIT 3
-// Show caret within N lines of edge when it's scrolled to view
-// If CARET_SLOP not set then centre caret on screen when it's
-// scrolled to view
-#define wxSTC_CARET_SLOP 0x01
+// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
+#define wxSTC_VISIBLE_SLOP 0x01
+#define wxSTC_VISIBLE_STRICT 0x04
-// Value not used
-#define wxSTC_CARET_CENTER 0x02
+// Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+// 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.
+#define wxSTC_CARET_SLOP 0x01
-// If CARET_SLOP also set then reposition whenever outside slop border
-// If CARET_SLOP not set then recentre even when visible
+// 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.
#define wxSTC_CARET_STRICT 0x04
-// If CARET_XEVEN set then both left and right margins are given equal weight
-// rather than favouring left following behaviour.
-#define wxSTC_CARET_XEVEN 0x08
+// 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.
+#define wxSTC_CARET_JUMPS 0x10
-// If CARET_XJUMPS set then when caret reaches the margin the display jumps
-// enough to leave the caret solidly within the display.
-#define wxSTC_CARET_XJUMPS 0x10
-#define wxSTC_CURSORNORMAL -1
-#define wxSTC_CURSORWAIT 3
-
-// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
-#define wxSTC_VISIBLE_SLOP 0x01
-#define wxSTC_VISIBLE_STRICT 0x04
+// 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.
+#define wxSTC_CARET_EVEN 0x08
// Notifications
-// Type of modification and the action which caused the modification
+// Type of modification and the action which caused the modification.
// These are defined as a bit mask to make it easy to specify which notifications are wanted.
// One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
#define wxSTC_MOD_INSERTTEXT 0x1
#define wxSTC_MOD_BEFOREDELETE 0x800
#define wxSTC_MODEVENTMASKALL 0xF77
-// Symbolic key codes and modifier flags
-// ASCII and other printable characters below 256
-// Extended keys above 300
+// Symbolic key codes and modifier flags.
+// ASCII and other printable characters below 256.
+// Extended keys above 300.
#define wxSTC_KEY_DOWN 300
#define wxSTC_KEY_UP 301
#define wxSTC_KEY_LEFT 302
#define wxSTC_LEX_PHP 30
#define wxSTC_LEX_BAAN 31
#define wxSTC_LEX_MATLAB 32
+#define wxSTC_LEX_SCRIPTOL 33
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
#define wxSTC_C_COMMENTDOCKEYWORD 17
#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
-// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
-#define wxSTC_B_DEFAULT 0
-#define wxSTC_B_COMMENT 1
-#define wxSTC_B_NUMBER 2
-#define wxSTC_B_KEYWORD 3
-#define wxSTC_B_STRING 4
-#define wxSTC_B_PREPROCESSOR 5
-#define wxSTC_B_OPERATOR 6
-#define wxSTC_B_IDENTIFIER 7
-#define wxSTC_B_DATE 8
-
// Lexical states for SCLEX_HTML, SCLEX_XML
#define wxSTC_H_DEFAULT 0
#define wxSTC_H_TAG 1
#define wxSTC_PL_STRING_QR 29
#define wxSTC_PL_STRING_QW 30
+// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
+#define wxSTC_B_DEFAULT 0
+#define wxSTC_B_COMMENT 1
+#define wxSTC_B_NUMBER 2
+#define wxSTC_B_KEYWORD 3
+#define wxSTC_B_STRING 4
+#define wxSTC_B_PREPROCESSOR 5
+#define wxSTC_B_OPERATOR 6
+#define wxSTC_B_IDENTIFIER 7
+#define wxSTC_B_DATE 8
+
+// Lexical states for SCLEX_PROPERTIES
+#define wxSTC_PROPS_DEFAULT 0
+#define wxSTC_PROPS_COMMENT 1
+#define wxSTC_PROPS_SECTION 2
+#define wxSTC_PROPS_ASSIGNMENT 3
+#define wxSTC_PROPS_DEFVAL 4
+
// Lexical states for SCLEX_LATEX
#define wxSTC_L_DEFAULT 0
#define wxSTC_L_COMMAND 1
#define wxSTC_ERR_PERL 6
#define wxSTC_ERR_NET 7
#define wxSTC_ERR_LUA 8
+#define wxSTC_ERR_CTAG 9
#define wxSTC_ERR_DIFF_CHANGED 10
#define wxSTC_ERR_DIFF_ADDITION 11
#define wxSTC_ERR_DIFF_DELETION 12
#define wxSTC_MAKE_TARGET 5
#define wxSTC_MAKE_IDEOL 9
-// Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+// Lexical states for SCLEX_DIFF
+#define wxSTC_DIFF_DEFAULT 0
+#define wxSTC_DIFF_COMMENT 1
+#define wxSTC_DIFF_COMMAND 2
+#define wxSTC_DIFF_HEADER 3
+#define wxSTC_DIFF_POSITION 4
+#define wxSTC_DIFF_DELETED 5
+#define wxSTC_DIFF_ADDED 6
+
+// Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
#define wxSTC_CONF_DEFAULT 0
#define wxSTC_CONF_COMMENT 1
#define wxSTC_CONF_NUMBER 2
#define wxSTC_CONF_IP 8
#define wxSTC_CONF_DIRECTIVE 9
-// Avenue
+// Lexical states for SCLEX_AVE, Avenue
#define wxSTC_AVE_DEFAULT 0
#define wxSTC_AVE_COMMENT 1
#define wxSTC_AVE_NUMBER 2
#define wxSTC_EIFFEL_IDENTIFIER 7
#define wxSTC_EIFFEL_STRINGEOL 8
-// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
+// Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
#define wxSTC_NNCRONTAB_DEFAULT 0
#define wxSTC_NNCRONTAB_COMMENT 1
#define wxSTC_NNCRONTAB_TASK 2
#define wxSTC_MATLAB_OPERATOR 6
#define wxSTC_MATLAB_IDENTIFIER 7
+// Lexical states for SCLEX_SCRIPTOL
+#define wxSTC_SCRIPTOL_DEFAULT 0
+#define wxSTC_SCRIPTOL_COMMENT 1
+#define wxSTC_SCRIPTOL_COMMENTLINE 2
+#define wxSTC_SCRIPTOL_COMMENTDOC 3
+#define wxSTC_SCRIPTOL_NUMBER 4
+#define wxSTC_SCRIPTOL_WORD 5
+#define wxSTC_SCRIPTOL_STRING 6
+#define wxSTC_SCRIPTOL_CHARACTER 7
+#define wxSTC_SCRIPTOL_UUID 8
+#define wxSTC_SCRIPTOL_PREPROCESSOR 9
+#define wxSTC_SCRIPTOL_OPERATOR 10
+#define wxSTC_SCRIPTOL_IDENTIFIER 11
+#define wxSTC_SCRIPTOL_STRINGEOL 12
+#define wxSTC_SCRIPTOL_VERBATIM 13
+#define wxSTC_SCRIPTOL_REGEX 14
+#define wxSTC_SCRIPTOL_COMMENTLINEDOC 15
+#define wxSTC_SCRIPTOL_WORD2 16
+#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORD 17
+#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
+#define wxSTC_SCRIPTOL_COMMENTBASIC 19
+
// END of generated section
//----------------------------------------------------------------------
// and regenerate
- // Add text to the document
+ // Add text to the document.
void AddText(const wxString& text);
- // Add array of cells to document
+ // Add array of cells to document.
void AddStyledText(const wxMemoryBuffer& data);
- // Insert string at a position
+ // Insert string at a position.
void InsertText(int pos, const wxString& text);
- // Delete all text in the document
+ // Delete all text in the document.
void ClearAll();
- // Set all style bytes to 0, remove all folding information
+ // Set all style bytes to 0, remove all folding information.
void ClearDocumentStyle();
- // The number of characters in the document
+ // The number of characters in the document.
int GetLength();
- // Returns the character byte at the position
+ // Returns the character byte at the position.
int GetCharAt(int pos);
- // Returns the position of the caret
+ // Returns the position of the caret.
int GetCurrentPos();
- // Returns the position of the opposite end of the selection to the caret
+ // Returns the position of the opposite end of the selection to the caret.
int GetAnchor();
- // Returns the style byte at the position
+ // Returns the style byte at the position.
int GetStyleAt(int pos);
- // Redoes the next action on the undo history
+ // Redoes the next action on the undo history.
void Redo();
// Choose between collecting actions into the undo
// Retrieve a buffer of cells.
wxMemoryBuffer GetStyledText(int startPos, int endPos);
- // Are there any redoable actions in the undo history.
+ // Are there any redoable actions in the undo history?
bool CanRedo();
- // Retrieve the line number at which a particular marker is located
+ // Retrieve the line number at which a particular marker is located.
int MarkerLineFromHandle(int handle);
// Delete a marker.
void SetEOLMode(int eolMode);
// 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.
+ // The styling mask can be used to protect some bits in each styling byte from modification.
void StartStyling(int pos, int mask);
// Change style from current styling position for length characters to a style
// and move the current styling position to after this newly styled segment.
void SetStyling(int length, int style);
- // Is drawing done first into a buffer or direct to the screen.
+ // Is drawing done first into a buffer or direct to the screen?
bool GetBufferedDraw();
// If drawing is buffered then each line of text is drawn into a bitmap buffer
// before drawing it to the screen to avoid flicker.
void SetBufferedDraw(bool buffered);
- // Change the visible size of a tab to be a multiple of the width of a space
- // character.
+ // Change the visible size of a tab to be a multiple of the width of a space character.
void SetTabWidth(int tabWidth);
// Retrieve the visible size of a tab.
// Add a marker to a line, returning an ID which can be used to find or delete the marker.
int MarkerAdd(int line, int markerNumber);
- // Delete a marker from a line
+ // Delete a marker from a line.
void MarkerDelete(int line, int markerNumber);
- // Delete all markers with a particular number from all lines
+ // Delete all markers with a particular number from all lines.
void MarkerDeleteAll(int markerNumber);
// Get a bit mask of all the markers set on a line.
// Get the time in milliseconds that the caret is on and off. 0 = steady on.
void SetCaretPeriod(int periodMilliseconds);
- // Set the set of characters making up words for when moving or selecting
- // by word.
+ // Set the set of characters making up words for when moving or selecting by word.
void SetWordChars(const wxString& characters);
// Start a sequence of actions that is undone and redone as a unit.
// Retrieve the foreground colour of an indicator.
wxColour IndicatorGetForeground(int indic);
- // 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
+ // 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.
void SetStyleBits(int bits);
// Is the background of the line containing the caret in a different colour?
bool GetCaretLineVisible();
- // Dsplay the background of the line containing the caret in a different colour.
+ // Display the background of the line containing the caret in a different colour.
void SetCaretLineVisible(bool show);
// Get the colour of the background of the line containing the caret.
// Is there an auto-completion list visible?
bool AutoCompActive();
- // Retrieve the position of the caret when the auto-completion list was
- // displayed.
+ // Retrieve the position of the caret when the auto-completion list was displayed.
int AutoCompPosStart();
// User has selected an item so remove the list and insert the selection.
// Define a set of character that when typed cancel the auto-completion list.
void AutoCompStops(const wxString& 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.
+ // Change the separator character in the string setting up an auto-completion list.
+ // Default is space but can be changed if items contain space.
void AutoCompSetSeparator(int separatorCharacter);
// Retrieve the auto-completion list separator character.
// Display a list of strings and send notification when user chooses one.
void UserListShow(int listType, const wxString& itemList);
- // Set whether or not autocompletion is hidden automatically when nothing matches
+ // Set whether or not autocompletion is hidden automatically when nothing matches.
void AutoCompSetAutoHide(bool autoHide);
- // Retrieve whether or not autocompletion is hidden automatically when nothing matches
+ // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
bool AutoCompGetAutoHide();
- // Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+ // Set whether or not autocompletion deletes any word characters
+ // after the inserted text upon completion.
void AutoCompSetDropRestOfWord(bool dropRestOfWord);
- // Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+ // Retrieve whether or not autocompletion deletes any word characters
+ // after the inserted text upon completion.
bool AutoCompGetDropRestOfWord();
// Set the number of spaces used for one level of indentation.
// Find some text in the document.
int FindText(int minPos, int maxPos, const wxString& text, int flags=0);
- // On Windows will draw the document into a display context such as a printer.
+ // On Windows, will draw the document into a display context such as a printer.
int FormatRange(bool doDraw,
int startPos,
int endPos,
// Will a paste succeed?
bool CanPaste();
- // Are there any undoable actions in the undo history.
+ // Are there any undoable actions in the undo history?
bool CanUndo();
// Delete the undo history.
// Retrieve the number of characters in the document.
int GetTextLength();
- // Set to overtype (true) or insert mode
+ // Set to overtype (true) or insert mode.
void SetOvertype(bool overtype);
// Returns true if overtype mode is active otherwise false is returned.
bool GetOvertype();
- // Set the width of the insert mode caret
+ // Set the width of the insert mode caret.
void SetCaretWidth(int pixelWidth);
- // Returns the width of the insert mode caret
+ // Returns the width of the insert mode caret.
int GetCaretWidth();
// Sets the position that starts the target which is used for updating the
// Returns length of range or -1 for failure in which case target is not moved.
int SearchInTarget(const wxString& text);
- // Set the search flags used by SearchInTarget
+ // Set the search flags used by SearchInTarget.
void SetSearchFlags(int flags);
- // Get the search flags used by SearchInTarget
+ // Get the search flags used by SearchInTarget.
int GetSearchFlags();
// Show a call tip containing a definition near position pos.
// Ensure a particular line is visible by expanding any header line hiding it.
void EnsureVisible(int line);
- // Set some debugging options for folding
+ // Set some debugging options for folding.
void SetFoldFlags(int flags);
// Ensure a particular line is visible by expanding any header line hiding it.
// Use the currently set visibility policy to determine which range to display.
void EnsureVisibleEnforcePolicy(int line);
- // Sets whether a tab pressed when caret is within indentation indents
+ // Sets whether a tab pressed when caret is within indentation indents.
void SetTabIndents(bool tabIndents);
// Does a tab pressed when caret is within indentation indent?
bool GetTabIndents();
- // Sets whether a backspace pressed when caret is within indentation unindents
+ // Sets whether a backspace pressed when caret is within indentation unindents.
void SetBackSpaceUnIndents(bool bsUnIndents);
// Does a backspace pressed when caret is within indentation unindent?
bool GetBackSpaceUnIndents();
- // Sets the time the mouse must sit still to generate a mouse dwell event
+ // Sets the time the mouse must sit still to generate a mouse dwell event.
void SetMouseDwellTime(int periodMilliseconds);
- // Retrieve the time the mouse must sit still to generate a mouse dwell event
+ // Retrieve the time the mouse must sit still to generate a mouse dwell event.
int GetMouseDwellTime();
- // Get position of start of word
+ // Get position of start of word.
int WordStartPosition(int pos, bool onlyWordCharacters);
- // Get position of end of word
+ // Get position of end of word.
int WordEndPosition(int pos, bool onlyWordCharacters);
- // Sets whether text is word wrapped
+ // Sets whether text is word wrapped.
void SetWrapMode(int mode);
- // Retrieve whether text is word wrapped
+ // Retrieve whether text is word wrapped.
int GetWrapMode();
- // Sets the degree of caching of layout information
+ // Sets the degree of caching of layout information.
void SetLayoutCache(int mode);
- // Retrieve the degree of caching of layout information
+ // Retrieve the degree of caching of layout information.
int GetLayoutCache();
- // Move the caret inside current view if it's not there already
+ // Sets the document width assumed for scrolling.
+ void SetScrollWidth(int pixelWidth);
+
+ // Retrieve the document width assumed for scrolling.
+ int GetScrollWidth();
+
+ // Measure the pixel width of some text in a particular style.
+ // Nul terminated text argument.
+ // Does not handle tab or control characters.
+ int TextWidth(int style, const wxString& text);
+
+ // Sets the scroll range so that maximum scroll position has
+ // the last line at the bottom of the view (default).
+ // Setting this to false allows scrolling one page below the last line.
+ void SetEndAtLastLine(bool endAtLastLine);
+
+ // Retrieve whether the maximum scroll position has the last
+ // line at the bottom of the view.
+ int GetEndAtLastLine();
+
+ // Retrieve the height of a particular line of text in pixels.
+ int TextHeight(int line);
+
+ // Move the caret inside current view if it's not there already.
void MoveCaretInsideView();
- // How many characters are on a line, not including end of line characters.
+ // How many characters are on a line, not including end of line characters?
int LineLength(int line);
// Highlight the characters at two positions.
// Find the position of a matching brace or INVALID_POSITION if no match.
int BraceMatch(int pos);
- // Are the end of line characters visible.
+ // Are the end of line characters visible?
bool GetViewEOL();
- // Make the end of line characters visible or invisible
+ // Make the end of line characters visible or invisible.
void SetViewEOL(bool visible);
// Retrieve a pointer to the document object.
// Does not ensure the selection is visible.
int SearchPrev(int flags, const wxString& text);
- // Set the way the line the caret is on is kept visible.
- void SetCaretPolicy(int caretPolicy, int caretSlop);
-
// Retrieves the number of lines completely visible.
int LinesOnScreen();
// the wrong mouse button.
void UsePopUp(bool allowPopUp);
- // Is the selection a rectangular. The alternative is the more common stream selection.
+ // Is the selection rectangular? The alternative is the more common stream selection.
bool SelectionIsRectangle();
// Set the zoom level. This number of points is added to the size of all fonts.
// Get which document modification events are sent to the container.
int GetModEventMask();
- // Change internal focus flag
+ // Change internal focus flag.
void SetSTCFocus(bool focus);
- // Get internal focus flag
+ // Get internal focus flag.
bool GetSTCFocus();
- // Change error status - 0 = OK
+ // Change error status - 0 = OK.
void SetStatus(int statusCode);
- // Get error status
+ // Get error status.
int GetStatus();
- // Set whether the mouse is captured when its button is pressed
+ // Set whether the mouse is captured when its button is pressed.
void SetMouseDownCaptures(bool captures);
- // Get whether mouse gets captured
+ // Get whether mouse gets captured.
bool GetMouseDownCaptures();
- // Sets the cursor to one of the SC_CURSOR* values
+ // Sets the cursor to one of the SC_CURSOR* values.
void SetCursor(int cursorType);
- // Get cursor type
+ // Get cursor type.
int GetCursor();
// Change the way control characters are displayed:
- // If symbol is < 32, keep the drawn way, else, use the given character
+ // If symbol is < 32, keep the drawn way, else, use the given character.
void SetControlCharSymbol(int symbol);
- // Get the way control characters are displayed
+ // Get the way control characters are displayed.
int GetControlCharSymbol();
- // Move to the previous change in capitalistion
+ // Move to the previous change in capitalisation.
void WordPartLeft();
- // Move to the previous change in capitalistion extending selection to new caret position.
+ // Move to the previous change in capitalisation extending selection
+ // to new caret position.
void WordPartLeftExtend();
- // Move to the change next in capitalistion
+ // Move to the change next in capitalisation.
void WordPartRight();
- // Move to the next change in capitalistion extending selection to new caret position.
+ // Move to the next change in capitalisation extending selection
+ // to new caret position.
void WordPartRightExtend();
- // Set the way the display area is determined when a particular line is to be moved to.
+ // Set the way the display area is determined when a particular line
+ // is to be moved to by Find, FindNext, GotoLine, etc.
void SetVisiblePolicy(int visiblePolicy, int visibleSlop);
- // Delete back from the current position to the start of the line
+ // Delete back from the current position to the start of the line.
void DelLineLeft();
- // Delete forwards from the current position to the end of the line
+ // Delete forwards from the current position to the end of the line.
void DelLineRight();
- // Get and Set the xOffset (ie, horizonal scroll position)
+ // Get and Set the xOffset (ie, horizonal scroll position).
void SetXOffset(int newOffset);
int GetXOffset();
+ // Set the way the caret is kept visible when going sideway.
+ // The exclusion zone is given in pixels.
+ void SetXCaretPolicy(int caretPolicy, int caretSlop);
+
+ // Set the way the line the caret is on is kept visible.
+ // The exclusion zone is given in lines.
+ void SetYCaretPolicy(int caretPolicy, int caretSlop);
+
// Start notifying the container of all key presses and commands.
void StartRecord();
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM, 1672)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_START_DRAG,
wxEVT_STC_DRAG_OVER,
wxEVT_STC_DO_DROP,
+ wxEVT_STC_ZOOM,
};
#endif
#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif
//----------------------------------------------------------------------
return stc->SendMsg(msg, wParam, lParam);
}
+long Platform::SendScintillaPointer(WindowID w,
+ unsigned int msg,
+ unsigned long wParam,
+ void *lParam) {
+
+ wxStyledTextCtrl* stc = (wxStyledTextCtrl*)w;
+ return stc->SendMsg(msg, wParam, (long)lParam);
+}
+
// These are utility functions not really tied to a platform
#include "wx/stc/stc.h"
#include "PlatWX.h"
-
-//----------------------------------------------------------------------
-
-const int H_SCROLL_MAX = 4000;
-const int H_SCROLL_STEP = 20;
-const int H_SCROLL_PAGE = 200;
-
//----------------------------------------------------------------------
// Helper classes
}
}
+const int H_SCROLL_STEP = 20;
bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
bool modified = false;
+ // Check the vertical scrollbar
if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar
int sbMax = stc->GetScrollRange(wxVERTICAL);
int sbThumb = stc->GetScrollThumb(wxVERTICAL);
}
- if (horizontalScrollBarVisible) {
- if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar
- int sbMax = stc->GetScrollRange(wxHORIZONTAL);
- int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
- if ((sbMax != H_SCROLL_MAX) || (sbThumb != H_SCROLL_STEP)) {
- stc->SetScrollbar(wxHORIZONTAL, 0, H_SCROLL_STEP, H_SCROLL_MAX);
- modified = true;
+ // Check the horizontal scrollbar
+ PRectangle rcText = GetTextRectangle();
+ int horizEnd = scrollWidth;
+ if (horizEnd < 0)
+ horizEnd = 0;
+ if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
+ horizEnd = 0;
+ int pageWidth = rcText.Width();
+
+ if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar
+ int sbMax = stc->GetScrollRange(wxHORIZONTAL);
+ int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
+ int sbPos = stc->GetScrollPos(wxHORIZONTAL);
+ if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
+ stc->SetScrollbar(wxHORIZONTAL, 0, pageWidth, horizEnd);
+ modified = true;
+ if (scrollWidth < pageWidth) {
+ HorizontalScrollTo(0);
}
}
- else { // otherwise use the one that's been given to us
- int sbMax = stc->m_hScrollBar->GetRange();
- int sbPage = stc->m_hScrollBar->GetPageSize();
- if ((sbMax != H_SCROLL_MAX) || (sbPage != H_SCROLL_STEP)) {
- stc->m_hScrollBar->SetScrollbar(0, H_SCROLL_STEP, H_SCROLL_MAX, H_SCROLL_STEP);
- modified = true;
+ }
+ else { // otherwise use the one that's been given to us
+ int sbMax = stc->m_hScrollBar->GetRange();
+ int sbThumb = stc->m_hScrollBar->GetPageSize();
+ int sbPos = stc->m_hScrollBar->GetThumbPosition();
+ if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
+ stc->m_hScrollBar->SetScrollbar(0, pageWidth, horizEnd, pageWidth);
+ modified = true;
+ if (scrollWidth < pageWidth) {
+ HorizontalScrollTo(0);
}
}
}
+
return modified;
}
void ScintillaWX::DoHScroll(int type, int pos) {
int xPos = xOffset;
+ PRectangle rcText = GetTextRectangle();
+ int pageWidth = rcText.Width() * 2 / 3;
if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
xPos -= H_SCROLL_STEP;
else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
xPos += H_SCROLL_STEP;
else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
- xPos -= H_SCROLL_PAGE;
- else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN)
- xPos += H_SCROLL_PAGE;
+ xPos -= pageWidth;
+ else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN) {
+ xPos += pageWidth;
+ if (xPos > scrollWidth - rcText.Width()) {
+ xPos = scrollWidth - rcText.Width();
+ }
+ }
else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
xPos = 0;
else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
- xPos = H_SCROLL_MAX;
+ xPos = scrollWidth;
else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
xPos = pos;
elif op == 'evt ':
pass
+ elif op == 'enu ':
+ pass
+
+ elif op == 'lex ':
+ pass
+
else:
print '***** Unknown line type: ', line
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
-The current version of the Scintilla code is 1.45
+The current version of the Scintilla code is 1.47
}
void SetCodePage(int codePage_) { codePage = codePage_; }
+ virtual bool Match(int pos, const char *s)=0;
virtual char StyleAt(int position)=0;
virtual int GetLine(int position)=0;
virtual int LineStart(int line)=0;
int language;
LexerFunction fnLexer;
LexerFunction fnFolder;
-
+ const char * const * wordListDescriptions;
+
static const LexerModule *base;
static int nextLanguage;
public:
const char *languageName;
LexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_=0, LexerFunction fnFolder_=0);
+ const char *languageName_=0, LexerFunction fnFolder_=0,
+ const char * const wordListDescriptions_[] = NULL);
int GetLanguage() const { return language; }
+
+ // -1 is returned if no WordList information is available
+ int GetNumWordLists() const;
+ const char *GetWordListDescription(int index) const;
+
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const;
virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
(rc.top >= top) && (rc.bottom <= bottom);
}
bool Intersects(PRectangle other) {
- return (right >= other.left) && (left <= other.right) &&
- (bottom >= other.top) && (top <= other.bottom);
+ return (right > other.left) && (left < other.right) &&
+ (bottom > other.top) && (top < other.bottom);
}
int Width() { return right - left; }
int Height() { return bottom - top; }
static bool IsKeyDown(int key);
static long SendScintilla(
WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
+ static long SendScintillaPointer(
+ WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0);
static bool IsDBCSLeadByte(int codePage, char ch);
// These are utility functions not really tied to a platform
bool ignoreCase=false, char otherSeparator='\0');
};
-inline bool nonFuncChar(char ch) {
- return strchr("\t\n\r !\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", ch) != NULL;
-}
-
inline bool IsAlphabetic(unsigned int ch) {
return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'));
}
// These functions are implemented because each platform calls them something different.
int CompareCaseInsensitive(const char *a, const char *b);
-int CompareNCaseInsensitive(const char *a, const char *b, int len);
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
bool EqualCaseInsensitive(const char *a, const char *b);
// Define another string class.
*
* Hold the length of the string for quick operations,
* can have a buffer bigger than the string to avoid too many memory allocations and copies.
- * May have embedded zeroes as a result of @a substitute, but rely too heavily on C string
- * functions to allow reliable manipulations of these strings.
+ * May have embedded zeroes as a result of @a substitute, but relies too heavily on C string
+ * functions to allow reliable manipulations of these strings, other than simple appends, etc.
**/
class SString {
public:
/** Type of string lengths (sizes) and positions (indexes). */
- typedef unsigned int lenpos_t;
+ typedef size_t lenpos_t;
/** Out of bounds value indicating that the string argument should be measured. */
enum { measure_length=0xffffffffU};
}
if (sSize > 0 && sSize_ <= sSize) { // Does not allocate new buffer if the current is big enough
if (s && sSize_) {
- strncpy(s, sOther, sSize_);
+ memcpy(s, sOther, sSize_);
}
s[sSize_] = '\0';
sLen = sSize_;
sSize = sLen = (s) ? strlen(s) : 0;
}
SString(const char *s_, lenpos_t first, lenpos_t last) : sizeGrowth(sizeGrowthDefault) {
+ // note: expects the "last" argument to point one beyond the range end (a la STL iterators)
s = StringAllocate(s_ + first, last - first);
sSize = sLen = (s) ? strlen(s) : 0;
}
else
return '\0';
}
+ SString substr(lenpos_t subPos, lenpos_t subLen=measure_length) const {
+ if (subPos >= sLen) {
+ return SString(); // return a null string if start index is out of bounds
+ }
+ if ((subLen == measure_length) || (subPos + subLen > sLen)) {
+ subLen = sLen - subPos; // can't substr past end of source string
+ }
+ return SString(s, subPos, subPos + subLen);
+ }
+ SString &lowercase(lenpos_t subPos = 0, lenpos_t subLen=measure_length) {
+ if ((subLen == measure_length) || (subPos + subLen > sLen)) {
+ subLen = sLen - subPos; // don't apply past end of string
+ }
+ for (lenpos_t i = subPos; i < subPos + subLen; i++) {
+ if (s[i] < 'A' || s[i] > 'Z')
+ continue;
+ else
+ s[i] = static_cast<char>(s[i] - 'A' + 'a');
+ }
+ return *this;
+ }
SString &append(const char *sOther, lenpos_t sLenOther=measure_length, char sep = '\0') {
if (!sOther) {
return *this;
s[sLen] = sep;
sLen++;
}
- strncpy(&s[sLen], sOther, sLenOther);
+ memcpy(&s[sLen], sOther, sLenOther);
sLen += sLenOther;
s[sLen] = '\0';
}
sLen -= len;
}
}
+ SString &change(lenpos_t pos, char ch) {
+ if (pos >= sLen) { // character changed must be in string bounds
+ return *this;
+ }
+ *(s + pos) = ch;
+ return *this;
+ }
/** Read an integral numeric value from the string. */
int value() const {
if (s)
else
return 0;
}
- int search(const char *sFind, lenpos_t start=0) {
+ int search(const char *sFind, lenpos_t start=0) const {
if (start < sLen) {
const char *sFound = strstr(s + start, sFind);
if (sFound) {
}
char *sNew = new char[len + 1];
if (sNew) {
- strncpy(sNew, s, len);
+ memcpy(sNew, s, len);
sNew[len] = '\0';
}
return sNew;
#define SCLEX_PHP 30
#define SCLEX_BAAN 31
#define SCLEX_MATLAB 32
+#define SCLEX_SCRIPTOL 33
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_C_WORD2 16
#define SCE_C_COMMENTDOCKEYWORD 17
#define SCE_C_COMMENTDOCKEYWORDERROR 18
-#define SCE_B_DEFAULT 0
-#define SCE_B_COMMENT 1
-#define SCE_B_NUMBER 2
-#define SCE_B_KEYWORD 3
-#define SCE_B_STRING 4
-#define SCE_B_PREPROCESSOR 5
-#define SCE_B_OPERATOR 6
-#define SCE_B_IDENTIFIER 7
-#define SCE_B_DATE 8
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
#define SCE_PL_STRING_QX 28
#define SCE_PL_STRING_QR 29
#define SCE_PL_STRING_QW 30
+#define SCE_B_DEFAULT 0
+#define SCE_B_COMMENT 1
+#define SCE_B_NUMBER 2
+#define SCE_B_KEYWORD 3
+#define SCE_B_STRING 4
+#define SCE_B_PREPROCESSOR 5
+#define SCE_B_OPERATOR 6
+#define SCE_B_IDENTIFIER 7
+#define SCE_B_DATE 8
+#define SCE_PROPS_DEFAULT 0
+#define SCE_PROPS_COMMENT 1
+#define SCE_PROPS_SECTION 2
+#define SCE_PROPS_ASSIGNMENT 3
+#define SCE_PROPS_DEFVAL 4
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
#define SCE_ERR_PERL 6
#define SCE_ERR_NET 7
#define SCE_ERR_LUA 8
+#define SCE_ERR_CTAG 9
#define SCE_ERR_DIFF_CHANGED 10
#define SCE_ERR_DIFF_ADDITION 11
#define SCE_ERR_DIFF_DELETION 12
#define SCE_MAKE_OPERATOR 4
#define SCE_MAKE_TARGET 5
#define SCE_MAKE_IDEOL 9
+#define SCE_DIFF_DEFAULT 0
+#define SCE_DIFF_COMMENT 1
+#define SCE_DIFF_COMMAND 2
+#define SCE_DIFF_HEADER 3
+#define SCE_DIFF_POSITION 4
+#define SCE_DIFF_DELETED 5
+#define SCE_DIFF_ADDED 6
#define SCE_CONF_DEFAULT 0
#define SCE_CONF_COMMENT 1
#define SCE_CONF_NUMBER 2
#define SCE_MATLAB_STRING 5
#define SCE_MATLAB_OPERATOR 6
#define SCE_MATLAB_IDENTIFIER 7
+#define SCE_SCRIPTOL_DEFAULT 0
+#define SCE_SCRIPTOL_COMMENT 1
+#define SCE_SCRIPTOL_COMMENTLINE 2
+#define SCE_SCRIPTOL_COMMENTDOC 3
+#define SCE_SCRIPTOL_NUMBER 4
+#define SCE_SCRIPTOL_WORD 5
+#define SCE_SCRIPTOL_STRING 6
+#define SCE_SCRIPTOL_CHARACTER 7
+#define SCE_SCRIPTOL_UUID 8
+#define SCE_SCRIPTOL_PREPROCESSOR 9
+#define SCE_SCRIPTOL_OPERATOR 10
+#define SCE_SCRIPTOL_IDENTIFIER 11
+#define SCE_SCRIPTOL_STRINGEOL 12
+#define SCE_SCRIPTOL_VERBATIM 13
+#define SCE_SCRIPTOL_REGEX 14
+#define SCE_SCRIPTOL_COMMENTLINEDOC 15
+#define SCE_SCRIPTOL_WORD2 16
+#define SCE_SCRIPTOL_COMMENTDOCKEYWORD 17
+#define SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
+#define SCE_SCRIPTOL_COMMENTBASIC 19
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#endif
// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
// May need to be changed for 64 bit platforms.
+#if _MSC_VER >= 1300
+#include <BaseTsd.h>
+#endif
+#ifdef MAXULONG_PTR
+typedef ULONG_PTR uptr_t;
+typedef LONG_PTR sptr_t;
+#else
typedef unsigned long uptr_t;
typedef long sptr_t;
+#endif
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
#define SC_CACHE_DOCUMENT 3
#define SCI_SETLAYOUTCACHE 2272
#define SCI_GETLAYOUTCACHE 2273
+#define SCI_SETSCROLLWIDTH 2274
+#define SCI_GETSCROLLWIDTH 2275
+#define SCI_TEXTWIDTH 2276
+#define SCI_SETENDATLASTLINE 2277
+#define SCI_GETENDATLASTLINE 2278
+#define SCI_TEXTHEIGHT 2279
#define SCI_LINEDOWN 2300
#define SCI_LINEDOWNEXTEND 2301
#define SCI_LINEUP 2302
#define SCI_SEARCHANCHOR 2366
#define SCI_SEARCHNEXT 2367
#define SCI_SEARCHPREV 2368
-#define CARET_SLOP 0x01
-#define CARET_CENTER 0x02
-#define CARET_STRICT 0x04
-#define CARET_XEVEN 0x08
-#define CARET_XJUMPS 0x10
-#define SCI_SETCARETPOLICY 2369
#define SCI_LINESONSCREEN 2370
#define SCI_USEPOPUP 2371
#define SCI_SELECTIONISRECTANGLE 2372
#define SCI_SETXOFFSET 2397
#define SCI_GETXOFFSET 2398
#define SCI_GRABFOCUS 2400
+#define CARET_SLOP 0x01
+#define CARET_STRICT 0x04
+#define CARET_JUMPS 0x10
+#define CARET_EVEN 0x08
+#define SCI_SETXCARETPOLICY 2402
+#define SCI_SETYCARETPOLICY 2403
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
#define SCN_URIDROPPED 2015
#define SCN_DWELLSTART 2016
#define SCN_DWELLEND 2017
+#define SCN_ZOOM 2018
//--Autogenerated -- end of section automatically generated from Scintilla.iface
// These structures are defined to be exactly the same shape as the Win32
#ifdef INCLUDE_DEPRECATED_FEATURES
+#define SCI_SETCARETPOLICY 2369
+#define CARET_CENTER 0x02
+#define CARET_XEVEN 0x08
+#define CARET_XJUMPS 0x10
+
#define SCN_POSCHANGED 2012
#define SCN_CHECKBRACE 2007
## set -> a property set function
## val -> definition of a constant
## evt -> an event
+## enu -> associate an enumeration with a set of vals with a prefix
+## lex -> associate a lexer with the lexical classes it produces
+##
## All other feature names should be ignored. They may be defined in the future.
## A property may have a set function, a get function or both. Each will have
## "Get" or "Set" in their names and the corresponding name will have the obvious switch.
## The feature numbers are stable so features will not be renumbered.
## Features may be removed but they will go through a period of deprecation
## before removal which is signalled by moving them into the Deprecated category.
+##
+## enu has the syntax enu<ws><enumeration>=<prefix>[<ws><prefix>]* where all the val
+## features in this file starting with a given <prefix> are considered part of the
+## enumeration.
+##
+## lex has the syntax lex<ws><name>=<lexerVal><ws><prefix>[<ws><prefix>]*
+## where name is a reasonably capitalised (Python, XML) identifier or UI name,
+## lexerVal is the val used to specify the lexer, and the list of prefixes is similar
+## to enu. The name may not be the same as that used within the lexer so the lexerVal
+## should be used to tie these entities together.
## Types:
## void
val SCI_OPTIONAL_START=3000
val SCI_LEXER_START=4000
-# Add text to the document
+# Add text to the document.
fun void AddText=2001(int length, string text)
-# Add array of cells to document
+# Add array of cells to document.
fun void AddStyledText=2002(int length, cells c)
-# Insert string at a position
+# Insert string at a position.
fun void InsertText=2003(position pos, string text)
-# Delete all text in the document
+# Delete all text in the document.
fun void ClearAll=2004(,)
-# Set all style bytes to 0, remove all folding information
+# Set all style bytes to 0, remove all folding information.
fun void ClearDocumentStyle=2005(,)
-# The number of characters in the document
+# The number of characters in the document.
get int GetLength=2006(,)
-# Returns the character byte at the position
+# Returns the character byte at the position.
get int GetCharAt=2007(position pos,)
-# Returns the position of the caret
+# Returns the position of the caret.
get position GetCurrentPos=2008(,)
-# Returns the position of the opposite end of the selection to the caret
+# Returns the position of the opposite end of the selection to the caret.
get position GetAnchor=2009(,)
-# Returns the style byte at the position
+# Returns the style byte at the position.
get int GetStyleAt=2010(position pos,)
-# Redoes the next action on the undo history
+# Redoes the next action on the undo history.
fun void Redo=2011(,)
# Choose between collecting actions into the undo
# Returns the number of bytes in the buffer not including terminating nulls.
fun int GetStyledText=2015(, textrange tr)
-# Are there any redoable actions in the undo history.
+# Are there any redoable actions in the undo history?
fun bool CanRedo=2016(,)
-# Retrieve the line number at which a particular marker is located
+# Retrieve the line number at which a particular marker is located.
fun int MarkerLineFromHandle=2017(int handle,)
# Delete a marker.
# Is undo history being collected?
get bool GetUndoCollection=2019(,)
+enu WhiteSpace=SCWS_
val SCWS_INVISIBLE=0
val SCWS_VISIBLEALWAYS=1
val SCWS_VISIBLEAFTERINDENT=2
# Retrieve the position of the last correctly styled character.
get position GetEndStyled=2028(,)
+enu EndOfLine=SC_EOL_
val SC_EOL_CRLF=0
val SC_EOL_CR=1
val SC_EOL_LF=2
set void SetEOLMode=2031(int eolMode,)
# 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.
+# The styling mask can be used to protect some bits in each styling byte from modification.
fun void StartStyling=2032(position pos, int mask)
# Change style from current styling position for length characters to a style
# and move the current styling position to after this newly styled segment.
fun void SetStyling=2033(int length, int style)
-# Is drawing done first into a buffer or direct to the screen.
+# Is drawing done first into a buffer or direct to the screen?
get bool GetBufferedDraw=2034(,)
# If drawing is buffered then each line of text is drawn into a bitmap buffer
# before drawing it to the screen to avoid flicker.
set void SetBufferedDraw=2035(bool buffered,)
-# Change the visible size of a tab to be a multiple of the width of a space
-# character.
+# Change the visible size of a tab to be a multiple of the width of a space character.
set void SetTabWidth=2036(int tabWidth,)
# Retrieve the visible size of a tab.
# The SC_CP_UTF8 value can be used to enter Unicode mode.
set void SetCodePage=2037(int codePage,)
-# In palette mode, Scintilla uses the environments palette calls to display
+# In palette mode, Scintilla uses the environment's palette calls to display
# more colours. This may lead to ugly displays.
set void SetUsePalette=2039(bool usePalette,)
+enu MarkerSymbol=SC_MARK_
val MARKER_MAX=31
val SC_MARK_CIRCLE=0
val SC_MARK_ROUNDRECT=1
val SC_MARK_MINUS=7
val SC_MARK_PLUS=8
-# Shapes used for outlining column
+# Shapes used for outlining column.
val SC_MARK_VLINE=9
val SC_MARK_LCORNER=10
val SC_MARK_TCORNER=11
val SC_MARK_CIRCLEMINUS=20
val SC_MARK_CIRCLEMINUSCONNECTED=21
-# Invisible mark that only sets the line background color
+# Invisible mark that only sets the line background color.
val SC_MARK_BACKGROUND=22
val SC_MARK_CHARACTER=10000
-# Markers used for outlining column
+enu MarkerOutline=SC_MARKNUM_
+# Markers used for outlining column.
val SC_MARKNUM_FOLDEREND=25
val SC_MARKNUM_FOLDEROPENMID=26
val SC_MARKNUM_FOLDERMIDTAIL=27
# Add a marker to a line, returning an ID which can be used to find or delete the marker.
fun int MarkerAdd=2043(int line, int markerNumber)
-# Delete a marker from a line
+# Delete a marker from a line.
fun void MarkerDelete=2044(int line, int markerNumber)
-# Delete all markers with a particular number from all lines
+# Delete all markers with a particular number from all lines.
fun void MarkerDeleteAll=2045(int markerNumber,)
# Get a bit mask of all the markers set on a line.
# Find the previous line before lineStart that includes a marker in mask.
fun int MarkerPrevious=2048(int lineStart, int markerMask)
+enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
# 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.
+enu StylesCommon=STYLE_
val STYLE_DEFAULT=32
val STYLE_LINENUMBER=33
val STYLE_BRACELIGHT=34
# Character set identifiers are used in StyleSetCharacterSet.
# The values are the same as the Windows *_CHARSET values.
+enu CharacterSet=SC_CHARSET_
val SC_CHARSET_ANSI=0
val SC_CHARSET_DEFAULT=1
val SC_CHARSET_BALTIC=186
# Set a style to be underlined or not.
set void StyleSetUnderline=2059(int style, bool underline)
+enu CaseVisible=SC_CASE_
val SC_CASE_MIXED=0
val SC_CASE_UPPER=1
val SC_CASE_LOWER=2
# Get the time in milliseconds that the caret is on and off. 0 = steady on.
set void SetCaretPeriod=2076(int periodMilliseconds,)
-# Set the set of characters making up words for when moving or selecting
-# by word.
+# Set the set of characters making up words for when moving or selecting by word.
set void SetWordChars=2077(, string characters)
# Start a sequence of actions that is undone and redone as a unit.
# End a sequence of actions that is undone and redone as a unit.
fun void EndUndoAction=2079(,)
+enu IndicatorStyle=INDIC_
val INDIC_MAX=7
val INDIC_PLAIN=0
val INDIC_SQUIGGLE=1
# Retrieve the foreground colour of an indicator.
get colour IndicGetFore=2083(int indic,)
-# 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
+# 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.
set void SetStyleBits=2090(int bits,)
# Is the background of the line containing the caret in a different colour?
get bool GetCaretLineVisible=2095(,)
-# Dsplay the background of the line containing the caret in a different colour.
+# Display the background of the line containing the caret in a different colour.
set void SetCaretLineVisible=2096(bool show,)
# Get the colour of the background of the line containing the caret.
# Is there an auto-completion list visible?
fun bool AutoCActive=2102(,)
-# Retrieve the position of the caret when the auto-completion list was
-# displayed.
+# Retrieve the position of the caret when the auto-completion list was displayed.
fun position AutoCPosStart=2103(,)
# User has selected an item so remove the list and insert the selection.
# Define a set of character that when typed cancel the auto-completion list.
fun void AutoCStops=2105(, string 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.
+# Change the separator character in the string setting up an auto-completion list.
+# Default is space but can be changed if items contain space.
set void AutoCSetSeparator=2106(int separatorCharacter,)
# Retrieve the auto-completion list separator character.
# Display a list of strings and send notification when user chooses one.
fun void UserListShow=2117(int listType, string itemList)
-# Set whether or not autocompletion is hidden automatically when nothing matches
+# Set whether or not autocompletion is hidden automatically when nothing matches.
set void AutoCSetAutoHide=2118(bool autoHide,)
-# Retrieve whether or not autocompletion is hidden automatically when nothing matches
+# Retrieve whether or not autocompletion is hidden automatically when nothing matches.
get bool AutoCGetAutoHide=2119(,)
-# Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+# Set whether or not autocompletion deletes any word characters
+# after the inserted text upon completion.
set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,)
-# Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+# Retrieve whether or not autocompletion deletes any word characters
+# after the inserted text upon completion.
get bool AutoCGetDropRestOfWord=2271(,)
# Set the number of spaces used for one level of indentation.
# Returns the print magnification.
get int GetPrintMagnification=2147(,)
+enu PrintOption=SC_PRINT_
# PrintColourMode - use same colours as screen.
val SC_PRINT_NORMAL=0
# PrintColourMode - invert the light value of each style for printing.
# Returns the print colour mode.
get int GetPrintColourMode=2149(,)
+enu FindOption=SCFIND_
val SCFIND_WHOLEWORD=2
val SCFIND_MATCHCASE=4
val SCFIND_WORDSTART=0x00100000
# Find some text in the document.
fun position FindText=2150(int flags, findtext ft)
-# On Windows will draw the document into a display context such as a printer.
+# On Windows, will draw the document into a display context such as a printer.
fun void FormatRange=2151(bool draw, formatrange fr)
# Retrieve the line at the top of the display.
# Will a paste succeed?
fun bool CanPaste=2173(,)
-# Are there any undoable actions in the undo history.
+# Are there any undoable actions in the undo history?
fun bool CanUndo=2174(,)
# Delete the undo history.
# the function returned by GetDirectFunction.
get int GetDirectPointer=2185(,)
-# Set to overtype (true) or insert mode
+# Set to overtype (true) or insert mode.
set void SetOvertype=2186(bool overtype,)
# Returns true if overtype mode is active otherwise false is returned.
get bool GetOvertype=2187(,)
-# Set the width of the insert mode caret
+# Set the width of the insert mode caret.
set void SetCaretWidth=2188(int pixelWidth,)
-# Returns the width of the insert mode caret
+# Returns the width of the insert mode caret.
get int GetCaretWidth=2189(,)
# Sets the position that starts the target which is used for updating the
# Returns length of range or -1 for failure in which case target is not moved.
fun int SearchInTarget=2197(int length, string text)
-# Set the search flags used by SearchInTarget
+# Set the search flags used by SearchInTarget.
set void SetSearchFlags=2198(int flags,)
-# Get the search flags used by SearchInTarget
+# Get the search flags used by SearchInTarget.
get int GetSearchFlags=2199(,)
# Show a call tip containing a definition near position pos.
# Find the document line of a display line taking hidden lines into account.
fun int DocLineFromVisible=2221(int lineDisplay,)
+enu FoldLevel=SC_FOLDLEVEL
val SC_FOLDLEVELBASE=0x400
val SC_FOLDLEVELWHITEFLAG=0x1000
val SC_FOLDLEVELHEADERFLAG=0x2000
# Ensure a particular line is visible by expanding any header line hiding it.
fun void EnsureVisible=2232(int line,)
-# Set some debugging options for folding
+# Set some debugging options for folding.
fun void SetFoldFlags=2233(int flags,)
# 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.
fun void EnsureVisibleEnforcePolicy=2234(int line,)
-# Sets whether a tab pressed when caret is within indentation indents
+# Sets whether a tab pressed when caret is within indentation indents.
set void SetTabIndents=2260(bool tabIndents,)
# Does a tab pressed when caret is within indentation indent?
get bool GetTabIndents=2261(,)
-# Sets whether a backspace pressed when caret is within indentation unindents
+# Sets whether a backspace pressed when caret is within indentation unindents.
set void SetBackSpaceUnIndents=2262(bool bsUnIndents,)
# Does a backspace pressed when caret is within indentation unindent?
val SC_TIME_FOREVER=10000000
-# Sets the time the mouse must sit still to generate a mouse dwell event
+# Sets the time the mouse must sit still to generate a mouse dwell event.
set void SetMouseDwellTime=2264(int periodMilliseconds,)
-# Retrieve the time the mouse must sit still to generate a mouse dwell event
+# Retrieve the time the mouse must sit still to generate a mouse dwell event.
get int GetMouseDwellTime=2265(,)
-# Get position of start of word
+# Get position of start of word.
fun int WordStartPosition=2266(position pos, bool onlyWordCharacters)
-# Get position of end of word
+# Get position of end of word.
fun int WordEndPosition=2267(position pos, bool onlyWordCharacters)
+enu Wrap=SC_WRAP_
val SC_WRAP_NONE=0
val SC_WRAP_WORD=1
-# Sets whether text is word wrapped
+# Sets whether text is word wrapped.
set void SetWrapMode=2268(int mode,)
-# Retrieve whether text is word wrapped
+# Retrieve whether text is word wrapped.
get int GetWrapMode=2269(,)
+enu LineCache=SC_CACHE_
val SC_CACHE_NONE=0
val SC_CACHE_CARET=1
val SC_CACHE_PAGE=2
val SC_CACHE_DOCUMENT=3
-# Sets the degree of caching of layout information
+# Sets the degree of caching of layout information.
set void SetLayoutCache=2272(int mode,)
-# Retrieve the degree of caching of layout information
+# Retrieve the degree of caching of layout information.
get int GetLayoutCache=2273(,)
+# Sets the document width assumed for scrolling.
+set void SetScrollWidth=2274(int pixelWidth,)
+
+# Retrieve the document width assumed for scrolling.
+get int GetScrollWidth=2275(,)
+
+# Measure the pixel width of some text in a particular style.
+# Nul terminated text argument.
+# Does not handle tab or control characters.
+fun int TextWidth=2276(int style, string text)
+
+# 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.
+set void SetEndAtLastLine=2277(bool endAtLastLine,)
+
+# Retrieve whether the maximum scroll position has the last
+# line at the bottom of the view.
+get int GetEndAtLastLine=2278(,)
+
+# Retrieve the height of a particular line of text in pixels.
+fun int TextHeight=2279(int line,)
+
## Start of key messages
# Move caret down one line.
fun void LineDown=2300(,)
# Delete the selection or if no selection, the character before the caret.
fun void DeleteBack=2326(,)
-# If selection is empty or all on one line replace the selection with a tab
-# character.
+# 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.
fun void Tab=2327(,)
fun void LineScrollUp=2343(,)
# Delete the selection or if no selection, the character before the caret.
-# Will not delete the chraacter before at the start of a line.
+# Will not delete the character before at the start of a line.
fun void DeleteBackNotLine=2344(,)
-# Move the caret inside current view if it's not there already
+# Move the caret inside current view if it's not there already.
fun void MoveCaretInsideView=2401(,)
-# How many characters are on a line, not including end of line characters.
+# How many characters are on a line, not including end of line characters?
fun int LineLength=2350(int line,)
# Highlight the characters at two positions.
-fun void BraceHighlight=2351(position pos1,position pos2)
+fun void BraceHighlight=2351(position pos1, position pos2)
# Highlight the character at a position indicating there is no matching brace.
fun void BraceBadLight=2352(position pos,)
# Find the position of a matching brace or INVALID_POSITION if no match.
fun position BraceMatch=2353(position pos,)
-# Are the end of line characters visible.
+# Are the end of line characters visible?
get bool GetViewEOL=2355(,)
-# Make the end of line characters visible or invisible
+# Make the end of line characters visible or invisible.
set void SetViewEOL=2356(bool visible,)
# Retrieve a pointer to the document object.
# Set which document modification events are sent to the container.
set void SetModEventMask=2359(int mask,)
+enu EdgeVisualStyle=EDGE_
val EDGE_NONE=0
val EDGE_LINE=1
val EDGE_BACKGROUND=2
# Does not ensure the selection is visible.
fun int SearchPrev=2368(int flags, string text)
-# Show caret within N lines of edge when it's scrolled to view
-# If CARET_SLOP not set then centre caret on screen when it's
-# scrolled to view
-val CARET_SLOP=0x01
-# Value not used
-val CARET_CENTER=0x02
-# If CARET_SLOP also set then reposition whenever outside slop border
-# If CARET_SLOP not set then recentre even when visible
-val CARET_STRICT=0x04
-# If CARET_XEVEN set then both left and right margins are given equal weight
-# rather than favouring left following behaviour.
-val CARET_XEVEN=0x08
-# If CARET_XJUMPS set then when caret reaches the margin the display jumps
-# enough to leave the caret solidly within the display.
-val CARET_XJUMPS=0x10
-# Set the way the line the caret is on is kept visible.
-fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
-
# Retrieves the number of lines completely visible.
get int LinesOnScreen=2370(,)
# the wrong mouse button.
fun void UsePopUp=2371(bool allowPopUp,)
-# Is the selection a rectangular. The alternative is the more common stream selection.
+# Is the selection rectangular? The alternative is the more common stream selection.
get bool SelectionIsRectangle=2372(,)
# Set the zoom level. This number of points is added to the size of all fonts.
# Get which document modification events are sent to the container.
get int GetModEventMask=2378(,)
-# Change internal focus flag
+# Change internal focus flag.
set void SetFocus=2380(bool focus,)
-# Get internal focus flag
+# Get internal focus flag.
get bool GetFocus=2381(,)
-# Change error status - 0 = OK
+# Change error status - 0 = OK.
set void SetStatus=2382(int statusCode,)
-# Get error status
+# Get error status.
get int GetStatus=2383(,)
-# Set whether the mouse is captured when its button is pressed
+# Set whether the mouse is captured when its button is pressed.
set void SetMouseDownCaptures=2384(bool captures,)
-# Get whether mouse gets captured
+# Get whether mouse gets captured.
get bool GetMouseDownCaptures=2385(,)
+enu CursorShape=SC_CURSOR
val SC_CURSORNORMAL=-1
val SC_CURSORWAIT=3
-# Sets the cursor to one of the SC_CURSOR* values
+# Sets the cursor to one of the SC_CURSOR* values.
set void SetCursor=2386(int cursorType,)
-# Get cursor type
+# Get cursor type.
get int GetCursor=2387(,)
# Change the way control characters are displayed:
-# If symbol is < 32, keep the drawn way, else, use the given character
+# If symbol is < 32, keep the drawn way, else, use the given character.
set void SetControlCharSymbol=2388(int symbol,)
-# Get the way control characters are displayed
+# Get the way control characters are displayed.
get int GetControlCharSymbol=2389(,)
-# Move to the previous change in capitalistion
+# Move to the previous change in capitalisation.
fun void WordPartLeft=2390(,)
-# Move to the previous change in capitalistion extending selection to new caret position.
+# Move to the previous change in capitalisation extending selection
+# to new caret position.
fun void WordPartLeftExtend=2391(,)
-# Move to the change next in capitalistion
+# Move to the change next in capitalisation.
fun void WordPartRight=2392(,)
-# Move to the next change in capitalistion extending selection to new caret position.
+# Move to the next change in capitalisation extending selection
+# to new caret position.
fun void WordPartRightExtend=2393(,)
-# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
+# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
val VISIBLE_SLOP=0x01
val VISIBLE_STRICT=0x04
-# Set the way the display area is determined when a particular line is to be moved to.
+# Set the way the display area is determined when a particular line
+# is to be moved to by Find, FindNext, GotoLine, etc.
fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop)
-# Delete back from the current position to the start of the line
+# Delete back from the current position to the start of the line.
fun void DelLineLeft=2395(,)
-# Delete forwards from the current position to the end of the line
+# Delete forwards from the current position to the end of the line.
fun void DelLineRight=2396(,)
-# Get and Set the xOffset (ie, horizonal scroll position)
+# Get and Set the xOffset (ie, horizonal scroll position).
set void SetXOffset=2397(int newOffset,)
get int GetXOffset=2398(,)
# Set the focus to this Scintilla widget.
-# GTK+ Specific
+# GTK+ Specific.
fun void GrabFocus=2400(,)
+enu CaretPolicy = CARET_
+# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+# 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.
+val CARET_SLOP=0x01
+# 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.
+val CARET_STRICT=0x04
+# 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.
+val CARET_JUMPS=0x10
+# 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.
+val CARET_EVEN=0x08
+
+# Set the way the caret is kept visible when going sideway.
+# The exclusion zone is given in pixels.
+fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop)
+
+# Set the way the line the caret is on is kept visible.
+# The exclusion zone is given in lines.
+fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
set void SetLexerLanguage=4006(, string language)
# Notifications
-# Type of modification and the action which caused the modification
+# Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
# One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
+enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_LAST
val SC_MOD_INSERTTEXT=0x1
val SC_MOD_DELETETEXT=0x2
val SC_MOD_CHANGESTYLE=0x4
val SC_MODEVENTMASKALL=0xF77
# For compatibility, these go through the COMMAND notification rather than NOTIFY
-# and have exactly the same values as the EN_* constants.
+# and should have had exactly the same values as the EN_* constants.
+# Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_*
+# As clients depend on these constants, this will not be changed.
val SCEN_CHANGE=768
val SCEN_SETFOCUS=512
val SCEN_KILLFOCUS=256
-# Symbolic key codes and modifier flags
-# ASCII and other printable characters below 256
-# Extended keys above 300
+# Symbolic key codes and modifier flags.
+# ASCII and other printable characters below 256.
+# Extended keys above 300.
+enu Keys=SCK_
val SCK_DOWN=300
val SCK_UP=301
val SCK_LEFT=302
val SCK_SUBTRACT=311
val SCK_DIVIDE=312
+enu KeyMod=SCMOD_
val SCMOD_SHIFT=1
val SCMOD_CTRL=2
val SCMOD_ALT=4
################################################
# For SciLexer.h
+enu Lexer=SCLEX_
val SCLEX_CONTAINER=0
val SCLEX_NULL=1
val SCLEX_PYTHON=2
val SCLEX_PHP=30
val SCLEX_BAAN=31
val SCLEX_MATLAB=32
+val SCLEX_SCRIPTOL=33
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON
+lex Python=SCLEX_PYTHON SCE_P_
+lex Ruby=SCLEX_RUBY SCE_P_
val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1
val SCE_P_NUMBER=2
val SCE_P_COMMENTBLOCK=12
val SCE_P_STRINGEOL=13
# Lexical states for SCLEX_CPP
+lex Cpp=SCLEX_CPP SCE_C_
+lex SQL=SCLEX_SQL SCE_C_
+lex Pascal=SCLEX_PASCAL SCE_C_
+lex TCL=SCLEX_TCL SCE_C_
+lex BullAnt=SCLEX_BULLANT SCE_C_
val SCE_C_DEFAULT=0
val SCE_C_COMMENT=1
val SCE_C_COMMENTLINE=2
val SCE_C_WORD2=16
val SCE_C_COMMENTDOCKEYWORD=17
val SCE_C_COMMENTDOCKEYWORDERROR=18
-# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
-val SCE_B_DEFAULT=0
-val SCE_B_COMMENT=1
-val SCE_B_NUMBER=2
-val SCE_B_KEYWORD=3
-val SCE_B_STRING=4
-val SCE_B_PREPROCESSOR=5
-val SCE_B_OPERATOR=6
-val SCE_B_IDENTIFIER=7
-val SCE_B_DATE=8
# Lexical states for SCLEX_HTML, SCLEX_XML
+lex HTML=SCLEX_HTML SCE_H
+lex XML=SCLEX_XML SCE_H
+lex ASP=SCLEX_ASP SCE_H
+lex PHP=SCLEX_PHP SCE_H
val SCE_H_DEFAULT=0
val SCE_H_TAG=1
val SCE_H_TAGUNKNOWN=2
val SCE_HPHP_HSTRING_VARIABLE=126
val SCE_HPHP_OPERATOR=127
# Lexical states for SCLEX_PERL
+lex Perl=SCLEX_PERL SCE_PL_
val SCE_PL_DEFAULT=0
val SCE_PL_ERROR=1
val SCE_PL_COMMENTLINE=2
val SCE_PL_STRING_QX=28
val SCE_PL_STRING_QR=29
val SCE_PL_STRING_QW=30
+# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
+lex VB=SCLEX_VB SCE_B_
+lex VBScript=SCLEX_VBSCRIPT SCE_B_
+val SCE_B_DEFAULT=0
+val SCE_B_COMMENT=1
+val SCE_B_NUMBER=2
+val SCE_B_KEYWORD=3
+val SCE_B_STRING=4
+val SCE_B_PREPROCESSOR=5
+val SCE_B_OPERATOR=6
+val SCE_B_IDENTIFIER=7
+val SCE_B_DATE=8
+# Lexical states for SCLEX_PROPERTIES
+lex Properties=SCLEX_PROPERTIES SCE_PROPS_
+val SCE_PROPS_DEFAULT=0
+val SCE_PROPS_COMMENT=1
+val SCE_PROPS_SECTION=2
+val SCE_PROPS_ASSIGNMENT=3
+val SCE_PROPS_DEFVAL=4
# Lexical states for SCLEX_LATEX
+lex LaTeX=SCLEX_LATEX SCE_L_
val SCE_L_DEFAULT=0
val SCE_L_COMMAND=1
val SCE_L_TAG=2
val SCE_L_MATH=3
val SCE_L_COMMENT=4
# Lexical states for SCLEX_LUA
+lex Lua=SCLEX_LUA SCE_LUA_
val SCE_LUA_DEFAULT=0
val SCE_LUA_COMMENT=1
val SCE_LUA_COMMENTLINE=2
val SCE_LUA_WORD5=16
val SCE_LUA_WORD6=17
# Lexical states for SCLEX_ERRORLIST
+lex ErrorList=SCLEX_ERRORLIST SCE_ERR_
val SCE_ERR_DEFAULT=0
val SCE_ERR_PYTHON=1
val SCE_ERR_GCC=2
val SCE_ERR_PERL=6
val SCE_ERR_NET=7
val SCE_ERR_LUA=8
+val SCE_ERR_CTAG=9
val SCE_ERR_DIFF_CHANGED=10
val SCE_ERR_DIFF_ADDITION=11
val SCE_ERR_DIFF_DELETION=12
val SCE_ERR_DIFF_MESSAGE=13
# Lexical states for SCLEX_BATCH
+lex Batch=SCLEX_BATCH SCE_BAT_
val SCE_BAT_DEFAULT=0
val SCE_BAT_COMMENT=1
val SCE_BAT_WORD=2
val SCE_BAT_IDENTIFIER=6
val SCE_BAT_OPERATOR=7
# Lexical states for SCLEX_MAKEFILE
+lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_
val SCE_MAKE_DEFAULT=0
val SCE_MAKE_COMMENT=1
val SCE_MAKE_PREPROCESSOR=2
val SCE_MAKE_OPERATOR=4
val SCE_MAKE_TARGET=5
val SCE_MAKE_IDEOL=9
-# Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+# Lexical states for SCLEX_DIFF
+lex Diff=SCLEX_DIFF SCE_DIFF_
+val SCE_DIFF_DEFAULT=0
+val SCE_DIFF_COMMENT=1
+val SCE_DIFF_COMMAND=2
+val SCE_DIFF_HEADER=3
+val SCE_DIFF_POSITION=4
+val SCE_DIFF_DELETED=5
+val SCE_DIFF_ADDED=6
+# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
+lex Conf=SCLEX_CONF SCE_CONF_
val SCE_CONF_DEFAULT=0
val SCE_CONF_COMMENT=1
val SCE_CONF_NUMBER=2
val SCE_CONF_OPERATOR=7
val SCE_CONF_IP=8
val SCE_CONF_DIRECTIVE=9
-# Avenue
+# Lexical states for SCLEX_AVE, Avenue
+lex Avenue=SCLEX_AVE SCE_AVE_
val SCE_AVE_DEFAULT=0
val SCE_AVE_COMMENT=1
val SCE_AVE_NUMBER=2
val SCE_AVE_IDENTIFIER=9
val SCE_AVE_OPERATOR=10
# Lexical states for SCLEX_ADA
+lex Ada=SCLEX_ADA SCE_ADA_
val SCE_ADA_DEFAULT=0
val SCE_ADA_COMMENT=1
val SCE_ADA_NUMBER=2
val SCE_ADA_IDENTIFIER=7
val SCE_ADA_STRINGEOL=8
# Lexical states for SCLEX_BAAN
+lex Baan=SCLEX_BAAN SCE_BAAN_
val SCE_BAAN_DEFAULT=0
val SCE_BAAN_COMMENT=1
val SCE_BAAN_COMMENTDOC=2
val SCE_BAAN_STRINGEOL=9
val SCE_BAAN_WORD2=10
# Lexical states for SCLEX_LISP
+lex Lisp=SCLEX_LISP SCE_LISP_
val SCE_LISP_DEFAULT=0
val SCE_LISP_COMMENT=1
val SCE_LISP_NUMBER=2
val SCE_LISP_IDENTIFIER=9
val SCE_LISP_OPERATOR=10
# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_
+lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_
val SCE_EIFFEL_DEFAULT=0
val SCE_EIFFEL_COMMENTLINE=1
val SCE_EIFFEL_NUMBER=2
val SCE_EIFFEL_OPERATOR=6
val SCE_EIFFEL_IDENTIFIER=7
val SCE_EIFFEL_STRINGEOL=8
-# Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
+# Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
+lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_
val SCE_NNCRONTAB_DEFAULT=0
val SCE_NNCRONTAB_COMMENT=1
val SCE_NNCRONTAB_TASK=2
val SCE_NNCRONTAB_ENVIRONMENT=9
val SCE_NNCRONTAB_IDENTIFIER=10
# Lexical states for SCLEX_MATLAB
+lex MatLab=SCLEX_MATLAB SCE_MATLAB_
val SCE_MATLAB_DEFAULT=0
val SCE_MATLAB_COMMENT=1
val SCE_MATLAB_COMMAND=2
val SCE_MATLAB_STRING=5
val SCE_MATLAB_OPERATOR=6
val SCE_MATLAB_IDENTIFIER=7
+# Lexical states for SCLEX_SCRIPTOL
+lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_
+val SCE_SCRIPTOL_DEFAULT=0
+val SCE_SCRIPTOL_COMMENT=1
+val SCE_SCRIPTOL_COMMENTLINE=2
+val SCE_SCRIPTOL_COMMENTDOC=3
+val SCE_SCRIPTOL_NUMBER=4
+val SCE_SCRIPTOL_WORD=5
+val SCE_SCRIPTOL_STRING=6
+val SCE_SCRIPTOL_CHARACTER=7
+val SCE_SCRIPTOL_UUID=8
+val SCE_SCRIPTOL_PREPROCESSOR=9
+val SCE_SCRIPTOL_OPERATOR=10
+val SCE_SCRIPTOL_IDENTIFIER=11
+val SCE_SCRIPTOL_STRINGEOL=12
+val SCE_SCRIPTOL_VERBATIM=13
+val SCE_SCRIPTOL_REGEX=14
+val SCE_SCRIPTOL_COMMENTLINEDOC=15
+val SCE_SCRIPTOL_WORD2=16
+val SCE_SCRIPTOL_COMMENTDOCKEYWORD=17
+val SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR=18
+val SCE_SCRIPTOL_COMMENTBASIC=19
# Events
evt void URIDropped=2015(string text)
evt void DwellStart=2016(int position)
evt void DwellEnd=2017(int position)
+evt void Zoom=2018(void)
cat Deprecated
+# CARET_POLICY changed in 1.47
+fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
+val CARET_CENTER=0x02
+val CARET_XEVEN=0x08
+val CARET_XJUMPS=0x10
+
# The old name for SCN_UPDATEUI
val SCN_CHECKBRACE=2007
evt void PosChanged=2012(int position)
+
};
struct _ScintillaClass {
- GtkFixedClass parent_class;
+ GtkContainerClass parent_class;
void (* command) (ScintillaObject *ttt);
void (* notify) (ScintillaObject *ttt);
void scintilla_set_id (ScintillaObject *sci,int id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+#if GTK_MAJOR_VERSION < 2
+#define SCINTILLA_NOTIFY "notify"
+#else
+#define SCINTILLA_NOTIFY "sci-notify"
+#endif
+
#ifdef __cplusplus
}
#endif
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
}
~WindowAccessor();
+ bool Match(int pos, const char *s);
char StyleAt(int position);
int GetLine(int position);
int LineStart(int line);
}
void AutoComplete::Select(const char *word) {
- int lenWord = strlen(word);
+ size_t lenWord = strlen(word);
int location = -1;
const int maxItemLen=1000;
char item[maxItemLen];
look = newline + 1;
numLines++;
}
- int lastWidth = surfaceMeasure->WidthText(font, look, strlen(look));
+ int lastWidth = surfaceMeasure->WidthText(font, look, static_cast<int>(strlen(look)));
width = Platform::Maximum(width, lastWidth) + 10;
int lineHeight = surfaceMeasure->Height(font);
// Extra line for border and an empty line at top and bottom
//Platform::DebugPrintf("Removing cr end of line\n");
lv.Remove(lineRemove);
}
- } else if ((ch == '\n') && !ignoreNL) {
- //Platform::DebugPrintf("Removing lf end of line\n");
- lv.Remove(lineRemove);
- ignoreNL = false; // Further \n are not real deletions
+ } else if (ch == '\n') {
+ if (ignoreNL) {
+ ignoreNL = false; // Further \n are real deletions
+ } else {
+ //Platform::DebugPrintf("Removing lf end of line\n");
+ lv.Remove(lineRemove);
+ }
}
ch = chNext;
// SetStyleAt does not change the persistent state of a document
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
-void Document::DeleteChars(int pos, int len) {
+bool Document::DeleteChars(int pos, int len) {
if (len == 0)
- return;
+ return false;
if ((pos + len) > Length())
- return;
+ return false;
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
- if (enteredCount == 0) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
if (!cb.IsReadOnly()) {
NotifyModified(
}
enteredCount--;
}
+ return !cb.IsReadOnly();
}
-void Document::InsertStyledString(int position, char *s, int insertLength) {
+bool Document::InsertStyledString(int position, char *s, int insertLength) {
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
- if (enteredCount == 0) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
if (!cb.IsReadOnly()) {
NotifyModified(
}
enteredCount--;
}
+ return !cb.IsReadOnly();
}
int Document::Undo() {
return newPos;
}
-void Document::InsertChar(int pos, char ch) {
+bool Document::InsertChar(int pos, char ch) {
char chs[2];
chs[0] = ch;
chs[1] = 0;
- InsertStyledString(pos*2, chs, 2);
+ return InsertStyledString(pos*2, chs, 2);
}
// Insert a null terminated string
-void Document::InsertString(int position, const char *s) {
- InsertString(position, s, strlen(s));
+bool Document::InsertString(int position, const char *s) {
+ return InsertString(position, s, strlen(s));
}
// Insert a string with a length
-void Document::InsertString(int position, const char *s, int insertLength) {
+bool Document::InsertString(int position, const char *s, size_t insertLength) {
+ bool changed = false;
char *sWithStyle = new char[insertLength * 2];
if (sWithStyle) {
- for (int i = 0; i < insertLength; i++) {
+ for (size_t i = 0; i < insertLength; i++) {
sWithStyle[i*2] = s[i];
sWithStyle[i*2 + 1] = 0;
}
- InsertStyledString(position*2, sWithStyle, insertLength*2);
+ changed = InsertStyledString(position*2, sWithStyle,
+ static_cast<int>(insertLength*2));
delete []sWithStyle;
}
+ return changed;
}
void Document::ChangeChar(int pos, char ch) {
DeleteChars(pos, LenChar(pos));
}
-int Document::DelCharBack(int pos) {
+void Document::DelCharBack(int pos) {
if (pos <= 0) {
- return pos;
+ return;
} else if (IsCrLf(pos - 2)) {
DeleteChars(pos - 2, 2);
- return pos - 2;
} else if (SC_CP_UTF8 == dbcsCodePage) {
int startChar = MovePositionOutsideChar(pos - 1, -1, false);
DeleteChars(startChar, pos - startChar);
- return startChar;
} else if (IsDBCS(pos - 1)) {
DeleteChars(pos - 2, 2);
- return pos - 2;
} else {
DeleteChars(pos - 1, 1);
- return pos - 1;
}
}
Document *pdoc;
int end;
public:
-DocumentIndexer(Document *pdoc_, int end_) :
- pdoc(pdoc_), end(end_) {}
+ DocumentIndexer(Document *pdoc_, int end_) :
+ pdoc(pdoc_), end(end_) {
+ }
virtual char CharAt(int index) {
if (index < 0 || index >= end)
// Compute actual search ranges needed
int lengthFind = *length;
if (lengthFind == -1)
- lengthFind = strlen(s);
+ lengthFind = static_cast<int>(strlen(s));
int endSearch = endPos;
if (startPos <= endPos) {
endSearch = endPos - lengthFind + 1;
endStyled = position;
}
-void Document::SetStyleFor(int length, char style) {
- if (enteredCount == 0) {
+bool Document::SetStyleFor(int length, char style) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
int prevEndStyled = endStyled;
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
}
endStyled += length;
enteredCount--;
+ return true;
}
}
-void Document::SetStyles(int length, char *styles) {
- if (enteredCount == 0) {
+bool Document::SetStyles(int length, char *styles) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
int prevEndStyled = endStyled;
bool didChange = false;
+ int lastChange = 0;
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
PLATFORM_ASSERT(endStyled < Length());
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
didChange = true;
+ lastChange = iPos;
}
}
if (didChange) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
- prevEndStyled, endStyled - prevEndStyled);
+ prevEndStyled, lastChange);
NotifyModified(mh);
}
enteredCount--;
+ return true;
}
}
if (styleClock > 0x100000) {
styleClock = 0;
}
+ // Ask the watchers to style, and stop as soon as one responds.
+ for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) {
+ watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
+ }
}
- // Ask the watchers to style, and stop as soon as one responds.
- for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++)
- watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
return pos <= GetEndStyled();
}
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
// Gateways to modifying document
- void DeleteChars(int pos, int len);
- void InsertStyledString(int position, char *s, int insertLength);
+ bool DeleteChars(int pos, int len);
+ bool InsertStyledString(int position, char *s, int insertLength);
int Undo();
int Redo();
bool CanUndo() { return cb.CanUndo(); }
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
bool IsReadOnly() { return cb.IsReadOnly(); }
- void InsertChar(int pos, char ch);
- void InsertString(int position, const char *s);
- void InsertString(int position, const char *s, int insertLength);
+ bool InsertChar(int pos, char ch);
+ bool InsertString(int position, const char *s);
+ bool InsertString(int position, const char *s, size_t insertLength);
void ChangeChar(int pos, char ch);
void DelChar(int pos);
- int DelCharBack(int pos);
+ void DelCharBack(int pos);
char CharAt(int position) { return cb.CharAt(position); }
void GetCharRange(char *buffer, int position, int lengthRetrieve) {
void SetWordChars(unsigned char *chars);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
- void SetStyleFor(int length, char style);
- void SetStyles(int length, char *styles);
+ bool SetStyleFor(int length, char style);
+ bool SetStyles(int length, char *styles);
int GetEndStyled() { return endStyled; }
bool EnsureStyledTo(int pos);
int GetStyleClock() { return styleClock; }
buf[endPos-startPos] = '\0';
}
+bool DocumentAccessor::Match(int pos, const char *s) {
+ for (int i=0; *s; i++) {
+ if (*s != SafeGetCharAt(pos+i))
+ return false;
+ s++;
+ }
+ return true;
+}
+
char DocumentAccessor::StyleAt(int position) {
return pdoc->StyleAt(position);
}
startSeg(0), startPosStyling(0) {
}
~DocumentAccessor();
+ bool Match(int pos, const char *s);
char StyleAt(int position);
int GetLine(int position);
int LineStart(int line);
chars = new char[maxLineLength_ + 1];
styles = new char[maxLineLength_ + 1];
indicators = new char[maxLineLength_ + 1];
- positions = new int[maxLineLength_ + 1];
+ // Extra position allocated as sometimes the Windows
+ // GetTextExtentExPoint API writes an extra element.
+ positions = new int[maxLineLength_ + 1 + 1];
maxLineLength = maxLineLength_;
}
}
}
void LineLayout::Invalidate(validLevel validity_) {
- validity = validity_;
+ if (validity > validity_)
+ validity = validity_;
}
void LineLayout::SetLineStart(int line, int start) {
}
if (lengthForLevel > size) {
Deallocate();
- } else {
- if (lengthForLevel < length) {
- for (int i=lengthForLevel; i<length; i++) {
- delete cache[i];
- cache[i] = 0;
- }
+ } else if (lengthForLevel < length) {
+ for (int i=lengthForLevel; i<length; i++) {
+ delete cache[i];
+ cache[i] = 0;
}
- Invalidate(LineLayout::llInvalid);
}
if (!cache) {
Allocate(lengthForLevel);
int linesOnScreen, int linesInDoc) {
AllocateForLevel(linesOnScreen, linesInDoc);
if (styleClock != styleClock_) {
- Invalidate(LineLayout::llInvalid);
+ Invalidate(LineLayout::llCheckTextAndStyle);
styleClock = styleClock_;
}
allInvalidated = false;
xEndSelect = 0;
primarySelection = true;
- caretPolicy = CARET_SLOP;
- caretSlop = 0;
+ caretXPolicy = CARET_SLOP | CARET_EVEN;
+ caretXSlop = 50;
- visiblePolicy = VISIBLE_SLOP;
- visibleSlop = 0;
+ caretYPolicy = CARET_EVEN;
+ caretYSlop = 0;
searchAnchor = 0;
xOffset = 0;
xCaretMargin = 50;
horizontalScrollBarVisible = true;
+ scrollWidth = 2000;
+ endAtLastLine = true;
pixmapLine = Surface::Allocate();
pixmapSelMargin = Surface::Allocate();
int Editor::MaxScrollPos() {
//Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n",
//LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1);
- int retVal = cs.LinesDisplayed() - LinesOnScreen();
- if (retVal < 0)
+ int retVal = cs.LinesDisplayed();
+ if (endAtLastLine) {
+ retVal -= LinesOnScreen();
+ } else {
+ retVal--;
+ }
+ if (retVal < 0) {
return 0;
- else
+ } else {
return retVal;
+ }
}
static inline bool IsControlCharacter(char ch) {
return INVALID_POSITION;
}
-// Find the document position corresponding to an x coordinate on a particular document line.
-// Ensure is between whole characters when document is in multi-byte or UTF-8 mode.
+/**
+ * Find the document position corresponding to an x coordinate on a particular document line.
+ * Ensure is between whole characters when document is in multi-byte or UTF-8 mode.
+ */
int Editor::PositionFromLineX(int lineDoc, int x) {
RefreshStyleData();
if (lineDoc >= pdoc->LinesTotal())
return retVal;
}
+// If painting then abandon the painting because a wider redraw is needed.
+// Return true if calling code should stop drawing
+bool Editor::AbandonPaint() {
+ if ((paintState == painting) && !paintingAllText) {
+ paintState = paintAbandoned;
+ }
+ return paintState == paintAbandoned;
+}
+
void Editor::RedrawRect(PRectangle rc) {
//Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom);
}
void Editor::RedrawSelMargin() {
- if (vs.maskInLine) {
- Redraw();
- } else {
- PRectangle rcSelMargin = GetClientRectangle();
- rcSelMargin.right = vs.fixedColumnWidth;
- wMain.InvalidateRectangle(rcSelMargin);
+ if (!AbandonPaint()) {
+ if (vs.maskInLine) {
+ Redraw();
+ } else {
+ PRectangle rcSelMargin = GetClientRectangle();
+ rcSelMargin.right = vs.fixedColumnWidth;
+ wMain.InvalidateRectangle(rcSelMargin);
+ }
}
}
return lineDisplay;
}
+/**
+ * Ensure the caret is reasonably visible in context.
+ *
+Caret policy in SciTE
+
+If slop is set, we can define a slop value.
+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.
+
+If 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.
+
+If 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.
+'3UZ' notation is used to indicate three time the size of the UZ as a distance to the margin.
+
+If 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.
+
+ | | | | |
+slop | strict | jumps | even | Caret can go to the margin | When reaching limit (caret going out of
+ | | | | | visibility or going into the UZ) display is...
+-----+--------+-------+------+--------------------------------------------+--------------------------------------------------------------
+ 0 | 0 | 0 | 0 | Yes | moved to put caret on top/on right
+ 0 | 0 | 0 | 1 | Yes | moved by one position
+ 0 | 0 | 1 | 0 | Yes | moved to put caret on top/on right
+ 0 | 0 | 1 | 1 | Yes | centred on the caret
+ 0 | 1 | - | 0 | Caret is always on top/on right of display | -
+ 0 | 1 | - | 1 | No, caret is always centred | -
+ 1 | 0 | 0 | 0 | Yes | moved to put caret out of the asymmetrical UZ
+ 1 | 0 | 0 | 1 | Yes | moved to put caret out of the UZ
+ 1 | 0 | 1 | 0 | Yes | moved to put caret at 3UZ of the top or right margin
+ 1 | 0 | 1 | 1 | Yes | moved to put caret at 3UZ of the margin
+ 1 | 1 | - | 0 | Caret is always at UZ of top/right margin | -
+ 1 | 1 | 0 | 1 | No, kept out of UZ | moved by one position
+ 1 | 1 | 1 | 1 | No, kept out of UZ | moved to put caret at 3UZ of the margin
+*/
void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
//Platform::DebugPrintf("EnsureCaretVisible %d %s\n", xOffset, useMargin ? " margin" : " ");
PRectangle rcClient = GetTextRectangle();
//int rcClientFullWidth = rcClient.Width();
int posCaret = currentPos;
- if (posDrag >= 0)
+ if (posDrag >= 0) {
posCaret = posDrag;
+ }
Point pt = LocationFromPosition(posCaret);
- Point ptEOL = LocationFromPosition(pdoc->LineEndPosition(posCaret));
Point ptBottomCaret = pt;
- int lineCaret = DisplayFromPosition(posCaret);
ptBottomCaret.y += vs.lineHeight - 1;
-
- // Ensure the caret is reasonably visible in context:
- // xMargin must equal to xCaretMargin, with a minimum of 2 and a maximum of
- // slightly less than half the width of the text area.
- int xMargin = Platform::Clamp(xCaretMargin, 2, Platform::Maximum(rcClient.Width() - 10, 4) / 2);
- if (!useMargin)
- xMargin = 2;
-
- // If we scroll the display, we use a minimum amount of xMargin.
- int offsetLeft = rcClient.left + xMargin;
- int offsetRight = rcClient.right - xMargin;
- // If we are in XJUMPS mode, then when the margin is reached, the
- // offset jumps so that it won't need to move agin for a while.
- if (!(caretPolicy & CARET_XJUMPS)) {
- rcClient.left = offsetLeft;
- rcClient.right = offsetRight;
- }
+ int lineCaret = DisplayFromPosition(posCaret);
+ bool bSlop, bStrict, bJump, bEven;
// Vertical positioning
- if (vert && (!rcClient.Contains(pt) || !rcClient.Contains(ptBottomCaret) || (caretPolicy & CARET_STRICT))) {
- //Platform::DebugPrintf("EnsureCaretVisible move, (%d,%d)(%d,%d)\n", pt.x, pt.y, rcClient.left, rcClient.right);
+ if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) {
+ int linesOnScreen = LinesOnScreen();
+ int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2;
+ int newTopLine = topLine;
+ bSlop = (caretYPolicy & CARET_SLOP) != 0;
+ bStrict = (caretYPolicy & CARET_STRICT) != 0;
+ bJump = (caretYPolicy & CARET_JUMPS) != 0;
+ bEven = (caretYPolicy & CARET_EVEN) != 0;
+
// It should be possible to scroll the window to show the caret,
// but this fails to remove the caret on GTK+
- if (caretPolicy & CARET_SLOP) {
- if ((topLine > lineCaret) || ((caretPolicy & CARET_STRICT) && (topLine + caretSlop > lineCaret))) {
- SetTopLine(Platform::Clamp(lineCaret - caretSlop, 0, MaxScrollPos()));
- SetVerticalScrollPos();
- Redraw();
- } else if ((lineCaret > topLine + LinesOnScreen() - 1) ||
- ((caretPolicy & CARET_STRICT) && (lineCaret > topLine + LinesOnScreen() - 1 - caretSlop))) {
- SetTopLine(Platform::Clamp(lineCaret - LinesOnScreen() + 1 + caretSlop, 0, MaxScrollPos()));
- SetVerticalScrollPos();
- Redraw();
+ if (bSlop) { // A margin is defined
+ int yMoveT, yMoveB;
+ if (bStrict) {
+ int yMarginT, yMarginB;
+ if (!useMargin) {
+ // In drag mode, avoid moves
+ // otherwise, a double click will select several lines.
+ yMarginT = yMarginB = 0;
+ } else {
+ // yMarginT must equal to caretYSlop, with a minimum of 1 and
+ // a maximum of slightly less than half the heigth of the text area.
+ yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen);
+ if (bEven) {
+ yMarginB = yMarginT;
+ } else {
+ yMarginB = linesOnScreen - yMarginT - 1;
+ }
+ }
+ yMoveT = yMarginT;
+ if (bEven) {
+ if (bJump) {
+ yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen);
+ }
+ yMoveB = yMoveT;
+ } else {
+ yMoveB = linesOnScreen - yMoveT - 1;
+ }
+ if (lineCaret < topLine + yMarginT) {
+ // Caret goes too high
+ newTopLine = lineCaret - yMoveT;
+ } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) {
+ // Caret goes too low
+ newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+ }
+ } else { // Not strict
+ yMoveT = bJump ? caretYSlop * 3 : caretYSlop;
+ yMoveT = Platform::Clamp(yMoveT, 1, halfScreen);
+ if (bEven) {
+ yMoveB = yMoveT;
+ } else {
+ yMoveB = linesOnScreen - yMoveT - 1;
+ }
+ if (lineCaret < topLine) {
+ // Caret goes too high
+ newTopLine = lineCaret - yMoveT;
+ } else if (lineCaret > topLine + linesOnScreen - 1) {
+ // Caret goes too low
+ newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+ }
}
- } else {
- if ((topLine > lineCaret) || (lineCaret > topLine + LinesOnScreen() - 1) || (caretPolicy & CARET_STRICT)) {
- SetTopLine(Platform::Clamp(lineCaret - LinesOnScreen() / 2 + 1, 0, MaxScrollPos()));
- SetVerticalScrollPos();
- Redraw();
+ } else { // No slop
+ if (!bStrict && !bJump) {
+ // Minimal move
+ if (lineCaret < topLine) {
+ // Caret goes too high
+ newTopLine = lineCaret;
+ } else if (lineCaret > topLine + linesOnScreen - 1) {
+ // Caret goes too low
+ if (bEven) {
+ newTopLine = lineCaret - linesOnScreen + 1;
+ } else {
+ newTopLine = lineCaret;
+ }
+ }
+ } else { // Strict or going out of display
+ if (bEven) {
+ // Always center caret
+ newTopLine = lineCaret - halfScreen;
+ } else {
+ // Always put caret on top of display
+ newTopLine = lineCaret;
+ }
}
}
+ newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos());
+ if (newTopLine != topLine) {
+ SetTopLine(newTopLine);
+ SetVerticalScrollPos();
+ Redraw();
+ }
}
// Horizontal positioning
if (horiz && (wrapState == eWrapNone)) {
+ int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2;
int xOffsetNew = xOffset;
- if (pt.x < rcClient.left) {
- xOffsetNew = xOffset - (offsetLeft - pt.x);
- } else if ((!(caretPolicy & CARET_XEVEN) && ((xOffset > 0) && useMargin)) || pt.x >= rcClient.right) {
- xOffsetNew = xOffset + (pt.x - offsetRight);
- int xOffsetEOL = xOffset + (ptEOL.x - offsetRight) - xMargin + 2;
- //Platform::DebugPrintf("Margin %d %d\n", xOffsetNew, xOffsetEOL);
- // Ensure don't scroll out into empty space
- if (xOffsetNew > xOffsetEOL)
- xOffsetNew = xOffsetEOL;
- }
- if (xOffsetNew < 0)
+ bSlop = (caretXPolicy & CARET_SLOP) != 0;
+ bStrict = (caretXPolicy & CARET_STRICT) != 0;
+ bJump = (caretXPolicy & CARET_JUMPS) != 0;
+ bEven = (caretXPolicy & CARET_EVEN) != 0;
+
+ if (bSlop) { // A margin is defined
+ int xMoveL, xMoveR;
+ if (bStrict) {
+ int xMarginL, xMarginR;
+ if (!useMargin) {
+ // In drag mode, avoid moves unless very near of the margin
+ // otherwise, a simple click will select text.
+ xMarginL = xMarginR = 2;
+ } else {
+ // xMargin must equal to caretXSlop, with a minimum of 2 and
+ // a maximum of slightly less than half the width of the text area.
+ xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen);
+ if (bEven) {
+ xMarginL = xMarginR;
+ } else {
+ xMarginL = rcClient.Width() - xMarginR - 4;
+ }
+ }
+ if (bJump && bEven) {
+ // Jump is used only in even mode
+ xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen);
+ } else {
+ xMoveL = xMoveR = 0; // Not used, avoid a warning
+ }
+ if (pt.x < rcClient.left + xMarginL) {
+ // Caret is on the left of the display
+ if (bJump && bEven) {
+ xOffsetNew -= xMoveL;
+ } else {
+ // Move just enough to allow to display the caret
+ xOffsetNew -= (rcClient.left + xMarginL) - pt.x;
+ }
+ } else if (pt.x >= rcClient.right - xMarginR) {
+ // Caret is on the right of the display
+ if (bJump && bEven) {
+ xOffsetNew += xMoveR;
+ } else {
+ // Move just enough to allow to display the caret
+ xOffsetNew += pt.x - (rcClient.right - xMarginR) + 1;
+ }
+ }
+ } else { // Not strict
+ xMoveR = bJump ? caretXSlop * 3 : caretXSlop;
+ xMoveR = Platform::Clamp(xMoveR, 1, halfScreen);
+ if (bEven) {
+ xMoveL = xMoveR;
+ } else {
+ xMoveL = rcClient.Width() - xMoveR - 4;
+ }
+ if (pt.x < rcClient.left) {
+ // Caret is on the left of the display
+ xOffsetNew -= xMoveL;
+ } else if (pt.x >= rcClient.right) {
+ // Caret is on the right of the display
+ xOffsetNew += xMoveR;
+ }
+ }
+ } else { // No slop
+ if (bStrict ||
+ (bJump && (pt.x < rcClient.left || pt.x >= rcClient.right))) {
+ // Strict or going out of display
+ if (bEven) {
+ // Center caret
+ xOffsetNew += pt.x - rcClient.left - halfScreen;
+ } else {
+ // Put caret on right
+ xOffsetNew += pt.x - rcClient.right + 1;
+ }
+ } else {
+ // Move just enough to allow to display the caret
+ if (pt.x < rcClient.left) {
+ // Caret is on the left of the display
+ if (bEven) {
+ xOffsetNew -= rcClient.left - pt.x;
+ } else {
+ xOffsetNew += pt.x - rcClient.right + 1;
+ }
+ } else if (pt.x >= rcClient.right) {
+ // Caret is on the right of the display
+ xOffsetNew += pt.x - rcClient.right + 1;
+ }
+ }
+ }
+ // In case of a jump (find result) largely out of display, adjust the offset to display the caret
+ if (pt.x + xOffset < rcClient.left + xOffsetNew) {
+ xOffsetNew = pt.x + xOffset - rcClient.left;
+ } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) {
+ xOffsetNew = pt.x + xOffset - rcClient.right + 1;
+ }
+ if (xOffsetNew < 0) {
xOffsetNew = 0;
+ }
if (xOffset != xOffsetNew) {
xOffset = xOffsetNew;
SetHorizontalScrollPos();
}
void Editor::NeedWrapping(int docLineStartWrapping) {
- docLineLastWrapped = docLineStartWrapping - 1;
- if (docLineLastWrapped < -1)
- docLineLastWrapped = -1;
- llc.Invalidate(LineLayout::llPositions);
+ if (docLineLastWrapped > (docLineStartWrapping - 1)) {
+ docLineLastWrapped = docLineStartWrapping - 1;
+ if (docLineLastWrapped < -1)
+ docLineLastWrapped = -1;
+ llc.Invalidate(LineLayout::llPositions);
+ }
}
// Check if wrapping needed and perform any needed wrapping.
}
docLineLastWrapped = 0x7ffffff;
} else {
- ElapsedTime et;
+ //ElapsedTime et;
int lineDocTop = cs.DocFromDisplay(topLine);
int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
PRectangle rcTextArea = GetClientRectangle();
goodTopLine += subLineTop;
else
goodTopLine += cs.GetHeight(lineDocTop);
- double durWrap = et.Duration(true);
+ //double durWrap = et.Duration(true);
//Platform::DebugPrintf("Wrap:%9.6g \n", durWrap);
}
}
if (!ll)
return;
int posLineStart = pdoc->LineStart(line);
+ int posLineEnd = pdoc->LineStart(line + 1);
+ // If the line is very long, limit the treatment to a length that should fit in the viewport
+ if (posLineEnd > (posLineStart + ll->maxLineLength)) {
+ posLineEnd = posLineStart + ll->maxLineLength;
+ }
+ if (ll->validity == LineLayout::llCheckTextAndStyle) {
+ int lineLength = 0;
+ for (int cid = posLineStart; cid < posLineEnd; cid++) {
+ char chDoc = pdoc->CharAt(cid);
+ if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) {
+ lineLength++;
+ }
+ }
+ if (lineLength == ll->numCharsInLine) {
+ int numCharsInLine = 0;
+ // See if chars, styles, indicators, are all the same
+ bool allSame = true;
+ char styleByte;
+ int styleMask = pdoc->stylingBitsMask;
+ // Check base line layout
+ for (int charInDoc = posLineStart; allSame && (charInDoc < posLineEnd); charInDoc++) {
+ char chDoc = pdoc->CharAt(charInDoc);
+ styleByte = pdoc->StyleAt(charInDoc);
+ if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) {
+ allSame = allSame &&
+ (ll->styles[numCharsInLine] == static_cast<char>(styleByte & styleMask));
+ allSame = allSame &&
+ (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
+ if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper)
+ allSame = allSame &&
+ (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
+ else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
+ allSame = allSame &&
+ (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
+ else
+ allSame = allSame &&
+ (ll->chars[numCharsInLine] == chDoc);
+ numCharsInLine++;
+ }
+ }
+ if (allSame) {
+ ll->validity = LineLayout::llPositions;
+ } else {
+ ll->validity = LineLayout::llInvalid;
+ }
+ } else {
+ ll->validity = LineLayout::llInvalid;
+ }
+ }
if (ll->validity == LineLayout::llInvalid) {
ll->widthLine = LineLayout::wrapWidthInfinite;
ll->lines = 1;
ll->edgeColumn = -1;
}
- int posLineEnd = pdoc->LineStart(line + 1);
- Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
char styleByte = 0;
int styleMask = pdoc->stylingBitsMask;
- ll->xHighlightGuide = 0;
- // If the line is very long, limit the treatment to a length that should fit in the viewport
- if (posLineEnd > (posLineStart + ll->maxLineLength)) {
- posLineEnd = posLineStart + ll->maxLineLength;
- }
// Fill base line layout
for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) {
char chDoc = pdoc->CharAt(charInDoc);
numCharsInLine++;
}
}
+ ll->xHighlightGuide = 0;
// Extra element at the end of the line to hold end x position and act as
ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character
ll->styles[numCharsInLine] = styleByte; // For eolFilled
ll->positions[0] = 0;
unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars;
bool lastSegItalics = false;
+ Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) ||
ll->widthLine = width;
if (width == LineLayout::wrapWidthInfinite) {
ll->lines = 1;
+ } else if (width > ll->positions[ll->numCharsInLine]) {
+ // Simple common case where line does not need wrapping.
+ ll->lines = 1;
} else {
ll->lines = 0;
// Calculate line start positions based upon width.
}
void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
- //Platform::DebugPrintf("Paint %d %d - %d %d\n", rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+ //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n",
+ // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+
RefreshStyleData();
PRectangle rcClient = GetClientRectangle();
if (WrapLines()) {
// The wrapping process has changed the height of some lines so abandon this
// paint for a complete repaint.
- paintState = paintAbandoned;
- return;
+ if (AbandonPaint()) {
+ return;
+ }
}
if (!pixmapSelPattern->Initialised()) {
surfaceWindow->SetPalette(&palette, true);
pixmapLine->SetPalette(&palette, !hasFocus);
- //Platform::DebugPrintf("Paint: (%3d,%3d) ... (%3d,%3d)\n",
- // rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
-
int screenLinePaintFirst = rcArea.top / vs.lineHeight;
// The area to be painted plus one extra line is styled.
// The extra line is to determine when a style change, such as starting a comment flows on to other lines.
while (visibleLine < cs.LinesDisplayed() && yposScreen < rcArea.bottom) {
int lineDoc = cs.DocFromDisplay(visibleLine);
- //Platform::DebugPrintf("Painting line %d\n", line);
// Only visible lines should be handled by the code within the loop
PLATFORM_ASSERT(cs.GetVisible(lineDoc));
int lineStartSet = cs.DisplayFromDoc(lineDoc);
return endPosPrint;
}
+int Editor::TextWidth(int style, const char *text) {
+ RefreshStyleData();
+ AutoSurface surface(IsUnicodeMode());
+ if (surface) {
+ return surface->WidthText(vs.styles[style].font, text, strlen(text));
+ } else {
+ return 1;
+ }
+}
+
// Empty method is overridden on GTK+ to show / hide scrollbars
-void Editor::ReconfigureScrollBars() {}
+void Editor::ReconfigureScrollBars() {
+}
void Editor::SetScrollBars() {
RefreshStyleData();
- int nMax = cs.LinesDisplayed();
- int nPage = nMax - MaxScrollPos() + 1;
- bool modified = ModifyScrollBars(nMax, nPage);
+ int nMax = MaxScrollPos();
+ int nPage = LinesOnScreen();
+ bool modified = ModifyScrollBars(nMax + nPage - 1, nPage);
// TODO: ensure always showing as many lines as possible
// May not be, if, for example, window made larger
SetVerticalScrollPos();
Redraw();
}
- if (modified)
- Redraw();
+ if (modified) {
+ if (!AbandonPaint())
+ Redraw();
+ }
//Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage);
}
}
}
}
- pdoc->InsertString(currentPos, s, len);
- SetEmptySelection(currentPos + len);
+ if (pdoc->InsertString(currentPos, s, len)) {
+ SetEmptySelection(currentPos + len);
+ }
EnsureCaretVisible();
// Avoid blinking during rapid typing:
ShowCaretAtCurrentPosition();
if (0 != pdoc->Length()) {
pdoc->DeleteChars(0, pdoc->Length());
}
- cs.Clear();
+ if (!pdoc->IsReadOnly()) {
+ cs.Clear();
+ }
pdoc->EndUndoAction();
anchor = 0;
currentPos = 0;
SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
pdoc->EndUndoAction();
} else {
- int newPos = pdoc->DelCharBack(currentPos);
- SetEmptySelection(newPos);
+ pdoc->DelCharBack(currentPos);
}
}
} else {
char txt[2];
txt[0] = static_cast<char>(ch);
txt[1] = '\0';
- NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
+ NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<sptr_t>(txt));
}
}
NotifyParent(scn);
}
+void Editor::NotifyZoom() {
+ SCNotification scn;
+ scn.nmhdr.code = SCN_ZOOM;
+ NotifyParent(scn);
+}
+
// Notifications from document
void Editor::NotifyModifyAttempt(Document*, void *) {
//Platform::DebugPrintf("** Modify Attempt\n");
void Editor::CheckModificationForWrap(DocModification mh) {
if ((mh.modificationType & SC_MOD_INSERTTEXT) ||
(mh.modificationType & SC_MOD_DELETETEXT)) {
- llc.Invalidate(LineLayout::llInvalid);
+ llc.Invalidate(LineLayout::llCheckTextAndStyle);
if (wrapState != eWrapNone) {
int lineDoc = pdoc->LineFromPosition(mh.position);
if (mh.linesAdded == 0) {
needUpdateUI = true;
if (paintState == painting) {
CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length));
- } else if (paintState == notPainting) {
- CheckModificationForWrap(mh);
- if (mh.modificationType & SC_MOD_CHANGESTYLE) {
+ }
+ CheckModificationForWrap(mh);
+ if (mh.modificationType & SC_MOD_CHANGESTYLE) {
+ if (paintState == notPainting) {
if (mh.position < pdoc->LineStart(topLine)) {
// Styling performed before this view
Redraw();
} else {
InvalidateRange(mh.position, mh.position + mh.length);
}
- } else {
- // Move selection and brace highlights
- if (mh.modificationType & SC_MOD_INSERTTEXT) {
- currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length);
- anchor = MovePositionForInsertion(anchor, mh.position, mh.length);
- braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length);
- braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length);
- } else if (mh.modificationType & SC_MOD_DELETETEXT) {
- currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length);
- anchor = MovePositionForDeletion(anchor, mh.position, mh.length);
- braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
- braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
+ }
+ } else {
+ // Move selection and brace highlights
+ if (mh.modificationType & SC_MOD_INSERTTEXT) {
+ currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length);
+ anchor = MovePositionForInsertion(anchor, mh.position, mh.length);
+ braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length);
+ braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length);
+ } else if (mh.modificationType & SC_MOD_DELETETEXT) {
+ currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length);
+ anchor = MovePositionForDeletion(anchor, mh.position, mh.length);
+ braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
+ braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
+ }
+ if (cs.LinesDisplayed() < cs.LinesInDoc()) {
+ // Some lines are hidden so may need shown.
+ // TODO: check if the modified area is hidden.
+ if (mh.modificationType & SC_MOD_BEFOREINSERT) {
+ NotifyNeedShown(mh.position, mh.length);
+ } else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
+ NotifyNeedShown(mh.position, mh.length);
}
- if (cs.LinesDisplayed() < cs.LinesInDoc()) {
- // Some lines are hidden so may need shown.
- // TODO: check if the modified area is hidden.
- if (mh.modificationType & SC_MOD_BEFOREINSERT) {
- NotifyNeedShown(mh.position, mh.length);
- } else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
- NotifyNeedShown(mh.position, mh.length);
- }
+ }
+ if (mh.linesAdded != 0) {
+ // Update contraction state for inserted and removed lines
+ // lineOfPos should be calculated in context of state before modification, shouldn't it
+ int lineOfPos = pdoc->LineFromPosition(mh.position);
+ if (mh.linesAdded > 0) {
+ cs.InsertLines(lineOfPos, mh.linesAdded);
+ } else {
+ cs.DeleteLines(lineOfPos, -mh.linesAdded);
}
- if (mh.linesAdded != 0) {
- // Update contraction state for inserted and removed lines
- // lineOfPos should be calculated in context of state before modification, shouldn't it
- int lineOfPos = pdoc->LineFromPosition(mh.position);
- if (mh.linesAdded > 0) {
- cs.InsertLines(lineOfPos, mh.linesAdded);
- } else {
- cs.DeleteLines(lineOfPos, -mh.linesAdded);
- }
- // Avoid scrolling of display if change before current display
- if (mh.position < posTopLine) {
- int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
- if (newTop != topLine) {
- SetTopLine(newTop);
- SetVerticalScrollPos();
- }
+ // Avoid scrolling of display if change before current display
+ if (mh.position < posTopLine) {
+ int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
+ if (newTop != topLine) {
+ SetTopLine(newTop);
+ SetVerticalScrollPos();
}
+ }
- //Platform::DebugPrintf("** %x Doc Changed\n", this);
- // TODO: could invalidate from mh.startModification to end of screen
- //InvalidateRange(mh.position, mh.position + mh.length);
+ //Platform::DebugPrintf("** %x Doc Changed\n", this);
+ // TODO: could invalidate from mh.startModification to end of screen
+ //InvalidateRange(mh.position, mh.position + mh.length);
+ if (paintState == notPainting) {
Redraw();
- } else {
- //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
- // mh.position, mh.position + mh.length);
+ }
+ } else {
+ //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
+ // mh.position, mh.position + mh.length);
+ if (paintState == notPainting) {
InvalidateRange(mh.position, mh.position + mh.length);
}
}
- } // else paintState == paintAbandoned so no need to do anything
+ }
if (mh.linesAdded != 0) {
SetScrollBars();
}
if (mh.modificationType & SC_MOD_CHANGEMARKER) {
- RedrawSelMargin();
+ if (paintState == notPainting) {
+ RedrawSelMargin();
+ }
}
// If client wants to see this modification
end = startNext;
char *thisLine = CopyRange(start, end);
pdoc->DeleteChars(start, end - start);
- pdoc->InsertString(startPrev, thisLine, end - start);
- MovePositionTo(startPrev + end - start);
+ if (pdoc->InsertString(startPrev, thisLine, end - start)) {
+ MovePositionTo(startPrev + end - start);
+ }
delete []thisLine;
} else {
// Last line so line has no line end
char *prevEnd = CopyRange(endPrev, start);
pdoc->DeleteChars(endPrev, end - endPrev);
pdoc->InsertString(startPrev, thisLine, end - start);
- pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev);
- MovePositionTo(startPrev + end - endPrev);
+ if (pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev)) {
+ MovePositionTo(startPrev + end - endPrev);
+ }
delete []thisLine;
delete []prevEnd;
}
void Editor::CancelModes() {}
-int Editor::KeyCommand(unsigned int iMessage) {
+void Editor::NewLine() {
+ ClearSelection();
+ const char *eol = "\n";
+ if (pdoc->eolMode == SC_EOL_CRLF) {
+ eol = "\r\n";
+ } else if (pdoc->eolMode == SC_EOL_CR) {
+ eol = "\r";
+ } // else SC_EOL_LF -> "\n" already set
+ if (pdoc->InsertString(currentPos, eol)) {
+ SetEmptySelection(currentPos + strlen(eol));
+ while (*eol) {
+ NotifyChar(*eol);
+ eol++;
+ }
+ }
+ SetLastXChosen();
+ EnsureCaretVisible();
+}
+
+void Editor::CursorUpOrDown(int direction, bool extend) {
Point pt = LocationFromPosition(currentPos);
+ int posNew = PositionFromLocation(
+ Point(lastXChosen, pt.y + direction * vs.lineHeight));
+ if (direction < 0) {
+ // Line wrapping may lead to a location on the same line, so
+ // seek back if that is the case.
+ // There is an equivalent case when moving down which skips
+ // over a line but as that does not trap the user it is fine.
+ Point ptNew = LocationFromPosition(posNew);
+ while ((posNew > 0) && (pt.y == ptNew.y)) {
+ posNew--;
+ ptNew = LocationFromPosition(posNew);
+ }
+ }
+ MovePositionTo(posNew, extend);
+}
+int Editor::KeyCommand(unsigned int iMessage) {
switch (iMessage) {
case SCI_LINEDOWN:
- MovePositionTo(PositionFromLocation(
- Point(lastXChosen, pt.y + vs.lineHeight)));
+ CursorUpOrDown(1);
break;
case SCI_LINEDOWNEXTEND:
- MovePositionTo(PositionFromLocation(
- Point(lastXChosen, pt.y + vs.lineHeight)), true);
+ CursorUpOrDown(1, true);
break;
case SCI_LINESCROLLDOWN:
ScrollTo(topLine + 1);
MoveCaretInsideView();
break;
case SCI_LINEUP:
- MovePositionTo(PositionFromLocation(
- Point(lastXChosen, pt.y - vs.lineHeight)));
+ CursorUpOrDown(-1);
break;
case SCI_LINEUPEXTEND:
- MovePositionTo(PositionFromLocation(
- Point(lastXChosen, pt.y - vs.lineHeight)), true);
+ CursorUpOrDown(-1, true);
break;
case SCI_LINESCROLLUP:
ScrollTo(topLine - 1);
EnsureCaretVisible();
break;
case SCI_NEWLINE:
- ClearSelection();
- if (pdoc->eolMode == SC_EOL_CRLF) {
- pdoc->InsertString(currentPos, "\r\n");
- SetEmptySelection(currentPos + 2);
- NotifyChar('\r');
- NotifyChar('\n');
- } else if (pdoc->eolMode == SC_EOL_CR) {
- pdoc->InsertChar(currentPos, '\r');
- SetEmptySelection(currentPos + 1);
- NotifyChar('\r');
- } else if (pdoc->eolMode == SC_EOL_LF) {
- pdoc->InsertChar(currentPos, '\n');
- SetEmptySelection(currentPos + 1);
- NotifyChar('\n');
- }
- SetLastXChosen();
- EnsureCaretVisible();
+ NewLine();
break;
case SCI_FORMFEED:
AddChar('\f');
SetLastXChosen();
break;
case SCI_ZOOMIN:
- if (vs.zoomLevel < 20)
+ if (vs.zoomLevel < 20) {
vs.zoomLevel++;
- NeedWrapping();
- InvalidateStyleRedraw();
+ NeedWrapping();
+ InvalidateStyleRedraw();
+ NotifyZoom();
+ }
break;
case SCI_ZOOMOUT:
- if (vs.zoomLevel > -10)
+ if (vs.zoomLevel > -10) {
vs.zoomLevel--;
- NeedWrapping();
- InvalidateStyleRedraw();
+ NeedWrapping();
+ InvalidateStyleRedraw();
+ NotifyZoom();
+ }
break;
case SCI_DELWORDLEFT: {
int startWord = pdoc->NextWordStart(currentPos, -1);
pdoc->DeleteChars(startWord, currentPos - startWord);
- MovePositionTo(startWord);
SetLastXChosen();
}
break;
case SCI_DELWORDRIGHT: {
int endWord = pdoc->NextWordStart(currentPos, 1);
pdoc->DeleteChars(currentPos, endWord - currentPos);
- MovePositionTo(currentPos);
}
break;
case SCI_DELLINELEFT: {
int line = pdoc->LineFromPosition(currentPos);
int start = pdoc->LineStart(line);
pdoc->DeleteChars(start, currentPos - start);
- MovePositionTo(start);
SetLastXChosen();
}
break;
int line = pdoc->LineFromPosition(currentPos);
int end = pdoc->LineEnd(line);
pdoc->DeleteChars(currentPos, end - currentPos);
- MovePositionTo(currentPos);
}
break;
case SCI_LINECUT: {
int start = pdoc->LineStart(line);
int end = pdoc->LineStart(line + 1);
pdoc->DeleteChars(start, end - start);
- MovePositionTo(start);
}
break;
case SCI_LINETRANSPOSE:
int lineCurrentPos = pdoc->LineFromPosition(currentPos);
if (lineOfAnchor == lineCurrentPos) {
if (forwards) {
+ pdoc->BeginUndoAction();
ClearSelection();
if (pdoc->GetColumn(currentPos) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) &&
pdoc->tabIndents) {
- pdoc->BeginUndoAction();
int indentation = pdoc->GetLineIndentation(lineCurrentPos);
int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars);
pdoc->SetLineIndentation(lineCurrentPos, indentation + indentationStep);
SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
- pdoc->EndUndoAction();
} else {
if (pdoc->useTabs) {
pdoc->InsertChar(currentPos, '\t');
if (numSpaces < 1)
numSpaces = pdoc->tabInChars;
for (int i = 0; i < numSpaces; i++) {
- pdoc->InsertChar(currentPos, ' ');
+ pdoc->InsertChar(currentPos + i, ' ');
}
SetEmptySelection(currentPos + numSpaces);
}
}
+ pdoc->EndUndoAction();
} else {
if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) &&
pdoc->tabIndents) {
* @return The position of the found text, -1 if not found.
*/
long Editor::FindText(
- unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+ uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
- long lParam) { ///< @c TextToFind structure: The text to search for in the given range.
+ sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range.
TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
int lengthFound = strlen(ft->lpstrText);
*/
long Editor::SearchText(
unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV.
- unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+ uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
- long lParam) { ///< The text to search for.
+ sptr_t lParam) { ///< The text to search for.
const char *txt = reinterpret_cast<char *>(lParam);
int pos;
SetSelection(position, position);
} else {
position = MovePositionOutsideChar(position, currentPos - position);
- pdoc->InsertString(position, value);
+ if (pdoc->InsertString(position, value)) {
+ SetSelection(position + strlen(value), position);
+ }
pdoc->EndUndoAction();
- SetSelection(position + strlen(value), position);
}
} else if (inDragDrop) {
SetSelection(position, position);
if (selStart < selEnd) {
if (drag.len) {
if (ctrl) {
- pdoc->InsertString(newPos, drag.s, drag.len);
+ if (pdoc->InsertString(newPos, drag.s, drag.len)) {
SetSelection(newPos, newPos + drag.len);
+ }
} else if (newPos < selStart) {
pdoc->DeleteChars(selStart, drag.len);
- pdoc->InsertString(newPos, drag.s, drag.len);
- SetSelection(newPos, newPos + drag.len);
+ if (pdoc->InsertString(newPos, drag.s, drag.len)) {
+ SetSelection(newPos, newPos + drag.len);
+ }
} else if (newPos > selEnd) {
pdoc->DeleteChars(selStart, drag.len);
newPos -= drag.len;
- pdoc->InsertString(newPos, drag.s, drag.len);
- SetSelection(newPos, newPos + drag.len);
+ if (pdoc->InsertString(newPos, drag.s, drag.len)) {
+ SetSelection(newPos, newPos + drag.len);
+ }
} else {
SetEmptySelection(newPos);
}
if (IsOverlap(topLine, paintTopLine, lineRangeStart, lineRangeEnd)) {
//Platform::DebugPrintf("Change (%d-%d) in top npv(%d-%d)\n",
// lineRangeStart, lineRangeEnd, topLine, paintTopLine);
- paintState = paintAbandoned;
+ AbandonPaint();
return;
}
}
if (IsOverlap(paintBottomLine, bottomLine, lineRangeStart, lineRangeEnd)) {
//Platform::DebugPrintf("Change (%d-%d) in bottom npv(%d-%d)\n",
// lineRangeStart, lineRangeEnd, paintBottomLine, bottomLine);
- paintState = paintAbandoned;
+ AbandonPaint();
return;
}
}
return wParam < ViewStyle::margins;
}
+static char *CharPtrFromSPtr(sptr_t lParam) {
+ return reinterpret_cast<char *>(lParam);
+}
+
sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
//Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam);
{
if (lParam == 0)
return 0;
- char *ptr = reinterpret_cast<char *>(lParam);
+ if (wParam == 0)
+ return 0;
+ char *ptr = CharPtrFromSPtr(lParam);
unsigned int iChar = 0;
for (; iChar < wParam - 1; iChar++)
ptr[iChar] = pdoc->CharAt(iChar);
return 0;
pdoc->DeleteChars(0, pdoc->Length());
SetEmptySelection(0);
- pdoc->InsertString(0, reinterpret_cast<char *>(lParam));
+ pdoc->InsertString(0, CharPtrFromSPtr(lParam));
return 1;
}
case SCI_CLEAR:
Clear();
SetLastXChosen();
+ EnsureCaretVisible();
break;
case SCI_UNDO:
}
int lineStart = pdoc->LineStart(wParam);
int lineEnd = pdoc->LineStart(wParam + 1);
- char *ptr = reinterpret_cast<char *>(lParam);
+ char *ptr = CharPtrFromSPtr(lParam);
int iPlace = 0;
for (int iChar = lineStart; iChar < lineEnd; iChar++) {
ptr[iPlace++] = pdoc->CharAt(iChar);
return 0;
SelectionText selectedText;
CopySelectionRange(&selectedText);
- char *ptr = reinterpret_cast<char *>(lParam);
+ char *ptr = CharPtrFromSPtr(lParam);
int iChar = 0;
if (selectedText.len) {
for (; iChar < selectedText.len; iChar++)
return 0;
pdoc->BeginUndoAction();
ClearSelection();
- char *replacement = reinterpret_cast<char *>(lParam);
+ char *replacement = CharPtrFromSPtr(lParam);
pdoc->InsertString(currentPos, replacement);
pdoc->EndUndoAction();
SetEmptySelection(currentPos + strlen(replacement));
case SCI_REPLACETARGET:
PLATFORM_ASSERT(lParam);
- return ReplaceTarget(false, reinterpret_cast<char *>(lParam), wParam);
+ return ReplaceTarget(false, CharPtrFromSPtr(lParam), wParam);
case SCI_REPLACETARGETRE:
PLATFORM_ASSERT(lParam);
- return ReplaceTarget(true, reinterpret_cast<char *>(lParam), wParam);
+ return ReplaceTarget(true, CharPtrFromSPtr(lParam), wParam);
case SCI_SEARCHINTARGET:
PLATFORM_ASSERT(lParam);
- return SearchInTarget(reinterpret_cast<char *>(lParam), wParam);
+ return SearchInTarget(CharPtrFromSPtr(lParam), wParam);
case SCI_SETSEARCHFLAGS:
searchFlags = wParam;
case SCI_ADDTEXT: {
if (lParam == 0)
return 0;
- pdoc->InsertString(CurrentPosition(), reinterpret_cast<char *>(lParam), wParam);
+ pdoc->InsertString(CurrentPosition(), CharPtrFromSPtr(lParam), wParam);
SetEmptySelection(currentPos + wParam);
return 0;
}
case SCI_ADDSTYLEDTEXT: {
if (lParam == 0)
return 0;
- pdoc->InsertStyledString(CurrentPosition() * 2, reinterpret_cast<char *>(lParam), wParam);
+ pdoc->InsertStyledString(CurrentPosition() * 2, CharPtrFromSPtr(lParam), wParam);
SetEmptySelection(currentPos + wParam / 2);
return 0;
}
if (static_cast<short>(wParam) == -1)
insertPos = CurrentPosition();
int newCurrent = CurrentPosition();
- int newAnchor = anchor;
- char *sz = reinterpret_cast<char *>(lParam);
+ char *sz = CharPtrFromSPtr(lParam);
pdoc->InsertString(insertPos, sz);
if (newCurrent > insertPos)
newCurrent += strlen(sz);
- if (newAnchor > insertPos)
- newAnchor += strlen(sz);
SetEmptySelection(newCurrent);
return 0;
}
int lineCurrentPos = pdoc->LineFromPosition(currentPos);
int lineStart = pdoc->LineStart(lineCurrentPos);
unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1);
- char *ptr = reinterpret_cast<char *>(lParam);
+ char *ptr = CharPtrFromSPtr(lParam);
unsigned int iPlace = 0;
for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) {
ptr[iPlace++] = pdoc->CharAt(iChar);
case SCI_SETSTYLINGEX: // Specify a complete styling buffer
if (lParam == 0)
return 0;
- pdoc->SetStyles(wParam, reinterpret_cast<char *>(lParam));
+ pdoc->SetStyles(wParam, CharPtrFromSPtr(lParam));
break;
case SCI_SETBUFFEREDDRAW:
case SCI_GETLAYOUTCACHE:
return llc.GetLevel();
+ case SCI_SETSCROLLWIDTH:
+ PLATFORM_ASSERT(wParam > 0);
+ if ((wParam > 0) && (wParam != static_cast<unsigned int >(scrollWidth))) {
+ scrollWidth = wParam;
+ SetScrollBars();
+ }
+ break;
+
+ case SCI_GETSCROLLWIDTH:
+ return scrollWidth;
+
+ case SCI_TEXTWIDTH:
+ PLATFORM_ASSERT((wParam >= 0) && (wParam <= STYLE_MAX));
+ PLATFORM_ASSERT(lParam);
+ return TextWidth(wParam, CharPtrFromSPtr(lParam));
+
+ case SCI_TEXTHEIGHT:
+ return vs.lineHeight;
+
+ case SCI_SETENDATLASTLINE:
+ PLATFORM_ASSERT((wParam == 0) || (wParam ==1));
+ if (endAtLastLine != (wParam != 0)) {
+ endAtLastLine = wParam != 0;
+ SetScrollBars();
+ }
+ break;
+
+ case SCI_GETENDATLASTLINE:
+ return endAtLastLine;
+
case SCI_GETCOLUMN:
return pdoc->GetColumn(wParam);
if (lParam == 0)
return 0;
if (wParam <= STYLE_MAX) {
- vs.SetStyleFontName(wParam, reinterpret_cast<const char *>(lParam));
+ vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam));
InvalidateStyleRedraw();
}
break;
case SCI_SEARCHPREV:
return SearchText(iMessage, wParam, lParam);
- case SCI_SETCARETPOLICY:
- caretPolicy = wParam;
- caretSlop = lParam;
+ case SCI_SETCARETPOLICY: // Deprecated
+ caretXPolicy = caretYPolicy = wParam;
+ caretXSlop = caretYSlop = lParam;
+ break;
+
+ case SCI_SETXCARETPOLICY:
+ caretXPolicy = wParam;
+ caretXSlop = lParam;
+ break;
+
+ case SCI_SETYCARETPOLICY:
+ caretYPolicy = wParam;
+ caretYSlop = lParam;
break;
case SCI_SETVISIBLEPOLICY:
case SCI_SETVIEWEOL:
vs.viewEOL = wParam != 0;
- Redraw();
+ InvalidateStyleRedraw();
break;
case SCI_SETZOOM:
vs.zoomLevel = wParam;
NeedWrapping();
InvalidateStyleRedraw();
+ NotifyZoom();
break;
case SCI_GETZOOM:
enum { wrapWidthInfinite = 0x7ffffff };
int maxLineLength;
int numCharsInLine;
- enum validLevel { llInvalid, llPositions, llLines } validity;
+ enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
int xHighlightGuide;
bool highlightColumn;
int selStart;
}
}
void SetLineStart(int line, int start);
- void SetBracesHighlight(Range rangeLine, Position braces[],
+ void SetBracesHighlight(Range rangeLine, Position braces[],
char bracesMatchStyle, int xHighlight);
void RestoreBracesHighlight(Range rangeLine, Position braces[]);
};
LineLayoutCache();
virtual ~LineLayoutCache();
void Deallocate();
- enum {
- llcNone=SC_CACHE_NONE,
- llcCaret=SC_CACHE_CARET,
- llcPage=SC_CACHE_PAGE,
+ enum {
+ llcNone=SC_CACHE_NONE,
+ llcCaret=SC_CACHE_CARET,
+ llcPage=SC_CACHE_PAGE,
llcDocument=SC_CACHE_DOCUMENT
};
void Invalidate(LineLayout::validLevel validity_);
void SetLevel(int level_);
int GetLevel() { return level; }
- LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
+ LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
int linesOnScreen, int linesInDoc);
void Dispose(LineLayout *ll);
};
int xOffset; ///< Horizontal scrolled amount in pixels
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret
bool horizontalScrollBarVisible;
+ int scrollWidth;
+ bool endAtLastLine;
Surface *pixmapLine;
Surface *pixmapSelMargin;
int xEndSelect;
bool primarySelection;
- int caretPolicy;
- int caretSlop;
+ int caretXPolicy;
+ int caretXSlop; ///< Ensure this many pixels visible on both sides of caret
+
+ int caretYPolicy;
+ int caretYSlop; ///< Ensure this many lines visible on both sides of caret
int visiblePolicy;
int visibleSlop;
int LineFromLocation(Point pt);
void SetTopLine(int topLineNew);
+ bool AbandonPaint();
void RedrawRect(PRectangle rc);
void Redraw();
void RedrawSelMargin();
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
void PaintSelMargin(Surface *surface, PRectangle &rc);
LineLayout *RetrieveLineLayout(int lineNumber);
- void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
+ void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite);
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine=0);
void Paint(Surface *surfaceWindow, PRectangle rcArea);
long FormatRange(bool draw, RangeToFormat *pfr);
+ int TextWidth(int style, const char *text);
virtual void SetVerticalScrollPos() = 0;
virtual void SetHorizontalScrollPos() = 0;
bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
void NotifyNeedShown(int pos, int len);
void NotifyDwelling(Point pt, bool state);
+ void NotifyZoom();
void NotifyModifyAttempt(Document *document, void *userData);
void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
void NotifyModified(Document *document, DocModification mh, void *userData);
void NotifyDeleted(Document *document, void *userData);
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
- void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
+ void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void PageMove(int direction, bool extend=false);
void ChangeCaseOfSelection(bool makeUpperCase);
void LineTranspose();
virtual void CancelModes();
+ void NewLine();
+ void CursorUpOrDown(int direction, bool extend=false);
virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
void Indent(bool forwards);
- long FindText(unsigned long wParam, long lParam);
+ long FindText(uptr_t wParam, sptr_t lParam);
void SearchAnchor();
- long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
+ long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
long SearchInTarget(const char *text, int length);
void GoToLine(int lineNo);
int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_, LexerFunction fnFolder_) :
+ const char *languageName_, LexerFunction fnFolder_,
+ const char * const wordListDescriptions_[]) :
language(language_),
fnLexer(fnLexer_),
fnFolder(fnFolder_),
+ wordListDescriptions(wordListDescriptions_),
languageName(languageName_) {
next = base;
base = this;
}
}
+int LexerModule::GetNumWordLists() const {
+ if (wordListDescriptions == NULL) {
+ return -1;
+ } else {
+ int numWordLists = 0;
+
+ while (wordListDescriptions[numWordLists]) {
+ ++numWordLists;
+ }
+
+ return numWordLists;
+ }
+}
+
+const char * LexerModule::GetWordListDescription(int index) const {
+ static const char *emptyStr = "";
+
+ PLATFORM_ASSERT(index < GetNumWordLists());
+ if (index >= GetNumWordLists()) {
+ return emptyStr;
+ } else {
+ return wordListDescriptions[index];
+ }
+}
+
const LexerModule *LexerModule::Find(int language) {
const LexerModule *lm = base;
while (lm) {
LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
-#ifdef __vms
-#define LINK_LEXERS
-#endif
-
-#ifdef LINK_LEXERS
-
-// The following code forces a reference to all of the Scintilla lexers.
-// If we don't do something like this, then the linker tends to "optimize"
-// them away. (eric@sourcegear.com)
-
-// Taken from wxWindow's stc.cpp. Walter.
-
+// Alternative historical name for Scintilla_LinkLexers
int wxForceScintillaLexers(void) {
return Scintilla_LinkLexers();
}
+// To add or remove a lexer, add or remove its file and run LexGen.py.
+
+// Force a reference to all of the Scintilla lexers so that the linker will
+// not remove the code of the lexers.
int Scintilla_LinkLexers() {
- extern LexerModule lmAda;
- extern LexerModule lmAVE;
- extern LexerModule lmBaan;
- extern LexerModule lmBatch;
- extern LexerModule lmConf;
- extern LexerModule lmCPP;
- extern LexerModule lmDiff;
- extern LexerModule lmEiffel;
- extern LexerModule lmEiffelkw;
- extern LexerModule lmErrorList;
- extern LexerModule lmHTML;
- extern LexerModule lmLatex;
- extern LexerModule lmLISP;
- extern LexerModule lmLua;
- extern LexerModule lmMake;
- extern LexerModule lmMatlab;
- extern LexerModule lmPascal;
- extern LexerModule lmPerl;
- extern LexerModule lmProps;
- extern LexerModule lmPython;
- extern LexerModule lmRuby;
- extern LexerModule lmSQL;
- extern LexerModule lmVB;
- extern LexerModule lmXML;
- extern LexerModule lmBullant;
-
- if (
- &lmAda
- && &lmAVE
- && &lmBaan
- && &lmConf
- && &lmDiff
- && &lmLatex
- && &lmPascal
- && &lmCPP
- && &lmHTML
- && &lmXML
- && &lmProps
- && &lmErrorList
- && &lmMake
- && &lmMatlab
- && &lmBatch
- && &lmPerl
- && &lmPython
- && &lmSQL
- && &lmVB
- && &lmRuby
- && &lmEiffel
- && &lmEiffelkw
- && &lmLISP
- && &lmLua
- && &lmNull
- && &lmBullant
- )
- {
- return 1;
- }
- else
- {
- return 0;
- }
+ static int forcer = 0;
+
+// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
+#define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage();
+
+//++Autogenerated -- run src/LexGen.py to regenerate
+//**\(\tLINK_LEXER(\*);\n\)
+ LINK_LEXER(lmAda);
+ LINK_LEXER(lmAVE);
+ LINK_LEXER(lmBaan);
+ LINK_LEXER(lmBullant);
+ LINK_LEXER(lmConf);
+ LINK_LEXER(lmCPP);
+ LINK_LEXER(lmTCL);
+ LINK_LEXER(lmNncrontab);
+ LINK_LEXER(lmEiffel);
+ LINK_LEXER(lmEiffelkw);
+ LINK_LEXER(lmHTML);
+ LINK_LEXER(lmXML);
+ LINK_LEXER(lmASP);
+ LINK_LEXER(lmPHP);
+ LINK_LEXER(lmLISP);
+ LINK_LEXER(lmLua);
+ LINK_LEXER(lmMatlab);
+ LINK_LEXER(lmBatch);
+ LINK_LEXER(lmDiff);
+ LINK_LEXER(lmProps);
+ LINK_LEXER(lmMake);
+ LINK_LEXER(lmErrorList);
+ LINK_LEXER(lmLatex);
+ LINK_LEXER(lmPascal);
+ LINK_LEXER(lmPerl);
+ LINK_LEXER(lmPython);
+ LINK_LEXER(lmRuby);
+ LINK_LEXER(lmSQL);
+ LINK_LEXER(lmVB);
+ LINK_LEXER(lmVBScript);
+
+//--Autogenerated -- end of automatically generated section
+
+ return 1;
}
-#endif
for (; sc.More(); sc.Forward()) {
+ if (sc.atLineStart && (sc.state == SCE_C_STRING)) {
+ // Prevent SCE_C_STRINGEOL from leaking back to previous line
+ sc.SetState(SCE_C_STRING);
+ }
+
// Handle line continuation generically.
if (sc.ch == '\\') {
- if (sc.Match("\\\n")) {
- sc.Forward();
- sc.Forward();
- continue;
- }
- if (sc.Match("\\\r\n")) {
- sc.Forward();
- sc.Forward();
+ if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
+ if (sc.ch == '\r' && sc.chNext == '\n') {
+ sc.Forward();
+ }
continue;
}
}
sc.Complete();
}
+static bool IsStreamCommentStyle(int style) {
+ return style == SCE_C_COMMENT ||
+ style == SCE_C_COMMENTDOC ||
+ style == SCE_C_COMMENTDOCKEYWORD ||
+ style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+ bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
- if (foldComment &&
- (style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC)) {
- if (style != stylePrev) {
+ if (foldComment && IsStreamCommentStyle(style)) {
+ if (!IsStreamCommentStyle(stylePrev)) {
levelCurrent++;
- } else if ((style != styleNext) && !atEOL) {
+ } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelCurrent--;
}
}
+ if (foldComment && (style == SCE_C_COMMENTLINE)) {
+ if ((ch == '/') && (chNext == '/')) {
+ char chNext2 = styler.SafeGetCharAt(i + 2);
+ if (chNext2 == '{') {
+ levelCurrent++;
+ } else if (chNext2 == '}') {
+ levelCurrent--;
+ }
+ }
+ }
+ if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
+ if (ch == '#') {
+ unsigned int j=i+1;
+ while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+ j++;
+ }
+ if (styler.Match(j, "region") || styler.Match(j, "if")) {
+ levelCurrent++;
+ } else if (styler.Match(j, "end")) {
+ levelCurrent--;
+ }
+ }
+ }
if (style == SCE_C_OPERATOR) {
if (ch == '{') {
levelCurrent++;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
-LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc);
-LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc);
+static const char * const cppWordLists[] = {
+ "Primary keywords and identifiers",
+ "Secondary keywords and identifiers",
+ "Documentation comment keywords",
+ 0,
+};
+
+LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc, cppWordLists);
+LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc, cppWordLists);
/** @file LexCrontab.cxx
** Lexer to use with extended crontab files used by a powerful
** Windows scheduler/event monitor/automation manager nnCron.
- ** (http://nemtsev.virtualave.net/)
+ ** (http://nemtsev.eserv.ru/)
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
state = SCE_NNCRONTAB_TASK;
styler.ColourTo(i,SCE_NNCRONTAB_TASK);
}
- else if( ch == '\\' && styler.SafeGetCharAt(i+1) == ' ') {
+ else if( ch == '\\' && (styler.SafeGetCharAt(i+1) == ' ' ||
+ styler.SafeGetCharAt(i+1) == '\t')) {
// signals the start of an extended comment...
state = SCE_NNCRONTAB_COMMENT;
styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
// signals environment variables
state = SCE_NNCRONTAB_ENVIRONMENT;
styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
+ } else if( ch == '<' && styler.SafeGetCharAt(i+1) == '%') {
+ // signals environment variables
+ state = SCE_NNCRONTAB_ENVIRONMENT;
+ styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
} else if( ch == '*' ) {
// signals an asterisk
// no state jump necessary for this simple case...
break;
}
if( (ch == '%' && styler.SafeGetCharAt(i-1)!='\\')
- || (ch == '\n') || (ch == '\r') ) {
+ || (ch == '\n') || (ch == '\r') || (ch == '>') ) {
state = SCE_NNCRONTAB_DEFAULT;
styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
break;
case SCE_NNCRONTAB_IDENTIFIER:
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric
if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') ||
- (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ) {
+ (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ||
+ (ch == '@') ) {
buffer[bufferCount++] = ch;
} else {
state = SCE_NNCRONTAB_DEFAULT;
isScript = 0 == strcmp(s, "script");
}
}
- if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords)
+ if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords) {
// No keywords -> all are known
chAttr = SCE_H_TAG;
+ isScript = 0 == strcmp(s, "script");
+ }
styler.ColourTo(end, chAttr);
return isScript ? SCE_H_SCRIPT : chAttr;
}
//case SCE_HJ_COMMENTLINE:
case SCE_HJ_DOUBLESTRING:
case SCE_HJ_SINGLESTRING:
+ case SCE_HJ_REGEX:
case SCE_HB_STRING:
case SCE_HP_STRING:
case SCE_HP_TRIPLE:
sc.Complete();
}
-LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
-LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
-LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp");
-LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php");
+static const char * const htmlWordListDesc[] = {
+ "HTML elements and attributes",
+ "JavaScript keywords",
+ "VBScript keywords",
+ "Python keywords",
+ "PHP keywords",
+ "SGML and DTD keywords",
+ 0,
+};
+
+LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc);
+LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc);
+LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc);
+LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc);
**
** Written by Paul Winwood.
** Folder by Alexey Yutkin.
- ** Modified by Marcos E. Wurzius
+ ** Modified by Marcos E. Wurzius & Philippe Lhoste
**/
#include <stdlib.h>
#include "Scintilla.h"
#include "SciLexer.h"
+#define SCE_LUA_LAST_STYLE SCE_LUA_WORD6
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
-
inline bool isLuaOperator(char ch) {
if (isalnum(ch))
return false;
return false;
}
-
-static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
- Accessor &styler) {
+static void ColouriseLuaDoc(
+ unsigned int startPos,
+ int length,
+ int initStyle,
+ WordList *keywordlists[],
+ Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
- int literalString = 0;
- int literalStringFlag =0;
+
+ // Must initialize the literal string nesting level, if we are inside such a string.
+ int literalStringLevel = 0;
+ if (initStyle == SCE_LUA_LITERALSTRING) {
+ literalStringLevel = 1;
+ }
+ // We use states above the last one to indicate nesting level of literal strings
+ if (initStyle > SCE_LUA_LAST_STYLE) {
+ literalStringLevel = initStyle - SCE_LUA_LAST_STYLE + 1;
+ }
// Do not leak onto next line
- if (initStyle == SCE_LUA_STRINGEOL)
+ if (initStyle == SCE_LUA_STRINGEOL) {
initStyle = SCE_LUA_DEFAULT;
+ }
StyleContext sc(startPos, length, initStyle, styler);
- if(startPos == 0 && sc.ch == '#') sc.SetState(SCE_LUA_COMMENTLINE);
+ if (startPos == 0 && sc.ch == '#') {
+ sc.SetState(SCE_LUA_COMMENTLINE);
+ }
for (; sc.More(); sc.Forward()) {
-
- // Handle line continuation generically.
- if (sc.ch == '\\') {
- if (sc.Match("\\\n")) {
- sc.Forward();
- sc.Forward();
- continue;
- }
- if (sc.Match("\\\r\n")) {
- sc.Forward();
- sc.Forward();
+ if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) {
+ // Prevent SCE_LUA_STRINGEOL from leaking back to previous line
+ sc.SetState(SCE_LUA_STRING);
+ }
+
+ // Handle string line continuation
+ if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) &&
+ sc.ch == '\\') {
+ if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
+ if (sc.ch == '\r' && sc.chNext == '\n') {
+ sc.Forward();
+ }
continue;
}
}
}
sc.SetState(SCE_LUA_DEFAULT);
}
-
-
} else if (sc.state == SCE_LUA_COMMENTLINE ) {
if (sc.atLineEnd) {
sc.SetState(SCE_LUA_DEFAULT);
}
+ } else if (sc.state == SCE_LUA_PREPROCESSOR ) {
+ if (sc.atLineEnd) {
+ sc.SetState(SCE_LUA_DEFAULT);
+ }
} else if (sc.state == SCE_LUA_STRING) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.ChangeState(SCE_LUA_STRINGEOL);
sc.ForwardSetState(SCE_LUA_DEFAULT);
}
-
} else if (sc.state == SCE_LUA_CHARACTER) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.ChangeState(SCE_LUA_STRINGEOL);
sc.ForwardSetState(SCE_LUA_DEFAULT);
}
- } else if (sc.state == SCE_LUA_LITERALSTRING) {
- if (sc.chPrev == '[' && sc.ch == '[' && literalStringFlag != 1) {
- literalString++;
- literalStringFlag = 1;
- }
- else if (sc.chPrev == ']' && sc.ch == ']' && literalStringFlag != 2 ) {
- if((--literalString == 1))
+ } else if (sc.state == SCE_LUA_LITERALSTRING || sc.state > SCE_LUA_LAST_STYLE) {
+ if (sc.Match('[', '[')) {
+ literalStringLevel++;
+ sc.SetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
+ } else if (sc.Match(']', ']') && literalStringLevel > 0) {
+ literalStringLevel--;
+ sc.Forward();
+ if (literalStringLevel == 0) {
sc.ForwardSetState(SCE_LUA_DEFAULT);
- literalStringFlag = 2;
+ } else if (literalStringLevel == 1) {
+ sc.ForwardSetState(SCE_LUA_LITERALSTRING);
+ } else {
+ sc.ForwardSetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
+ }
}
- else literalStringFlag = 0;
- }
+ }
// Determine if a new state should be entered.
if (sc.state == SCE_LUA_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
- sc.SetState(SCE_LUA_NUMBER);
- } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
- sc.SetState(SCE_LUA_IDENTIFIER);
- } else if (sc.ch == '\"') {
+ sc.SetState(SCE_LUA_NUMBER);
+ } else if (IsAWordStart(sc.ch)) {
+ sc.SetState(SCE_LUA_IDENTIFIER);
+ } else if (sc.Match('\"')) {
sc.SetState(SCE_LUA_STRING);
- } else if (sc.ch == '\'') {
+ } else if (sc.Match('\'')) {
sc.SetState(SCE_LUA_CHARACTER);
- } else if (sc.ch == '[' && sc.chNext == '[') {
+ } else if (sc.Match('[', '[')) {
+ literalStringLevel = 1;
sc.SetState(SCE_LUA_LITERALSTRING);
- literalString = 1;
- } else if (sc.ch == '-' && sc.chNext == '-') {
+ sc.Forward();
+ } else if (sc.Match('-', '-')) {
sc.SetState(SCE_LUA_COMMENTLINE);
+ sc.Forward();
+ } else if (sc.Match('$') && sc.atLineStart) {
+ sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code
} else if (isLuaOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_LUA_OPERATOR);
}
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
int styleNext = styler.StyleAt(startPos);
char s[10];
+
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LUA_WORD) {
- if ( ch == 'i' || ch == 'e' || ch == 't' || ch == 'd' || ch == 'f') {
+ if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e') {
for (unsigned int j = 0; j < 8; j++) {
- if (!iswordchar(styler[i + j]))
+ if (!iswordchar(styler[i + j])) {
break;
+ }
s[j] = styler[i + j];
s[j + 1] = '\0';
}
-
- if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0)
- || (strcmp(s, "function") == 0))
+
+ if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0)) {
levelCurrent++;
- if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0))
+ }
+ if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) {
levelCurrent--;
-
+ }
}
- }
- else if (style == SCE_LUA_OPERATOR)
- {
- if(ch == '{' || ch == '(')
+ } else if (style == SCE_LUA_OPERATOR) {
+ if (ch == '{' || ch == '(') {
levelCurrent++;
- else if(ch == '}' || ch == ')')
+ } else if (ch == '}' || ch == ')') {
levelCurrent--;
+ }
}
-
+
if (atEOL) {
int lev = levelPrev;
- if (visibleChars == 0 && foldCompact)
+ if (visibleChars == 0 && foldCompact) {
lev |= SC_FOLDLEVELWHITEFLAG;
- if ((levelCurrent > levelPrev) && (visibleChars > 0))
+ }
+ if ((levelCurrent > levelPrev) && (visibleChars > 0)) {
lev |= SC_FOLDLEVELHEADERFLAG;
+ }
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
levelPrev = levelCurrent;
visibleChars = 0;
}
- if (!isspacechar(ch))
+ if (!isspacechar(ch)) {
visibleChars++;
+ }
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
// difference starts then each line starting with ' ' is a whitespace
// otherwise it is considered a comment (Only in..., Binary file...)
if (0 == strncmp(lineBuffer, "diff ", 3)) {
- styler.ColourTo(endLine, 2);
+ styler.ColourTo(endLine, SCE_DIFF_COMMAND);
} else if (0 == strncmp(lineBuffer, "--- ", 3)) {
- styler.ColourTo(endLine, 3);
+ styler.ColourTo(endLine, SCE_DIFF_HEADER);
} else if (0 == strncmp(lineBuffer, "+++ ", 3)) {
- styler.ColourTo(endLine, 3);
+ styler.ColourTo(endLine, SCE_DIFF_HEADER);
+ } else if (0 == strncmp(lineBuffer, "***", 3)) {
+ styler.ColourTo(endLine, SCE_DIFF_HEADER);
} else if (lineBuffer[0] == '@') {
- styler.ColourTo(endLine, 4);
+ styler.ColourTo(endLine, SCE_DIFF_POSITION);
} else if (lineBuffer[0] == '-') {
- styler.ColourTo(endLine, 5);
+ styler.ColourTo(endLine, SCE_DIFF_DELETED);
} else if (lineBuffer[0] == '+') {
- styler.ColourTo(endLine, 6);
+ styler.ColourTo(endLine, SCE_DIFF_ADDED);
} else if (lineBuffer[0] != ' ') {
- styler.ColourTo(endLine, 1);
+ styler.ColourTo(endLine, SCE_DIFF_COMMENT);
} else {
- styler.ColourTo(endLine, 0);
+ styler.ColourTo(endLine, SCE_DIFF_DEFAULT);
}
}
i++;
if (i < lengthLine) {
if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
- styler.ColourTo(endPos, 1);
+ styler.ColourTo(endPos, SCE_PROPS_COMMENT);
} else if (lineBuffer[i] == '[') {
- styler.ColourTo(endPos, 2);
+ styler.ColourTo(endPos, SCE_PROPS_SECTION);
} else if (lineBuffer[i] == '@') {
- styler.ColourTo(startLine + i, 4);
+ styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
if (lineBuffer[++i] == '=')
- styler.ColourTo(startLine + i, 3);
- styler.ColourTo(endPos, 0);
+ styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
+ styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
// Search for the '=' character
while ((i < lengthLine) && (lineBuffer[i] != '='))
i++;
if ((i < lengthLine) && (lineBuffer[i] == '=')) {
- styler.ColourTo(startLine + i - 1, 0);
+ styler.ColourTo(startLine + i - 1, SCE_PROPS_DEFAULT);
styler.ColourTo(startLine + i, 3);
- styler.ColourTo(endPos, 0);
+ styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
- styler.ColourTo(endPos, 0);
+ styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
}
}
} else {
- styler.ColourTo(endPos, 0);
+ styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
}
}
state = 1;
} else if ((state == 0) && (lineBuffer[i] == '(')) {
state = 10;
+ } else if ((state == 0) && (lineBuffer[i] == '\t')) {
+ state = 20;
} else if ((state == 1) && isdigit(lineBuffer[i])) {
state = 2;
} else if ((state == 2) && (lineBuffer[i] == ':')) {
break;
} else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
state = 99;
+ } else if ((state == 20) && isdigit(lineBuffer[i])) {
+ state = 24;
+ break;
+ } else if ((state == 20) && ((lineBuffer[i] == '/') && (lineBuffer[i+1] == '^'))) {
+ state = 21;
+ } else if ((state == 21) && ((lineBuffer[i] == '$') && (lineBuffer[i+1] == '/'))) {
+ state = 22;
+ break;
}
}
if (state == 3) {
styler.ColourTo(endPos, SCE_ERR_GCC);
} else if ((state == 13) || (state == 14) || (state == 15)) {
styler.ColourTo(endPos, SCE_ERR_MS);
+ } else if (((state == 22) || (state == 24)) && (lineBuffer[0] != '\t')) {
+ styler.ColourTo(endPos, SCE_ERR_CTAG);
} else {
styler.ColourTo(endPos, SCE_ERR_DEFAULT);
}
styler.ColourTo(lengthDoc - 1, state);
}
-LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl");
+static const char * const perlWordListDesc[] = {
+ "Perl keywords",
+ 0
+};
+
+LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", 0, perlWordListDesc);
//styler.SetLevel(lineCurrent, indentCurrent);
}
-LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
+static const char * const pythonWordListDesc[] = {
+ "Python keywords",
+ 0
+};
+
+LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc,
+ pythonWordListDesc);
return *a - *b;
}
-int CompareNCaseInsensitive(const char *a, const char *b, int len) {
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
while (*a && *b && len) {
if (*a != *b) {
char upperA = MakeUpperCase(*a);
return 0 == CompareCaseInsensitive(a, b);
}
-inline unsigned int HashString(const char *s, int len) {
+inline unsigned int HashString(const char *s, size_t len) {
unsigned int ret = 0;
while (len--) {
ret <<= 4;
if (!*key) // Empty keys are not supported
return;
if (lenKey == -1)
- lenKey = strlen(key);
+ lenKey = static_cast<int>(strlen(key));
if (lenVal == -1)
- lenVal = strlen(val);
+ lenVal = static_cast<int>(strlen(val));
unsigned int hash = HashString(key, lenKey);
for (Property *p = props[hash % hashRoots]; p; p = p->next) {
if ((hash == p->hash) &&
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
char *var = StringDup(cpvar + 2, lenvar);
SString val = GetExpanded(var);
- int newlenbase = strlen(base) + val.length() - lenvar;
+ size_t newlenbase = strlen(base) + val.length() - lenvar;
char *newbase = new char[newlenbase];
strncpy(newbase, base, cpvar - base);
strcpy(newbase + (cpvar - base), val.c_str());
}
static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) {
- int lentarget = strlen(target);
- int lensuffix = strlen(suffix);
+ size_t lentarget = strlen(target);
+ size_t lensuffix = strlen(suffix);
if (lensuffix > lentarget)
return false;
- for (int i = lensuffix - 1; i >= 0; i--) {
+ for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) {
if (MakeUpperCase(target[i + lentarget - lensuffix]) !=
MakeUpperCase(suffix[i]))
return false;
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
char *var = StringDup(cpvar + 2, lenvar);
SString val = GetWild(var, filename);
- int newlenbase = strlen(base) + val.length() - lenvar;
+ size_t newlenbase = strlen(base) + val.length() - lenvar;
char *newbase = new char[newlenbase];
strncpy(newbase, base, cpvar - base);
strcpy(newbase + (cpvar - base), val.c_str());
}
char *PropSet::ToString() {
- unsigned int len=0;
+ size_t len=0;
for (int r = 0; r < hashRoots; r++) {
for (Property *p = props[r]; p; p = p->next) {
len += strlen(p->key) + 1;
if (keywords) {
words = 0;
prev = '\0';
- int slen = strlen(wordlist);
- for (int k = 0; k < slen; k++) {
+ size_t slen = strlen(wordlist);
+ for (size_t k = 0; k < slen; k++) {
if (!iswordsep(wordlist[k], onlyLineEnds)) {
if (!prev) {
keywords[words] = &wordlist[k];
* Modification history:
*
* $Log$
- * Revision 1.3 2002/03/18 22:31:00 RD
- * Updated wxSTC from Scintilla 1.40 to Scintilla 1.45
+ * Revision 1.4 2002/09/06 16:58:12 RD
+ * Updated to Scintilla from 1.45 to 1.47
*
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
* Addition of new target methods - versions of ReplaceTarget that take counted
}
void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
- bool acActiveBeforeCharAdded = ac.Active();
- if (!acActiveBeforeCharAdded || !ac.IsFillUpChar(*s))
+ bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
+ if (!isFillUp) {
Editor::AddCharUTF(s, len, treatAsDBCS);
- if (acActiveBeforeCharAdded)
+ }
+ if (ac.Active()) {
AutoCompleteChanged(s[0]);
+ // For fill ups add the character after the autocompletion has
+ // triggered so containers see the key so can display a calltip.
+ if (isFillUp) {
+ Editor::AddCharUTF(s, len, treatAsDBCS);
+ }
+ }
}
void ScintillaBase::Command(int cmdId) {
void ScintillaBase::AutoCompleteChanged(char ch) {
if (ac.IsFillUpChar(ch)) {
- AutoCompleteCompleted(ch);
+ AutoCompleteCompleted();
} else if (currentPos <= ac.posStart - ac.startLen) {
ac.Cancel();
} else if (ac.cancelAtStartPos && currentPos <= ac.posStart) {
}
}
-void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
+void ScintillaBase::AutoCompleteCompleted() {
int item = ac.lb.GetSelection();
char selected[1000];
if (item != -1) {
SetEmptySelection(ac.posStart);
if (item != -1) {
SString piece = selected;
- if (fillUp)
- piece += fillUp;
pdoc->InsertString(firstPos, piece.c_str());
SetEmptySelection(firstPos + piece.length());
}
}
void ScintillaBase::ContextMenu(Point pt) {
- bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
- popup.CreatePopUp();
- AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
- AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
- AddToPopUp("");
- AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
- AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
- AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
- AddToPopUp("Delete", idcmdDelete, writable && currentPos != anchor);
- AddToPopUp("");
- AddToPopUp("Select All", idcmdSelectAll);
- popup.Show(pt, wMain);
+ if (displayPopupMenu) {
+ bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
+ popup.CreatePopUp();
+ AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
+ AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
+ AddToPopUp("");
+ AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
+ AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
+ AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
+ AddToPopUp("Delete", idcmdDelete, writable && currentPos != anchor);
+ AddToPopUp("");
+ AddToPopUp("Select All", idcmdSelectAll);
+ popup.Show(pt, wMain);
+ }
}
void ScintillaBase::CancelModes() {
void AutoCompleteCancel();
void AutoCompleteMove(int delta);
void AutoCompleteChanged(char ch=0);
- void AutoCompleteCompleted(char fillUp='\0');
+ void AutoCompleteCompleted();
void AutoCompleteMoveToCurrentWord();
static void AutoCompleteDoubleClick(void* p);
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
}
+inline bool IsASpaceOrTab(unsigned int ch) {
+ return (ch == ' ') || (ch == '\t');
+}
+
inline bool IsADigit(unsigned int ch) {
return (ch >= '0') && (ch <= '9');
}
endPos = lenDoc;
TextRange tr = {{startPos, endPos}, buf};
- Platform::SendScintilla(id, SCI_GETTEXTRANGE, 0, reinterpret_cast<long>(&tr));
+ Platform::SendScintillaPointer(id, SCI_GETTEXTRANGE, 0, &tr);
+}
+
+bool WindowAccessor::Match(int pos, const char *s) {
+ for (int i=0; *s; i++) {
+ if (*s != SafeGetCharAt(pos+i))
+ return false;
+ s++;
+ }
+ return true;
}
char WindowAccessor::StyleAt(int position) {
startPos = extremePosition;
lenDoc = -1;
if (validLen > 0) {
- Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen,
- reinterpret_cast<long>(styleBuf));
+ Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
+ styleBuf);
validLen = 0;
}
}
DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
+DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
#ifdef LINK_LEXERS
// forces the linking of the lexer modules
-int wxForceScintillaLexers();
+int Scintilla_LinkLexers();
#endif
//----------------------------------------------------------------------
wxDefaultValidator, name)
{
#ifdef LINK_LEXERS
- wxForceScintillaLexers();
+ Scintilla_LinkLexers();
#endif
m_swx = new ScintillaWX(this);
m_stopWatch.Start();
// this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
-// Add text to the document
+// Add text to the document.
void wxStyledTextCtrl::AddText(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
SendMsg(2001, strlen(buf), (long)(const char*)buf);
}
-// Add array of cells to document
+// Add array of cells to document.
void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
SendMsg(2002, data.GetDataLen(), (long)data.GetData());
}
-// Insert string at a position
+// Insert string at a position.
void wxStyledTextCtrl::InsertText(int pos, const wxString& text) {
SendMsg(2003, pos, (long)(const char*)wx2stc(text));
}
-// Delete all text in the document
+// Delete all text in the document.
void wxStyledTextCtrl::ClearAll() {
SendMsg(2004, 0, 0);
}
-// Set all style bytes to 0, remove all folding information
+// Set all style bytes to 0, remove all folding information.
void wxStyledTextCtrl::ClearDocumentStyle() {
SendMsg(2005, 0, 0);
}
-// The number of characters in the document
+// The number of characters in the document.
int wxStyledTextCtrl::GetLength() {
return SendMsg(2006, 0, 0);
}
-// Returns the character byte at the position
+// Returns the character byte at the position.
int wxStyledTextCtrl::GetCharAt(int pos) {
return (unsigned char)SendMsg(2007, pos, 0);
}
-// Returns the position of the caret
+// Returns the position of the caret.
int wxStyledTextCtrl::GetCurrentPos() {
return SendMsg(2008, 0, 0);
}
-// Returns the position of the opposite end of the selection to the caret
+// Returns the position of the opposite end of the selection to the caret.
int wxStyledTextCtrl::GetAnchor() {
return SendMsg(2009, 0, 0);
}
-// Returns the style byte at the position
+// Returns the style byte at the position.
int wxStyledTextCtrl::GetStyleAt(int pos) {
return (unsigned char)SendMsg(2010, pos, 0);
}
-// Redoes the next action on the undo history
+// Redoes the next action on the undo history.
void wxStyledTextCtrl::Redo() {
SendMsg(2011, 0, 0);
}
return buf;
}
-// Are there any redoable actions in the undo history.
+// Are there any redoable actions in the undo history?
bool wxStyledTextCtrl::CanRedo() {
return SendMsg(2016, 0, 0) != 0;
}
-// Retrieve the line number at which a particular marker is located
+// Retrieve the line number at which a particular marker is located.
int wxStyledTextCtrl::MarkerLineFromHandle(int handle) {
return SendMsg(2017, handle, 0);
}
}
// Set the current styling position to pos and the styling mask to mask.
-// The styling mask can be used to protect some bits in each styling byte from
-// modification.
+// The styling mask can be used to protect some bits in each styling byte from modification.
void wxStyledTextCtrl::StartStyling(int pos, int mask) {
SendMsg(2032, pos, mask);
}
SendMsg(2033, length, style);
}
-// Is drawing done first into a buffer or direct to the screen.
+// Is drawing done first into a buffer or direct to the screen?
bool wxStyledTextCtrl::GetBufferedDraw() {
return SendMsg(2034, 0, 0) != 0;
}
SendMsg(2035, buffered, 0);
}
-// Change the visible size of a tab to be a multiple of the width of a space
-// character.
+// Change the visible size of a tab to be a multiple of the width of a space character.
void wxStyledTextCtrl::SetTabWidth(int tabWidth) {
SendMsg(2036, tabWidth, 0);
}
return SendMsg(2043, line, markerNumber);
}
-// Delete a marker from a line
+// Delete a marker from a line.
void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber) {
SendMsg(2044, line, markerNumber);
}
-// Delete all markers with a particular number from all lines
+// Delete all markers with a particular number from all lines.
void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber) {
SendMsg(2045, markerNumber, 0);
}
SendMsg(2076, periodMilliseconds, 0);
}
-// Set the set of characters making up words for when moving or selecting
-// by word.
+// Set the set of characters making up words for when moving or selecting by word.
void wxStyledTextCtrl::SetWordChars(const wxString& characters) {
SendMsg(2077, 0, (long)(const char*)wx2stc(characters));
}
return wxColourFromLong(c);
}
-// 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
+// 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.
void wxStyledTextCtrl::SetStyleBits(int bits) {
SendMsg(2090, bits, 0);
return SendMsg(2095, 0, 0) != 0;
}
-// Dsplay the background of the line containing the caret in a different colour.
+// Display the background of the line containing the caret in a different colour.
void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
SendMsg(2096, show, 0);
}
return SendMsg(2102, 0, 0) != 0;
}
-// Retrieve the position of the caret when the auto-completion list was
-// displayed.
+// Retrieve the position of the caret when the auto-completion list was displayed.
int wxStyledTextCtrl::AutoCompPosStart() {
return SendMsg(2103, 0, 0);
}
SendMsg(2105, 0, (long)(const char*)wx2stc(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.
+// Change the separator character in the string setting up an auto-completion list.
+// Default is space but can be changed if items contain space.
void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter) {
SendMsg(2106, separatorCharacter, 0);
}
SendMsg(2117, listType, (long)(const char*)wx2stc(itemList));
}
-// Set whether or not autocompletion is hidden automatically when nothing matches
+// Set whether or not autocompletion is hidden automatically when nothing matches.
void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide) {
SendMsg(2118, autoHide, 0);
}
-// Retrieve whether or not autocompletion is hidden automatically when nothing matches
+// Retrieve whether or not autocompletion is hidden automatically when nothing matches.
bool wxStyledTextCtrl::AutoCompGetAutoHide() {
return SendMsg(2119, 0, 0) != 0;
}
-// Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+// Set whether or not autocompletion deletes any word characters
+// after the inserted text upon completion.
void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord) {
SendMsg(2270, dropRestOfWord, 0);
}
-// Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+// Retrieve whether or not autocompletion deletes any word characters
+// after the inserted text upon completion.
bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
return SendMsg(2271, 0, 0) != 0;
}
return SendMsg(2150, flags, (long)&ft);
}
-// On Windows will draw the document into a display context such as a printer.
+// On Windows, will draw the document into a display context such as a printer.
int wxStyledTextCtrl::FormatRange(bool doDraw,
int startPos,
int endPos,
return SendMsg(2173, 0, 0) != 0;
}
-// Are there any undoable actions in the undo history.
+// Are there any undoable actions in the undo history?
bool wxStyledTextCtrl::CanUndo() {
return SendMsg(2174, 0, 0) != 0;
}
return SendMsg(2183, 0, 0);
}
-// Set to overtype (true) or insert mode
+// Set to overtype (true) or insert mode.
void wxStyledTextCtrl::SetOvertype(bool overtype) {
SendMsg(2186, overtype, 0);
}
return SendMsg(2187, 0, 0) != 0;
}
-// Set the width of the insert mode caret
+// Set the width of the insert mode caret.
void wxStyledTextCtrl::SetCaretWidth(int pixelWidth) {
SendMsg(2188, pixelWidth, 0);
}
-// Returns the width of the insert mode caret
+// Returns the width of the insert mode caret.
int wxStyledTextCtrl::GetCaretWidth() {
return SendMsg(2189, 0, 0);
}
return SendMsg(2197, strlen(buf), (long)(const char*)buf);
}
-// Set the search flags used by SearchInTarget
+// Set the search flags used by SearchInTarget.
void wxStyledTextCtrl::SetSearchFlags(int flags) {
SendMsg(2198, flags, 0);
}
-// Get the search flags used by SearchInTarget
+// Get the search flags used by SearchInTarget.
int wxStyledTextCtrl::GetSearchFlags() {
return SendMsg(2199, 0, 0);
}
SendMsg(2232, line, 0);
}
-// Set some debugging options for folding
+// Set some debugging options for folding.
void wxStyledTextCtrl::SetFoldFlags(int flags) {
SendMsg(2233, flags, 0);
}
SendMsg(2234, line, 0);
}
-// Sets whether a tab pressed when caret is within indentation indents
+// Sets whether a tab pressed when caret is within indentation indents.
void wxStyledTextCtrl::SetTabIndents(bool tabIndents) {
SendMsg(2260, tabIndents, 0);
}
return SendMsg(2261, 0, 0) != 0;
}
-// Sets whether a backspace pressed when caret is within indentation unindents
+// Sets whether a backspace pressed when caret is within indentation unindents.
void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents) {
SendMsg(2262, bsUnIndents, 0);
}
return SendMsg(2263, 0, 0) != 0;
}
-// Sets the time the mouse must sit still to generate a mouse dwell event
+// Sets the time the mouse must sit still to generate a mouse dwell event.
void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds) {
SendMsg(2264, periodMilliseconds, 0);
}
-// Retrieve the time the mouse must sit still to generate a mouse dwell event
+// Retrieve the time the mouse must sit still to generate a mouse dwell event.
int wxStyledTextCtrl::GetMouseDwellTime() {
return SendMsg(2265, 0, 0);
}
-// Get position of start of word
+// Get position of start of word.
int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters) {
return SendMsg(2266, pos, onlyWordCharacters);
}
-// Get position of end of word
+// Get position of end of word.
int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters) {
return SendMsg(2267, pos, onlyWordCharacters);
}
-// Sets whether text is word wrapped
+// Sets whether text is word wrapped.
void wxStyledTextCtrl::SetWrapMode(int mode) {
SendMsg(2268, mode, 0);
}
-// Retrieve whether text is word wrapped
+// Retrieve whether text is word wrapped.
int wxStyledTextCtrl::GetWrapMode() {
return SendMsg(2269, 0, 0);
}
-// Sets the degree of caching of layout information
+// Sets the degree of caching of layout information.
void wxStyledTextCtrl::SetLayoutCache(int mode) {
SendMsg(2272, mode, 0);
}
-// Retrieve the degree of caching of layout information
+// Retrieve the degree of caching of layout information.
int wxStyledTextCtrl::GetLayoutCache() {
return SendMsg(2273, 0, 0);
}
-// Move the caret inside current view if it's not there already
+// Sets the document width assumed for scrolling.
+void wxStyledTextCtrl::SetScrollWidth(int pixelWidth) {
+ SendMsg(2274, pixelWidth, 0);
+}
+
+// Retrieve the document width assumed for scrolling.
+int wxStyledTextCtrl::GetScrollWidth() {
+ return SendMsg(2275, 0, 0);
+}
+
+// Measure the pixel width of some text in a particular style.
+// Nul terminated text argument.
+// Does not handle tab or control characters.
+int wxStyledTextCtrl::TextWidth(int style, const wxString& text) {
+ return SendMsg(2276, style, (long)(const char*)wx2stc(text));
+}
+
+// Sets the scroll range so that maximum scroll position has
+// the last line at the bottom of the view (default).
+// Setting this to false allows scrolling one page below the last line.
+void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine) {
+ SendMsg(2277, endAtLastLine, 0);
+}
+
+// Retrieve whether the maximum scroll position has the last
+// line at the bottom of the view.
+int wxStyledTextCtrl::GetEndAtLastLine() {
+ return SendMsg(2278, 0, 0);
+}
+
+// Retrieve the height of a particular line of text in pixels.
+int wxStyledTextCtrl::TextHeight(int line) {
+ return SendMsg(2279, line, 0);
+}
+
+// Move the caret inside current view if it's not there already.
void wxStyledTextCtrl::MoveCaretInsideView() {
SendMsg(2401, 0, 0);
}
-// How many characters are on a line, not including end of line characters.
+// How many characters are on a line, not including end of line characters?
int wxStyledTextCtrl::LineLength(int line) {
return SendMsg(2350, line, 0);
}
return SendMsg(2353, pos, 0);
}
-// Are the end of line characters visible.
+// Are the end of line characters visible?
bool wxStyledTextCtrl::GetViewEOL() {
return SendMsg(2355, 0, 0) != 0;
}
-// Make the end of line characters visible or invisible
+// Make the end of line characters visible or invisible.
void wxStyledTextCtrl::SetViewEOL(bool visible) {
SendMsg(2356, visible, 0);
}
return SendMsg(2368, flags, (long)(const char*)wx2stc(text));
}
-// Set the way the line the caret is on is kept visible.
-void wxStyledTextCtrl::SetCaretPolicy(int caretPolicy, int caretSlop) {
- SendMsg(2369, caretPolicy, caretSlop);
-}
-
// Retrieves the number of lines completely visible.
int wxStyledTextCtrl::LinesOnScreen() {
return SendMsg(2370, 0, 0);
SendMsg(2371, allowPopUp, 0);
}
-// Is the selection a rectangular. The alternative is the more common stream selection.
+// Is the selection rectangular? The alternative is the more common stream selection.
bool wxStyledTextCtrl::SelectionIsRectangle() {
return SendMsg(2372, 0, 0) != 0;
}
return SendMsg(2378, 0, 0);
}
-// Change internal focus flag
+// Change internal focus flag.
void wxStyledTextCtrl::SetSTCFocus(bool focus) {
SendMsg(2380, focus, 0);
}
-// Get internal focus flag
+// Get internal focus flag.
bool wxStyledTextCtrl::GetSTCFocus() {
return SendMsg(2381, 0, 0) != 0;
}
-// Change error status - 0 = OK
+// Change error status - 0 = OK.
void wxStyledTextCtrl::SetStatus(int statusCode) {
SendMsg(2382, statusCode, 0);
}
-// Get error status
+// Get error status.
int wxStyledTextCtrl::GetStatus() {
return SendMsg(2383, 0, 0);
}
-// Set whether the mouse is captured when its button is pressed
+// Set whether the mouse is captured when its button is pressed.
void wxStyledTextCtrl::SetMouseDownCaptures(bool captures) {
SendMsg(2384, captures, 0);
}
-// Get whether mouse gets captured
+// Get whether mouse gets captured.
bool wxStyledTextCtrl::GetMouseDownCaptures() {
return SendMsg(2385, 0, 0) != 0;
}
-// Sets the cursor to one of the SC_CURSOR* values
+// Sets the cursor to one of the SC_CURSOR* values.
void wxStyledTextCtrl::SetCursor(int cursorType) {
SendMsg(2386, cursorType, 0);
}
-// Get cursor type
+// Get cursor type.
int wxStyledTextCtrl::GetCursor() {
return SendMsg(2387, 0, 0);
}
// Change the way control characters are displayed:
-// If symbol is < 32, keep the drawn way, else, use the given character
+// If symbol is < 32, keep the drawn way, else, use the given character.
void wxStyledTextCtrl::SetControlCharSymbol(int symbol) {
SendMsg(2388, symbol, 0);
}
-// Get the way control characters are displayed
+// Get the way control characters are displayed.
int wxStyledTextCtrl::GetControlCharSymbol() {
return SendMsg(2389, 0, 0);
}
-// Move to the previous change in capitalistion
+// Move to the previous change in capitalisation.
void wxStyledTextCtrl::WordPartLeft() {
SendMsg(2390, 0, 0);
}
-// Move to the previous change in capitalistion extending selection to new caret position.
+// Move to the previous change in capitalisation extending selection
+// to new caret position.
void wxStyledTextCtrl::WordPartLeftExtend() {
SendMsg(2391, 0, 0);
}
-// Move to the change next in capitalistion
+// Move to the change next in capitalisation.
void wxStyledTextCtrl::WordPartRight() {
SendMsg(2392, 0, 0);
}
-// Move to the next change in capitalistion extending selection to new caret position.
+// Move to the next change in capitalisation extending selection
+// to new caret position.
void wxStyledTextCtrl::WordPartRightExtend() {
SendMsg(2393, 0, 0);
}
-// Set the way the display area is determined when a particular line is to be moved to.
+// Set the way the display area is determined when a particular line
+// is to be moved to by Find, FindNext, GotoLine, etc.
void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop) {
SendMsg(2394, visiblePolicy, visibleSlop);
}
-// Delete back from the current position to the start of the line
+// Delete back from the current position to the start of the line.
void wxStyledTextCtrl::DelLineLeft() {
SendMsg(2395, 0, 0);
}
-// Delete forwards from the current position to the end of the line
+// Delete forwards from the current position to the end of the line.
void wxStyledTextCtrl::DelLineRight() {
SendMsg(2396, 0, 0);
}
-// Get and Set the xOffset (ie, horizonal scroll position)
+// Get and Set the xOffset (ie, horizonal scroll position).
void wxStyledTextCtrl::SetXOffset(int newOffset) {
SendMsg(2397, newOffset, 0);
}
return SendMsg(2398, 0, 0);
}
+// Set the way the caret is kept visible when going sideway.
+// The exclusion zone is given in pixels.
+void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop) {
+ SendMsg(2402, caretPolicy, caretSlop);
+}
+
+// Set the way the line the caret is on is kept visible.
+// The exclusion zone is given in lines.
+void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop) {
+ SendMsg(2403, caretPolicy, caretSlop);
+}
+
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord() {
SendMsg(3001, 0, 0);
evt.SetY(scn.y);
break;
+ case SCN_ZOOM:
+ evt.SetEventType(wxEVT_STC_ZOOM);
+ break;
+
default:
return;
}
DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
+DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
#ifdef LINK_LEXERS
// forces the linking of the lexer modules
-int wxForceScintillaLexers();
+int Scintilla_LinkLexers();
#endif
//----------------------------------------------------------------------
wxDefaultValidator, name)
{
#ifdef LINK_LEXERS
- wxForceScintillaLexers();
+ Scintilla_LinkLexers();
#endif
m_swx = new ScintillaWX(this);
m_stopWatch.Start();
evt.SetY(scn.y);
break;
+ case SCN_ZOOM:
+ evt.SetEventType(wxEVT_STC_ZOOM);
+ break;
+
default:
return;
}
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM, 1672)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_START_DRAG,
wxEVT_STC_DRAG_OVER,
wxEVT_STC_DO_DROP,
+ wxEVT_STC_ZOOM,
};
#endif
#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif
//----------------------------------------------------------------------
#define wxSTC_OPTIONAL_START 3000
#define wxSTC_LEXER_START 4000
-// Redoes the next action on the undo history
+// Redoes the next action on the undo history.
#define wxSTC_CMD_REDO 2011
// Select all the text in the document.
#define wxSTC_MARK_MINUS 7
#define wxSTC_MARK_PLUS 8
-// Shapes used for outlining column
+// Shapes used for outlining column.
#define wxSTC_MARK_VLINE 9
#define wxSTC_MARK_LCORNER 10
#define wxSTC_MARK_TCORNER 11
#define wxSTC_MARK_CIRCLEMINUS 20
#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
-// Invisible mark that only sets the line background color
+// Invisible mark that only sets the line background color.
#define wxSTC_MARK_BACKGROUND 22
#define wxSTC_MARK_CHARACTER 10000
-// Markers used for outlining column
+// Markers used for outlining column.
#define wxSTC_MARKNUM_FOLDEREND 25
#define wxSTC_MARKNUM_FOLDEROPENMID 26
#define wxSTC_MARKNUM_FOLDERMIDTAIL 27
// Delete the selection or if no selection, the character before the caret.
#define wxSTC_CMD_DELETEBACK 2326
-// If selection is empty or all on one line replace the selection with a tab
-// character.
+// 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.
#define wxSTC_CMD_TAB 2327
#define wxSTC_CMD_LINESCROLLUP 2343
// Delete the selection or if no selection, the character before the caret.
-// Will not delete the chraacter before at the start of a line.
+// Will not delete the character before at the start of a line.
#define wxSTC_CMD_DELETEBACKNOTLINE 2344
#define wxSTC_EDGE_NONE 0
#define wxSTC_EDGE_LINE 1
#define wxSTC_EDGE_BACKGROUND 2
+#define wxSTC_CURSORNORMAL -1
+#define wxSTC_CURSORWAIT 3
-// Show caret within N lines of edge when it's scrolled to view
-// If CARET_SLOP not set then centre caret on screen when it's
-// scrolled to view
-#define wxSTC_CARET_SLOP 0x01
+// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
+#define wxSTC_VISIBLE_SLOP 0x01
+#define wxSTC_VISIBLE_STRICT 0x04
-// Value not used
-#define wxSTC_CARET_CENTER 0x02
+// Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+// 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.
+#define wxSTC_CARET_SLOP 0x01
-// If CARET_SLOP also set then reposition whenever outside slop border
-// If CARET_SLOP not set then recentre even when visible
+// 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.
#define wxSTC_CARET_STRICT 0x04
-// If CARET_XEVEN set then both left and right margins are given equal weight
-// rather than favouring left following behaviour.
-#define wxSTC_CARET_XEVEN 0x08
+// 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.
+#define wxSTC_CARET_JUMPS 0x10
-// If CARET_XJUMPS set then when caret reaches the margin the display jumps
-// enough to leave the caret solidly within the display.
-#define wxSTC_CARET_XJUMPS 0x10
-#define wxSTC_CURSORNORMAL -1
-#define wxSTC_CURSORWAIT 3
-
-// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
-#define wxSTC_VISIBLE_SLOP 0x01
-#define wxSTC_VISIBLE_STRICT 0x04
+// 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.
+#define wxSTC_CARET_EVEN 0x08
// Notifications
-// Type of modification and the action which caused the modification
+// Type of modification and the action which caused the modification.
// These are defined as a bit mask to make it easy to specify which notifications are wanted.
// One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
#define wxSTC_MOD_INSERTTEXT 0x1
#define wxSTC_MOD_BEFOREDELETE 0x800
#define wxSTC_MODEVENTMASKALL 0xF77
-// Symbolic key codes and modifier flags
-// ASCII and other printable characters below 256
-// Extended keys above 300
+// Symbolic key codes and modifier flags.
+// ASCII and other printable characters below 256.
+// Extended keys above 300.
#define wxSTC_KEY_DOWN 300
#define wxSTC_KEY_UP 301
#define wxSTC_KEY_LEFT 302
#define wxSTC_LEX_PHP 30
#define wxSTC_LEX_BAAN 31
#define wxSTC_LEX_MATLAB 32
+#define wxSTC_LEX_SCRIPTOL 33
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
#define wxSTC_C_COMMENTDOCKEYWORD 17
#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
-// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
-#define wxSTC_B_DEFAULT 0
-#define wxSTC_B_COMMENT 1
-#define wxSTC_B_NUMBER 2
-#define wxSTC_B_KEYWORD 3
-#define wxSTC_B_STRING 4
-#define wxSTC_B_PREPROCESSOR 5
-#define wxSTC_B_OPERATOR 6
-#define wxSTC_B_IDENTIFIER 7
-#define wxSTC_B_DATE 8
-
// Lexical states for SCLEX_HTML, SCLEX_XML
#define wxSTC_H_DEFAULT 0
#define wxSTC_H_TAG 1
#define wxSTC_PL_STRING_QR 29
#define wxSTC_PL_STRING_QW 30
+// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
+#define wxSTC_B_DEFAULT 0
+#define wxSTC_B_COMMENT 1
+#define wxSTC_B_NUMBER 2
+#define wxSTC_B_KEYWORD 3
+#define wxSTC_B_STRING 4
+#define wxSTC_B_PREPROCESSOR 5
+#define wxSTC_B_OPERATOR 6
+#define wxSTC_B_IDENTIFIER 7
+#define wxSTC_B_DATE 8
+
+// Lexical states for SCLEX_PROPERTIES
+#define wxSTC_PROPS_DEFAULT 0
+#define wxSTC_PROPS_COMMENT 1
+#define wxSTC_PROPS_SECTION 2
+#define wxSTC_PROPS_ASSIGNMENT 3
+#define wxSTC_PROPS_DEFVAL 4
+
// Lexical states for SCLEX_LATEX
#define wxSTC_L_DEFAULT 0
#define wxSTC_L_COMMAND 1
#define wxSTC_ERR_PERL 6
#define wxSTC_ERR_NET 7
#define wxSTC_ERR_LUA 8
+#define wxSTC_ERR_CTAG 9
#define wxSTC_ERR_DIFF_CHANGED 10
#define wxSTC_ERR_DIFF_ADDITION 11
#define wxSTC_ERR_DIFF_DELETION 12
#define wxSTC_MAKE_TARGET 5
#define wxSTC_MAKE_IDEOL 9
-// Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+// Lexical states for SCLEX_DIFF
+#define wxSTC_DIFF_DEFAULT 0
+#define wxSTC_DIFF_COMMENT 1
+#define wxSTC_DIFF_COMMAND 2
+#define wxSTC_DIFF_HEADER 3
+#define wxSTC_DIFF_POSITION 4
+#define wxSTC_DIFF_DELETED 5
+#define wxSTC_DIFF_ADDED 6
+
+// Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
#define wxSTC_CONF_DEFAULT 0
#define wxSTC_CONF_COMMENT 1
#define wxSTC_CONF_NUMBER 2
#define wxSTC_CONF_IP 8
#define wxSTC_CONF_DIRECTIVE 9
-// Avenue
+// Lexical states for SCLEX_AVE, Avenue
#define wxSTC_AVE_DEFAULT 0
#define wxSTC_AVE_COMMENT 1
#define wxSTC_AVE_NUMBER 2
#define wxSTC_EIFFEL_IDENTIFIER 7
#define wxSTC_EIFFEL_STRINGEOL 8
-// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
+// Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
#define wxSTC_NNCRONTAB_DEFAULT 0
#define wxSTC_NNCRONTAB_COMMENT 1
#define wxSTC_NNCRONTAB_TASK 2
#define wxSTC_MATLAB_OPERATOR 6
#define wxSTC_MATLAB_IDENTIFIER 7
+// Lexical states for SCLEX_SCRIPTOL
+#define wxSTC_SCRIPTOL_DEFAULT 0
+#define wxSTC_SCRIPTOL_COMMENT 1
+#define wxSTC_SCRIPTOL_COMMENTLINE 2
+#define wxSTC_SCRIPTOL_COMMENTDOC 3
+#define wxSTC_SCRIPTOL_NUMBER 4
+#define wxSTC_SCRIPTOL_WORD 5
+#define wxSTC_SCRIPTOL_STRING 6
+#define wxSTC_SCRIPTOL_CHARACTER 7
+#define wxSTC_SCRIPTOL_UUID 8
+#define wxSTC_SCRIPTOL_PREPROCESSOR 9
+#define wxSTC_SCRIPTOL_OPERATOR 10
+#define wxSTC_SCRIPTOL_IDENTIFIER 11
+#define wxSTC_SCRIPTOL_STRINGEOL 12
+#define wxSTC_SCRIPTOL_VERBATIM 13
+#define wxSTC_SCRIPTOL_REGEX 14
+#define wxSTC_SCRIPTOL_COMMENTLINEDOC 15
+#define wxSTC_SCRIPTOL_WORD2 16
+#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORD 17
+#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
+#define wxSTC_SCRIPTOL_COMMENTBASIC 19
+
// END of generated section
//----------------------------------------------------------------------
// and regenerate
- // Add text to the document
+ // Add text to the document.
void AddText(const wxString& text);
- // Add array of cells to document
+ // Add array of cells to document.
void AddStyledText(const wxMemoryBuffer& data);
- // Insert string at a position
+ // Insert string at a position.
void InsertText(int pos, const wxString& text);
- // Delete all text in the document
+ // Delete all text in the document.
void ClearAll();
- // Set all style bytes to 0, remove all folding information
+ // Set all style bytes to 0, remove all folding information.
void ClearDocumentStyle();
- // The number of characters in the document
+ // The number of characters in the document.
int GetLength();
- // Returns the character byte at the position
+ // Returns the character byte at the position.
int GetCharAt(int pos);
- // Returns the position of the caret
+ // Returns the position of the caret.
int GetCurrentPos();
- // Returns the position of the opposite end of the selection to the caret
+ // Returns the position of the opposite end of the selection to the caret.
int GetAnchor();
- // Returns the style byte at the position
+ // Returns the style byte at the position.
int GetStyleAt(int pos);
- // Redoes the next action on the undo history
+ // Redoes the next action on the undo history.
void Redo();
// Choose between collecting actions into the undo
// Retrieve a buffer of cells.
wxMemoryBuffer GetStyledText(int startPos, int endPos);
- // Are there any redoable actions in the undo history.
+ // Are there any redoable actions in the undo history?
bool CanRedo();
- // Retrieve the line number at which a particular marker is located
+ // Retrieve the line number at which a particular marker is located.
int MarkerLineFromHandle(int handle);
// Delete a marker.
void SetEOLMode(int eolMode);
// 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.
+ // The styling mask can be used to protect some bits in each styling byte from modification.
void StartStyling(int pos, int mask);
// Change style from current styling position for length characters to a style
// and move the current styling position to after this newly styled segment.
void SetStyling(int length, int style);
- // Is drawing done first into a buffer or direct to the screen.
+ // Is drawing done first into a buffer or direct to the screen?
bool GetBufferedDraw();
// If drawing is buffered then each line of text is drawn into a bitmap buffer
// before drawing it to the screen to avoid flicker.
void SetBufferedDraw(bool buffered);
- // Change the visible size of a tab to be a multiple of the width of a space
- // character.
+ // Change the visible size of a tab to be a multiple of the width of a space character.
void SetTabWidth(int tabWidth);
// Retrieve the visible size of a tab.
// Add a marker to a line, returning an ID which can be used to find or delete the marker.
int MarkerAdd(int line, int markerNumber);
- // Delete a marker from a line
+ // Delete a marker from a line.
void MarkerDelete(int line, int markerNumber);
- // Delete all markers with a particular number from all lines
+ // Delete all markers with a particular number from all lines.
void MarkerDeleteAll(int markerNumber);
// Get a bit mask of all the markers set on a line.
// Get the time in milliseconds that the caret is on and off. 0 = steady on.
void SetCaretPeriod(int periodMilliseconds);
- // Set the set of characters making up words for when moving or selecting
- // by word.
+ // Set the set of characters making up words for when moving or selecting by word.
void SetWordChars(const wxString& characters);
// Start a sequence of actions that is undone and redone as a unit.
// Retrieve the foreground colour of an indicator.
wxColour IndicatorGetForeground(int indic);
- // 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
+ // 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.
void SetStyleBits(int bits);
// Is the background of the line containing the caret in a different colour?
bool GetCaretLineVisible();
- // Dsplay the background of the line containing the caret in a different colour.
+ // Display the background of the line containing the caret in a different colour.
void SetCaretLineVisible(bool show);
// Get the colour of the background of the line containing the caret.
// Is there an auto-completion list visible?
bool AutoCompActive();
- // Retrieve the position of the caret when the auto-completion list was
- // displayed.
+ // Retrieve the position of the caret when the auto-completion list was displayed.
int AutoCompPosStart();
// User has selected an item so remove the list and insert the selection.
// Define a set of character that when typed cancel the auto-completion list.
void AutoCompStops(const wxString& 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.
+ // Change the separator character in the string setting up an auto-completion list.
+ // Default is space but can be changed if items contain space.
void AutoCompSetSeparator(int separatorCharacter);
// Retrieve the auto-completion list separator character.
// Display a list of strings and send notification when user chooses one.
void UserListShow(int listType, const wxString& itemList);
- // Set whether or not autocompletion is hidden automatically when nothing matches
+ // Set whether or not autocompletion is hidden automatically when nothing matches.
void AutoCompSetAutoHide(bool autoHide);
- // Retrieve whether or not autocompletion is hidden automatically when nothing matches
+ // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
bool AutoCompGetAutoHide();
- // Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+ // Set whether or not autocompletion deletes any word characters
+ // after the inserted text upon completion.
void AutoCompSetDropRestOfWord(bool dropRestOfWord);
- // Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+ // Retrieve whether or not autocompletion deletes any word characters
+ // after the inserted text upon completion.
bool AutoCompGetDropRestOfWord();
// Set the number of spaces used for one level of indentation.
// Find some text in the document.
int FindText(int minPos, int maxPos, const wxString& text, int flags=0);
- // On Windows will draw the document into a display context such as a printer.
+ // On Windows, will draw the document into a display context such as a printer.
int FormatRange(bool doDraw,
int startPos,
int endPos,
// Will a paste succeed?
bool CanPaste();
- // Are there any undoable actions in the undo history.
+ // Are there any undoable actions in the undo history?
bool CanUndo();
// Delete the undo history.
// Retrieve the number of characters in the document.
int GetTextLength();
- // Set to overtype (true) or insert mode
+ // Set to overtype (true) or insert mode.
void SetOvertype(bool overtype);
// Returns true if overtype mode is active otherwise false is returned.
bool GetOvertype();
- // Set the width of the insert mode caret
+ // Set the width of the insert mode caret.
void SetCaretWidth(int pixelWidth);
- // Returns the width of the insert mode caret
+ // Returns the width of the insert mode caret.
int GetCaretWidth();
// Sets the position that starts the target which is used for updating the
// Returns length of range or -1 for failure in which case target is not moved.
int SearchInTarget(const wxString& text);
- // Set the search flags used by SearchInTarget
+ // Set the search flags used by SearchInTarget.
void SetSearchFlags(int flags);
- // Get the search flags used by SearchInTarget
+ // Get the search flags used by SearchInTarget.
int GetSearchFlags();
// Show a call tip containing a definition near position pos.
// Ensure a particular line is visible by expanding any header line hiding it.
void EnsureVisible(int line);
- // Set some debugging options for folding
+ // Set some debugging options for folding.
void SetFoldFlags(int flags);
// Ensure a particular line is visible by expanding any header line hiding it.
// Use the currently set visibility policy to determine which range to display.
void EnsureVisibleEnforcePolicy(int line);
- // Sets whether a tab pressed when caret is within indentation indents
+ // Sets whether a tab pressed when caret is within indentation indents.
void SetTabIndents(bool tabIndents);
// Does a tab pressed when caret is within indentation indent?
bool GetTabIndents();
- // Sets whether a backspace pressed when caret is within indentation unindents
+ // Sets whether a backspace pressed when caret is within indentation unindents.
void SetBackSpaceUnIndents(bool bsUnIndents);
// Does a backspace pressed when caret is within indentation unindent?
bool GetBackSpaceUnIndents();
- // Sets the time the mouse must sit still to generate a mouse dwell event
+ // Sets the time the mouse must sit still to generate a mouse dwell event.
void SetMouseDwellTime(int periodMilliseconds);
- // Retrieve the time the mouse must sit still to generate a mouse dwell event
+ // Retrieve the time the mouse must sit still to generate a mouse dwell event.
int GetMouseDwellTime();
- // Get position of start of word
+ // Get position of start of word.
int WordStartPosition(int pos, bool onlyWordCharacters);
- // Get position of end of word
+ // Get position of end of word.
int WordEndPosition(int pos, bool onlyWordCharacters);
- // Sets whether text is word wrapped
+ // Sets whether text is word wrapped.
void SetWrapMode(int mode);
- // Retrieve whether text is word wrapped
+ // Retrieve whether text is word wrapped.
int GetWrapMode();
- // Sets the degree of caching of layout information
+ // Sets the degree of caching of layout information.
void SetLayoutCache(int mode);
- // Retrieve the degree of caching of layout information
+ // Retrieve the degree of caching of layout information.
int GetLayoutCache();
- // Move the caret inside current view if it's not there already
+ // Sets the document width assumed for scrolling.
+ void SetScrollWidth(int pixelWidth);
+
+ // Retrieve the document width assumed for scrolling.
+ int GetScrollWidth();
+
+ // Measure the pixel width of some text in a particular style.
+ // Nul terminated text argument.
+ // Does not handle tab or control characters.
+ int TextWidth(int style, const wxString& text);
+
+ // Sets the scroll range so that maximum scroll position has
+ // the last line at the bottom of the view (default).
+ // Setting this to false allows scrolling one page below the last line.
+ void SetEndAtLastLine(bool endAtLastLine);
+
+ // Retrieve whether the maximum scroll position has the last
+ // line at the bottom of the view.
+ int GetEndAtLastLine();
+
+ // Retrieve the height of a particular line of text in pixels.
+ int TextHeight(int line);
+
+ // Move the caret inside current view if it's not there already.
void MoveCaretInsideView();
- // How many characters are on a line, not including end of line characters.
+ // How many characters are on a line, not including end of line characters?
int LineLength(int line);
// Highlight the characters at two positions.
// Find the position of a matching brace or INVALID_POSITION if no match.
int BraceMatch(int pos);
- // Are the end of line characters visible.
+ // Are the end of line characters visible?
bool GetViewEOL();
- // Make the end of line characters visible or invisible
+ // Make the end of line characters visible or invisible.
void SetViewEOL(bool visible);
// Retrieve a pointer to the document object.
// Does not ensure the selection is visible.
int SearchPrev(int flags, const wxString& text);
- // Set the way the line the caret is on is kept visible.
- void SetCaretPolicy(int caretPolicy, int caretSlop);
-
// Retrieves the number of lines completely visible.
int LinesOnScreen();
// the wrong mouse button.
void UsePopUp(bool allowPopUp);
- // Is the selection a rectangular. The alternative is the more common stream selection.
+ // Is the selection rectangular? The alternative is the more common stream selection.
bool SelectionIsRectangle();
// Set the zoom level. This number of points is added to the size of all fonts.
// Get which document modification events are sent to the container.
int GetModEventMask();
- // Change internal focus flag
+ // Change internal focus flag.
void SetSTCFocus(bool focus);
- // Get internal focus flag
+ // Get internal focus flag.
bool GetSTCFocus();
- // Change error status - 0 = OK
+ // Change error status - 0 = OK.
void SetStatus(int statusCode);
- // Get error status
+ // Get error status.
int GetStatus();
- // Set whether the mouse is captured when its button is pressed
+ // Set whether the mouse is captured when its button is pressed.
void SetMouseDownCaptures(bool captures);
- // Get whether mouse gets captured
+ // Get whether mouse gets captured.
bool GetMouseDownCaptures();
- // Sets the cursor to one of the SC_CURSOR* values
+ // Sets the cursor to one of the SC_CURSOR* values.
void SetCursor(int cursorType);
- // Get cursor type
+ // Get cursor type.
int GetCursor();
// Change the way control characters are displayed:
- // If symbol is < 32, keep the drawn way, else, use the given character
+ // If symbol is < 32, keep the drawn way, else, use the given character.
void SetControlCharSymbol(int symbol);
- // Get the way control characters are displayed
+ // Get the way control characters are displayed.
int GetControlCharSymbol();
- // Move to the previous change in capitalistion
+ // Move to the previous change in capitalisation.
void WordPartLeft();
- // Move to the previous change in capitalistion extending selection to new caret position.
+ // Move to the previous change in capitalisation extending selection
+ // to new caret position.
void WordPartLeftExtend();
- // Move to the change next in capitalistion
+ // Move to the change next in capitalisation.
void WordPartRight();
- // Move to the next change in capitalistion extending selection to new caret position.
+ // Move to the next change in capitalisation extending selection
+ // to new caret position.
void WordPartRightExtend();
- // Set the way the display area is determined when a particular line is to be moved to.
+ // Set the way the display area is determined when a particular line
+ // is to be moved to by Find, FindNext, GotoLine, etc.
void SetVisiblePolicy(int visiblePolicy, int visibleSlop);
- // Delete back from the current position to the start of the line
+ // Delete back from the current position to the start of the line.
void DelLineLeft();
- // Delete forwards from the current position to the end of the line
+ // Delete forwards from the current position to the end of the line.
void DelLineRight();
- // Get and Set the xOffset (ie, horizonal scroll position)
+ // Get and Set the xOffset (ie, horizonal scroll position).
void SetXOffset(int newOffset);
int GetXOffset();
+ // Set the way the caret is kept visible when going sideway.
+ // The exclusion zone is given in pixels.
+ void SetXCaretPolicy(int caretPolicy, int caretSlop);
+
+ // Set the way the line the caret is on is kept visible.
+ // The exclusion zone is given in lines.
+ void SetYCaretPolicy(int caretPolicy, int caretSlop);
+
// Start notifying the container of all key presses and commands.
void StartRecord();
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM, 1672)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_START_DRAG,
wxEVT_STC_DRAG_OVER,
wxEVT_STC_DO_DROP,
+ wxEVT_STC_ZOOM,
};
#endif
#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif
//----------------------------------------------------------------------
return stc->SendMsg(msg, wParam, lParam);
}
+long Platform::SendScintillaPointer(WindowID w,
+ unsigned int msg,
+ unsigned long wParam,
+ void *lParam) {
+
+ wxStyledTextCtrl* stc = (wxStyledTextCtrl*)w;
+ return stc->SendMsg(msg, wParam, (long)lParam);
+}
+
// These are utility functions not really tied to a platform
#include "wx/stc/stc.h"
#include "PlatWX.h"
-
-//----------------------------------------------------------------------
-
-const int H_SCROLL_MAX = 4000;
-const int H_SCROLL_STEP = 20;
-const int H_SCROLL_PAGE = 200;
-
//----------------------------------------------------------------------
// Helper classes
}
}
+const int H_SCROLL_STEP = 20;
bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
bool modified = false;
+ // Check the vertical scrollbar
if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar
int sbMax = stc->GetScrollRange(wxVERTICAL);
int sbThumb = stc->GetScrollThumb(wxVERTICAL);
}
- if (horizontalScrollBarVisible) {
- if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar
- int sbMax = stc->GetScrollRange(wxHORIZONTAL);
- int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
- if ((sbMax != H_SCROLL_MAX) || (sbThumb != H_SCROLL_STEP)) {
- stc->SetScrollbar(wxHORIZONTAL, 0, H_SCROLL_STEP, H_SCROLL_MAX);
- modified = true;
+ // Check the horizontal scrollbar
+ PRectangle rcText = GetTextRectangle();
+ int horizEnd = scrollWidth;
+ if (horizEnd < 0)
+ horizEnd = 0;
+ if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
+ horizEnd = 0;
+ int pageWidth = rcText.Width();
+
+ if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar
+ int sbMax = stc->GetScrollRange(wxHORIZONTAL);
+ int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
+ int sbPos = stc->GetScrollPos(wxHORIZONTAL);
+ if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
+ stc->SetScrollbar(wxHORIZONTAL, 0, pageWidth, horizEnd);
+ modified = true;
+ if (scrollWidth < pageWidth) {
+ HorizontalScrollTo(0);
}
}
- else { // otherwise use the one that's been given to us
- int sbMax = stc->m_hScrollBar->GetRange();
- int sbPage = stc->m_hScrollBar->GetPageSize();
- if ((sbMax != H_SCROLL_MAX) || (sbPage != H_SCROLL_STEP)) {
- stc->m_hScrollBar->SetScrollbar(0, H_SCROLL_STEP, H_SCROLL_MAX, H_SCROLL_STEP);
- modified = true;
+ }
+ else { // otherwise use the one that's been given to us
+ int sbMax = stc->m_hScrollBar->GetRange();
+ int sbThumb = stc->m_hScrollBar->GetPageSize();
+ int sbPos = stc->m_hScrollBar->GetThumbPosition();
+ if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
+ stc->m_hScrollBar->SetScrollbar(0, pageWidth, horizEnd, pageWidth);
+ modified = true;
+ if (scrollWidth < pageWidth) {
+ HorizontalScrollTo(0);
}
}
}
+
return modified;
}
void ScintillaWX::DoHScroll(int type, int pos) {
int xPos = xOffset;
+ PRectangle rcText = GetTextRectangle();
+ int pageWidth = rcText.Width() * 2 / 3;
if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
xPos -= H_SCROLL_STEP;
else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
xPos += H_SCROLL_STEP;
else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
- xPos -= H_SCROLL_PAGE;
- else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN)
- xPos += H_SCROLL_PAGE;
+ xPos -= pageWidth;
+ else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN) {
+ xPos += pageWidth;
+ if (xPos > scrollWidth - rcText.Width()) {
+ xPos = scrollWidth - rcText.Width();
+ }
+ }
else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
xPos = 0;
else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
- xPos = H_SCROLL_MAX;
+ xPos = scrollWidth;
else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
xPos = pos;
elif op == 'evt ':
pass
+ elif op == 'enu ':
+ pass
+
+ elif op == 'lex ':
+ pass
+
else:
print '***** Unknown line type: ', line
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
-The current version of the Scintilla code is 1.45
+The current version of the Scintilla code is 1.47
}
void SetCodePage(int codePage_) { codePage = codePage_; }
+ virtual bool Match(int pos, const char *s)=0;
virtual char StyleAt(int position)=0;
virtual int GetLine(int position)=0;
virtual int LineStart(int line)=0;
int language;
LexerFunction fnLexer;
LexerFunction fnFolder;
-
+ const char * const * wordListDescriptions;
+
static const LexerModule *base;
static int nextLanguage;
public:
const char *languageName;
LexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_=0, LexerFunction fnFolder_=0);
+ const char *languageName_=0, LexerFunction fnFolder_=0,
+ const char * const wordListDescriptions_[] = NULL);
int GetLanguage() const { return language; }
+
+ // -1 is returned if no WordList information is available
+ int GetNumWordLists() const;
+ const char *GetWordListDescription(int index) const;
+
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const;
virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
(rc.top >= top) && (rc.bottom <= bottom);
}
bool Intersects(PRectangle other) {
- return (right >= other.left) && (left <= other.right) &&
- (bottom >= other.top) && (top <= other.bottom);
+ return (right > other.left) && (left < other.right) &&
+ (bottom > other.top) && (top < other.bottom);
}
int Width() { return right - left; }
int Height() { return bottom - top; }
static bool IsKeyDown(int key);
static long SendScintilla(
WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
+ static long SendScintillaPointer(
+ WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0);
static bool IsDBCSLeadByte(int codePage, char ch);
// These are utility functions not really tied to a platform
bool ignoreCase=false, char otherSeparator='\0');
};
-inline bool nonFuncChar(char ch) {
- return strchr("\t\n\r !\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", ch) != NULL;
-}
-
inline bool IsAlphabetic(unsigned int ch) {
return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'));
}
// These functions are implemented because each platform calls them something different.
int CompareCaseInsensitive(const char *a, const char *b);
-int CompareNCaseInsensitive(const char *a, const char *b, int len);
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
bool EqualCaseInsensitive(const char *a, const char *b);
// Define another string class.
*
* Hold the length of the string for quick operations,
* can have a buffer bigger than the string to avoid too many memory allocations and copies.
- * May have embedded zeroes as a result of @a substitute, but rely too heavily on C string
- * functions to allow reliable manipulations of these strings.
+ * May have embedded zeroes as a result of @a substitute, but relies too heavily on C string
+ * functions to allow reliable manipulations of these strings, other than simple appends, etc.
**/
class SString {
public:
/** Type of string lengths (sizes) and positions (indexes). */
- typedef unsigned int lenpos_t;
+ typedef size_t lenpos_t;
/** Out of bounds value indicating that the string argument should be measured. */
enum { measure_length=0xffffffffU};
}
if (sSize > 0 && sSize_ <= sSize) { // Does not allocate new buffer if the current is big enough
if (s && sSize_) {
- strncpy(s, sOther, sSize_);
+ memcpy(s, sOther, sSize_);
}
s[sSize_] = '\0';
sLen = sSize_;
sSize = sLen = (s) ? strlen(s) : 0;
}
SString(const char *s_, lenpos_t first, lenpos_t last) : sizeGrowth(sizeGrowthDefault) {
+ // note: expects the "last" argument to point one beyond the range end (a la STL iterators)
s = StringAllocate(s_ + first, last - first);
sSize = sLen = (s) ? strlen(s) : 0;
}
else
return '\0';
}
+ SString substr(lenpos_t subPos, lenpos_t subLen=measure_length) const {
+ if (subPos >= sLen) {
+ return SString(); // return a null string if start index is out of bounds
+ }
+ if ((subLen == measure_length) || (subPos + subLen > sLen)) {
+ subLen = sLen - subPos; // can't substr past end of source string
+ }
+ return SString(s, subPos, subPos + subLen);
+ }
+ SString &lowercase(lenpos_t subPos = 0, lenpos_t subLen=measure_length) {
+ if ((subLen == measure_length) || (subPos + subLen > sLen)) {
+ subLen = sLen - subPos; // don't apply past end of string
+ }
+ for (lenpos_t i = subPos; i < subPos + subLen; i++) {
+ if (s[i] < 'A' || s[i] > 'Z')
+ continue;
+ else
+ s[i] = static_cast<char>(s[i] - 'A' + 'a');
+ }
+ return *this;
+ }
SString &append(const char *sOther, lenpos_t sLenOther=measure_length, char sep = '\0') {
if (!sOther) {
return *this;
s[sLen] = sep;
sLen++;
}
- strncpy(&s[sLen], sOther, sLenOther);
+ memcpy(&s[sLen], sOther, sLenOther);
sLen += sLenOther;
s[sLen] = '\0';
}
sLen -= len;
}
}
+ SString &change(lenpos_t pos, char ch) {
+ if (pos >= sLen) { // character changed must be in string bounds
+ return *this;
+ }
+ *(s + pos) = ch;
+ return *this;
+ }
/** Read an integral numeric value from the string. */
int value() const {
if (s)
else
return 0;
}
- int search(const char *sFind, lenpos_t start=0) {
+ int search(const char *sFind, lenpos_t start=0) const {
if (start < sLen) {
const char *sFound = strstr(s + start, sFind);
if (sFound) {
}
char *sNew = new char[len + 1];
if (sNew) {
- strncpy(sNew, s, len);
+ memcpy(sNew, s, len);
sNew[len] = '\0';
}
return sNew;
#define SCLEX_PHP 30
#define SCLEX_BAAN 31
#define SCLEX_MATLAB 32
+#define SCLEX_SCRIPTOL 33
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_C_WORD2 16
#define SCE_C_COMMENTDOCKEYWORD 17
#define SCE_C_COMMENTDOCKEYWORDERROR 18
-#define SCE_B_DEFAULT 0
-#define SCE_B_COMMENT 1
-#define SCE_B_NUMBER 2
-#define SCE_B_KEYWORD 3
-#define SCE_B_STRING 4
-#define SCE_B_PREPROCESSOR 5
-#define SCE_B_OPERATOR 6
-#define SCE_B_IDENTIFIER 7
-#define SCE_B_DATE 8
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
#define SCE_PL_STRING_QX 28
#define SCE_PL_STRING_QR 29
#define SCE_PL_STRING_QW 30
+#define SCE_B_DEFAULT 0
+#define SCE_B_COMMENT 1
+#define SCE_B_NUMBER 2
+#define SCE_B_KEYWORD 3
+#define SCE_B_STRING 4
+#define SCE_B_PREPROCESSOR 5
+#define SCE_B_OPERATOR 6
+#define SCE_B_IDENTIFIER 7
+#define SCE_B_DATE 8
+#define SCE_PROPS_DEFAULT 0
+#define SCE_PROPS_COMMENT 1
+#define SCE_PROPS_SECTION 2
+#define SCE_PROPS_ASSIGNMENT 3
+#define SCE_PROPS_DEFVAL 4
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
#define SCE_ERR_PERL 6
#define SCE_ERR_NET 7
#define SCE_ERR_LUA 8
+#define SCE_ERR_CTAG 9
#define SCE_ERR_DIFF_CHANGED 10
#define SCE_ERR_DIFF_ADDITION 11
#define SCE_ERR_DIFF_DELETION 12
#define SCE_MAKE_OPERATOR 4
#define SCE_MAKE_TARGET 5
#define SCE_MAKE_IDEOL 9
+#define SCE_DIFF_DEFAULT 0
+#define SCE_DIFF_COMMENT 1
+#define SCE_DIFF_COMMAND 2
+#define SCE_DIFF_HEADER 3
+#define SCE_DIFF_POSITION 4
+#define SCE_DIFF_DELETED 5
+#define SCE_DIFF_ADDED 6
#define SCE_CONF_DEFAULT 0
#define SCE_CONF_COMMENT 1
#define SCE_CONF_NUMBER 2
#define SCE_MATLAB_STRING 5
#define SCE_MATLAB_OPERATOR 6
#define SCE_MATLAB_IDENTIFIER 7
+#define SCE_SCRIPTOL_DEFAULT 0
+#define SCE_SCRIPTOL_COMMENT 1
+#define SCE_SCRIPTOL_COMMENTLINE 2
+#define SCE_SCRIPTOL_COMMENTDOC 3
+#define SCE_SCRIPTOL_NUMBER 4
+#define SCE_SCRIPTOL_WORD 5
+#define SCE_SCRIPTOL_STRING 6
+#define SCE_SCRIPTOL_CHARACTER 7
+#define SCE_SCRIPTOL_UUID 8
+#define SCE_SCRIPTOL_PREPROCESSOR 9
+#define SCE_SCRIPTOL_OPERATOR 10
+#define SCE_SCRIPTOL_IDENTIFIER 11
+#define SCE_SCRIPTOL_STRINGEOL 12
+#define SCE_SCRIPTOL_VERBATIM 13
+#define SCE_SCRIPTOL_REGEX 14
+#define SCE_SCRIPTOL_COMMENTLINEDOC 15
+#define SCE_SCRIPTOL_WORD2 16
+#define SCE_SCRIPTOL_COMMENTDOCKEYWORD 17
+#define SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
+#define SCE_SCRIPTOL_COMMENTBASIC 19
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#endif
// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
// May need to be changed for 64 bit platforms.
+#if _MSC_VER >= 1300
+#include <BaseTsd.h>
+#endif
+#ifdef MAXULONG_PTR
+typedef ULONG_PTR uptr_t;
+typedef LONG_PTR sptr_t;
+#else
typedef unsigned long uptr_t;
typedef long sptr_t;
+#endif
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
#define SC_CACHE_DOCUMENT 3
#define SCI_SETLAYOUTCACHE 2272
#define SCI_GETLAYOUTCACHE 2273
+#define SCI_SETSCROLLWIDTH 2274
+#define SCI_GETSCROLLWIDTH 2275
+#define SCI_TEXTWIDTH 2276
+#define SCI_SETENDATLASTLINE 2277
+#define SCI_GETENDATLASTLINE 2278
+#define SCI_TEXTHEIGHT 2279
#define SCI_LINEDOWN 2300
#define SCI_LINEDOWNEXTEND 2301
#define SCI_LINEUP 2302
#define SCI_SEARCHANCHOR 2366
#define SCI_SEARCHNEXT 2367
#define SCI_SEARCHPREV 2368
-#define CARET_SLOP 0x01
-#define CARET_CENTER 0x02
-#define CARET_STRICT 0x04
-#define CARET_XEVEN 0x08
-#define CARET_XJUMPS 0x10
-#define SCI_SETCARETPOLICY 2369
#define SCI_LINESONSCREEN 2370
#define SCI_USEPOPUP 2371
#define SCI_SELECTIONISRECTANGLE 2372
#define SCI_SETXOFFSET 2397
#define SCI_GETXOFFSET 2398
#define SCI_GRABFOCUS 2400
+#define CARET_SLOP 0x01
+#define CARET_STRICT 0x04
+#define CARET_JUMPS 0x10
+#define CARET_EVEN 0x08
+#define SCI_SETXCARETPOLICY 2402
+#define SCI_SETYCARETPOLICY 2403
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
#define SCN_URIDROPPED 2015
#define SCN_DWELLSTART 2016
#define SCN_DWELLEND 2017
+#define SCN_ZOOM 2018
//--Autogenerated -- end of section automatically generated from Scintilla.iface
// These structures are defined to be exactly the same shape as the Win32
#ifdef INCLUDE_DEPRECATED_FEATURES
+#define SCI_SETCARETPOLICY 2369
+#define CARET_CENTER 0x02
+#define CARET_XEVEN 0x08
+#define CARET_XJUMPS 0x10
+
#define SCN_POSCHANGED 2012
#define SCN_CHECKBRACE 2007
## set -> a property set function
## val -> definition of a constant
## evt -> an event
+## enu -> associate an enumeration with a set of vals with a prefix
+## lex -> associate a lexer with the lexical classes it produces
+##
## All other feature names should be ignored. They may be defined in the future.
## A property may have a set function, a get function or both. Each will have
## "Get" or "Set" in their names and the corresponding name will have the obvious switch.
## The feature numbers are stable so features will not be renumbered.
## Features may be removed but they will go through a period of deprecation
## before removal which is signalled by moving them into the Deprecated category.
+##
+## enu has the syntax enu<ws><enumeration>=<prefix>[<ws><prefix>]* where all the val
+## features in this file starting with a given <prefix> are considered part of the
+## enumeration.
+##
+## lex has the syntax lex<ws><name>=<lexerVal><ws><prefix>[<ws><prefix>]*
+## where name is a reasonably capitalised (Python, XML) identifier or UI name,
+## lexerVal is the val used to specify the lexer, and the list of prefixes is similar
+## to enu. The name may not be the same as that used within the lexer so the lexerVal
+## should be used to tie these entities together.
## Types:
## void
val SCI_OPTIONAL_START=3000
val SCI_LEXER_START=4000
-# Add text to the document
+# Add text to the document.
fun void AddText=2001(int length, string text)
-# Add array of cells to document
+# Add array of cells to document.
fun void AddStyledText=2002(int length, cells c)
-# Insert string at a position
+# Insert string at a position.
fun void InsertText=2003(position pos, string text)
-# Delete all text in the document
+# Delete all text in the document.
fun void ClearAll=2004(,)
-# Set all style bytes to 0, remove all folding information
+# Set all style bytes to 0, remove all folding information.
fun void ClearDocumentStyle=2005(,)
-# The number of characters in the document
+# The number of characters in the document.
get int GetLength=2006(,)
-# Returns the character byte at the position
+# Returns the character byte at the position.
get int GetCharAt=2007(position pos,)
-# Returns the position of the caret
+# Returns the position of the caret.
get position GetCurrentPos=2008(,)
-# Returns the position of the opposite end of the selection to the caret
+# Returns the position of the opposite end of the selection to the caret.
get position GetAnchor=2009(,)
-# Returns the style byte at the position
+# Returns the style byte at the position.
get int GetStyleAt=2010(position pos,)
-# Redoes the next action on the undo history
+# Redoes the next action on the undo history.
fun void Redo=2011(,)
# Choose between collecting actions into the undo
# Returns the number of bytes in the buffer not including terminating nulls.
fun int GetStyledText=2015(, textrange tr)
-# Are there any redoable actions in the undo history.
+# Are there any redoable actions in the undo history?
fun bool CanRedo=2016(,)
-# Retrieve the line number at which a particular marker is located
+# Retrieve the line number at which a particular marker is located.
fun int MarkerLineFromHandle=2017(int handle,)
# Delete a marker.
# Is undo history being collected?
get bool GetUndoCollection=2019(,)
+enu WhiteSpace=SCWS_
val SCWS_INVISIBLE=0
val SCWS_VISIBLEALWAYS=1
val SCWS_VISIBLEAFTERINDENT=2
# Retrieve the position of the last correctly styled character.
get position GetEndStyled=2028(,)
+enu EndOfLine=SC_EOL_
val SC_EOL_CRLF=0
val SC_EOL_CR=1
val SC_EOL_LF=2
set void SetEOLMode=2031(int eolMode,)
# 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.
+# The styling mask can be used to protect some bits in each styling byte from modification.
fun void StartStyling=2032(position pos, int mask)
# Change style from current styling position for length characters to a style
# and move the current styling position to after this newly styled segment.
fun void SetStyling=2033(int length, int style)
-# Is drawing done first into a buffer or direct to the screen.
+# Is drawing done first into a buffer or direct to the screen?
get bool GetBufferedDraw=2034(,)
# If drawing is buffered then each line of text is drawn into a bitmap buffer
# before drawing it to the screen to avoid flicker.
set void SetBufferedDraw=2035(bool buffered,)
-# Change the visible size of a tab to be a multiple of the width of a space
-# character.
+# Change the visible size of a tab to be a multiple of the width of a space character.
set void SetTabWidth=2036(int tabWidth,)
# Retrieve the visible size of a tab.
# The SC_CP_UTF8 value can be used to enter Unicode mode.
set void SetCodePage=2037(int codePage,)
-# In palette mode, Scintilla uses the environments palette calls to display
+# In palette mode, Scintilla uses the environment's palette calls to display
# more colours. This may lead to ugly displays.
set void SetUsePalette=2039(bool usePalette,)
+enu MarkerSymbol=SC_MARK_
val MARKER_MAX=31
val SC_MARK_CIRCLE=0
val SC_MARK_ROUNDRECT=1
val SC_MARK_MINUS=7
val SC_MARK_PLUS=8
-# Shapes used for outlining column
+# Shapes used for outlining column.
val SC_MARK_VLINE=9
val SC_MARK_LCORNER=10
val SC_MARK_TCORNER=11
val SC_MARK_CIRCLEMINUS=20
val SC_MARK_CIRCLEMINUSCONNECTED=21
-# Invisible mark that only sets the line background color
+# Invisible mark that only sets the line background color.
val SC_MARK_BACKGROUND=22
val SC_MARK_CHARACTER=10000
-# Markers used for outlining column
+enu MarkerOutline=SC_MARKNUM_
+# Markers used for outlining column.
val SC_MARKNUM_FOLDEREND=25
val SC_MARKNUM_FOLDEROPENMID=26
val SC_MARKNUM_FOLDERMIDTAIL=27
# Add a marker to a line, returning an ID which can be used to find or delete the marker.
fun int MarkerAdd=2043(int line, int markerNumber)
-# Delete a marker from a line
+# Delete a marker from a line.
fun void MarkerDelete=2044(int line, int markerNumber)
-# Delete all markers with a particular number from all lines
+# Delete all markers with a particular number from all lines.
fun void MarkerDeleteAll=2045(int markerNumber,)
# Get a bit mask of all the markers set on a line.
# Find the previous line before lineStart that includes a marker in mask.
fun int MarkerPrevious=2048(int lineStart, int markerMask)
+enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
# 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.
+enu StylesCommon=STYLE_
val STYLE_DEFAULT=32
val STYLE_LINENUMBER=33
val STYLE_BRACELIGHT=34
# Character set identifiers are used in StyleSetCharacterSet.
# The values are the same as the Windows *_CHARSET values.
+enu CharacterSet=SC_CHARSET_
val SC_CHARSET_ANSI=0
val SC_CHARSET_DEFAULT=1
val SC_CHARSET_BALTIC=186
# Set a style to be underlined or not.
set void StyleSetUnderline=2059(int style, bool underline)
+enu CaseVisible=SC_CASE_
val SC_CASE_MIXED=0
val SC_CASE_UPPER=1
val SC_CASE_LOWER=2
# Get the time in milliseconds that the caret is on and off. 0 = steady on.
set void SetCaretPeriod=2076(int periodMilliseconds,)
-# Set the set of characters making up words for when moving or selecting
-# by word.
+# Set the set of characters making up words for when moving or selecting by word.
set void SetWordChars=2077(, string characters)
# Start a sequence of actions that is undone and redone as a unit.
# End a sequence of actions that is undone and redone as a unit.
fun void EndUndoAction=2079(,)
+enu IndicatorStyle=INDIC_
val INDIC_MAX=7
val INDIC_PLAIN=0
val INDIC_SQUIGGLE=1
# Retrieve the foreground colour of an indicator.
get colour IndicGetFore=2083(int indic,)
-# 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
+# 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.
set void SetStyleBits=2090(int bits,)
# Is the background of the line containing the caret in a different colour?
get bool GetCaretLineVisible=2095(,)
-# Dsplay the background of the line containing the caret in a different colour.
+# Display the background of the line containing the caret in a different colour.
set void SetCaretLineVisible=2096(bool show,)
# Get the colour of the background of the line containing the caret.
# Is there an auto-completion list visible?
fun bool AutoCActive=2102(,)
-# Retrieve the position of the caret when the auto-completion list was
-# displayed.
+# Retrieve the position of the caret when the auto-completion list was displayed.
fun position AutoCPosStart=2103(,)
# User has selected an item so remove the list and insert the selection.
# Define a set of character that when typed cancel the auto-completion list.
fun void AutoCStops=2105(, string 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.
+# Change the separator character in the string setting up an auto-completion list.
+# Default is space but can be changed if items contain space.
set void AutoCSetSeparator=2106(int separatorCharacter,)
# Retrieve the auto-completion list separator character.
# Display a list of strings and send notification when user chooses one.
fun void UserListShow=2117(int listType, string itemList)
-# Set whether or not autocompletion is hidden automatically when nothing matches
+# Set whether or not autocompletion is hidden automatically when nothing matches.
set void AutoCSetAutoHide=2118(bool autoHide,)
-# Retrieve whether or not autocompletion is hidden automatically when nothing matches
+# Retrieve whether or not autocompletion is hidden automatically when nothing matches.
get bool AutoCGetAutoHide=2119(,)
-# Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+# Set whether or not autocompletion deletes any word characters
+# after the inserted text upon completion.
set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,)
-# Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+# Retrieve whether or not autocompletion deletes any word characters
+# after the inserted text upon completion.
get bool AutoCGetDropRestOfWord=2271(,)
# Set the number of spaces used for one level of indentation.
# Returns the print magnification.
get int GetPrintMagnification=2147(,)
+enu PrintOption=SC_PRINT_
# PrintColourMode - use same colours as screen.
val SC_PRINT_NORMAL=0
# PrintColourMode - invert the light value of each style for printing.
# Returns the print colour mode.
get int GetPrintColourMode=2149(,)
+enu FindOption=SCFIND_
val SCFIND_WHOLEWORD=2
val SCFIND_MATCHCASE=4
val SCFIND_WORDSTART=0x00100000
# Find some text in the document.
fun position FindText=2150(int flags, findtext ft)
-# On Windows will draw the document into a display context such as a printer.
+# On Windows, will draw the document into a display context such as a printer.
fun void FormatRange=2151(bool draw, formatrange fr)
# Retrieve the line at the top of the display.
# Will a paste succeed?
fun bool CanPaste=2173(,)
-# Are there any undoable actions in the undo history.
+# Are there any undoable actions in the undo history?
fun bool CanUndo=2174(,)
# Delete the undo history.
# the function returned by GetDirectFunction.
get int GetDirectPointer=2185(,)
-# Set to overtype (true) or insert mode
+# Set to overtype (true) or insert mode.
set void SetOvertype=2186(bool overtype,)
# Returns true if overtype mode is active otherwise false is returned.
get bool GetOvertype=2187(,)
-# Set the width of the insert mode caret
+# Set the width of the insert mode caret.
set void SetCaretWidth=2188(int pixelWidth,)
-# Returns the width of the insert mode caret
+# Returns the width of the insert mode caret.
get int GetCaretWidth=2189(,)
# Sets the position that starts the target which is used for updating the
# Returns length of range or -1 for failure in which case target is not moved.
fun int SearchInTarget=2197(int length, string text)
-# Set the search flags used by SearchInTarget
+# Set the search flags used by SearchInTarget.
set void SetSearchFlags=2198(int flags,)
-# Get the search flags used by SearchInTarget
+# Get the search flags used by SearchInTarget.
get int GetSearchFlags=2199(,)
# Show a call tip containing a definition near position pos.
# Find the document line of a display line taking hidden lines into account.
fun int DocLineFromVisible=2221(int lineDisplay,)
+enu FoldLevel=SC_FOLDLEVEL
val SC_FOLDLEVELBASE=0x400
val SC_FOLDLEVELWHITEFLAG=0x1000
val SC_FOLDLEVELHEADERFLAG=0x2000
# Ensure a particular line is visible by expanding any header line hiding it.
fun void EnsureVisible=2232(int line,)
-# Set some debugging options for folding
+# Set some debugging options for folding.
fun void SetFoldFlags=2233(int flags,)
# 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.
fun void EnsureVisibleEnforcePolicy=2234(int line,)
-# Sets whether a tab pressed when caret is within indentation indents
+# Sets whether a tab pressed when caret is within indentation indents.
set void SetTabIndents=2260(bool tabIndents,)
# Does a tab pressed when caret is within indentation indent?
get bool GetTabIndents=2261(,)
-# Sets whether a backspace pressed when caret is within indentation unindents
+# Sets whether a backspace pressed when caret is within indentation unindents.
set void SetBackSpaceUnIndents=2262(bool bsUnIndents,)
# Does a backspace pressed when caret is within indentation unindent?
val SC_TIME_FOREVER=10000000
-# Sets the time the mouse must sit still to generate a mouse dwell event
+# Sets the time the mouse must sit still to generate a mouse dwell event.
set void SetMouseDwellTime=2264(int periodMilliseconds,)
-# Retrieve the time the mouse must sit still to generate a mouse dwell event
+# Retrieve the time the mouse must sit still to generate a mouse dwell event.
get int GetMouseDwellTime=2265(,)
-# Get position of start of word
+# Get position of start of word.
fun int WordStartPosition=2266(position pos, bool onlyWordCharacters)
-# Get position of end of word
+# Get position of end of word.
fun int WordEndPosition=2267(position pos, bool onlyWordCharacters)
+enu Wrap=SC_WRAP_
val SC_WRAP_NONE=0
val SC_WRAP_WORD=1
-# Sets whether text is word wrapped
+# Sets whether text is word wrapped.
set void SetWrapMode=2268(int mode,)
-# Retrieve whether text is word wrapped
+# Retrieve whether text is word wrapped.
get int GetWrapMode=2269(,)
+enu LineCache=SC_CACHE_
val SC_CACHE_NONE=0
val SC_CACHE_CARET=1
val SC_CACHE_PAGE=2
val SC_CACHE_DOCUMENT=3
-# Sets the degree of caching of layout information
+# Sets the degree of caching of layout information.
set void SetLayoutCache=2272(int mode,)
-# Retrieve the degree of caching of layout information
+# Retrieve the degree of caching of layout information.
get int GetLayoutCache=2273(,)
+# Sets the document width assumed for scrolling.
+set void SetScrollWidth=2274(int pixelWidth,)
+
+# Retrieve the document width assumed for scrolling.
+get int GetScrollWidth=2275(,)
+
+# Measure the pixel width of some text in a particular style.
+# Nul terminated text argument.
+# Does not handle tab or control characters.
+fun int TextWidth=2276(int style, string text)
+
+# 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.
+set void SetEndAtLastLine=2277(bool endAtLastLine,)
+
+# Retrieve whether the maximum scroll position has the last
+# line at the bottom of the view.
+get int GetEndAtLastLine=2278(,)
+
+# Retrieve the height of a particular line of text in pixels.
+fun int TextHeight=2279(int line,)
+
## Start of key messages
# Move caret down one line.
fun void LineDown=2300(,)
# Delete the selection or if no selection, the character before the caret.
fun void DeleteBack=2326(,)
-# If selection is empty or all on one line replace the selection with a tab
-# character.
+# 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.
fun void Tab=2327(,)
fun void LineScrollUp=2343(,)
# Delete the selection or if no selection, the character before the caret.
-# Will not delete the chraacter before at the start of a line.
+# Will not delete the character before at the start of a line.
fun void DeleteBackNotLine=2344(,)
-# Move the caret inside current view if it's not there already
+# Move the caret inside current view if it's not there already.
fun void MoveCaretInsideView=2401(,)
-# How many characters are on a line, not including end of line characters.
+# How many characters are on a line, not including end of line characters?
fun int LineLength=2350(int line,)
# Highlight the characters at two positions.
-fun void BraceHighlight=2351(position pos1,position pos2)
+fun void BraceHighlight=2351(position pos1, position pos2)
# Highlight the character at a position indicating there is no matching brace.
fun void BraceBadLight=2352(position pos,)
# Find the position of a matching brace or INVALID_POSITION if no match.
fun position BraceMatch=2353(position pos,)
-# Are the end of line characters visible.
+# Are the end of line characters visible?
get bool GetViewEOL=2355(,)
-# Make the end of line characters visible or invisible
+# Make the end of line characters visible or invisible.
set void SetViewEOL=2356(bool visible,)
# Retrieve a pointer to the document object.
# Set which document modification events are sent to the container.
set void SetModEventMask=2359(int mask,)
+enu EdgeVisualStyle=EDGE_
val EDGE_NONE=0
val EDGE_LINE=1
val EDGE_BACKGROUND=2
# Does not ensure the selection is visible.
fun int SearchPrev=2368(int flags, string text)
-# Show caret within N lines of edge when it's scrolled to view
-# If CARET_SLOP not set then centre caret on screen when it's
-# scrolled to view
-val CARET_SLOP=0x01
-# Value not used
-val CARET_CENTER=0x02
-# If CARET_SLOP also set then reposition whenever outside slop border
-# If CARET_SLOP not set then recentre even when visible
-val CARET_STRICT=0x04
-# If CARET_XEVEN set then both left and right margins are given equal weight
-# rather than favouring left following behaviour.
-val CARET_XEVEN=0x08
-# If CARET_XJUMPS set then when caret reaches the margin the display jumps
-# enough to leave the caret solidly within the display.
-val CARET_XJUMPS=0x10
-# Set the way the line the caret is on is kept visible.
-fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
-
# Retrieves the number of lines completely visible.
get int LinesOnScreen=2370(,)
# the wrong mouse button.
fun void UsePopUp=2371(bool allowPopUp,)
-# Is the selection a rectangular. The alternative is the more common stream selection.
+# Is the selection rectangular? The alternative is the more common stream selection.
get bool SelectionIsRectangle=2372(,)
# Set the zoom level. This number of points is added to the size of all fonts.
# Get which document modification events are sent to the container.
get int GetModEventMask=2378(,)
-# Change internal focus flag
+# Change internal focus flag.
set void SetFocus=2380(bool focus,)
-# Get internal focus flag
+# Get internal focus flag.
get bool GetFocus=2381(,)
-# Change error status - 0 = OK
+# Change error status - 0 = OK.
set void SetStatus=2382(int statusCode,)
-# Get error status
+# Get error status.
get int GetStatus=2383(,)
-# Set whether the mouse is captured when its button is pressed
+# Set whether the mouse is captured when its button is pressed.
set void SetMouseDownCaptures=2384(bool captures,)
-# Get whether mouse gets captured
+# Get whether mouse gets captured.
get bool GetMouseDownCaptures=2385(,)
+enu CursorShape=SC_CURSOR
val SC_CURSORNORMAL=-1
val SC_CURSORWAIT=3
-# Sets the cursor to one of the SC_CURSOR* values
+# Sets the cursor to one of the SC_CURSOR* values.
set void SetCursor=2386(int cursorType,)
-# Get cursor type
+# Get cursor type.
get int GetCursor=2387(,)
# Change the way control characters are displayed:
-# If symbol is < 32, keep the drawn way, else, use the given character
+# If symbol is < 32, keep the drawn way, else, use the given character.
set void SetControlCharSymbol=2388(int symbol,)
-# Get the way control characters are displayed
+# Get the way control characters are displayed.
get int GetControlCharSymbol=2389(,)
-# Move to the previous change in capitalistion
+# Move to the previous change in capitalisation.
fun void WordPartLeft=2390(,)
-# Move to the previous change in capitalistion extending selection to new caret position.
+# Move to the previous change in capitalisation extending selection
+# to new caret position.
fun void WordPartLeftExtend=2391(,)
-# Move to the change next in capitalistion
+# Move to the change next in capitalisation.
fun void WordPartRight=2392(,)
-# Move to the next change in capitalistion extending selection to new caret position.
+# Move to the next change in capitalisation extending selection
+# to new caret position.
fun void WordPartRightExtend=2393(,)
-# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
+# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
val VISIBLE_SLOP=0x01
val VISIBLE_STRICT=0x04
-# Set the way the display area is determined when a particular line is to be moved to.
+# Set the way the display area is determined when a particular line
+# is to be moved to by Find, FindNext, GotoLine, etc.
fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop)
-# Delete back from the current position to the start of the line
+# Delete back from the current position to the start of the line.
fun void DelLineLeft=2395(,)
-# Delete forwards from the current position to the end of the line
+# Delete forwards from the current position to the end of the line.
fun void DelLineRight=2396(,)
-# Get and Set the xOffset (ie, horizonal scroll position)
+# Get and Set the xOffset (ie, horizonal scroll position).
set void SetXOffset=2397(int newOffset,)
get int GetXOffset=2398(,)
# Set the focus to this Scintilla widget.
-# GTK+ Specific
+# GTK+ Specific.
fun void GrabFocus=2400(,)
+enu CaretPolicy = CARET_
+# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+# 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.
+val CARET_SLOP=0x01
+# 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.
+val CARET_STRICT=0x04
+# 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.
+val CARET_JUMPS=0x10
+# 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.
+val CARET_EVEN=0x08
+
+# Set the way the caret is kept visible when going sideway.
+# The exclusion zone is given in pixels.
+fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop)
+
+# Set the way the line the caret is on is kept visible.
+# The exclusion zone is given in lines.
+fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
set void SetLexerLanguage=4006(, string language)
# Notifications
-# Type of modification and the action which caused the modification
+# Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
# One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
+enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_LAST
val SC_MOD_INSERTTEXT=0x1
val SC_MOD_DELETETEXT=0x2
val SC_MOD_CHANGESTYLE=0x4
val SC_MODEVENTMASKALL=0xF77
# For compatibility, these go through the COMMAND notification rather than NOTIFY
-# and have exactly the same values as the EN_* constants.
+# and should have had exactly the same values as the EN_* constants.
+# Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_*
+# As clients depend on these constants, this will not be changed.
val SCEN_CHANGE=768
val SCEN_SETFOCUS=512
val SCEN_KILLFOCUS=256
-# Symbolic key codes and modifier flags
-# ASCII and other printable characters below 256
-# Extended keys above 300
+# Symbolic key codes and modifier flags.
+# ASCII and other printable characters below 256.
+# Extended keys above 300.
+enu Keys=SCK_
val SCK_DOWN=300
val SCK_UP=301
val SCK_LEFT=302
val SCK_SUBTRACT=311
val SCK_DIVIDE=312
+enu KeyMod=SCMOD_
val SCMOD_SHIFT=1
val SCMOD_CTRL=2
val SCMOD_ALT=4
################################################
# For SciLexer.h
+enu Lexer=SCLEX_
val SCLEX_CONTAINER=0
val SCLEX_NULL=1
val SCLEX_PYTHON=2
val SCLEX_PHP=30
val SCLEX_BAAN=31
val SCLEX_MATLAB=32
+val SCLEX_SCRIPTOL=33
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON
+lex Python=SCLEX_PYTHON SCE_P_
+lex Ruby=SCLEX_RUBY SCE_P_
val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1
val SCE_P_NUMBER=2
val SCE_P_COMMENTBLOCK=12
val SCE_P_STRINGEOL=13
# Lexical states for SCLEX_CPP
+lex Cpp=SCLEX_CPP SCE_C_
+lex SQL=SCLEX_SQL SCE_C_
+lex Pascal=SCLEX_PASCAL SCE_C_
+lex TCL=SCLEX_TCL SCE_C_
+lex BullAnt=SCLEX_BULLANT SCE_C_
val SCE_C_DEFAULT=0
val SCE_C_COMMENT=1
val SCE_C_COMMENTLINE=2
val SCE_C_WORD2=16
val SCE_C_COMMENTDOCKEYWORD=17
val SCE_C_COMMENTDOCKEYWORDERROR=18
-# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
-val SCE_B_DEFAULT=0
-val SCE_B_COMMENT=1
-val SCE_B_NUMBER=2
-val SCE_B_KEYWORD=3
-val SCE_B_STRING=4
-val SCE_B_PREPROCESSOR=5
-val SCE_B_OPERATOR=6
-val SCE_B_IDENTIFIER=7
-val SCE_B_DATE=8
# Lexical states for SCLEX_HTML, SCLEX_XML
+lex HTML=SCLEX_HTML SCE_H
+lex XML=SCLEX_XML SCE_H
+lex ASP=SCLEX_ASP SCE_H
+lex PHP=SCLEX_PHP SCE_H
val SCE_H_DEFAULT=0
val SCE_H_TAG=1
val SCE_H_TAGUNKNOWN=2
val SCE_HPHP_HSTRING_VARIABLE=126
val SCE_HPHP_OPERATOR=127
# Lexical states for SCLEX_PERL
+lex Perl=SCLEX_PERL SCE_PL_
val SCE_PL_DEFAULT=0
val SCE_PL_ERROR=1
val SCE_PL_COMMENTLINE=2
val SCE_PL_STRING_QX=28
val SCE_PL_STRING_QR=29
val SCE_PL_STRING_QW=30
+# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
+lex VB=SCLEX_VB SCE_B_
+lex VBScript=SCLEX_VBSCRIPT SCE_B_
+val SCE_B_DEFAULT=0
+val SCE_B_COMMENT=1
+val SCE_B_NUMBER=2
+val SCE_B_KEYWORD=3
+val SCE_B_STRING=4
+val SCE_B_PREPROCESSOR=5
+val SCE_B_OPERATOR=6
+val SCE_B_IDENTIFIER=7
+val SCE_B_DATE=8
+# Lexical states for SCLEX_PROPERTIES
+lex Properties=SCLEX_PROPERTIES SCE_PROPS_
+val SCE_PROPS_DEFAULT=0
+val SCE_PROPS_COMMENT=1
+val SCE_PROPS_SECTION=2
+val SCE_PROPS_ASSIGNMENT=3
+val SCE_PROPS_DEFVAL=4
# Lexical states for SCLEX_LATEX
+lex LaTeX=SCLEX_LATEX SCE_L_
val SCE_L_DEFAULT=0
val SCE_L_COMMAND=1
val SCE_L_TAG=2
val SCE_L_MATH=3
val SCE_L_COMMENT=4
# Lexical states for SCLEX_LUA
+lex Lua=SCLEX_LUA SCE_LUA_
val SCE_LUA_DEFAULT=0
val SCE_LUA_COMMENT=1
val SCE_LUA_COMMENTLINE=2
val SCE_LUA_WORD5=16
val SCE_LUA_WORD6=17
# Lexical states for SCLEX_ERRORLIST
+lex ErrorList=SCLEX_ERRORLIST SCE_ERR_
val SCE_ERR_DEFAULT=0
val SCE_ERR_PYTHON=1
val SCE_ERR_GCC=2
val SCE_ERR_PERL=6
val SCE_ERR_NET=7
val SCE_ERR_LUA=8
+val SCE_ERR_CTAG=9
val SCE_ERR_DIFF_CHANGED=10
val SCE_ERR_DIFF_ADDITION=11
val SCE_ERR_DIFF_DELETION=12
val SCE_ERR_DIFF_MESSAGE=13
# Lexical states for SCLEX_BATCH
+lex Batch=SCLEX_BATCH SCE_BAT_
val SCE_BAT_DEFAULT=0
val SCE_BAT_COMMENT=1
val SCE_BAT_WORD=2
val SCE_BAT_IDENTIFIER=6
val SCE_BAT_OPERATOR=7
# Lexical states for SCLEX_MAKEFILE
+lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_
val SCE_MAKE_DEFAULT=0
val SCE_MAKE_COMMENT=1
val SCE_MAKE_PREPROCESSOR=2
val SCE_MAKE_OPERATOR=4
val SCE_MAKE_TARGET=5
val SCE_MAKE_IDEOL=9
-# Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+# Lexical states for SCLEX_DIFF
+lex Diff=SCLEX_DIFF SCE_DIFF_
+val SCE_DIFF_DEFAULT=0
+val SCE_DIFF_COMMENT=1
+val SCE_DIFF_COMMAND=2
+val SCE_DIFF_HEADER=3
+val SCE_DIFF_POSITION=4
+val SCE_DIFF_DELETED=5
+val SCE_DIFF_ADDED=6
+# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
+lex Conf=SCLEX_CONF SCE_CONF_
val SCE_CONF_DEFAULT=0
val SCE_CONF_COMMENT=1
val SCE_CONF_NUMBER=2
val SCE_CONF_OPERATOR=7
val SCE_CONF_IP=8
val SCE_CONF_DIRECTIVE=9
-# Avenue
+# Lexical states for SCLEX_AVE, Avenue
+lex Avenue=SCLEX_AVE SCE_AVE_
val SCE_AVE_DEFAULT=0
val SCE_AVE_COMMENT=1
val SCE_AVE_NUMBER=2
val SCE_AVE_IDENTIFIER=9
val SCE_AVE_OPERATOR=10
# Lexical states for SCLEX_ADA
+lex Ada=SCLEX_ADA SCE_ADA_
val SCE_ADA_DEFAULT=0
val SCE_ADA_COMMENT=1
val SCE_ADA_NUMBER=2
val SCE_ADA_IDENTIFIER=7
val SCE_ADA_STRINGEOL=8
# Lexical states for SCLEX_BAAN
+lex Baan=SCLEX_BAAN SCE_BAAN_
val SCE_BAAN_DEFAULT=0
val SCE_BAAN_COMMENT=1
val SCE_BAAN_COMMENTDOC=2
val SCE_BAAN_STRINGEOL=9
val SCE_BAAN_WORD2=10
# Lexical states for SCLEX_LISP
+lex Lisp=SCLEX_LISP SCE_LISP_
val SCE_LISP_DEFAULT=0
val SCE_LISP_COMMENT=1
val SCE_LISP_NUMBER=2
val SCE_LISP_IDENTIFIER=9
val SCE_LISP_OPERATOR=10
# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_
+lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_
val SCE_EIFFEL_DEFAULT=0
val SCE_EIFFEL_COMMENTLINE=1
val SCE_EIFFEL_NUMBER=2
val SCE_EIFFEL_OPERATOR=6
val SCE_EIFFEL_IDENTIFIER=7
val SCE_EIFFEL_STRINGEOL=8
-# Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
+# Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
+lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_
val SCE_NNCRONTAB_DEFAULT=0
val SCE_NNCRONTAB_COMMENT=1
val SCE_NNCRONTAB_TASK=2
val SCE_NNCRONTAB_ENVIRONMENT=9
val SCE_NNCRONTAB_IDENTIFIER=10
# Lexical states for SCLEX_MATLAB
+lex MatLab=SCLEX_MATLAB SCE_MATLAB_
val SCE_MATLAB_DEFAULT=0
val SCE_MATLAB_COMMENT=1
val SCE_MATLAB_COMMAND=2
val SCE_MATLAB_STRING=5
val SCE_MATLAB_OPERATOR=6
val SCE_MATLAB_IDENTIFIER=7
+# Lexical states for SCLEX_SCRIPTOL
+lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_
+val SCE_SCRIPTOL_DEFAULT=0
+val SCE_SCRIPTOL_COMMENT=1
+val SCE_SCRIPTOL_COMMENTLINE=2
+val SCE_SCRIPTOL_COMMENTDOC=3
+val SCE_SCRIPTOL_NUMBER=4
+val SCE_SCRIPTOL_WORD=5
+val SCE_SCRIPTOL_STRING=6
+val SCE_SCRIPTOL_CHARACTER=7
+val SCE_SCRIPTOL_UUID=8
+val SCE_SCRIPTOL_PREPROCESSOR=9
+val SCE_SCRIPTOL_OPERATOR=10
+val SCE_SCRIPTOL_IDENTIFIER=11
+val SCE_SCRIPTOL_STRINGEOL=12
+val SCE_SCRIPTOL_VERBATIM=13
+val SCE_SCRIPTOL_REGEX=14
+val SCE_SCRIPTOL_COMMENTLINEDOC=15
+val SCE_SCRIPTOL_WORD2=16
+val SCE_SCRIPTOL_COMMENTDOCKEYWORD=17
+val SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR=18
+val SCE_SCRIPTOL_COMMENTBASIC=19
# Events
evt void URIDropped=2015(string text)
evt void DwellStart=2016(int position)
evt void DwellEnd=2017(int position)
+evt void Zoom=2018(void)
cat Deprecated
+# CARET_POLICY changed in 1.47
+fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
+val CARET_CENTER=0x02
+val CARET_XEVEN=0x08
+val CARET_XJUMPS=0x10
+
# The old name for SCN_UPDATEUI
val SCN_CHECKBRACE=2007
evt void PosChanged=2012(int position)
+
};
struct _ScintillaClass {
- GtkFixedClass parent_class;
+ GtkContainerClass parent_class;
void (* command) (ScintillaObject *ttt);
void (* notify) (ScintillaObject *ttt);
void scintilla_set_id (ScintillaObject *sci,int id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+#if GTK_MAJOR_VERSION < 2
+#define SCINTILLA_NOTIFY "notify"
+#else
+#define SCINTILLA_NOTIFY "sci-notify"
+#endif
+
#ifdef __cplusplus
}
#endif
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
}
~WindowAccessor();
+ bool Match(int pos, const char *s);
char StyleAt(int position);
int GetLine(int position);
int LineStart(int line);
}
void AutoComplete::Select(const char *word) {
- int lenWord = strlen(word);
+ size_t lenWord = strlen(word);
int location = -1;
const int maxItemLen=1000;
char item[maxItemLen];
look = newline + 1;
numLines++;
}
- int lastWidth = surfaceMeasure->WidthText(font, look, strlen(look));
+ int lastWidth = surfaceMeasure->WidthText(font, look, static_cast<int>(strlen(look)));
width = Platform::Maximum(width, lastWidth) + 10;
int lineHeight = surfaceMeasure->Height(font);
// Extra line for border and an empty line at top and bottom
//Platform::DebugPrintf("Removing cr end of line\n");
lv.Remove(lineRemove);
}
- } else if ((ch == '\n') && !ignoreNL) {
- //Platform::DebugPrintf("Removing lf end of line\n");
- lv.Remove(lineRemove);
- ignoreNL = false; // Further \n are not real deletions
+ } else if (ch == '\n') {
+ if (ignoreNL) {
+ ignoreNL = false; // Further \n are real deletions
+ } else {
+ //Platform::DebugPrintf("Removing lf end of line\n");
+ lv.Remove(lineRemove);
+ }
}
ch = chNext;
// SetStyleAt does not change the persistent state of a document
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
-void Document::DeleteChars(int pos, int len) {
+bool Document::DeleteChars(int pos, int len) {
if (len == 0)
- return;
+ return false;
if ((pos + len) > Length())
- return;
+ return false;
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
- if (enteredCount == 0) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
if (!cb.IsReadOnly()) {
NotifyModified(
}
enteredCount--;
}
+ return !cb.IsReadOnly();
}
-void Document::InsertStyledString(int position, char *s, int insertLength) {
+bool Document::InsertStyledString(int position, char *s, int insertLength) {
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
- if (enteredCount == 0) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
if (!cb.IsReadOnly()) {
NotifyModified(
}
enteredCount--;
}
+ return !cb.IsReadOnly();
}
int Document::Undo() {
return newPos;
}
-void Document::InsertChar(int pos, char ch) {
+bool Document::InsertChar(int pos, char ch) {
char chs[2];
chs[0] = ch;
chs[1] = 0;
- InsertStyledString(pos*2, chs, 2);
+ return InsertStyledString(pos*2, chs, 2);
}
// Insert a null terminated string
-void Document::InsertString(int position, const char *s) {
- InsertString(position, s, strlen(s));
+bool Document::InsertString(int position, const char *s) {
+ return InsertString(position, s, strlen(s));
}
// Insert a string with a length
-void Document::InsertString(int position, const char *s, int insertLength) {
+bool Document::InsertString(int position, const char *s, size_t insertLength) {
+ bool changed = false;
char *sWithStyle = new char[insertLength * 2];
if (sWithStyle) {
- for (int i = 0; i < insertLength; i++) {
+ for (size_t i = 0; i < insertLength; i++) {
sWithStyle[i*2] = s[i];
sWithStyle[i*2 + 1] = 0;
}
- InsertStyledString(position*2, sWithStyle, insertLength*2);
+ changed = InsertStyledString(position*2, sWithStyle,
+ static_cast<int>(insertLength*2));
delete []sWithStyle;
}
+ return changed;
}
void Document::ChangeChar(int pos, char ch) {
DeleteChars(pos, LenChar(pos));
}
-int Document::DelCharBack(int pos) {
+void Document::DelCharBack(int pos) {
if (pos <= 0) {
- return pos;
+ return;
} else if (IsCrLf(pos - 2)) {
DeleteChars(pos - 2, 2);
- return pos - 2;
} else if (SC_CP_UTF8 == dbcsCodePage) {
int startChar = MovePositionOutsideChar(pos - 1, -1, false);
DeleteChars(startChar, pos - startChar);
- return startChar;
} else if (IsDBCS(pos - 1)) {
DeleteChars(pos - 2, 2);
- return pos - 2;
} else {
DeleteChars(pos - 1, 1);
- return pos - 1;
}
}
Document *pdoc;
int end;
public:
-DocumentIndexer(Document *pdoc_, int end_) :
- pdoc(pdoc_), end(end_) {}
+ DocumentIndexer(Document *pdoc_, int end_) :
+ pdoc(pdoc_), end(end_) {
+ }
virtual char CharAt(int index) {
if (index < 0 || index >= end)
// Compute actual search ranges needed
int lengthFind = *length;
if (lengthFind == -1)
- lengthFind = strlen(s);
+ lengthFind = static_cast<int>(strlen(s));
int endSearch = endPos;
if (startPos <= endPos) {
endSearch = endPos - lengthFind + 1;
endStyled = position;
}
-void Document::SetStyleFor(int length, char style) {
- if (enteredCount == 0) {
+bool Document::SetStyleFor(int length, char style) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
int prevEndStyled = endStyled;
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
}
endStyled += length;
enteredCount--;
+ return true;
}
}
-void Document::SetStyles(int length, char *styles) {
- if (enteredCount == 0) {
+bool Document::SetStyles(int length, char *styles) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
int prevEndStyled = endStyled;
bool didChange = false;
+ int lastChange = 0;
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
PLATFORM_ASSERT(endStyled < Length());
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
didChange = true;
+ lastChange = iPos;
}
}
if (didChange) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
- prevEndStyled, endStyled - prevEndStyled);
+ prevEndStyled, lastChange);
NotifyModified(mh);
}
enteredCount--;
+ return true;
}
}
if (styleClock > 0x100000) {
styleClock = 0;
}
+ // Ask the watchers to style, and stop as soon as one responds.
+ for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) {
+ watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
+ }
}
- // Ask the watchers to style, and stop as soon as one responds.
- for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++)
- watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
return pos <= GetEndStyled();
}
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
// Gateways to modifying document
- void DeleteChars(int pos, int len);
- void InsertStyledString(int position, char *s, int insertLength);
+ bool DeleteChars(int pos, int len);
+ bool InsertStyledString(int position, char *s, int insertLength);
int Undo();
int Redo();
bool CanUndo() { return cb.CanUndo(); }
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
bool IsReadOnly() { return cb.IsReadOnly(); }
- void InsertChar(int pos, char ch);
- void InsertString(int position, const char *s);
- void InsertString(int position, const char *s, int insertLength);
+ bool InsertChar(int pos, char ch);
+ bool InsertString(int position, const char *s);
+ bool InsertString(int position, const char *s, size_t insertLength);
void ChangeChar(int pos, char ch);
void DelChar(int pos);
- int DelCharBack(int pos);
+ void DelCharBack(int pos);
char CharAt(int position) { return cb.CharAt(position); }
void GetCharRange(char *buffer, int position, int lengthRetrieve) {
void SetWordChars(unsigned char *chars);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
- void SetStyleFor(int length, char style);
- void SetStyles(int length, char *styles);
+ bool SetStyleFor(int length, char style);
+ bool SetStyles(int length, char *styles);
int GetEndStyled() { return endStyled; }
bool EnsureStyledTo(int pos);
int GetStyleClock() { return styleClock; }
buf[endPos-startPos] = '\0';
}
+bool DocumentAccessor::Match(int pos, const char *s) {
+ for (int i=0; *s; i++) {
+ if (*s != SafeGetCharAt(pos+i))
+ return false;
+ s++;
+ }
+ return true;
+}
+
char DocumentAccessor::StyleAt(int position) {
return pdoc->StyleAt(position);
}
startSeg(0), startPosStyling(0) {
}
~DocumentAccessor();
+ bool Match(int pos, const char *s);
char StyleAt(int position);
int GetLine(int position);
int LineStart(int line);
chars = new char[maxLineLength_ + 1];
styles = new char[maxLineLength_ + 1];
indicators = new char[maxLineLength_ + 1];
- positions = new int[maxLineLength_ + 1];
+ // Extra position allocated as sometimes the Windows
+ // GetTextExtentExPoint API writes an extra element.
+ positions = new int[maxLineLength_ + 1 + 1];
maxLineLength = maxLineLength_;
}
}
}
void LineLayout::Invalidate(validLevel validity_) {
- validity = validity_;
+ if (validity > validity_)
+ validity = validity_;
}
void LineLayout::SetLineStart(int line, int start) {
}
if (lengthForLevel > size) {
Deallocate();
- } else {
- if (lengthForLevel < length) {
- for (int i=lengthForLevel; i<length; i++) {
- delete cache[i];
- cache[i] = 0;
- }
+ } else if (lengthForLevel < length) {
+ for (int i=lengthForLevel; i<length; i++) {
+ delete cache[i];
+ cache[i] = 0;
}
- Invalidate(LineLayout::llInvalid);
}
if (!cache) {
Allocate(lengthForLevel);
int linesOnScreen, int linesInDoc) {
AllocateForLevel(linesOnScreen, linesInDoc);
if (styleClock != styleClock_) {
- Invalidate(LineLayout::llInvalid);
+ Invalidate(LineLayout::llCheckTextAndStyle);
styleClock = styleClock_;
}
allInvalidated = false;
xEndSelect = 0;
primarySelection = true;
- caretPolicy = CARET_SLOP;
- caretSlop = 0;
+ caretXPolicy = CARET_SLOP | CARET_EVEN;
+ caretXSlop = 50;
- visiblePolicy = VISIBLE_SLOP;
- visibleSlop = 0;
+ caretYPolicy = CARET_EVEN;
+ caretYSlop = 0;
searchAnchor = 0;
xOffset = 0;
xCaretMargin = 50;
horizontalScrollBarVisible = true;
+ scrollWidth = 2000;
+ endAtLastLine = true;
pixmapLine = Surface::Allocate();
pixmapSelMargin = Surface::Allocate();
int Editor::MaxScrollPos() {
//Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n",
//LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1);
- int retVal = cs.LinesDisplayed() - LinesOnScreen();
- if (retVal < 0)
+ int retVal = cs.LinesDisplayed();
+ if (endAtLastLine) {
+ retVal -= LinesOnScreen();
+ } else {
+ retVal--;
+ }
+ if (retVal < 0) {
return 0;
- else
+ } else {
return retVal;
+ }
}
static inline bool IsControlCharacter(char ch) {
return INVALID_POSITION;
}
-// Find the document position corresponding to an x coordinate on a particular document line.
-// Ensure is between whole characters when document is in multi-byte or UTF-8 mode.
+/**
+ * Find the document position corresponding to an x coordinate on a particular document line.
+ * Ensure is between whole characters when document is in multi-byte or UTF-8 mode.
+ */
int Editor::PositionFromLineX(int lineDoc, int x) {
RefreshStyleData();
if (lineDoc >= pdoc->LinesTotal())
return retVal;
}
+// If painting then abandon the painting because a wider redraw is needed.
+// Return true if calling code should stop drawing
+bool Editor::AbandonPaint() {
+ if ((paintState == painting) && !paintingAllText) {
+ paintState = paintAbandoned;
+ }
+ return paintState == paintAbandoned;
+}
+
void Editor::RedrawRect(PRectangle rc) {
//Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom);
}
void Editor::RedrawSelMargin() {
- if (vs.maskInLine) {
- Redraw();
- } else {
- PRectangle rcSelMargin = GetClientRectangle();
- rcSelMargin.right = vs.fixedColumnWidth;
- wMain.InvalidateRectangle(rcSelMargin);
+ if (!AbandonPaint()) {
+ if (vs.maskInLine) {
+ Redraw();
+ } else {
+ PRectangle rcSelMargin = GetClientRectangle();
+ rcSelMargin.right = vs.fixedColumnWidth;
+ wMain.InvalidateRectangle(rcSelMargin);
+ }
}
}
return lineDisplay;
}
+/**
+ * Ensure the caret is reasonably visible in context.
+ *
+Caret policy in SciTE
+
+If slop is set, we can define a slop value.
+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.
+
+If 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.
+
+If 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.
+'3UZ' notation is used to indicate three time the size of the UZ as a distance to the margin.
+
+If 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.
+
+ | | | | |
+slop | strict | jumps | even | Caret can go to the margin | When reaching limit (caret going out of
+ | | | | | visibility or going into the UZ) display is...
+-----+--------+-------+------+--------------------------------------------+--------------------------------------------------------------
+ 0 | 0 | 0 | 0 | Yes | moved to put caret on top/on right
+ 0 | 0 | 0 | 1 | Yes | moved by one position
+ 0 | 0 | 1 | 0 | Yes | moved to put caret on top/on right
+ 0 | 0 | 1 | 1 | Yes | centred on the caret
+ 0 | 1 | - | 0 | Caret is always on top/on right of display | -
+ 0 | 1 | - | 1 | No, caret is always centred | -
+ 1 | 0 | 0 | 0 | Yes | moved to put caret out of the asymmetrical UZ
+ 1 | 0 | 0 | 1 | Yes | moved to put caret out of the UZ
+ 1 | 0 | 1 | 0 | Yes | moved to put caret at 3UZ of the top or right margin
+ 1 | 0 | 1 | 1 | Yes | moved to put caret at 3UZ of the margin
+ 1 | 1 | - | 0 | Caret is always at UZ of top/right margin | -
+ 1 | 1 | 0 | 1 | No, kept out of UZ | moved by one position
+ 1 | 1 | 1 | 1 | No, kept out of UZ | moved to put caret at 3UZ of the margin
+*/
void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
//Platform::DebugPrintf("EnsureCaretVisible %d %s\n", xOffset, useMargin ? " margin" : " ");
PRectangle rcClient = GetTextRectangle();
//int rcClientFullWidth = rcClient.Width();
int posCaret = currentPos;
- if (posDrag >= 0)
+ if (posDrag >= 0) {
posCaret = posDrag;
+ }
Point pt = LocationFromPosition(posCaret);
- Point ptEOL = LocationFromPosition(pdoc->LineEndPosition(posCaret));
Point ptBottomCaret = pt;
- int lineCaret = DisplayFromPosition(posCaret);
ptBottomCaret.y += vs.lineHeight - 1;
-
- // Ensure the caret is reasonably visible in context:
- // xMargin must equal to xCaretMargin, with a minimum of 2 and a maximum of
- // slightly less than half the width of the text area.
- int xMargin = Platform::Clamp(xCaretMargin, 2, Platform::Maximum(rcClient.Width() - 10, 4) / 2);
- if (!useMargin)
- xMargin = 2;
-
- // If we scroll the display, we use a minimum amount of xMargin.
- int offsetLeft = rcClient.left + xMargin;
- int offsetRight = rcClient.right - xMargin;
- // If we are in XJUMPS mode, then when the margin is reached, the
- // offset jumps so that it won't need to move agin for a while.
- if (!(caretPolicy & CARET_XJUMPS)) {
- rcClient.left = offsetLeft;
- rcClient.right = offsetRight;
- }
+ int lineCaret = DisplayFromPosition(posCaret);
+ bool bSlop, bStrict, bJump, bEven;
// Vertical positioning
- if (vert && (!rcClient.Contains(pt) || !rcClient.Contains(ptBottomCaret) || (caretPolicy & CARET_STRICT))) {
- //Platform::DebugPrintf("EnsureCaretVisible move, (%d,%d)(%d,%d)\n", pt.x, pt.y, rcClient.left, rcClient.right);
+ if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) {
+ int linesOnScreen = LinesOnScreen();
+ int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2;
+ int newTopLine = topLine;
+ bSlop = (caretYPolicy & CARET_SLOP) != 0;
+ bStrict = (caretYPolicy & CARET_STRICT) != 0;
+ bJump = (caretYPolicy & CARET_JUMPS) != 0;
+ bEven = (caretYPolicy & CARET_EVEN) != 0;
+
// It should be possible to scroll the window to show the caret,
// but this fails to remove the caret on GTK+
- if (caretPolicy & CARET_SLOP) {
- if ((topLine > lineCaret) || ((caretPolicy & CARET_STRICT) && (topLine + caretSlop > lineCaret))) {
- SetTopLine(Platform::Clamp(lineCaret - caretSlop, 0, MaxScrollPos()));
- SetVerticalScrollPos();
- Redraw();
- } else if ((lineCaret > topLine + LinesOnScreen() - 1) ||
- ((caretPolicy & CARET_STRICT) && (lineCaret > topLine + LinesOnScreen() - 1 - caretSlop))) {
- SetTopLine(Platform::Clamp(lineCaret - LinesOnScreen() + 1 + caretSlop, 0, MaxScrollPos()));
- SetVerticalScrollPos();
- Redraw();
+ if (bSlop) { // A margin is defined
+ int yMoveT, yMoveB;
+ if (bStrict) {
+ int yMarginT, yMarginB;
+ if (!useMargin) {
+ // In drag mode, avoid moves
+ // otherwise, a double click will select several lines.
+ yMarginT = yMarginB = 0;
+ } else {
+ // yMarginT must equal to caretYSlop, with a minimum of 1 and
+ // a maximum of slightly less than half the heigth of the text area.
+ yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen);
+ if (bEven) {
+ yMarginB = yMarginT;
+ } else {
+ yMarginB = linesOnScreen - yMarginT - 1;
+ }
+ }
+ yMoveT = yMarginT;
+ if (bEven) {
+ if (bJump) {
+ yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen);
+ }
+ yMoveB = yMoveT;
+ } else {
+ yMoveB = linesOnScreen - yMoveT - 1;
+ }
+ if (lineCaret < topLine + yMarginT) {
+ // Caret goes too high
+ newTopLine = lineCaret - yMoveT;
+ } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) {
+ // Caret goes too low
+ newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+ }
+ } else { // Not strict
+ yMoveT = bJump ? caretYSlop * 3 : caretYSlop;
+ yMoveT = Platform::Clamp(yMoveT, 1, halfScreen);
+ if (bEven) {
+ yMoveB = yMoveT;
+ } else {
+ yMoveB = linesOnScreen - yMoveT - 1;
+ }
+ if (lineCaret < topLine) {
+ // Caret goes too high
+ newTopLine = lineCaret - yMoveT;
+ } else if (lineCaret > topLine + linesOnScreen - 1) {
+ // Caret goes too low
+ newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+ }
}
- } else {
- if ((topLine > lineCaret) || (lineCaret > topLine + LinesOnScreen() - 1) || (caretPolicy & CARET_STRICT)) {
- SetTopLine(Platform::Clamp(lineCaret - LinesOnScreen() / 2 + 1, 0, MaxScrollPos()));
- SetVerticalScrollPos();
- Redraw();
+ } else { // No slop
+ if (!bStrict && !bJump) {
+ // Minimal move
+ if (lineCaret < topLine) {
+ // Caret goes too high
+ newTopLine = lineCaret;
+ } else if (lineCaret > topLine + linesOnScreen - 1) {
+ // Caret goes too low
+ if (bEven) {
+ newTopLine = lineCaret - linesOnScreen + 1;
+ } else {
+ newTopLine = lineCaret;
+ }
+ }
+ } else { // Strict or going out of display
+ if (bEven) {
+ // Always center caret
+ newTopLine = lineCaret - halfScreen;
+ } else {
+ // Always put caret on top of display
+ newTopLine = lineCaret;
+ }
}
}
+ newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos());
+ if (newTopLine != topLine) {
+ SetTopLine(newTopLine);
+ SetVerticalScrollPos();
+ Redraw();
+ }
}
// Horizontal positioning
if (horiz && (wrapState == eWrapNone)) {
+ int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2;
int xOffsetNew = xOffset;
- if (pt.x < rcClient.left) {
- xOffsetNew = xOffset - (offsetLeft - pt.x);
- } else if ((!(caretPolicy & CARET_XEVEN) && ((xOffset > 0) && useMargin)) || pt.x >= rcClient.right) {
- xOffsetNew = xOffset + (pt.x - offsetRight);
- int xOffsetEOL = xOffset + (ptEOL.x - offsetRight) - xMargin + 2;
- //Platform::DebugPrintf("Margin %d %d\n", xOffsetNew, xOffsetEOL);
- // Ensure don't scroll out into empty space
- if (xOffsetNew > xOffsetEOL)
- xOffsetNew = xOffsetEOL;
- }
- if (xOffsetNew < 0)
+ bSlop = (caretXPolicy & CARET_SLOP) != 0;
+ bStrict = (caretXPolicy & CARET_STRICT) != 0;
+ bJump = (caretXPolicy & CARET_JUMPS) != 0;
+ bEven = (caretXPolicy & CARET_EVEN) != 0;
+
+ if (bSlop) { // A margin is defined
+ int xMoveL, xMoveR;
+ if (bStrict) {
+ int xMarginL, xMarginR;
+ if (!useMargin) {
+ // In drag mode, avoid moves unless very near of the margin
+ // otherwise, a simple click will select text.
+ xMarginL = xMarginR = 2;
+ } else {
+ // xMargin must equal to caretXSlop, with a minimum of 2 and
+ // a maximum of slightly less than half the width of the text area.
+ xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen);
+ if (bEven) {
+ xMarginL = xMarginR;
+ } else {
+ xMarginL = rcClient.Width() - xMarginR - 4;
+ }
+ }
+ if (bJump && bEven) {
+ // Jump is used only in even mode
+ xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen);
+ } else {
+ xMoveL = xMoveR = 0; // Not used, avoid a warning
+ }
+ if (pt.x < rcClient.left + xMarginL) {
+ // Caret is on the left of the display
+ if (bJump && bEven) {
+ xOffsetNew -= xMoveL;
+ } else {
+ // Move just enough to allow to display the caret
+ xOffsetNew -= (rcClient.left + xMarginL) - pt.x;
+ }
+ } else if (pt.x >= rcClient.right - xMarginR) {
+ // Caret is on the right of the display
+ if (bJump && bEven) {
+ xOffsetNew += xMoveR;
+ } else {
+ // Move just enough to allow to display the caret
+ xOffsetNew += pt.x - (rcClient.right - xMarginR) + 1;
+ }
+ }
+ } else { // Not strict
+ xMoveR = bJump ? caretXSlop * 3 : caretXSlop;
+ xMoveR = Platform::Clamp(xMoveR, 1, halfScreen);
+ if (bEven) {
+ xMoveL = xMoveR;
+ } else {
+ xMoveL = rcClient.Width() - xMoveR - 4;
+ }
+ if (pt.x < rcClient.left) {
+ // Caret is on the left of the display
+ xOffsetNew -= xMoveL;
+ } else if (pt.x >= rcClient.right) {
+ // Caret is on the right of the display
+ xOffsetNew += xMoveR;
+ }
+ }
+ } else { // No slop
+ if (bStrict ||
+ (bJump && (pt.x < rcClient.left || pt.x >= rcClient.right))) {
+ // Strict or going out of display
+ if (bEven) {
+ // Center caret
+ xOffsetNew += pt.x - rcClient.left - halfScreen;
+ } else {
+ // Put caret on right
+ xOffsetNew += pt.x - rcClient.right + 1;
+ }
+ } else {
+ // Move just enough to allow to display the caret
+ if (pt.x < rcClient.left) {
+ // Caret is on the left of the display
+ if (bEven) {
+ xOffsetNew -= rcClient.left - pt.x;
+ } else {
+ xOffsetNew += pt.x - rcClient.right + 1;
+ }
+ } else if (pt.x >= rcClient.right) {
+ // Caret is on the right of the display
+ xOffsetNew += pt.x - rcClient.right + 1;
+ }
+ }
+ }
+ // In case of a jump (find result) largely out of display, adjust the offset to display the caret
+ if (pt.x + xOffset < rcClient.left + xOffsetNew) {
+ xOffsetNew = pt.x + xOffset - rcClient.left;
+ } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) {
+ xOffsetNew = pt.x + xOffset - rcClient.right + 1;
+ }
+ if (xOffsetNew < 0) {
xOffsetNew = 0;
+ }
if (xOffset != xOffsetNew) {
xOffset = xOffsetNew;
SetHorizontalScrollPos();
}
void Editor::NeedWrapping(int docLineStartWrapping) {
- docLineLastWrapped = docLineStartWrapping - 1;
- if (docLineLastWrapped < -1)
- docLineLastWrapped = -1;
- llc.Invalidate(LineLayout::llPositions);
+ if (docLineLastWrapped > (docLineStartWrapping - 1)) {
+ docLineLastWrapped = docLineStartWrapping - 1;
+ if (docLineLastWrapped < -1)
+ docLineLastWrapped = -1;
+ llc.Invalidate(LineLayout::llPositions);
+ }
}
// Check if wrapping needed and perform any needed wrapping.
}
docLineLastWrapped = 0x7ffffff;
} else {
- ElapsedTime et;
+ //ElapsedTime et;
int lineDocTop = cs.DocFromDisplay(topLine);
int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
PRectangle rcTextArea = GetClientRectangle();
goodTopLine += subLineTop;
else
goodTopLine += cs.GetHeight(lineDocTop);
- double durWrap = et.Duration(true);
+ //double durWrap = et.Duration(true);
//Platform::DebugPrintf("Wrap:%9.6g \n", durWrap);
}
}
if (!ll)
return;
int posLineStart = pdoc->LineStart(line);
+ int posLineEnd = pdoc->LineStart(line + 1);
+ // If the line is very long, limit the treatment to a length that should fit in the viewport
+ if (posLineEnd > (posLineStart + ll->maxLineLength)) {
+ posLineEnd = posLineStart + ll->maxLineLength;
+ }
+ if (ll->validity == LineLayout::llCheckTextAndStyle) {
+ int lineLength = 0;
+ for (int cid = posLineStart; cid < posLineEnd; cid++) {
+ char chDoc = pdoc->CharAt(cid);
+ if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) {
+ lineLength++;
+ }
+ }
+ if (lineLength == ll->numCharsInLine) {
+ int numCharsInLine = 0;
+ // See if chars, styles, indicators, are all the same
+ bool allSame = true;
+ char styleByte;
+ int styleMask = pdoc->stylingBitsMask;
+ // Check base line layout
+ for (int charInDoc = posLineStart; allSame && (charInDoc < posLineEnd); charInDoc++) {
+ char chDoc = pdoc->CharAt(charInDoc);
+ styleByte = pdoc->StyleAt(charInDoc);
+ if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) {
+ allSame = allSame &&
+ (ll->styles[numCharsInLine] == static_cast<char>(styleByte & styleMask));
+ allSame = allSame &&
+ (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
+ if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper)
+ allSame = allSame &&
+ (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
+ else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
+ allSame = allSame &&
+ (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
+ else
+ allSame = allSame &&
+ (ll->chars[numCharsInLine] == chDoc);
+ numCharsInLine++;
+ }
+ }
+ if (allSame) {
+ ll->validity = LineLayout::llPositions;
+ } else {
+ ll->validity = LineLayout::llInvalid;
+ }
+ } else {
+ ll->validity = LineLayout::llInvalid;
+ }
+ }
if (ll->validity == LineLayout::llInvalid) {
ll->widthLine = LineLayout::wrapWidthInfinite;
ll->lines = 1;
ll->edgeColumn = -1;
}
- int posLineEnd = pdoc->LineStart(line + 1);
- Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
char styleByte = 0;
int styleMask = pdoc->stylingBitsMask;
- ll->xHighlightGuide = 0;
- // If the line is very long, limit the treatment to a length that should fit in the viewport
- if (posLineEnd > (posLineStart + ll->maxLineLength)) {
- posLineEnd = posLineStart + ll->maxLineLength;
- }
// Fill base line layout
for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) {
char chDoc = pdoc->CharAt(charInDoc);
numCharsInLine++;
}
}
+ ll->xHighlightGuide = 0;
// Extra element at the end of the line to hold end x position and act as
ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character
ll->styles[numCharsInLine] = styleByte; // For eolFilled
ll->positions[0] = 0;
unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars;
bool lastSegItalics = false;
+ Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) ||
ll->widthLine = width;
if (width == LineLayout::wrapWidthInfinite) {
ll->lines = 1;
+ } else if (width > ll->positions[ll->numCharsInLine]) {
+ // Simple common case where line does not need wrapping.
+ ll->lines = 1;
} else {
ll->lines = 0;
// Calculate line start positions based upon width.
}
void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
- //Platform::DebugPrintf("Paint %d %d - %d %d\n", rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+ //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n",
+ // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+
RefreshStyleData();
PRectangle rcClient = GetClientRectangle();
if (WrapLines()) {
// The wrapping process has changed the height of some lines so abandon this
// paint for a complete repaint.
- paintState = paintAbandoned;
- return;
+ if (AbandonPaint()) {
+ return;
+ }
}
if (!pixmapSelPattern->Initialised()) {
surfaceWindow->SetPalette(&palette, true);
pixmapLine->SetPalette(&palette, !hasFocus);
- //Platform::DebugPrintf("Paint: (%3d,%3d) ... (%3d,%3d)\n",
- // rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
-
int screenLinePaintFirst = rcArea.top / vs.lineHeight;
// The area to be painted plus one extra line is styled.
// The extra line is to determine when a style change, such as starting a comment flows on to other lines.
while (visibleLine < cs.LinesDisplayed() && yposScreen < rcArea.bottom) {
int lineDoc = cs.DocFromDisplay(visibleLine);
- //Platform::DebugPrintf("Painting line %d\n", line);
// Only visible lines should be handled by the code within the loop
PLATFORM_ASSERT(cs.GetVisible(lineDoc));
int lineStartSet = cs.DisplayFromDoc(lineDoc);
return endPosPrint;
}
+int Editor::TextWidth(int style, const char *text) {
+ RefreshStyleData();
+ AutoSurface surface(IsUnicodeMode());
+ if (surface) {
+ return surface->WidthText(vs.styles[style].font, text, strlen(text));
+ } else {
+ return 1;
+ }
+}
+
// Empty method is overridden on GTK+ to show / hide scrollbars
-void Editor::ReconfigureScrollBars() {}
+void Editor::ReconfigureScrollBars() {
+}
void Editor::SetScrollBars() {
RefreshStyleData();
- int nMax = cs.LinesDisplayed();
- int nPage = nMax - MaxScrollPos() + 1;
- bool modified = ModifyScrollBars(nMax, nPage);
+ int nMax = MaxScrollPos();
+ int nPage = LinesOnScreen();
+ bool modified = ModifyScrollBars(nMax + nPage - 1, nPage);
// TODO: ensure always showing as many lines as possible
// May not be, if, for example, window made larger
SetVerticalScrollPos();
Redraw();
}
- if (modified)
- Redraw();
+ if (modified) {
+ if (!AbandonPaint())
+ Redraw();
+ }
//Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage);
}
}
}
}
- pdoc->InsertString(currentPos, s, len);
- SetEmptySelection(currentPos + len);
+ if (pdoc->InsertString(currentPos, s, len)) {
+ SetEmptySelection(currentPos + len);
+ }
EnsureCaretVisible();
// Avoid blinking during rapid typing:
ShowCaretAtCurrentPosition();
if (0 != pdoc->Length()) {
pdoc->DeleteChars(0, pdoc->Length());
}
- cs.Clear();
+ if (!pdoc->IsReadOnly()) {
+ cs.Clear();
+ }
pdoc->EndUndoAction();
anchor = 0;
currentPos = 0;
SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
pdoc->EndUndoAction();
} else {
- int newPos = pdoc->DelCharBack(currentPos);
- SetEmptySelection(newPos);
+ pdoc->DelCharBack(currentPos);
}
}
} else {
char txt[2];
txt[0] = static_cast<char>(ch);
txt[1] = '\0';
- NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
+ NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<sptr_t>(txt));
}
}
NotifyParent(scn);
}
+void Editor::NotifyZoom() {
+ SCNotification scn;
+ scn.nmhdr.code = SCN_ZOOM;
+ NotifyParent(scn);
+}
+
// Notifications from document
void Editor::NotifyModifyAttempt(Document*, void *) {
//Platform::DebugPrintf("** Modify Attempt\n");
void Editor::CheckModificationForWrap(DocModification mh) {
if ((mh.modificationType & SC_MOD_INSERTTEXT) ||
(mh.modificationType & SC_MOD_DELETETEXT)) {
- llc.Invalidate(LineLayout::llInvalid);
+ llc.Invalidate(LineLayout::llCheckTextAndStyle);
if (wrapState != eWrapNone) {
int lineDoc = pdoc->LineFromPosition(mh.position);
if (mh.linesAdded == 0) {
needUpdateUI = true;
if (paintState == painting) {
CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length));
- } else if (paintState == notPainting) {
- CheckModificationForWrap(mh);
- if (mh.modificationType & SC_MOD_CHANGESTYLE) {
+ }
+ CheckModificationForWrap(mh);
+ if (mh.modificationType & SC_MOD_CHANGESTYLE) {
+ if (paintState == notPainting) {
if (mh.position < pdoc->LineStart(topLine)) {
// Styling performed before this view
Redraw();
} else {
InvalidateRange(mh.position, mh.position + mh.length);
}
- } else {
- // Move selection and brace highlights
- if (mh.modificationType & SC_MOD_INSERTTEXT) {
- currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length);
- anchor = MovePositionForInsertion(anchor, mh.position, mh.length);
- braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length);
- braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length);
- } else if (mh.modificationType & SC_MOD_DELETETEXT) {
- currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length);
- anchor = MovePositionForDeletion(anchor, mh.position, mh.length);
- braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
- braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
+ }
+ } else {
+ // Move selection and brace highlights
+ if (mh.modificationType & SC_MOD_INSERTTEXT) {
+ currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length);
+ anchor = MovePositionForInsertion(anchor, mh.position, mh.length);
+ braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length);
+ braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length);
+ } else if (mh.modificationType & SC_MOD_DELETETEXT) {
+ currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length);
+ anchor = MovePositionForDeletion(anchor, mh.position, mh.length);
+ braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
+ braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
+ }
+ if (cs.LinesDisplayed() < cs.LinesInDoc()) {
+ // Some lines are hidden so may need shown.
+ // TODO: check if the modified area is hidden.
+ if (mh.modificationType & SC_MOD_BEFOREINSERT) {
+ NotifyNeedShown(mh.position, mh.length);
+ } else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
+ NotifyNeedShown(mh.position, mh.length);
}
- if (cs.LinesDisplayed() < cs.LinesInDoc()) {
- // Some lines are hidden so may need shown.
- // TODO: check if the modified area is hidden.
- if (mh.modificationType & SC_MOD_BEFOREINSERT) {
- NotifyNeedShown(mh.position, mh.length);
- } else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
- NotifyNeedShown(mh.position, mh.length);
- }
+ }
+ if (mh.linesAdded != 0) {
+ // Update contraction state for inserted and removed lines
+ // lineOfPos should be calculated in context of state before modification, shouldn't it
+ int lineOfPos = pdoc->LineFromPosition(mh.position);
+ if (mh.linesAdded > 0) {
+ cs.InsertLines(lineOfPos, mh.linesAdded);
+ } else {
+ cs.DeleteLines(lineOfPos, -mh.linesAdded);
}
- if (mh.linesAdded != 0) {
- // Update contraction state for inserted and removed lines
- // lineOfPos should be calculated in context of state before modification, shouldn't it
- int lineOfPos = pdoc->LineFromPosition(mh.position);
- if (mh.linesAdded > 0) {
- cs.InsertLines(lineOfPos, mh.linesAdded);
- } else {
- cs.DeleteLines(lineOfPos, -mh.linesAdded);
- }
- // Avoid scrolling of display if change before current display
- if (mh.position < posTopLine) {
- int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
- if (newTop != topLine) {
- SetTopLine(newTop);
- SetVerticalScrollPos();
- }
+ // Avoid scrolling of display if change before current display
+ if (mh.position < posTopLine) {
+ int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
+ if (newTop != topLine) {
+ SetTopLine(newTop);
+ SetVerticalScrollPos();
}
+ }
- //Platform::DebugPrintf("** %x Doc Changed\n", this);
- // TODO: could invalidate from mh.startModification to end of screen
- //InvalidateRange(mh.position, mh.position + mh.length);
+ //Platform::DebugPrintf("** %x Doc Changed\n", this);
+ // TODO: could invalidate from mh.startModification to end of screen
+ //InvalidateRange(mh.position, mh.position + mh.length);
+ if (paintState == notPainting) {
Redraw();
- } else {
- //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
- // mh.position, mh.position + mh.length);
+ }
+ } else {
+ //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
+ // mh.position, mh.position + mh.length);
+ if (paintState == notPainting) {
InvalidateRange(mh.position, mh.position + mh.length);
}
}
- } // else paintState == paintAbandoned so no need to do anything
+ }
if (mh.linesAdded != 0) {
SetScrollBars();
}
if (mh.modificationType & SC_MOD_CHANGEMARKER) {
- RedrawSelMargin();
+ if (paintState == notPainting) {
+ RedrawSelMargin();
+ }
}
// If client wants to see this modification
end = startNext;
char *thisLine = CopyRange(start, end);
pdoc->DeleteChars(start, end - start);
- pdoc->InsertString(startPrev, thisLine, end - start);
- MovePositionTo(startPrev + end - start);
+ if (pdoc->InsertString(startPrev, thisLine, end - start)) {
+ MovePositionTo(startPrev + end - start);
+ }
delete []thisLine;
} else {
// Last line so line has no line end
char *prevEnd = CopyRange(endPrev, start);
pdoc->DeleteChars(endPrev, end - endPrev);
pdoc->InsertString(startPrev, thisLine, end - start);
- pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev);
- MovePositionTo(startPrev + end - endPrev);
+ if (pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev)) {
+ MovePositionTo(startPrev + end - endPrev);
+ }
delete []thisLine;
delete []prevEnd;
}
void Editor::CancelModes() {}
-int Editor::KeyCommand(unsigned int iMessage) {
+void Editor::NewLine() {
+ ClearSelection();
+ const char *eol = "\n";
+ if (pdoc->eolMode == SC_EOL_CRLF) {
+ eol = "\r\n";
+ } else if (pdoc->eolMode == SC_EOL_CR) {
+ eol = "\r";
+ } // else SC_EOL_LF -> "\n" already set
+ if (pdoc->InsertString(currentPos, eol)) {
+ SetEmptySelection(currentPos + strlen(eol));
+ while (*eol) {
+ NotifyChar(*eol);
+ eol++;
+ }
+ }
+ SetLastXChosen();
+ EnsureCaretVisible();
+}
+
+void Editor::CursorUpOrDown(int direction, bool extend) {
Point pt = LocationFromPosition(currentPos);
+ int posNew = PositionFromLocation(
+ Point(lastXChosen, pt.y + direction * vs.lineHeight));
+ if (direction < 0) {
+ // Line wrapping may lead to a location on the same line, so
+ // seek back if that is the case.
+ // There is an equivalent case when moving down which skips
+ // over a line but as that does not trap the user it is fine.
+ Point ptNew = LocationFromPosition(posNew);
+ while ((posNew > 0) && (pt.y == ptNew.y)) {
+ posNew--;
+ ptNew = LocationFromPosition(posNew);
+ }
+ }
+ MovePositionTo(posNew, extend);
+}
+int Editor::KeyCommand(unsigned int iMessage) {
switch (iMessage) {
case SCI_LINEDOWN:
- MovePositionTo(PositionFromLocation(
- Point(lastXChosen, pt.y + vs.lineHeight)));
+ CursorUpOrDown(1);
break;
case SCI_LINEDOWNEXTEND:
- MovePositionTo(PositionFromLocation(
- Point(lastXChosen, pt.y + vs.lineHeight)), true);
+ CursorUpOrDown(1, true);
break;
case SCI_LINESCROLLDOWN:
ScrollTo(topLine + 1);
MoveCaretInsideView();
break;
case SCI_LINEUP:
- MovePositionTo(PositionFromLocation(
- Point(lastXChosen, pt.y - vs.lineHeight)));
+ CursorUpOrDown(-1);
break;
case SCI_LINEUPEXTEND:
- MovePositionTo(PositionFromLocation(
- Point(lastXChosen, pt.y - vs.lineHeight)), true);
+ CursorUpOrDown(-1, true);
break;
case SCI_LINESCROLLUP:
ScrollTo(topLine - 1);
EnsureCaretVisible();
break;
case SCI_NEWLINE:
- ClearSelection();
- if (pdoc->eolMode == SC_EOL_CRLF) {
- pdoc->InsertString(currentPos, "\r\n");
- SetEmptySelection(currentPos + 2);
- NotifyChar('\r');
- NotifyChar('\n');
- } else if (pdoc->eolMode == SC_EOL_CR) {
- pdoc->InsertChar(currentPos, '\r');
- SetEmptySelection(currentPos + 1);
- NotifyChar('\r');
- } else if (pdoc->eolMode == SC_EOL_LF) {
- pdoc->InsertChar(currentPos, '\n');
- SetEmptySelection(currentPos + 1);
- NotifyChar('\n');
- }
- SetLastXChosen();
- EnsureCaretVisible();
+ NewLine();
break;
case SCI_FORMFEED:
AddChar('\f');
SetLastXChosen();
break;
case SCI_ZOOMIN:
- if (vs.zoomLevel < 20)
+ if (vs.zoomLevel < 20) {
vs.zoomLevel++;
- NeedWrapping();
- InvalidateStyleRedraw();
+ NeedWrapping();
+ InvalidateStyleRedraw();
+ NotifyZoom();
+ }
break;
case SCI_ZOOMOUT:
- if (vs.zoomLevel > -10)
+ if (vs.zoomLevel > -10) {
vs.zoomLevel--;
- NeedWrapping();
- InvalidateStyleRedraw();
+ NeedWrapping();
+ InvalidateStyleRedraw();
+ NotifyZoom();
+ }
break;
case SCI_DELWORDLEFT: {
int startWord = pdoc->NextWordStart(currentPos, -1);
pdoc->DeleteChars(startWord, currentPos - startWord);
- MovePositionTo(startWord);
SetLastXChosen();
}
break;
case SCI_DELWORDRIGHT: {
int endWord = pdoc->NextWordStart(currentPos, 1);
pdoc->DeleteChars(currentPos, endWord - currentPos);
- MovePositionTo(currentPos);
}
break;
case SCI_DELLINELEFT: {
int line = pdoc->LineFromPosition(currentPos);
int start = pdoc->LineStart(line);
pdoc->DeleteChars(start, currentPos - start);
- MovePositionTo(start);
SetLastXChosen();
}
break;
int line = pdoc->LineFromPosition(currentPos);
int end = pdoc->LineEnd(line);
pdoc->DeleteChars(currentPos, end - currentPos);
- MovePositionTo(currentPos);
}
break;
case SCI_LINECUT: {
int start = pdoc->LineStart(line);
int end = pdoc->LineStart(line + 1);
pdoc->DeleteChars(start, end - start);
- MovePositionTo(start);
}
break;
case SCI_LINETRANSPOSE:
int lineCurrentPos = pdoc->LineFromPosition(currentPos);
if (lineOfAnchor == lineCurrentPos) {
if (forwards) {
+ pdoc->BeginUndoAction();
ClearSelection();
if (pdoc->GetColumn(currentPos) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) &&
pdoc->tabIndents) {
- pdoc->BeginUndoAction();
int indentation = pdoc->GetLineIndentation(lineCurrentPos);
int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars);
pdoc->SetLineIndentation(lineCurrentPos, indentation + indentationStep);
SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
- pdoc->EndUndoAction();
} else {
if (pdoc->useTabs) {
pdoc->InsertChar(currentPos, '\t');
if (numSpaces < 1)
numSpaces = pdoc->tabInChars;
for (int i = 0; i < numSpaces; i++) {
- pdoc->InsertChar(currentPos, ' ');
+ pdoc->InsertChar(currentPos + i, ' ');
}
SetEmptySelection(currentPos + numSpaces);
}
}
+ pdoc->EndUndoAction();
} else {
if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) &&
pdoc->tabIndents) {
* @return The position of the found text, -1 if not found.
*/
long Editor::FindText(
- unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+ uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
- long lParam) { ///< @c TextToFind structure: The text to search for in the given range.
+ sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range.
TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
int lengthFound = strlen(ft->lpstrText);
*/
long Editor::SearchText(
unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV.
- unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+ uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
- long lParam) { ///< The text to search for.
+ sptr_t lParam) { ///< The text to search for.
const char *txt = reinterpret_cast<char *>(lParam);
int pos;
SetSelection(position, position);
} else {
position = MovePositionOutsideChar(position, currentPos - position);
- pdoc->InsertString(position, value);
+ if (pdoc->InsertString(position, value)) {
+ SetSelection(position + strlen(value), position);
+ }
pdoc->EndUndoAction();
- SetSelection(position + strlen(value), position);
}
} else if (inDragDrop) {
SetSelection(position, position);
if (selStart < selEnd) {
if (drag.len) {
if (ctrl) {
- pdoc->InsertString(newPos, drag.s, drag.len);
+ if (pdoc->InsertString(newPos, drag.s, drag.len)) {
SetSelection(newPos, newPos + drag.len);
+ }
} else if (newPos < selStart) {
pdoc->DeleteChars(selStart, drag.len);
- pdoc->InsertString(newPos, drag.s, drag.len);
- SetSelection(newPos, newPos + drag.len);
+ if (pdoc->InsertString(newPos, drag.s, drag.len)) {
+ SetSelection(newPos, newPos + drag.len);
+ }
} else if (newPos > selEnd) {
pdoc->DeleteChars(selStart, drag.len);
newPos -= drag.len;
- pdoc->InsertString(newPos, drag.s, drag.len);
- SetSelection(newPos, newPos + drag.len);
+ if (pdoc->InsertString(newPos, drag.s, drag.len)) {
+ SetSelection(newPos, newPos + drag.len);
+ }
} else {
SetEmptySelection(newPos);
}
if (IsOverlap(topLine, paintTopLine, lineRangeStart, lineRangeEnd)) {
//Platform::DebugPrintf("Change (%d-%d) in top npv(%d-%d)\n",
// lineRangeStart, lineRangeEnd, topLine, paintTopLine);
- paintState = paintAbandoned;
+ AbandonPaint();
return;
}
}
if (IsOverlap(paintBottomLine, bottomLine, lineRangeStart, lineRangeEnd)) {
//Platform::DebugPrintf("Change (%d-%d) in bottom npv(%d-%d)\n",
// lineRangeStart, lineRangeEnd, paintBottomLine, bottomLine);
- paintState = paintAbandoned;
+ AbandonPaint();
return;
}
}
return wParam < ViewStyle::margins;
}
+static char *CharPtrFromSPtr(sptr_t lParam) {
+ return reinterpret_cast<char *>(lParam);
+}
+
sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
//Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam);
{
if (lParam == 0)
return 0;
- char *ptr = reinterpret_cast<char *>(lParam);
+ if (wParam == 0)
+ return 0;
+ char *ptr = CharPtrFromSPtr(lParam);
unsigned int iChar = 0;
for (; iChar < wParam - 1; iChar++)
ptr[iChar] = pdoc->CharAt(iChar);
return 0;
pdoc->DeleteChars(0, pdoc->Length());
SetEmptySelection(0);
- pdoc->InsertString(0, reinterpret_cast<char *>(lParam));
+ pdoc->InsertString(0, CharPtrFromSPtr(lParam));
return 1;
}
case SCI_CLEAR:
Clear();
SetLastXChosen();
+ EnsureCaretVisible();
break;
case SCI_UNDO:
}
int lineStart = pdoc->LineStart(wParam);
int lineEnd = pdoc->LineStart(wParam + 1);
- char *ptr = reinterpret_cast<char *>(lParam);
+ char *ptr = CharPtrFromSPtr(lParam);
int iPlace = 0;
for (int iChar = lineStart; iChar < lineEnd; iChar++) {
ptr[iPlace++] = pdoc->CharAt(iChar);
return 0;
SelectionText selectedText;
CopySelectionRange(&selectedText);
- char *ptr = reinterpret_cast<char *>(lParam);
+ char *ptr = CharPtrFromSPtr(lParam);
int iChar = 0;
if (selectedText.len) {
for (; iChar < selectedText.len; iChar++)
return 0;
pdoc->BeginUndoAction();
ClearSelection();
- char *replacement = reinterpret_cast<char *>(lParam);
+ char *replacement = CharPtrFromSPtr(lParam);
pdoc->InsertString(currentPos, replacement);
pdoc->EndUndoAction();
SetEmptySelection(currentPos + strlen(replacement));
case SCI_REPLACETARGET:
PLATFORM_ASSERT(lParam);
- return ReplaceTarget(false, reinterpret_cast<char *>(lParam), wParam);
+ return ReplaceTarget(false, CharPtrFromSPtr(lParam), wParam);
case SCI_REPLACETARGETRE:
PLATFORM_ASSERT(lParam);
- return ReplaceTarget(true, reinterpret_cast<char *>(lParam), wParam);
+ return ReplaceTarget(true, CharPtrFromSPtr(lParam), wParam);
case SCI_SEARCHINTARGET:
PLATFORM_ASSERT(lParam);
- return SearchInTarget(reinterpret_cast<char *>(lParam), wParam);
+ return SearchInTarget(CharPtrFromSPtr(lParam), wParam);
case SCI_SETSEARCHFLAGS:
searchFlags = wParam;
case SCI_ADDTEXT: {
if (lParam == 0)
return 0;
- pdoc->InsertString(CurrentPosition(), reinterpret_cast<char *>(lParam), wParam);
+ pdoc->InsertString(CurrentPosition(), CharPtrFromSPtr(lParam), wParam);
SetEmptySelection(currentPos + wParam);
return 0;
}
case SCI_ADDSTYLEDTEXT: {
if (lParam == 0)
return 0;
- pdoc->InsertStyledString(CurrentPosition() * 2, reinterpret_cast<char *>(lParam), wParam);
+ pdoc->InsertStyledString(CurrentPosition() * 2, CharPtrFromSPtr(lParam), wParam);
SetEmptySelection(currentPos + wParam / 2);
return 0;
}
if (static_cast<short>(wParam) == -1)
insertPos = CurrentPosition();
int newCurrent = CurrentPosition();
- int newAnchor = anchor;
- char *sz = reinterpret_cast<char *>(lParam);
+ char *sz = CharPtrFromSPtr(lParam);
pdoc->InsertString(insertPos, sz);
if (newCurrent > insertPos)
newCurrent += strlen(sz);
- if (newAnchor > insertPos)
- newAnchor += strlen(sz);
SetEmptySelection(newCurrent);
return 0;
}
int lineCurrentPos = pdoc->LineFromPosition(currentPos);
int lineStart = pdoc->LineStart(lineCurrentPos);
unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1);
- char *ptr = reinterpret_cast<char *>(lParam);
+ char *ptr = CharPtrFromSPtr(lParam);
unsigned int iPlace = 0;
for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) {
ptr[iPlace++] = pdoc->CharAt(iChar);
case SCI_SETSTYLINGEX: // Specify a complete styling buffer
if (lParam == 0)
return 0;
- pdoc->SetStyles(wParam, reinterpret_cast<char *>(lParam));
+ pdoc->SetStyles(wParam, CharPtrFromSPtr(lParam));
break;
case SCI_SETBUFFEREDDRAW:
case SCI_GETLAYOUTCACHE:
return llc.GetLevel();
+ case SCI_SETSCROLLWIDTH:
+ PLATFORM_ASSERT(wParam > 0);
+ if ((wParam > 0) && (wParam != static_cast<unsigned int >(scrollWidth))) {
+ scrollWidth = wParam;
+ SetScrollBars();
+ }
+ break;
+
+ case SCI_GETSCROLLWIDTH:
+ return scrollWidth;
+
+ case SCI_TEXTWIDTH:
+ PLATFORM_ASSERT((wParam >= 0) && (wParam <= STYLE_MAX));
+ PLATFORM_ASSERT(lParam);
+ return TextWidth(wParam, CharPtrFromSPtr(lParam));
+
+ case SCI_TEXTHEIGHT:
+ return vs.lineHeight;
+
+ case SCI_SETENDATLASTLINE:
+ PLATFORM_ASSERT((wParam == 0) || (wParam ==1));
+ if (endAtLastLine != (wParam != 0)) {
+ endAtLastLine = wParam != 0;
+ SetScrollBars();
+ }
+ break;
+
+ case SCI_GETENDATLASTLINE:
+ return endAtLastLine;
+
case SCI_GETCOLUMN:
return pdoc->GetColumn(wParam);
if (lParam == 0)
return 0;
if (wParam <= STYLE_MAX) {
- vs.SetStyleFontName(wParam, reinterpret_cast<const char *>(lParam));
+ vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam));
InvalidateStyleRedraw();
}
break;
case SCI_SEARCHPREV:
return SearchText(iMessage, wParam, lParam);
- case SCI_SETCARETPOLICY:
- caretPolicy = wParam;
- caretSlop = lParam;
+ case SCI_SETCARETPOLICY: // Deprecated
+ caretXPolicy = caretYPolicy = wParam;
+ caretXSlop = caretYSlop = lParam;
+ break;
+
+ case SCI_SETXCARETPOLICY:
+ caretXPolicy = wParam;
+ caretXSlop = lParam;
+ break;
+
+ case SCI_SETYCARETPOLICY:
+ caretYPolicy = wParam;
+ caretYSlop = lParam;
break;
case SCI_SETVISIBLEPOLICY:
case SCI_SETVIEWEOL:
vs.viewEOL = wParam != 0;
- Redraw();
+ InvalidateStyleRedraw();
break;
case SCI_SETZOOM:
vs.zoomLevel = wParam;
NeedWrapping();
InvalidateStyleRedraw();
+ NotifyZoom();
break;
case SCI_GETZOOM:
enum { wrapWidthInfinite = 0x7ffffff };
int maxLineLength;
int numCharsInLine;
- enum validLevel { llInvalid, llPositions, llLines } validity;
+ enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
int xHighlightGuide;
bool highlightColumn;
int selStart;
}
}
void SetLineStart(int line, int start);
- void SetBracesHighlight(Range rangeLine, Position braces[],
+ void SetBracesHighlight(Range rangeLine, Position braces[],
char bracesMatchStyle, int xHighlight);
void RestoreBracesHighlight(Range rangeLine, Position braces[]);
};
LineLayoutCache();
virtual ~LineLayoutCache();
void Deallocate();
- enum {
- llcNone=SC_CACHE_NONE,
- llcCaret=SC_CACHE_CARET,
- llcPage=SC_CACHE_PAGE,
+ enum {
+ llcNone=SC_CACHE_NONE,
+ llcCaret=SC_CACHE_CARET,
+ llcPage=SC_CACHE_PAGE,
llcDocument=SC_CACHE_DOCUMENT
};
void Invalidate(LineLayout::validLevel validity_);
void SetLevel(int level_);
int GetLevel() { return level; }
- LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
+ LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
int linesOnScreen, int linesInDoc);
void Dispose(LineLayout *ll);
};
int xOffset; ///< Horizontal scrolled amount in pixels
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret
bool horizontalScrollBarVisible;
+ int scrollWidth;
+ bool endAtLastLine;
Surface *pixmapLine;
Surface *pixmapSelMargin;
int xEndSelect;
bool primarySelection;
- int caretPolicy;
- int caretSlop;
+ int caretXPolicy;
+ int caretXSlop; ///< Ensure this many pixels visible on both sides of caret
+
+ int caretYPolicy;
+ int caretYSlop; ///< Ensure this many lines visible on both sides of caret
int visiblePolicy;
int visibleSlop;
int LineFromLocation(Point pt);
void SetTopLine(int topLineNew);
+ bool AbandonPaint();
void RedrawRect(PRectangle rc);
void Redraw();
void RedrawSelMargin();
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
void PaintSelMargin(Surface *surface, PRectangle &rc);
LineLayout *RetrieveLineLayout(int lineNumber);
- void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
+ void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite);
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine=0);
void Paint(Surface *surfaceWindow, PRectangle rcArea);
long FormatRange(bool draw, RangeToFormat *pfr);
+ int TextWidth(int style, const char *text);
virtual void SetVerticalScrollPos() = 0;
virtual void SetHorizontalScrollPos() = 0;
bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
void NotifyNeedShown(int pos, int len);
void NotifyDwelling(Point pt, bool state);
+ void NotifyZoom();
void NotifyModifyAttempt(Document *document, void *userData);
void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
void NotifyModified(Document *document, DocModification mh, void *userData);
void NotifyDeleted(Document *document, void *userData);
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
- void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
+ void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void PageMove(int direction, bool extend=false);
void ChangeCaseOfSelection(bool makeUpperCase);
void LineTranspose();
virtual void CancelModes();
+ void NewLine();
+ void CursorUpOrDown(int direction, bool extend=false);
virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
void Indent(bool forwards);
- long FindText(unsigned long wParam, long lParam);
+ long FindText(uptr_t wParam, sptr_t lParam);
void SearchAnchor();
- long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
+ long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
long SearchInTarget(const char *text, int length);
void GoToLine(int lineNo);
int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_, LexerFunction fnFolder_) :
+ const char *languageName_, LexerFunction fnFolder_,
+ const char * const wordListDescriptions_[]) :
language(language_),
fnLexer(fnLexer_),
fnFolder(fnFolder_),
+ wordListDescriptions(wordListDescriptions_),
languageName(languageName_) {
next = base;
base = this;
}
}
+int LexerModule::GetNumWordLists() const {
+ if (wordListDescriptions == NULL) {
+ return -1;
+ } else {
+ int numWordLists = 0;
+
+ while (wordListDescriptions[numWordLists]) {
+ ++numWordLists;
+ }
+
+ return numWordLists;
+ }
+}
+
+const char * LexerModule::GetWordListDescription(int index) const {
+ static const char *emptyStr = "";
+
+ PLATFORM_ASSERT(index < GetNumWordLists());
+ if (index >= GetNumWordLists()) {
+ return emptyStr;
+ } else {
+ return wordListDescriptions[index];
+ }
+}
+
const LexerModule *LexerModule::Find(int language) {
const LexerModule *lm = base;
while (lm) {
LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
-#ifdef __vms
-#define LINK_LEXERS
-#endif
-
-#ifdef LINK_LEXERS
-
-// The following code forces a reference to all of the Scintilla lexers.
-// If we don't do something like this, then the linker tends to "optimize"
-// them away. (eric@sourcegear.com)
-
-// Taken from wxWindow's stc.cpp. Walter.
-
+// Alternative historical name for Scintilla_LinkLexers
int wxForceScintillaLexers(void) {
return Scintilla_LinkLexers();
}
+// To add or remove a lexer, add or remove its file and run LexGen.py.
+
+// Force a reference to all of the Scintilla lexers so that the linker will
+// not remove the code of the lexers.
int Scintilla_LinkLexers() {
- extern LexerModule lmAda;
- extern LexerModule lmAVE;
- extern LexerModule lmBaan;
- extern LexerModule lmBatch;
- extern LexerModule lmConf;
- extern LexerModule lmCPP;
- extern LexerModule lmDiff;
- extern LexerModule lmEiffel;
- extern LexerModule lmEiffelkw;
- extern LexerModule lmErrorList;
- extern LexerModule lmHTML;
- extern LexerModule lmLatex;
- extern LexerModule lmLISP;
- extern LexerModule lmLua;
- extern LexerModule lmMake;
- extern LexerModule lmMatlab;
- extern LexerModule lmPascal;
- extern LexerModule lmPerl;
- extern LexerModule lmProps;
- extern LexerModule lmPython;
- extern LexerModule lmRuby;
- extern LexerModule lmSQL;
- extern LexerModule lmVB;
- extern LexerModule lmXML;
- extern LexerModule lmBullant;
-
- if (
- &lmAda
- && &lmAVE
- && &lmBaan
- && &lmConf
- && &lmDiff
- && &lmLatex
- && &lmPascal
- && &lmCPP
- && &lmHTML
- && &lmXML
- && &lmProps
- && &lmErrorList
- && &lmMake
- && &lmMatlab
- && &lmBatch
- && &lmPerl
- && &lmPython
- && &lmSQL
- && &lmVB
- && &lmRuby
- && &lmEiffel
- && &lmEiffelkw
- && &lmLISP
- && &lmLua
- && &lmNull
- && &lmBullant
- )
- {
- return 1;
- }
- else
- {
- return 0;
- }
+ static int forcer = 0;
+
+// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
+#define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage();
+
+//++Autogenerated -- run src/LexGen.py to regenerate
+//**\(\tLINK_LEXER(\*);\n\)
+ LINK_LEXER(lmAda);
+ LINK_LEXER(lmAVE);
+ LINK_LEXER(lmBaan);
+ LINK_LEXER(lmBullant);
+ LINK_LEXER(lmConf);
+ LINK_LEXER(lmCPP);
+ LINK_LEXER(lmTCL);
+ LINK_LEXER(lmNncrontab);
+ LINK_LEXER(lmEiffel);
+ LINK_LEXER(lmEiffelkw);
+ LINK_LEXER(lmHTML);
+ LINK_LEXER(lmXML);
+ LINK_LEXER(lmASP);
+ LINK_LEXER(lmPHP);
+ LINK_LEXER(lmLISP);
+ LINK_LEXER(lmLua);
+ LINK_LEXER(lmMatlab);
+ LINK_LEXER(lmBatch);
+ LINK_LEXER(lmDiff);
+ LINK_LEXER(lmProps);
+ LINK_LEXER(lmMake);
+ LINK_LEXER(lmErrorList);
+ LINK_LEXER(lmLatex);
+ LINK_LEXER(lmPascal);
+ LINK_LEXER(lmPerl);
+ LINK_LEXER(lmPython);
+ LINK_LEXER(lmRuby);
+ LINK_LEXER(lmSQL);
+ LINK_LEXER(lmVB);
+ LINK_LEXER(lmVBScript);
+
+//--Autogenerated -- end of automatically generated section
+
+ return 1;
}
-#endif
for (; sc.More(); sc.Forward()) {
+ if (sc.atLineStart && (sc.state == SCE_C_STRING)) {
+ // Prevent SCE_C_STRINGEOL from leaking back to previous line
+ sc.SetState(SCE_C_STRING);
+ }
+
// Handle line continuation generically.
if (sc.ch == '\\') {
- if (sc.Match("\\\n")) {
- sc.Forward();
- sc.Forward();
- continue;
- }
- if (sc.Match("\\\r\n")) {
- sc.Forward();
- sc.Forward();
+ if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
+ if (sc.ch == '\r' && sc.chNext == '\n') {
+ sc.Forward();
+ }
continue;
}
}
sc.Complete();
}
+static bool IsStreamCommentStyle(int style) {
+ return style == SCE_C_COMMENT ||
+ style == SCE_C_COMMENTDOC ||
+ style == SCE_C_COMMENTDOCKEYWORD ||
+ style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+ bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
- if (foldComment &&
- (style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC)) {
- if (style != stylePrev) {
+ if (foldComment && IsStreamCommentStyle(style)) {
+ if (!IsStreamCommentStyle(stylePrev)) {
levelCurrent++;
- } else if ((style != styleNext) && !atEOL) {
+ } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelCurrent--;
}
}
+ if (foldComment && (style == SCE_C_COMMENTLINE)) {
+ if ((ch == '/') && (chNext == '/')) {
+ char chNext2 = styler.SafeGetCharAt(i + 2);
+ if (chNext2 == '{') {
+ levelCurrent++;
+ } else if (chNext2 == '}') {
+ levelCurrent--;
+ }
+ }
+ }
+ if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
+ if (ch == '#') {
+ unsigned int j=i+1;
+ while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+ j++;
+ }
+ if (styler.Match(j, "region") || styler.Match(j, "if")) {
+ levelCurrent++;
+ } else if (styler.Match(j, "end")) {
+ levelCurrent--;
+ }
+ }
+ }
if (style == SCE_C_OPERATOR) {
if (ch == '{') {
levelCurrent++;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
-LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc);
-LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc);
+static const char * const cppWordLists[] = {
+ "Primary keywords and identifiers",
+ "Secondary keywords and identifiers",
+ "Documentation comment keywords",
+ 0,
+};
+
+LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc, cppWordLists);
+LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc, cppWordLists);
/** @file LexCrontab.cxx
** Lexer to use with extended crontab files used by a powerful
** Windows scheduler/event monitor/automation manager nnCron.
- ** (http://nemtsev.virtualave.net/)
+ ** (http://nemtsev.eserv.ru/)
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
state = SCE_NNCRONTAB_TASK;
styler.ColourTo(i,SCE_NNCRONTAB_TASK);
}
- else if( ch == '\\' && styler.SafeGetCharAt(i+1) == ' ') {
+ else if( ch == '\\' && (styler.SafeGetCharAt(i+1) == ' ' ||
+ styler.SafeGetCharAt(i+1) == '\t')) {
// signals the start of an extended comment...
state = SCE_NNCRONTAB_COMMENT;
styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
// signals environment variables
state = SCE_NNCRONTAB_ENVIRONMENT;
styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
+ } else if( ch == '<' && styler.SafeGetCharAt(i+1) == '%') {
+ // signals environment variables
+ state = SCE_NNCRONTAB_ENVIRONMENT;
+ styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
} else if( ch == '*' ) {
// signals an asterisk
// no state jump necessary for this simple case...
break;
}
if( (ch == '%' && styler.SafeGetCharAt(i-1)!='\\')
- || (ch == '\n') || (ch == '\r') ) {
+ || (ch == '\n') || (ch == '\r') || (ch == '>') ) {
state = SCE_NNCRONTAB_DEFAULT;
styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
break;
case SCE_NNCRONTAB_IDENTIFIER:
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric
if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') ||
- (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ) {
+ (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ||
+ (ch == '@') ) {
buffer[bufferCount++] = ch;
} else {
state = SCE_NNCRONTAB_DEFAULT;
isScript = 0 == strcmp(s, "script");
}
}
- if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords)
+ if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords) {
// No keywords -> all are known
chAttr = SCE_H_TAG;
+ isScript = 0 == strcmp(s, "script");
+ }
styler.ColourTo(end, chAttr);
return isScript ? SCE_H_SCRIPT : chAttr;
}
//case SCE_HJ_COMMENTLINE:
case SCE_HJ_DOUBLESTRING:
case SCE_HJ_SINGLESTRING:
+ case SCE_HJ_REGEX:
case SCE_HB_STRING:
case SCE_HP_STRING:
case SCE_HP_TRIPLE:
sc.Complete();
}
-LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
-LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
-LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp");
-LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php");
+static const char * const htmlWordListDesc[] = {
+ "HTML elements and attributes",
+ "JavaScript keywords",
+ "VBScript keywords",
+ "Python keywords",
+ "PHP keywords",
+ "SGML and DTD keywords",
+ 0,
+};
+
+LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc);
+LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc);
+LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc);
+LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc);
**
** Written by Paul Winwood.
** Folder by Alexey Yutkin.
- ** Modified by Marcos E. Wurzius
+ ** Modified by Marcos E. Wurzius & Philippe Lhoste
**/
#include <stdlib.h>
#include "Scintilla.h"
#include "SciLexer.h"
+#define SCE_LUA_LAST_STYLE SCE_LUA_WORD6
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
-
inline bool isLuaOperator(char ch) {
if (isalnum(ch))
return false;
return false;
}
-
-static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
- Accessor &styler) {
+static void ColouriseLuaDoc(
+ unsigned int startPos,
+ int length,
+ int initStyle,
+ WordList *keywordlists[],
+ Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
- int literalString = 0;
- int literalStringFlag =0;
+
+ // Must initialize the literal string nesting level, if we are inside such a string.
+ int literalStringLevel = 0;
+ if (initStyle == SCE_LUA_LITERALSTRING) {
+ literalStringLevel = 1;
+ }
+ // We use states above the last one to indicate nesting level of literal strings
+ if (initStyle > SCE_LUA_LAST_STYLE) {
+ literalStringLevel = initStyle - SCE_LUA_LAST_STYLE + 1;
+ }
// Do not leak onto next line
- if (initStyle == SCE_LUA_STRINGEOL)
+ if (initStyle == SCE_LUA_STRINGEOL) {
initStyle = SCE_LUA_DEFAULT;
+ }
StyleContext sc(startPos, length, initStyle, styler);
- if(startPos == 0 && sc.ch == '#') sc.SetState(SCE_LUA_COMMENTLINE);
+ if (startPos == 0 && sc.ch == '#') {
+ sc.SetState(SCE_LUA_COMMENTLINE);
+ }
for (; sc.More(); sc.Forward()) {
-
- // Handle line continuation generically.
- if (sc.ch == '\\') {
- if (sc.Match("\\\n")) {
- sc.Forward();
- sc.Forward();
- continue;
- }
- if (sc.Match("\\\r\n")) {
- sc.Forward();
- sc.Forward();
+ if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) {
+ // Prevent SCE_LUA_STRINGEOL from leaking back to previous line
+ sc.SetState(SCE_LUA_STRING);
+ }
+
+ // Handle string line continuation
+ if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) &&
+ sc.ch == '\\') {
+ if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
+ if (sc.ch == '\r' && sc.chNext == '\n') {
+ sc.Forward();
+ }
continue;
}
}
}
sc.SetState(SCE_LUA_DEFAULT);
}
-
-
} else if (sc.state == SCE_LUA_COMMENTLINE ) {
if (sc.atLineEnd) {
sc.SetState(SCE_LUA_DEFAULT);
}
+ } else if (sc.state == SCE_LUA_PREPROCESSOR ) {
+ if (sc.atLineEnd) {
+ sc.SetState(SCE_LUA_DEFAULT);
+ }
} else if (sc.state == SCE_LUA_STRING) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.ChangeState(SCE_LUA_STRINGEOL);
sc.ForwardSetState(SCE_LUA_DEFAULT);
}
-
} else if (sc.state == SCE_LUA_CHARACTER) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.ChangeState(SCE_LUA_STRINGEOL);
sc.ForwardSetState(SCE_LUA_DEFAULT);
}
- } else if (sc.state == SCE_LUA_LITERALSTRING) {
- if (sc.chPrev == '[' && sc.ch == '[' && literalStringFlag != 1) {
- literalString++;
- literalStringFlag = 1;
- }
- else if (sc.chPrev == ']' && sc.ch == ']' && literalStringFlag != 2 ) {
- if((--literalString == 1))
+ } else if (sc.state == SCE_LUA_LITERALSTRING || sc.state > SCE_LUA_LAST_STYLE) {
+ if (sc.Match('[', '[')) {
+ literalStringLevel++;
+ sc.SetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
+ } else if (sc.Match(']', ']') && literalStringLevel > 0) {
+ literalStringLevel--;
+ sc.Forward();
+ if (literalStringLevel == 0) {
sc.ForwardSetState(SCE_LUA_DEFAULT);
- literalStringFlag = 2;
+ } else if (literalStringLevel == 1) {
+ sc.ForwardSetState(SCE_LUA_LITERALSTRING);
+ } else {
+ sc.ForwardSetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
+ }
}
- else literalStringFlag = 0;
- }
+ }
// Determine if a new state should be entered.
if (sc.state == SCE_LUA_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
- sc.SetState(SCE_LUA_NUMBER);
- } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
- sc.SetState(SCE_LUA_IDENTIFIER);
- } else if (sc.ch == '\"') {
+ sc.SetState(SCE_LUA_NUMBER);
+ } else if (IsAWordStart(sc.ch)) {
+ sc.SetState(SCE_LUA_IDENTIFIER);
+ } else if (sc.Match('\"')) {
sc.SetState(SCE_LUA_STRING);
- } else if (sc.ch == '\'') {
+ } else if (sc.Match('\'')) {
sc.SetState(SCE_LUA_CHARACTER);
- } else if (sc.ch == '[' && sc.chNext == '[') {
+ } else if (sc.Match('[', '[')) {
+ literalStringLevel = 1;
sc.SetState(SCE_LUA_LITERALSTRING);
- literalString = 1;
- } else if (sc.ch == '-' && sc.chNext == '-') {
+ sc.Forward();
+ } else if (sc.Match('-', '-')) {
sc.SetState(SCE_LUA_COMMENTLINE);
+ sc.Forward();
+ } else if (sc.Match('$') && sc.atLineStart) {
+ sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code
} else if (isLuaOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_LUA_OPERATOR);
}
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
int styleNext = styler.StyleAt(startPos);
char s[10];
+
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LUA_WORD) {
- if ( ch == 'i' || ch == 'e' || ch == 't' || ch == 'd' || ch == 'f') {
+ if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e') {
for (unsigned int j = 0; j < 8; j++) {
- if (!iswordchar(styler[i + j]))
+ if (!iswordchar(styler[i + j])) {
break;
+ }
s[j] = styler[i + j];
s[j + 1] = '\0';
}
-
- if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0)
- || (strcmp(s, "function") == 0))
+
+ if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0)) {
levelCurrent++;
- if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0))
+ }
+ if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) {
levelCurrent--;
-
+ }
}
- }
- else if (style == SCE_LUA_OPERATOR)
- {
- if(ch == '{' || ch == '(')
+ } else if (style == SCE_LUA_OPERATOR) {
+ if (ch == '{' || ch == '(') {
levelCurrent++;
- else if(ch == '}' || ch == ')')
+ } else if (ch == '}' || ch == ')') {
levelCurrent--;
+ }
}
-
+
if (atEOL) {
int lev = levelPrev;
- if (visibleChars == 0 && foldCompact)
+ if (visibleChars == 0 && foldCompact) {
lev |= SC_FOLDLEVELWHITEFLAG;
- if ((levelCurrent > levelPrev) && (visibleChars > 0))
+ }
+ if ((levelCurrent > levelPrev) && (visibleChars > 0)) {
lev |= SC_FOLDLEVELHEADERFLAG;
+ }
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
levelPrev = levelCurrent;
visibleChars = 0;
}
- if (!isspacechar(ch))
+ if (!isspacechar(ch)) {
visibleChars++;
+ }
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
// difference starts then each line starting with ' ' is a whitespace
// otherwise it is considered a comment (Only in..., Binary file...)
if (0 == strncmp(lineBuffer, "diff ", 3)) {
- styler.ColourTo(endLine, 2);
+ styler.ColourTo(endLine, SCE_DIFF_COMMAND);
} else if (0 == strncmp(lineBuffer, "--- ", 3)) {
- styler.ColourTo(endLine, 3);
+ styler.ColourTo(endLine, SCE_DIFF_HEADER);
} else if (0 == strncmp(lineBuffer, "+++ ", 3)) {
- styler.ColourTo(endLine, 3);
+ styler.ColourTo(endLine, SCE_DIFF_HEADER);
+ } else if (0 == strncmp(lineBuffer, "***", 3)) {
+ styler.ColourTo(endLine, SCE_DIFF_HEADER);
} else if (lineBuffer[0] == '@') {
- styler.ColourTo(endLine, 4);
+ styler.ColourTo(endLine, SCE_DIFF_POSITION);
} else if (lineBuffer[0] == '-') {
- styler.ColourTo(endLine, 5);
+ styler.ColourTo(endLine, SCE_DIFF_DELETED);
} else if (lineBuffer[0] == '+') {
- styler.ColourTo(endLine, 6);
+ styler.ColourTo(endLine, SCE_DIFF_ADDED);
} else if (lineBuffer[0] != ' ') {
- styler.ColourTo(endLine, 1);
+ styler.ColourTo(endLine, SCE_DIFF_COMMENT);
} else {
- styler.ColourTo(endLine, 0);
+ styler.ColourTo(endLine, SCE_DIFF_DEFAULT);
}
}
i++;
if (i < lengthLine) {
if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
- styler.ColourTo(endPos, 1);
+ styler.ColourTo(endPos, SCE_PROPS_COMMENT);
} else if (lineBuffer[i] == '[') {
- styler.ColourTo(endPos, 2);
+ styler.ColourTo(endPos, SCE_PROPS_SECTION);
} else if (lineBuffer[i] == '@') {
- styler.ColourTo(startLine + i, 4);
+ styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
if (lineBuffer[++i] == '=')
- styler.ColourTo(startLine + i, 3);
- styler.ColourTo(endPos, 0);
+ styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
+ styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
// Search for the '=' character
while ((i < lengthLine) && (lineBuffer[i] != '='))
i++;
if ((i < lengthLine) && (lineBuffer[i] == '=')) {
- styler.ColourTo(startLine + i - 1, 0);
+ styler.ColourTo(startLine + i - 1, SCE_PROPS_DEFAULT);
styler.ColourTo(startLine + i, 3);
- styler.ColourTo(endPos, 0);
+ styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
- styler.ColourTo(endPos, 0);
+ styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
}
}
} else {
- styler.ColourTo(endPos, 0);
+ styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
}
}
state = 1;
} else if ((state == 0) && (lineBuffer[i] == '(')) {
state = 10;
+ } else if ((state == 0) && (lineBuffer[i] == '\t')) {
+ state = 20;
} else if ((state == 1) && isdigit(lineBuffer[i])) {
state = 2;
} else if ((state == 2) && (lineBuffer[i] == ':')) {
break;
} else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
state = 99;
+ } else if ((state == 20) && isdigit(lineBuffer[i])) {
+ state = 24;
+ break;
+ } else if ((state == 20) && ((lineBuffer[i] == '/') && (lineBuffer[i+1] == '^'))) {
+ state = 21;
+ } else if ((state == 21) && ((lineBuffer[i] == '$') && (lineBuffer[i+1] == '/'))) {
+ state = 22;
+ break;
}
}
if (state == 3) {
styler.ColourTo(endPos, SCE_ERR_GCC);
} else if ((state == 13) || (state == 14) || (state == 15)) {
styler.ColourTo(endPos, SCE_ERR_MS);
+ } else if (((state == 22) || (state == 24)) && (lineBuffer[0] != '\t')) {
+ styler.ColourTo(endPos, SCE_ERR_CTAG);
} else {
styler.ColourTo(endPos, SCE_ERR_DEFAULT);
}
styler.ColourTo(lengthDoc - 1, state);
}
-LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl");
+static const char * const perlWordListDesc[] = {
+ "Perl keywords",
+ 0
+};
+
+LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", 0, perlWordListDesc);
//styler.SetLevel(lineCurrent, indentCurrent);
}
-LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
+static const char * const pythonWordListDesc[] = {
+ "Python keywords",
+ 0
+};
+
+LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc,
+ pythonWordListDesc);
return *a - *b;
}
-int CompareNCaseInsensitive(const char *a, const char *b, int len) {
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
while (*a && *b && len) {
if (*a != *b) {
char upperA = MakeUpperCase(*a);
return 0 == CompareCaseInsensitive(a, b);
}
-inline unsigned int HashString(const char *s, int len) {
+inline unsigned int HashString(const char *s, size_t len) {
unsigned int ret = 0;
while (len--) {
ret <<= 4;
if (!*key) // Empty keys are not supported
return;
if (lenKey == -1)
- lenKey = strlen(key);
+ lenKey = static_cast<int>(strlen(key));
if (lenVal == -1)
- lenVal = strlen(val);
+ lenVal = static_cast<int>(strlen(val));
unsigned int hash = HashString(key, lenKey);
for (Property *p = props[hash % hashRoots]; p; p = p->next) {
if ((hash == p->hash) &&
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
char *var = StringDup(cpvar + 2, lenvar);
SString val = GetExpanded(var);
- int newlenbase = strlen(base) + val.length() - lenvar;
+ size_t newlenbase = strlen(base) + val.length() - lenvar;
char *newbase = new char[newlenbase];
strncpy(newbase, base, cpvar - base);
strcpy(newbase + (cpvar - base), val.c_str());
}
static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) {
- int lentarget = strlen(target);
- int lensuffix = strlen(suffix);
+ size_t lentarget = strlen(target);
+ size_t lensuffix = strlen(suffix);
if (lensuffix > lentarget)
return false;
- for (int i = lensuffix - 1; i >= 0; i--) {
+ for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) {
if (MakeUpperCase(target[i + lentarget - lensuffix]) !=
MakeUpperCase(suffix[i]))
return false;
int lenvar = cpendvar - cpvar - 2; // Subtract the $()
char *var = StringDup(cpvar + 2, lenvar);
SString val = GetWild(var, filename);
- int newlenbase = strlen(base) + val.length() - lenvar;
+ size_t newlenbase = strlen(base) + val.length() - lenvar;
char *newbase = new char[newlenbase];
strncpy(newbase, base, cpvar - base);
strcpy(newbase + (cpvar - base), val.c_str());
}
char *PropSet::ToString() {
- unsigned int len=0;
+ size_t len=0;
for (int r = 0; r < hashRoots; r++) {
for (Property *p = props[r]; p; p = p->next) {
len += strlen(p->key) + 1;
if (keywords) {
words = 0;
prev = '\0';
- int slen = strlen(wordlist);
- for (int k = 0; k < slen; k++) {
+ size_t slen = strlen(wordlist);
+ for (size_t k = 0; k < slen; k++) {
if (!iswordsep(wordlist[k], onlyLineEnds)) {
if (!prev) {
keywords[words] = &wordlist[k];
* Modification history:
*
* $Log$
- * Revision 1.3 2002/03/18 22:31:00 RD
- * Updated wxSTC from Scintilla 1.40 to Scintilla 1.45
+ * Revision 1.4 2002/09/06 16:58:12 RD
+ * Updated to Scintilla from 1.45 to 1.47
*
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
* Addition of new target methods - versions of ReplaceTarget that take counted
}
void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
- bool acActiveBeforeCharAdded = ac.Active();
- if (!acActiveBeforeCharAdded || !ac.IsFillUpChar(*s))
+ bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
+ if (!isFillUp) {
Editor::AddCharUTF(s, len, treatAsDBCS);
- if (acActiveBeforeCharAdded)
+ }
+ if (ac.Active()) {
AutoCompleteChanged(s[0]);
+ // For fill ups add the character after the autocompletion has
+ // triggered so containers see the key so can display a calltip.
+ if (isFillUp) {
+ Editor::AddCharUTF(s, len, treatAsDBCS);
+ }
+ }
}
void ScintillaBase::Command(int cmdId) {
void ScintillaBase::AutoCompleteChanged(char ch) {
if (ac.IsFillUpChar(ch)) {
- AutoCompleteCompleted(ch);
+ AutoCompleteCompleted();
} else if (currentPos <= ac.posStart - ac.startLen) {
ac.Cancel();
} else if (ac.cancelAtStartPos && currentPos <= ac.posStart) {
}
}
-void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
+void ScintillaBase::AutoCompleteCompleted() {
int item = ac.lb.GetSelection();
char selected[1000];
if (item != -1) {
SetEmptySelection(ac.posStart);
if (item != -1) {
SString piece = selected;
- if (fillUp)
- piece += fillUp;
pdoc->InsertString(firstPos, piece.c_str());
SetEmptySelection(firstPos + piece.length());
}
}
void ScintillaBase::ContextMenu(Point pt) {
- bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
- popup.CreatePopUp();
- AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
- AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
- AddToPopUp("");
- AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
- AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
- AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
- AddToPopUp("Delete", idcmdDelete, writable && currentPos != anchor);
- AddToPopUp("");
- AddToPopUp("Select All", idcmdSelectAll);
- popup.Show(pt, wMain);
+ if (displayPopupMenu) {
+ bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
+ popup.CreatePopUp();
+ AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
+ AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
+ AddToPopUp("");
+ AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
+ AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
+ AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
+ AddToPopUp("Delete", idcmdDelete, writable && currentPos != anchor);
+ AddToPopUp("");
+ AddToPopUp("Select All", idcmdSelectAll);
+ popup.Show(pt, wMain);
+ }
}
void ScintillaBase::CancelModes() {
void AutoCompleteCancel();
void AutoCompleteMove(int delta);
void AutoCompleteChanged(char ch=0);
- void AutoCompleteCompleted(char fillUp='\0');
+ void AutoCompleteCompleted();
void AutoCompleteMoveToCurrentWord();
static void AutoCompleteDoubleClick(void* p);
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
}
+inline bool IsASpaceOrTab(unsigned int ch) {
+ return (ch == ' ') || (ch == '\t');
+}
+
inline bool IsADigit(unsigned int ch) {
return (ch >= '0') && (ch <= '9');
}
endPos = lenDoc;
TextRange tr = {{startPos, endPos}, buf};
- Platform::SendScintilla(id, SCI_GETTEXTRANGE, 0, reinterpret_cast<long>(&tr));
+ Platform::SendScintillaPointer(id, SCI_GETTEXTRANGE, 0, &tr);
+}
+
+bool WindowAccessor::Match(int pos, const char *s) {
+ for (int i=0; *s; i++) {
+ if (*s != SafeGetCharAt(pos+i))
+ return false;
+ s++;
+ }
+ return true;
}
char WindowAccessor::StyleAt(int position) {
startPos = extremePosition;
lenDoc = -1;
if (validLen > 0) {
- Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen,
- reinterpret_cast<long>(styleBuf));
+ Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
+ styleBuf);
validLen = 0;
}
}
DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
+DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
#ifdef LINK_LEXERS
// forces the linking of the lexer modules
-int wxForceScintillaLexers();
+int Scintilla_LinkLexers();
#endif
//----------------------------------------------------------------------
wxDefaultValidator, name)
{
#ifdef LINK_LEXERS
- wxForceScintillaLexers();
+ Scintilla_LinkLexers();
#endif
m_swx = new ScintillaWX(this);
m_stopWatch.Start();
// this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
-// Add text to the document
+// Add text to the document.
void wxStyledTextCtrl::AddText(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
SendMsg(2001, strlen(buf), (long)(const char*)buf);
}
-// Add array of cells to document
+// Add array of cells to document.
void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
SendMsg(2002, data.GetDataLen(), (long)data.GetData());
}
-// Insert string at a position
+// Insert string at a position.
void wxStyledTextCtrl::InsertText(int pos, const wxString& text) {
SendMsg(2003, pos, (long)(const char*)wx2stc(text));
}
-// Delete all text in the document
+// Delete all text in the document.
void wxStyledTextCtrl::ClearAll() {
SendMsg(2004, 0, 0);
}
-// Set all style bytes to 0, remove all folding information
+// Set all style bytes to 0, remove all folding information.
void wxStyledTextCtrl::ClearDocumentStyle() {
SendMsg(2005, 0, 0);
}
-// The number of characters in the document
+// The number of characters in the document.
int wxStyledTextCtrl::GetLength() {
return SendMsg(2006, 0, 0);
}
-// Returns the character byte at the position
+// Returns the character byte at the position.
int wxStyledTextCtrl::GetCharAt(int pos) {
return (unsigned char)SendMsg(2007, pos, 0);
}
-// Returns the position of the caret
+// Returns the position of the caret.
int wxStyledTextCtrl::GetCurrentPos() {
return SendMsg(2008, 0, 0);
}
-// Returns the position of the opposite end of the selection to the caret
+// Returns the position of the opposite end of the selection to the caret.
int wxStyledTextCtrl::GetAnchor() {
return SendMsg(2009, 0, 0);
}
-// Returns the style byte at the position
+// Returns the style byte at the position.
int wxStyledTextCtrl::GetStyleAt(int pos) {
return (unsigned char)SendMsg(2010, pos, 0);
}
-// Redoes the next action on the undo history
+// Redoes the next action on the undo history.
void wxStyledTextCtrl::Redo() {
SendMsg(2011, 0, 0);
}
return buf;
}
-// Are there any redoable actions in the undo history.
+// Are there any redoable actions in the undo history?
bool wxStyledTextCtrl::CanRedo() {
return SendMsg(2016, 0, 0) != 0;
}
-// Retrieve the line number at which a particular marker is located
+// Retrieve the line number at which a particular marker is located.
int wxStyledTextCtrl::MarkerLineFromHandle(int handle) {
return SendMsg(2017, handle, 0);
}
}
// Set the current styling position to pos and the styling mask to mask.
-// The styling mask can be used to protect some bits in each styling byte from
-// modification.
+// The styling mask can be used to protect some bits in each styling byte from modification.
void wxStyledTextCtrl::StartStyling(int pos, int mask) {
SendMsg(2032, pos, mask);
}
SendMsg(2033, length, style);
}
-// Is drawing done first into a buffer or direct to the screen.
+// Is drawing done first into a buffer or direct to the screen?
bool wxStyledTextCtrl::GetBufferedDraw() {
return SendMsg(2034, 0, 0) != 0;
}
SendMsg(2035, buffered, 0);
}
-// Change the visible size of a tab to be a multiple of the width of a space
-// character.
+// Change the visible size of a tab to be a multiple of the width of a space character.
void wxStyledTextCtrl::SetTabWidth(int tabWidth) {
SendMsg(2036, tabWidth, 0);
}
return SendMsg(2043, line, markerNumber);
}
-// Delete a marker from a line
+// Delete a marker from a line.
void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber) {
SendMsg(2044, line, markerNumber);
}
-// Delete all markers with a particular number from all lines
+// Delete all markers with a particular number from all lines.
void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber) {
SendMsg(2045, markerNumber, 0);
}
SendMsg(2076, periodMilliseconds, 0);
}
-// Set the set of characters making up words for when moving or selecting
-// by word.
+// Set the set of characters making up words for when moving or selecting by word.
void wxStyledTextCtrl::SetWordChars(const wxString& characters) {
SendMsg(2077, 0, (long)(const char*)wx2stc(characters));
}
return wxColourFromLong(c);
}
-// 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
+// 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.
void wxStyledTextCtrl::SetStyleBits(int bits) {
SendMsg(2090, bits, 0);
return SendMsg(2095, 0, 0) != 0;
}
-// Dsplay the background of the line containing the caret in a different colour.
+// Display the background of the line containing the caret in a different colour.
void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
SendMsg(2096, show, 0);
}
return SendMsg(2102, 0, 0) != 0;
}
-// Retrieve the position of the caret when the auto-completion list was
-// displayed.
+// Retrieve the position of the caret when the auto-completion list was displayed.
int wxStyledTextCtrl::AutoCompPosStart() {
return SendMsg(2103, 0, 0);
}
SendMsg(2105, 0, (long)(const char*)wx2stc(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.
+// Change the separator character in the string setting up an auto-completion list.
+// Default is space but can be changed if items contain space.
void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter) {
SendMsg(2106, separatorCharacter, 0);
}
SendMsg(2117, listType, (long)(const char*)wx2stc(itemList));
}
-// Set whether or not autocompletion is hidden automatically when nothing matches
+// Set whether or not autocompletion is hidden automatically when nothing matches.
void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide) {
SendMsg(2118, autoHide, 0);
}
-// Retrieve whether or not autocompletion is hidden automatically when nothing matches
+// Retrieve whether or not autocompletion is hidden automatically when nothing matches.
bool wxStyledTextCtrl::AutoCompGetAutoHide() {
return SendMsg(2119, 0, 0) != 0;
}
-// Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+// Set whether or not autocompletion deletes any word characters
+// after the inserted text upon completion.
void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord) {
SendMsg(2270, dropRestOfWord, 0);
}
-// Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+// Retrieve whether or not autocompletion deletes any word characters
+// after the inserted text upon completion.
bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
return SendMsg(2271, 0, 0) != 0;
}
return SendMsg(2150, flags, (long)&ft);
}
-// On Windows will draw the document into a display context such as a printer.
+// On Windows, will draw the document into a display context such as a printer.
int wxStyledTextCtrl::FormatRange(bool doDraw,
int startPos,
int endPos,
return SendMsg(2173, 0, 0) != 0;
}
-// Are there any undoable actions in the undo history.
+// Are there any undoable actions in the undo history?
bool wxStyledTextCtrl::CanUndo() {
return SendMsg(2174, 0, 0) != 0;
}
return SendMsg(2183, 0, 0);
}
-// Set to overtype (true) or insert mode
+// Set to overtype (true) or insert mode.
void wxStyledTextCtrl::SetOvertype(bool overtype) {
SendMsg(2186, overtype, 0);
}
return SendMsg(2187, 0, 0) != 0;
}
-// Set the width of the insert mode caret
+// Set the width of the insert mode caret.
void wxStyledTextCtrl::SetCaretWidth(int pixelWidth) {
SendMsg(2188, pixelWidth, 0);
}
-// Returns the width of the insert mode caret
+// Returns the width of the insert mode caret.
int wxStyledTextCtrl::GetCaretWidth() {
return SendMsg(2189, 0, 0);
}
return SendMsg(2197, strlen(buf), (long)(const char*)buf);
}
-// Set the search flags used by SearchInTarget
+// Set the search flags used by SearchInTarget.
void wxStyledTextCtrl::SetSearchFlags(int flags) {
SendMsg(2198, flags, 0);
}
-// Get the search flags used by SearchInTarget
+// Get the search flags used by SearchInTarget.
int wxStyledTextCtrl::GetSearchFlags() {
return SendMsg(2199, 0, 0);
}
SendMsg(2232, line, 0);
}
-// Set some debugging options for folding
+// Set some debugging options for folding.
void wxStyledTextCtrl::SetFoldFlags(int flags) {
SendMsg(2233, flags, 0);
}
SendMsg(2234, line, 0);
}
-// Sets whether a tab pressed when caret is within indentation indents
+// Sets whether a tab pressed when caret is within indentation indents.
void wxStyledTextCtrl::SetTabIndents(bool tabIndents) {
SendMsg(2260, tabIndents, 0);
}
return SendMsg(2261, 0, 0) != 0;
}
-// Sets whether a backspace pressed when caret is within indentation unindents
+// Sets whether a backspace pressed when caret is within indentation unindents.
void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents) {
SendMsg(2262, bsUnIndents, 0);
}
return SendMsg(2263, 0, 0) != 0;
}
-// Sets the time the mouse must sit still to generate a mouse dwell event
+// Sets the time the mouse must sit still to generate a mouse dwell event.
void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds) {
SendMsg(2264, periodMilliseconds, 0);
}
-// Retrieve the time the mouse must sit still to generate a mouse dwell event
+// Retrieve the time the mouse must sit still to generate a mouse dwell event.
int wxStyledTextCtrl::GetMouseDwellTime() {
return SendMsg(2265, 0, 0);
}
-// Get position of start of word
+// Get position of start of word.
int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters) {
return SendMsg(2266, pos, onlyWordCharacters);
}
-// Get position of end of word
+// Get position of end of word.
int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters) {
return SendMsg(2267, pos, onlyWordCharacters);
}
-// Sets whether text is word wrapped
+// Sets whether text is word wrapped.
void wxStyledTextCtrl::SetWrapMode(int mode) {
SendMsg(2268, mode, 0);
}
-// Retrieve whether text is word wrapped
+// Retrieve whether text is word wrapped.
int wxStyledTextCtrl::GetWrapMode() {
return SendMsg(2269, 0, 0);
}
-// Sets the degree of caching of layout information
+// Sets the degree of caching of layout information.
void wxStyledTextCtrl::SetLayoutCache(int mode) {
SendMsg(2272, mode, 0);
}
-// Retrieve the degree of caching of layout information
+// Retrieve the degree of caching of layout information.
int wxStyledTextCtrl::GetLayoutCache() {
return SendMsg(2273, 0, 0);
}
-// Move the caret inside current view if it's not there already
+// Sets the document width assumed for scrolling.
+void wxStyledTextCtrl::SetScrollWidth(int pixelWidth) {
+ SendMsg(2274, pixelWidth, 0);
+}
+
+// Retrieve the document width assumed for scrolling.
+int wxStyledTextCtrl::GetScrollWidth() {
+ return SendMsg(2275, 0, 0);
+}
+
+// Measure the pixel width of some text in a particular style.
+// Nul terminated text argument.
+// Does not handle tab or control characters.
+int wxStyledTextCtrl::TextWidth(int style, const wxString& text) {
+ return SendMsg(2276, style, (long)(const char*)wx2stc(text));
+}
+
+// Sets the scroll range so that maximum scroll position has
+// the last line at the bottom of the view (default).
+// Setting this to false allows scrolling one page below the last line.
+void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine) {
+ SendMsg(2277, endAtLastLine, 0);
+}
+
+// Retrieve whether the maximum scroll position has the last
+// line at the bottom of the view.
+int wxStyledTextCtrl::GetEndAtLastLine() {
+ return SendMsg(2278, 0, 0);
+}
+
+// Retrieve the height of a particular line of text in pixels.
+int wxStyledTextCtrl::TextHeight(int line) {
+ return SendMsg(2279, line, 0);
+}
+
+// Move the caret inside current view if it's not there already.
void wxStyledTextCtrl::MoveCaretInsideView() {
SendMsg(2401, 0, 0);
}
-// How many characters are on a line, not including end of line characters.
+// How many characters are on a line, not including end of line characters?
int wxStyledTextCtrl::LineLength(int line) {
return SendMsg(2350, line, 0);
}
return SendMsg(2353, pos, 0);
}
-// Are the end of line characters visible.
+// Are the end of line characters visible?
bool wxStyledTextCtrl::GetViewEOL() {
return SendMsg(2355, 0, 0) != 0;
}
-// Make the end of line characters visible or invisible
+// Make the end of line characters visible or invisible.
void wxStyledTextCtrl::SetViewEOL(bool visible) {
SendMsg(2356, visible, 0);
}
return SendMsg(2368, flags, (long)(const char*)wx2stc(text));
}
-// Set the way the line the caret is on is kept visible.
-void wxStyledTextCtrl::SetCaretPolicy(int caretPolicy, int caretSlop) {
- SendMsg(2369, caretPolicy, caretSlop);
-}
-
// Retrieves the number of lines completely visible.
int wxStyledTextCtrl::LinesOnScreen() {
return SendMsg(2370, 0, 0);
SendMsg(2371, allowPopUp, 0);
}
-// Is the selection a rectangular. The alternative is the more common stream selection.
+// Is the selection rectangular? The alternative is the more common stream selection.
bool wxStyledTextCtrl::SelectionIsRectangle() {
return SendMsg(2372, 0, 0) != 0;
}
return SendMsg(2378, 0, 0);
}
-// Change internal focus flag
+// Change internal focus flag.
void wxStyledTextCtrl::SetSTCFocus(bool focus) {
SendMsg(2380, focus, 0);
}
-// Get internal focus flag
+// Get internal focus flag.
bool wxStyledTextCtrl::GetSTCFocus() {
return SendMsg(2381, 0, 0) != 0;
}
-// Change error status - 0 = OK
+// Change error status - 0 = OK.
void wxStyledTextCtrl::SetStatus(int statusCode) {
SendMsg(2382, statusCode, 0);
}
-// Get error status
+// Get error status.
int wxStyledTextCtrl::GetStatus() {
return SendMsg(2383, 0, 0);
}
-// Set whether the mouse is captured when its button is pressed
+// Set whether the mouse is captured when its button is pressed.
void wxStyledTextCtrl::SetMouseDownCaptures(bool captures) {
SendMsg(2384, captures, 0);
}
-// Get whether mouse gets captured
+// Get whether mouse gets captured.
bool wxStyledTextCtrl::GetMouseDownCaptures() {
return SendMsg(2385, 0, 0) != 0;
}
-// Sets the cursor to one of the SC_CURSOR* values
+// Sets the cursor to one of the SC_CURSOR* values.
void wxStyledTextCtrl::SetCursor(int cursorType) {
SendMsg(2386, cursorType, 0);
}
-// Get cursor type
+// Get cursor type.
int wxStyledTextCtrl::GetCursor() {
return SendMsg(2387, 0, 0);
}
// Change the way control characters are displayed:
-// If symbol is < 32, keep the drawn way, else, use the given character
+// If symbol is < 32, keep the drawn way, else, use the given character.
void wxStyledTextCtrl::SetControlCharSymbol(int symbol) {
SendMsg(2388, symbol, 0);
}
-// Get the way control characters are displayed
+// Get the way control characters are displayed.
int wxStyledTextCtrl::GetControlCharSymbol() {
return SendMsg(2389, 0, 0);
}
-// Move to the previous change in capitalistion
+// Move to the previous change in capitalisation.
void wxStyledTextCtrl::WordPartLeft() {
SendMsg(2390, 0, 0);
}
-// Move to the previous change in capitalistion extending selection to new caret position.
+// Move to the previous change in capitalisation extending selection
+// to new caret position.
void wxStyledTextCtrl::WordPartLeftExtend() {
SendMsg(2391, 0, 0);
}
-// Move to the change next in capitalistion
+// Move to the change next in capitalisation.
void wxStyledTextCtrl::WordPartRight() {
SendMsg(2392, 0, 0);
}
-// Move to the next change in capitalistion extending selection to new caret position.
+// Move to the next change in capitalisation extending selection
+// to new caret position.
void wxStyledTextCtrl::WordPartRightExtend() {
SendMsg(2393, 0, 0);
}
-// Set the way the display area is determined when a particular line is to be moved to.
+// Set the way the display area is determined when a particular line
+// is to be moved to by Find, FindNext, GotoLine, etc.
void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop) {
SendMsg(2394, visiblePolicy, visibleSlop);
}
-// Delete back from the current position to the start of the line
+// Delete back from the current position to the start of the line.
void wxStyledTextCtrl::DelLineLeft() {
SendMsg(2395, 0, 0);
}
-// Delete forwards from the current position to the end of the line
+// Delete forwards from the current position to the end of the line.
void wxStyledTextCtrl::DelLineRight() {
SendMsg(2396, 0, 0);
}
-// Get and Set the xOffset (ie, horizonal scroll position)
+// Get and Set the xOffset (ie, horizonal scroll position).
void wxStyledTextCtrl::SetXOffset(int newOffset) {
SendMsg(2397, newOffset, 0);
}
return SendMsg(2398, 0, 0);
}
+// Set the way the caret is kept visible when going sideway.
+// The exclusion zone is given in pixels.
+void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop) {
+ SendMsg(2402, caretPolicy, caretSlop);
+}
+
+// Set the way the line the caret is on is kept visible.
+// The exclusion zone is given in lines.
+void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop) {
+ SendMsg(2403, caretPolicy, caretSlop);
+}
+
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord() {
SendMsg(3001, 0, 0);
evt.SetY(scn.y);
break;
+ case SCN_ZOOM:
+ evt.SetEventType(wxEVT_STC_ZOOM);
+ break;
+
default:
return;
}
DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
+DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
#ifdef LINK_LEXERS
// forces the linking of the lexer modules
-int wxForceScintillaLexers();
+int Scintilla_LinkLexers();
#endif
//----------------------------------------------------------------------
wxDefaultValidator, name)
{
#ifdef LINK_LEXERS
- wxForceScintillaLexers();
+ Scintilla_LinkLexers();
#endif
m_swx = new ScintillaWX(this);
m_stopWatch.Start();
evt.SetY(scn.y);
break;
+ case SCN_ZOOM:
+ evt.SetEventType(wxEVT_STC_ZOOM);
+ break;
+
default:
return;
}
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM, 1672)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_START_DRAG,
wxEVT_STC_DRAG_OVER,
wxEVT_STC_DO_DROP,
+ wxEVT_STC_ZOOM,
};
#endif
#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif
//----------------------------------------------------------------------
Added wxBufferedDC.
-Upgraded wxSTC from Scintilla 1.40 to Scintilla 1.45
+Upgraded wxSTC from Scintilla 1.40 to Scintilla 1.45, and then again
+to version 1.47.
UNICODE!
wxWindows/wxPython can be compiled with unicode support enabled or
return _resultobj;
}
+#define wxStyledTextCtrl_SetScrollWidth(_swigobj,_swigarg0) (_swigobj->SetScrollWidth(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetScrollWidth(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ int _arg1;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self","pixelWidth", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetScrollWidth",_kwnames,&_argo0,&_arg1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetScrollWidth. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_SetScrollWidth(_arg0,_arg1);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetScrollWidth(_swigobj) (_swigobj->GetScrollWidth())
+static PyObject *_wrap_wxStyledTextCtrl_GetScrollWidth(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ int _result;
+ wxStyledTextCtrl * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetScrollWidth",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetScrollWidth. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ _result = (int )wxStyledTextCtrl_GetScrollWidth(_arg0);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_TextWidth(_swigobj,_swigarg0,_swigarg1) (_swigobj->TextWidth(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_TextWidth(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ int _result;
+ wxStyledTextCtrl * _arg0;
+ int _arg1;
+ wxString * _arg2;
+ PyObject * _argo0 = 0;
+ PyObject * _obj2 = 0;
+ char *_kwnames[] = { "self","style","text", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_TextWidth",_kwnames,&_argo0,&_arg1,&_obj2))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_TextWidth. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ _arg2 = wxString_in_helper(_obj2);
+ if (_arg2 == NULL)
+ return NULL;
+}
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ _result = (int )wxStyledTextCtrl_TextWidth(_arg0,_arg1,*_arg2);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+{
+ if (_obj2)
+ delete _arg2;
+}
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetEndAtLastLine(_swigobj,_swigarg0) (_swigobj->SetEndAtLastLine(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetEndAtLastLine(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ bool _arg1;
+ PyObject * _argo0 = 0;
+ int tempbool1;
+ char *_kwnames[] = { "self","endAtLastLine", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEndAtLastLine",_kwnames,&_argo0,&tempbool1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEndAtLastLine. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+ _arg1 = (bool ) tempbool1;
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_SetEndAtLastLine(_arg0,_arg1);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetEndAtLastLine(_swigobj) (_swigobj->GetEndAtLastLine())
+static PyObject *_wrap_wxStyledTextCtrl_GetEndAtLastLine(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ int _result;
+ wxStyledTextCtrl * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEndAtLastLine",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEndAtLastLine. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ _result = (int )wxStyledTextCtrl_GetEndAtLastLine(_arg0);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_TextHeight(_swigobj,_swigarg0) (_swigobj->TextHeight(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_TextHeight(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ int _result;
+ wxStyledTextCtrl * _arg0;
+ int _arg1;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self","line", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_TextHeight",_kwnames,&_argo0,&_arg1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_TextHeight. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ _result = (int )wxStyledTextCtrl_TextHeight(_arg0,_arg1);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+ return _resultobj;
+}
+
#define wxStyledTextCtrl_MoveCaretInsideView(_swigobj) (_swigobj->MoveCaretInsideView())
static PyObject *_wrap_wxStyledTextCtrl_MoveCaretInsideView(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
return _resultobj;
}
-#define wxStyledTextCtrl_SetCaretPolicy(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetCaretPolicy(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_SetCaretPolicy(PyObject *self, PyObject *args, PyObject *kwargs) {
- PyObject * _resultobj;
- wxStyledTextCtrl * _arg0;
- int _arg1;
- int _arg2;
- PyObject * _argo0 = 0;
- char *_kwnames[] = { "self","caretPolicy","caretSlop", NULL };
-
- self = self;
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetCaretPolicy",_kwnames,&_argo0,&_arg1,&_arg2))
- return NULL;
- if (_argo0) {
- if (_argo0 == Py_None) { _arg0 = NULL; }
- else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
- PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretPolicy. Expected _wxStyledTextCtrl_p.");
- return NULL;
- }
- }
-{
- PyThreadState* __tstate = wxPyBeginAllowThreads();
- wxStyledTextCtrl_SetCaretPolicy(_arg0,_arg1,_arg2);
-
- wxPyEndAllowThreads(__tstate);
- if (PyErr_Occurred()) return NULL;
-} Py_INCREF(Py_None);
- _resultobj = Py_None;
- return _resultobj;
-}
-
#define wxStyledTextCtrl_LinesOnScreen(_swigobj) (_swigobj->LinesOnScreen())
static PyObject *_wrap_wxStyledTextCtrl_LinesOnScreen(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
return _resultobj;
}
+#define wxStyledTextCtrl_SetXCaretPolicy(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetXCaretPolicy(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetXCaretPolicy(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ int _arg1;
+ int _arg2;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self","caretPolicy","caretSlop", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetXCaretPolicy",_kwnames,&_argo0,&_arg1,&_arg2))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetXCaretPolicy. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_SetXCaretPolicy(_arg0,_arg1,_arg2);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetYCaretPolicy(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetYCaretPolicy(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetYCaretPolicy(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextCtrl * _arg0;
+ int _arg1;
+ int _arg2;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self","caretPolicy","caretSlop", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetYCaretPolicy",_kwnames,&_argo0,&_arg1,&_arg2))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetYCaretPolicy. Expected _wxStyledTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxStyledTextCtrl_SetYCaretPolicy(_arg0,_arg1,_arg2);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
#define wxStyledTextCtrl_StartRecord(_swigobj) (_swigobj->StartRecord())
static PyObject *_wrap_wxStyledTextCtrl_StartRecord(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
{ "wxStyledTextCtrl_SetLexer", (PyCFunction) _wrap_wxStyledTextCtrl_SetLexer, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_StopRecord", (PyCFunction) _wrap_wxStyledTextCtrl_StopRecord, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_StartRecord", (PyCFunction) _wrap_wxStyledTextCtrl_StartRecord, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_SetYCaretPolicy", (PyCFunction) _wrap_wxStyledTextCtrl_SetYCaretPolicy, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_SetXCaretPolicy", (PyCFunction) _wrap_wxStyledTextCtrl_SetXCaretPolicy, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_GetXOffset", (PyCFunction) _wrap_wxStyledTextCtrl_GetXOffset, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SetXOffset", (PyCFunction) _wrap_wxStyledTextCtrl_SetXOffset, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_DelLineRight", (PyCFunction) _wrap_wxStyledTextCtrl_DelLineRight, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SelectionIsRectangle", (PyCFunction) _wrap_wxStyledTextCtrl_SelectionIsRectangle, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_UsePopUp", (PyCFunction) _wrap_wxStyledTextCtrl_UsePopUp, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_LinesOnScreen", (PyCFunction) _wrap_wxStyledTextCtrl_LinesOnScreen, METH_VARARGS | METH_KEYWORDS },
- { "wxStyledTextCtrl_SetCaretPolicy", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretPolicy, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SearchPrev", (PyCFunction) _wrap_wxStyledTextCtrl_SearchPrev, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SearchNext", (PyCFunction) _wrap_wxStyledTextCtrl_SearchNext, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SearchAnchor", (PyCFunction) _wrap_wxStyledTextCtrl_SearchAnchor, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_BraceHighlight", (PyCFunction) _wrap_wxStyledTextCtrl_BraceHighlight, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_LineLength", (PyCFunction) _wrap_wxStyledTextCtrl_LineLength, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_MoveCaretInsideView", (PyCFunction) _wrap_wxStyledTextCtrl_MoveCaretInsideView, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_TextHeight", (PyCFunction) _wrap_wxStyledTextCtrl_TextHeight, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_GetEndAtLastLine", (PyCFunction) _wrap_wxStyledTextCtrl_GetEndAtLastLine, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_SetEndAtLastLine", (PyCFunction) _wrap_wxStyledTextCtrl_SetEndAtLastLine, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_TextWidth", (PyCFunction) _wrap_wxStyledTextCtrl_TextWidth, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_GetScrollWidth", (PyCFunction) _wrap_wxStyledTextCtrl_GetScrollWidth, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextCtrl_SetScrollWidth", (PyCFunction) _wrap_wxStyledTextCtrl_SetScrollWidth, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_GetLayoutCache", (PyCFunction) _wrap_wxStyledTextCtrl_GetLayoutCache, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_SetLayoutCache", (PyCFunction) _wrap_wxStyledTextCtrl_SetLayoutCache, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextCtrl_GetWrapMode", (PyCFunction) _wrap_wxStyledTextCtrl_GetWrapMode, METH_VARARGS | METH_KEYWORDS },
PyDict_SetItemString(d,"wxSTC_EDGE_NONE", PyInt_FromLong((long) 0));
PyDict_SetItemString(d,"wxSTC_EDGE_LINE", PyInt_FromLong((long) 1));
PyDict_SetItemString(d,"wxSTC_EDGE_BACKGROUND", PyInt_FromLong((long) 2));
- PyDict_SetItemString(d,"wxSTC_CARET_SLOP", PyInt_FromLong((long) 0x01));
- PyDict_SetItemString(d,"wxSTC_CARET_CENTER", PyInt_FromLong((long) 0x02));
- PyDict_SetItemString(d,"wxSTC_CARET_STRICT", PyInt_FromLong((long) 0x04));
- PyDict_SetItemString(d,"wxSTC_CARET_XEVEN", PyInt_FromLong((long) 0x08));
- PyDict_SetItemString(d,"wxSTC_CARET_XJUMPS", PyInt_FromLong((long) 0x10));
PyDict_SetItemString(d,"wxSTC_CURSORNORMAL", PyInt_FromLong((long) -1));
PyDict_SetItemString(d,"wxSTC_CURSORWAIT", PyInt_FromLong((long) 3));
PyDict_SetItemString(d,"wxSTC_VISIBLE_SLOP", PyInt_FromLong((long) 0x01));
PyDict_SetItemString(d,"wxSTC_VISIBLE_STRICT", PyInt_FromLong((long) 0x04));
+ PyDict_SetItemString(d,"wxSTC_CARET_SLOP", PyInt_FromLong((long) 0x01));
+ PyDict_SetItemString(d,"wxSTC_CARET_STRICT", PyInt_FromLong((long) 0x04));
+ PyDict_SetItemString(d,"wxSTC_CARET_JUMPS", PyInt_FromLong((long) 0x10));
+ PyDict_SetItemString(d,"wxSTC_CARET_EVEN", PyInt_FromLong((long) 0x08));
PyDict_SetItemString(d,"wxSTC_MOD_INSERTTEXT", PyInt_FromLong((long) 0x1));
PyDict_SetItemString(d,"wxSTC_MOD_DELETETEXT", PyInt_FromLong((long) 0x2));
PyDict_SetItemString(d,"wxSTC_MOD_CHANGESTYLE", PyInt_FromLong((long) 0x4));
PyDict_SetItemString(d,"wxSTC_LEX_PHP", PyInt_FromLong((long) 30));
PyDict_SetItemString(d,"wxSTC_LEX_BAAN", PyInt_FromLong((long) 31));
PyDict_SetItemString(d,"wxSTC_LEX_MATLAB", PyInt_FromLong((long) 32));
+ PyDict_SetItemString(d,"wxSTC_LEX_SCRIPTOL", PyInt_FromLong((long) 33));
PyDict_SetItemString(d,"wxSTC_LEX_AUTOMATIC", PyInt_FromLong((long) 1000));
PyDict_SetItemString(d,"wxSTC_P_DEFAULT", PyInt_FromLong((long) 0));
PyDict_SetItemString(d,"wxSTC_P_COMMENTLINE", PyInt_FromLong((long) 1));
PyDict_SetItemString(d,"wxSTC_C_WORD2", PyInt_FromLong((long) 16));
PyDict_SetItemString(d,"wxSTC_C_COMMENTDOCKEYWORD", PyInt_FromLong((long) 17));
PyDict_SetItemString(d,"wxSTC_C_COMMENTDOCKEYWORDERROR", PyInt_FromLong((long) 18));
- PyDict_SetItemString(d,"wxSTC_B_DEFAULT", PyInt_FromLong((long) 0));
- PyDict_SetItemString(d,"wxSTC_B_COMMENT", PyInt_FromLong((long) 1));
- PyDict_SetItemString(d,"wxSTC_B_NUMBER", PyInt_FromLong((long) 2));
- PyDict_SetItemString(d,"wxSTC_B_KEYWORD", PyInt_FromLong((long) 3));
- PyDict_SetItemString(d,"wxSTC_B_STRING", PyInt_FromLong((long) 4));
- PyDict_SetItemString(d,"wxSTC_B_PREPROCESSOR", PyInt_FromLong((long) 5));
- PyDict_SetItemString(d,"wxSTC_B_OPERATOR", PyInt_FromLong((long) 6));
- PyDict_SetItemString(d,"wxSTC_B_IDENTIFIER", PyInt_FromLong((long) 7));
- PyDict_SetItemString(d,"wxSTC_B_DATE", PyInt_FromLong((long) 8));
PyDict_SetItemString(d,"wxSTC_H_DEFAULT", PyInt_FromLong((long) 0));
PyDict_SetItemString(d,"wxSTC_H_TAG", PyInt_FromLong((long) 1));
PyDict_SetItemString(d,"wxSTC_H_TAGUNKNOWN", PyInt_FromLong((long) 2));
PyDict_SetItemString(d,"wxSTC_PL_STRING_QX", PyInt_FromLong((long) 28));
PyDict_SetItemString(d,"wxSTC_PL_STRING_QR", PyInt_FromLong((long) 29));
PyDict_SetItemString(d,"wxSTC_PL_STRING_QW", PyInt_FromLong((long) 30));
+ PyDict_SetItemString(d,"wxSTC_B_DEFAULT", PyInt_FromLong((long) 0));
+ PyDict_SetItemString(d,"wxSTC_B_COMMENT", PyInt_FromLong((long) 1));
+ PyDict_SetItemString(d,"wxSTC_B_NUMBER", PyInt_FromLong((long) 2));
+ PyDict_SetItemString(d,"wxSTC_B_KEYWORD", PyInt_FromLong((long) 3));
+ PyDict_SetItemString(d,"wxSTC_B_STRING", PyInt_FromLong((long) 4));
+ PyDict_SetItemString(d,"wxSTC_B_PREPROCESSOR", PyInt_FromLong((long) 5));
+ PyDict_SetItemString(d,"wxSTC_B_OPERATOR", PyInt_FromLong((long) 6));
+ PyDict_SetItemString(d,"wxSTC_B_IDENTIFIER", PyInt_FromLong((long) 7));
+ PyDict_SetItemString(d,"wxSTC_B_DATE", PyInt_FromLong((long) 8));
+ PyDict_SetItemString(d,"wxSTC_PROPS_DEFAULT", PyInt_FromLong((long) 0));
+ PyDict_SetItemString(d,"wxSTC_PROPS_COMMENT", PyInt_FromLong((long) 1));
+ PyDict_SetItemString(d,"wxSTC_PROPS_SECTION", PyInt_FromLong((long) 2));
+ PyDict_SetItemString(d,"wxSTC_PROPS_ASSIGNMENT", PyInt_FromLong((long) 3));
+ PyDict_SetItemString(d,"wxSTC_PROPS_DEFVAL", PyInt_FromLong((long) 4));
PyDict_SetItemString(d,"wxSTC_L_DEFAULT", PyInt_FromLong((long) 0));
PyDict_SetItemString(d,"wxSTC_L_COMMAND", PyInt_FromLong((long) 1));
PyDict_SetItemString(d,"wxSTC_L_TAG", PyInt_FromLong((long) 2));
PyDict_SetItemString(d,"wxSTC_ERR_PERL", PyInt_FromLong((long) 6));
PyDict_SetItemString(d,"wxSTC_ERR_NET", PyInt_FromLong((long) 7));
PyDict_SetItemString(d,"wxSTC_ERR_LUA", PyInt_FromLong((long) 8));
+ PyDict_SetItemString(d,"wxSTC_ERR_CTAG", PyInt_FromLong((long) 9));
PyDict_SetItemString(d,"wxSTC_ERR_DIFF_CHANGED", PyInt_FromLong((long) 10));
PyDict_SetItemString(d,"wxSTC_ERR_DIFF_ADDITION", PyInt_FromLong((long) 11));
PyDict_SetItemString(d,"wxSTC_ERR_DIFF_DELETION", PyInt_FromLong((long) 12));
PyDict_SetItemString(d,"wxSTC_MAKE_OPERATOR", PyInt_FromLong((long) 4));
PyDict_SetItemString(d,"wxSTC_MAKE_TARGET", PyInt_FromLong((long) 5));
PyDict_SetItemString(d,"wxSTC_MAKE_IDEOL", PyInt_FromLong((long) 9));
+ PyDict_SetItemString(d,"wxSTC_DIFF_DEFAULT", PyInt_FromLong((long) 0));
+ PyDict_SetItemString(d,"wxSTC_DIFF_COMMENT", PyInt_FromLong((long) 1));
+ PyDict_SetItemString(d,"wxSTC_DIFF_COMMAND", PyInt_FromLong((long) 2));
+ PyDict_SetItemString(d,"wxSTC_DIFF_HEADER", PyInt_FromLong((long) 3));
+ PyDict_SetItemString(d,"wxSTC_DIFF_POSITION", PyInt_FromLong((long) 4));
+ PyDict_SetItemString(d,"wxSTC_DIFF_DELETED", PyInt_FromLong((long) 5));
+ PyDict_SetItemString(d,"wxSTC_DIFF_ADDED", PyInt_FromLong((long) 6));
PyDict_SetItemString(d,"wxSTC_CONF_DEFAULT", PyInt_FromLong((long) 0));
PyDict_SetItemString(d,"wxSTC_CONF_COMMENT", PyInt_FromLong((long) 1));
PyDict_SetItemString(d,"wxSTC_CONF_NUMBER", PyInt_FromLong((long) 2));
PyDict_SetItemString(d,"wxSTC_MATLAB_STRING", PyInt_FromLong((long) 5));
PyDict_SetItemString(d,"wxSTC_MATLAB_OPERATOR", PyInt_FromLong((long) 6));
PyDict_SetItemString(d,"wxSTC_MATLAB_IDENTIFIER", PyInt_FromLong((long) 7));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_DEFAULT", PyInt_FromLong((long) 0));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENT", PyInt_FromLong((long) 1));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTLINE", PyInt_FromLong((long) 2));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTDOC", PyInt_FromLong((long) 3));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_NUMBER", PyInt_FromLong((long) 4));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_WORD", PyInt_FromLong((long) 5));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_STRING", PyInt_FromLong((long) 6));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_CHARACTER", PyInt_FromLong((long) 7));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_UUID", PyInt_FromLong((long) 8));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_PREPROCESSOR", PyInt_FromLong((long) 9));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_OPERATOR", PyInt_FromLong((long) 10));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_IDENTIFIER", PyInt_FromLong((long) 11));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_STRINGEOL", PyInt_FromLong((long) 12));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_VERBATIM", PyInt_FromLong((long) 13));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_REGEX", PyInt_FromLong((long) 14));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTLINEDOC", PyInt_FromLong((long) 15));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_WORD2", PyInt_FromLong((long) 16));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTDOCKEYWORD", PyInt_FromLong((long) 17));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR", PyInt_FromLong((long) 18));
+ PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTBASIC", PyInt_FromLong((long) 19));
PyDict_SetItemString(d,"wxSTCNameStr", PyString_FromString("wxSTCNameStr"));
PyDict_SetItemString(d,"STC_USE_DND", PyInt_FromLong((long) 1));
PyDict_SetItemString(d,"wxEVT_STC_CHANGE", PyInt_FromLong((long) wxEVT_STC_CHANGE));
PyDict_SetItemString(d,"wxEVT_STC_START_DRAG", PyInt_FromLong((long) wxEVT_STC_START_DRAG));
PyDict_SetItemString(d,"wxEVT_STC_DRAG_OVER", PyInt_FromLong((long) wxEVT_STC_DRAG_OVER));
PyDict_SetItemString(d,"wxEVT_STC_DO_DROP", PyInt_FromLong((long) wxEVT_STC_DO_DROP));
+ PyDict_SetItemString(d,"wxEVT_STC_ZOOM", PyInt_FromLong((long) wxEVT_STC_ZOOM));
wxClassInfo::CleanUpClasses();
def EVT_STC_DO_DROP(win, id, func):
win.Connect(id, -1, wxEVT_STC_DO_DROP, func)
+def EVT_STC_ZOOM(win, id, func):
+ win.Connect(id, -1, wxEVT_STC_ZOOM, func)
+
class wxStyledTextCtrlPtr(wxControlPtr):
def __init__(self,this):
def GetLayoutCache(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_GetLayoutCache,(self,) + _args, _kwargs)
return val
+ def SetScrollWidth(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_SetScrollWidth,(self,) + _args, _kwargs)
+ return val
+ def GetScrollWidth(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_GetScrollWidth,(self,) + _args, _kwargs)
+ return val
+ def TextWidth(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_TextWidth,(self,) + _args, _kwargs)
+ return val
+ def SetEndAtLastLine(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_SetEndAtLastLine,(self,) + _args, _kwargs)
+ return val
+ def GetEndAtLastLine(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_GetEndAtLastLine,(self,) + _args, _kwargs)
+ return val
+ def TextHeight(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_TextHeight,(self,) + _args, _kwargs)
+ return val
def MoveCaretInsideView(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_MoveCaretInsideView,(self,) + _args, _kwargs)
return val
def SearchPrev(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_SearchPrev,(self,) + _args, _kwargs)
return val
- def SetCaretPolicy(self, *_args, **_kwargs):
- val = apply(stc_c.wxStyledTextCtrl_SetCaretPolicy,(self,) + _args, _kwargs)
- return val
def LinesOnScreen(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_LinesOnScreen,(self,) + _args, _kwargs)
return val
def GetXOffset(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_GetXOffset,(self,) + _args, _kwargs)
return val
+ def SetXCaretPolicy(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_SetXCaretPolicy,(self,) + _args, _kwargs)
+ return val
+ def SetYCaretPolicy(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextCtrl_SetYCaretPolicy,(self,) + _args, _kwargs)
+ return val
def StartRecord(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextCtrl_StartRecord,(self,) + _args, _kwargs)
return val
wxSTC_EDGE_NONE = stc_c.wxSTC_EDGE_NONE
wxSTC_EDGE_LINE = stc_c.wxSTC_EDGE_LINE
wxSTC_EDGE_BACKGROUND = stc_c.wxSTC_EDGE_BACKGROUND
-wxSTC_CARET_SLOP = stc_c.wxSTC_CARET_SLOP
-wxSTC_CARET_CENTER = stc_c.wxSTC_CARET_CENTER
-wxSTC_CARET_STRICT = stc_c.wxSTC_CARET_STRICT
-wxSTC_CARET_XEVEN = stc_c.wxSTC_CARET_XEVEN
-wxSTC_CARET_XJUMPS = stc_c.wxSTC_CARET_XJUMPS
wxSTC_CURSORNORMAL = stc_c.wxSTC_CURSORNORMAL
wxSTC_CURSORWAIT = stc_c.wxSTC_CURSORWAIT
wxSTC_VISIBLE_SLOP = stc_c.wxSTC_VISIBLE_SLOP
wxSTC_VISIBLE_STRICT = stc_c.wxSTC_VISIBLE_STRICT
+wxSTC_CARET_SLOP = stc_c.wxSTC_CARET_SLOP
+wxSTC_CARET_STRICT = stc_c.wxSTC_CARET_STRICT
+wxSTC_CARET_JUMPS = stc_c.wxSTC_CARET_JUMPS
+wxSTC_CARET_EVEN = stc_c.wxSTC_CARET_EVEN
wxSTC_MOD_INSERTTEXT = stc_c.wxSTC_MOD_INSERTTEXT
wxSTC_MOD_DELETETEXT = stc_c.wxSTC_MOD_DELETETEXT
wxSTC_MOD_CHANGESTYLE = stc_c.wxSTC_MOD_CHANGESTYLE
wxSTC_LEX_PHP = stc_c.wxSTC_LEX_PHP
wxSTC_LEX_BAAN = stc_c.wxSTC_LEX_BAAN
wxSTC_LEX_MATLAB = stc_c.wxSTC_LEX_MATLAB
+wxSTC_LEX_SCRIPTOL = stc_c.wxSTC_LEX_SCRIPTOL
wxSTC_LEX_AUTOMATIC = stc_c.wxSTC_LEX_AUTOMATIC
wxSTC_P_DEFAULT = stc_c.wxSTC_P_DEFAULT
wxSTC_P_COMMENTLINE = stc_c.wxSTC_P_COMMENTLINE
wxSTC_C_WORD2 = stc_c.wxSTC_C_WORD2
wxSTC_C_COMMENTDOCKEYWORD = stc_c.wxSTC_C_COMMENTDOCKEYWORD
wxSTC_C_COMMENTDOCKEYWORDERROR = stc_c.wxSTC_C_COMMENTDOCKEYWORDERROR
-wxSTC_B_DEFAULT = stc_c.wxSTC_B_DEFAULT
-wxSTC_B_COMMENT = stc_c.wxSTC_B_COMMENT
-wxSTC_B_NUMBER = stc_c.wxSTC_B_NUMBER
-wxSTC_B_KEYWORD = stc_c.wxSTC_B_KEYWORD
-wxSTC_B_STRING = stc_c.wxSTC_B_STRING
-wxSTC_B_PREPROCESSOR = stc_c.wxSTC_B_PREPROCESSOR
-wxSTC_B_OPERATOR = stc_c.wxSTC_B_OPERATOR
-wxSTC_B_IDENTIFIER = stc_c.wxSTC_B_IDENTIFIER
-wxSTC_B_DATE = stc_c.wxSTC_B_DATE
wxSTC_H_DEFAULT = stc_c.wxSTC_H_DEFAULT
wxSTC_H_TAG = stc_c.wxSTC_H_TAG
wxSTC_H_TAGUNKNOWN = stc_c.wxSTC_H_TAGUNKNOWN
wxSTC_PL_STRING_QX = stc_c.wxSTC_PL_STRING_QX
wxSTC_PL_STRING_QR = stc_c.wxSTC_PL_STRING_QR
wxSTC_PL_STRING_QW = stc_c.wxSTC_PL_STRING_QW
+wxSTC_B_DEFAULT = stc_c.wxSTC_B_DEFAULT
+wxSTC_B_COMMENT = stc_c.wxSTC_B_COMMENT
+wxSTC_B_NUMBER = stc_c.wxSTC_B_NUMBER
+wxSTC_B_KEYWORD = stc_c.wxSTC_B_KEYWORD
+wxSTC_B_STRING = stc_c.wxSTC_B_STRING
+wxSTC_B_PREPROCESSOR = stc_c.wxSTC_B_PREPROCESSOR
+wxSTC_B_OPERATOR = stc_c.wxSTC_B_OPERATOR
+wxSTC_B_IDENTIFIER = stc_c.wxSTC_B_IDENTIFIER
+wxSTC_B_DATE = stc_c.wxSTC_B_DATE
+wxSTC_PROPS_DEFAULT = stc_c.wxSTC_PROPS_DEFAULT
+wxSTC_PROPS_COMMENT = stc_c.wxSTC_PROPS_COMMENT
+wxSTC_PROPS_SECTION = stc_c.wxSTC_PROPS_SECTION
+wxSTC_PROPS_ASSIGNMENT = stc_c.wxSTC_PROPS_ASSIGNMENT
+wxSTC_PROPS_DEFVAL = stc_c.wxSTC_PROPS_DEFVAL
wxSTC_L_DEFAULT = stc_c.wxSTC_L_DEFAULT
wxSTC_L_COMMAND = stc_c.wxSTC_L_COMMAND
wxSTC_L_TAG = stc_c.wxSTC_L_TAG
wxSTC_ERR_PERL = stc_c.wxSTC_ERR_PERL
wxSTC_ERR_NET = stc_c.wxSTC_ERR_NET
wxSTC_ERR_LUA = stc_c.wxSTC_ERR_LUA
+wxSTC_ERR_CTAG = stc_c.wxSTC_ERR_CTAG
wxSTC_ERR_DIFF_CHANGED = stc_c.wxSTC_ERR_DIFF_CHANGED
wxSTC_ERR_DIFF_ADDITION = stc_c.wxSTC_ERR_DIFF_ADDITION
wxSTC_ERR_DIFF_DELETION = stc_c.wxSTC_ERR_DIFF_DELETION
wxSTC_MAKE_OPERATOR = stc_c.wxSTC_MAKE_OPERATOR
wxSTC_MAKE_TARGET = stc_c.wxSTC_MAKE_TARGET
wxSTC_MAKE_IDEOL = stc_c.wxSTC_MAKE_IDEOL
+wxSTC_DIFF_DEFAULT = stc_c.wxSTC_DIFF_DEFAULT
+wxSTC_DIFF_COMMENT = stc_c.wxSTC_DIFF_COMMENT
+wxSTC_DIFF_COMMAND = stc_c.wxSTC_DIFF_COMMAND
+wxSTC_DIFF_HEADER = stc_c.wxSTC_DIFF_HEADER
+wxSTC_DIFF_POSITION = stc_c.wxSTC_DIFF_POSITION
+wxSTC_DIFF_DELETED = stc_c.wxSTC_DIFF_DELETED
+wxSTC_DIFF_ADDED = stc_c.wxSTC_DIFF_ADDED
wxSTC_CONF_DEFAULT = stc_c.wxSTC_CONF_DEFAULT
wxSTC_CONF_COMMENT = stc_c.wxSTC_CONF_COMMENT
wxSTC_CONF_NUMBER = stc_c.wxSTC_CONF_NUMBER
wxSTC_MATLAB_STRING = stc_c.wxSTC_MATLAB_STRING
wxSTC_MATLAB_OPERATOR = stc_c.wxSTC_MATLAB_OPERATOR
wxSTC_MATLAB_IDENTIFIER = stc_c.wxSTC_MATLAB_IDENTIFIER
+wxSTC_SCRIPTOL_DEFAULT = stc_c.wxSTC_SCRIPTOL_DEFAULT
+wxSTC_SCRIPTOL_COMMENT = stc_c.wxSTC_SCRIPTOL_COMMENT
+wxSTC_SCRIPTOL_COMMENTLINE = stc_c.wxSTC_SCRIPTOL_COMMENTLINE
+wxSTC_SCRIPTOL_COMMENTDOC = stc_c.wxSTC_SCRIPTOL_COMMENTDOC
+wxSTC_SCRIPTOL_NUMBER = stc_c.wxSTC_SCRIPTOL_NUMBER
+wxSTC_SCRIPTOL_WORD = stc_c.wxSTC_SCRIPTOL_WORD
+wxSTC_SCRIPTOL_STRING = stc_c.wxSTC_SCRIPTOL_STRING
+wxSTC_SCRIPTOL_CHARACTER = stc_c.wxSTC_SCRIPTOL_CHARACTER
+wxSTC_SCRIPTOL_UUID = stc_c.wxSTC_SCRIPTOL_UUID
+wxSTC_SCRIPTOL_PREPROCESSOR = stc_c.wxSTC_SCRIPTOL_PREPROCESSOR
+wxSTC_SCRIPTOL_OPERATOR = stc_c.wxSTC_SCRIPTOL_OPERATOR
+wxSTC_SCRIPTOL_IDENTIFIER = stc_c.wxSTC_SCRIPTOL_IDENTIFIER
+wxSTC_SCRIPTOL_STRINGEOL = stc_c.wxSTC_SCRIPTOL_STRINGEOL
+wxSTC_SCRIPTOL_VERBATIM = stc_c.wxSTC_SCRIPTOL_VERBATIM
+wxSTC_SCRIPTOL_REGEX = stc_c.wxSTC_SCRIPTOL_REGEX
+wxSTC_SCRIPTOL_COMMENTLINEDOC = stc_c.wxSTC_SCRIPTOL_COMMENTLINEDOC
+wxSTC_SCRIPTOL_WORD2 = stc_c.wxSTC_SCRIPTOL_WORD2
+wxSTC_SCRIPTOL_COMMENTDOCKEYWORD = stc_c.wxSTC_SCRIPTOL_COMMENTDOCKEYWORD
+wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR = stc_c.wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR
+wxSTC_SCRIPTOL_COMMENTBASIC = stc_c.wxSTC_SCRIPTOL_COMMENTBASIC
wxSTCNameStr = stc_c.wxSTCNameStr
STC_USE_DND = stc_c.STC_USE_DND
wxEVT_STC_CHANGE = stc_c.wxEVT_STC_CHANGE
wxEVT_STC_START_DRAG = stc_c.wxEVT_STC_START_DRAG
wxEVT_STC_DRAG_OVER = stc_c.wxEVT_STC_DRAG_OVER
wxEVT_STC_DO_DROP = stc_c.wxEVT_STC_DO_DROP
+wxEVT_STC_ZOOM = stc_c.wxEVT_STC_ZOOM
#-------------- USER INCLUDE -----------------------
def EVT_STC_DO_DROP(win, id, func):
win.Connect(id, -1, wxEVT_STC_DO_DROP, func)
+def EVT_STC_ZOOM(win, id, func):
+ win.Connect(id, -1, wxEVT_STC_ZOOM, func)
+
"
//----------------------------------------------------------------------
wxFont(10, wxMODERN, wxNORMAL, wxNORMAL))
EVT_DYNAMIC_SASH_SPLIT(self, -1, self.OnSplit)
EVT_DYNAMIC_SASH_UNIFY(self, -1, self.OnUnify)
-
+ #self.SetScrollWidth(500)
def SetupScrollBars(self):
# hook the scrollbars provided by the wxDynamicSashWindow
p.SetAutoLayout(true)
-## ed.SetBufferedDraw(false)
-## ed.StyleClearAll()
+ #ed.SetBufferedDraw(false)
+ #ed.StyleClearAll()
+ #ed.SetScrollWidth(800)
+ #ed.SetWrapMode(true)
+
ed.SetText(demoText)
if wxUSE_UNICODE:
import codecs