Updated wxSTC to Scintilla 1.51
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -77,6 +77,9 @@
|
|||||||
// The SC_CP_UTF8 value can be used to enter Unicode mode.
|
// The SC_CP_UTF8 value can be used to enter Unicode mode.
|
||||||
// This is the same value as CP_UTF8 in Windows
|
// This is the same value as CP_UTF8 in Windows
|
||||||
#define wxSTC_CP_UTF8 65001
|
#define wxSTC_CP_UTF8 65001
|
||||||
|
|
||||||
|
// The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+.
|
||||||
|
#define wxSTC_CP_DBCS 1
|
||||||
#define wxSTC_MARKER_MAX 31
|
#define wxSTC_MARKER_MAX 31
|
||||||
#define wxSTC_MARK_CIRCLE 0
|
#define wxSTC_MARK_CIRCLE 0
|
||||||
#define wxSTC_MARK_ROUNDRECT 1
|
#define wxSTC_MARK_ROUNDRECT 1
|
||||||
@@ -107,6 +110,7 @@
|
|||||||
#define wxSTC_MARK_BACKGROUND 22
|
#define wxSTC_MARK_BACKGROUND 22
|
||||||
#define wxSTC_MARK_DOTDOTDOT 23
|
#define wxSTC_MARK_DOTDOTDOT 23
|
||||||
#define wxSTC_MARK_ARROWS 24
|
#define wxSTC_MARK_ARROWS 24
|
||||||
|
#define wxSTC_MARK_PIXMAP 25
|
||||||
#define wxSTC_MARK_CHARACTER 10000
|
#define wxSTC_MARK_CHARACTER 10000
|
||||||
|
|
||||||
// Markers used for outlining column.
|
// Markers used for outlining column.
|
||||||
@@ -188,7 +192,17 @@
|
|||||||
#define wxSTC_FOLDLEVELBASE 0x400
|
#define wxSTC_FOLDLEVELBASE 0x400
|
||||||
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000
|
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000
|
||||||
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000
|
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000
|
||||||
|
#define wxSTC_FOLDLEVELBOXHEADERFLAG 0x4000
|
||||||
|
#define wxSTC_FOLDLEVELBOXFOOTERFLAG 0x8000
|
||||||
|
#define wxSTC_FOLDLEVELCONTRACTED 0x10000
|
||||||
|
#define wxSTC_FOLDLEVELUNINDENT 0x20000
|
||||||
#define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF
|
#define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF
|
||||||
|
#define wxSTC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002
|
||||||
|
#define wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004
|
||||||
|
#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
|
||||||
|
#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
|
||||||
|
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||||
|
#define wxSTC_FOLDFLAG_BOX 0x0001
|
||||||
#define wxSTC_TIME_FOREVER 10000000
|
#define wxSTC_TIME_FOREVER 10000000
|
||||||
#define wxSTC_WRAP_NONE 0
|
#define wxSTC_WRAP_NONE 0
|
||||||
#define wxSTC_WRAP_WORD 1
|
#define wxSTC_WRAP_WORD 1
|
||||||
@@ -200,7 +214,7 @@
|
|||||||
#define wxSTC_EDGE_LINE 1
|
#define wxSTC_EDGE_LINE 1
|
||||||
#define wxSTC_EDGE_BACKGROUND 2
|
#define wxSTC_EDGE_BACKGROUND 2
|
||||||
#define wxSTC_CURSORNORMAL -1
|
#define wxSTC_CURSORNORMAL -1
|
||||||
#define wxSTC_CURSORWAIT 3
|
#define wxSTC_CURSORWAIT 4
|
||||||
|
|
||||||
// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
|
// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
|
||||||
#define wxSTC_VISIBLE_SLOP 0x01
|
#define wxSTC_VISIBLE_SLOP 0x01
|
||||||
@@ -308,6 +322,11 @@
|
|||||||
#define wxSTC_LEX_BAAN 31
|
#define wxSTC_LEX_BAAN 31
|
||||||
#define wxSTC_LEX_MATLAB 32
|
#define wxSTC_LEX_MATLAB 32
|
||||||
#define wxSTC_LEX_SCRIPTOL 33
|
#define wxSTC_LEX_SCRIPTOL 33
|
||||||
|
#define wxSTC_LEX_ASM 34
|
||||||
|
#define wxSTC_LEX_CPPNOCASE 35
|
||||||
|
#define wxSTC_LEX_FORTRAN 36
|
||||||
|
#define wxSTC_LEX_F77 37
|
||||||
|
#define wxSTC_LEX_CSS 38
|
||||||
|
|
||||||
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||||
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||||
@@ -576,6 +595,7 @@
|
|||||||
#define wxSTC_ERR_DIFF_ADDITION 11
|
#define wxSTC_ERR_DIFF_ADDITION 11
|
||||||
#define wxSTC_ERR_DIFF_DELETION 12
|
#define wxSTC_ERR_DIFF_DELETION 12
|
||||||
#define wxSTC_ERR_DIFF_MESSAGE 13
|
#define wxSTC_ERR_DIFF_MESSAGE 13
|
||||||
|
#define wxSTC_ERR_PHP 14
|
||||||
|
|
||||||
// Lexical states for SCLEX_BATCH
|
// Lexical states for SCLEX_BATCH
|
||||||
#define wxSTC_BAT_DEFAULT 0
|
#define wxSTC_BAT_DEFAULT 0
|
||||||
@@ -622,24 +642,31 @@
|
|||||||
#define wxSTC_AVE_COMMENT 1
|
#define wxSTC_AVE_COMMENT 1
|
||||||
#define wxSTC_AVE_NUMBER 2
|
#define wxSTC_AVE_NUMBER 2
|
||||||
#define wxSTC_AVE_WORD 3
|
#define wxSTC_AVE_WORD 3
|
||||||
#define wxSTC_AVE_KEYWORD 4
|
|
||||||
#define wxSTC_AVE_STATEMENT 5
|
|
||||||
#define wxSTC_AVE_STRING 6
|
#define wxSTC_AVE_STRING 6
|
||||||
#define wxSTC_AVE_ENUM 7
|
#define wxSTC_AVE_ENUM 7
|
||||||
#define wxSTC_AVE_STRINGEOL 8
|
#define wxSTC_AVE_STRINGEOL 8
|
||||||
#define wxSTC_AVE_IDENTIFIER 9
|
#define wxSTC_AVE_IDENTIFIER 9
|
||||||
#define wxSTC_AVE_OPERATOR 10
|
#define wxSTC_AVE_OPERATOR 10
|
||||||
|
#define wxSTC_AVE_WORD1 11
|
||||||
|
#define wxSTC_AVE_WORD2 12
|
||||||
|
#define wxSTC_AVE_WORD3 13
|
||||||
|
#define wxSTC_AVE_WORD4 14
|
||||||
|
#define wxSTC_AVE_WORD5 15
|
||||||
|
#define wxSTC_AVE_WORD6 16
|
||||||
|
|
||||||
// Lexical states for SCLEX_ADA
|
// Lexical states for SCLEX_ADA
|
||||||
#define wxSTC_ADA_DEFAULT 0
|
#define wxSTC_ADA_DEFAULT 0
|
||||||
#define wxSTC_ADA_COMMENT 1
|
#define wxSTC_ADA_WORD 1
|
||||||
#define wxSTC_ADA_NUMBER 2
|
#define wxSTC_ADA_IDENTIFIER 2
|
||||||
#define wxSTC_ADA_WORD 3
|
#define wxSTC_ADA_NUMBER 3
|
||||||
#define wxSTC_ADA_STRING 4
|
#define wxSTC_ADA_DELIMITER 4
|
||||||
#define wxSTC_ADA_CHARACTER 5
|
#define wxSTC_ADA_CHARACTER 5
|
||||||
#define wxSTC_ADA_OPERATOR 6
|
#define wxSTC_ADA_CHARACTEREOL 6
|
||||||
#define wxSTC_ADA_IDENTIFIER 7
|
#define wxSTC_ADA_STRING 7
|
||||||
#define wxSTC_ADA_STRINGEOL 8
|
#define wxSTC_ADA_STRINGEOL 8
|
||||||
|
#define wxSTC_ADA_LABEL 9
|
||||||
|
#define wxSTC_ADA_COMMENTLINE 10
|
||||||
|
#define wxSTC_ADA_ILLEGAL 11
|
||||||
|
|
||||||
// Lexical states for SCLEX_BAAN
|
// Lexical states for SCLEX_BAAN
|
||||||
#define wxSTC_BAAN_DEFAULT 0
|
#define wxSTC_BAAN_DEFAULT 0
|
||||||
@@ -720,6 +747,51 @@
|
|||||||
#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
|
#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
|
||||||
#define wxSTC_SCRIPTOL_COMMENTBASIC 19
|
#define wxSTC_SCRIPTOL_COMMENTBASIC 19
|
||||||
|
|
||||||
|
// Lexical states for SCLEX_ASM
|
||||||
|
#define wxSTC_ASM_DEFAULT 0
|
||||||
|
#define wxSTC_ASM_COMMENT 1
|
||||||
|
#define wxSTC_ASM_NUMBER 2
|
||||||
|
#define wxSTC_ASM_STRING 3
|
||||||
|
#define wxSTC_ASM_OPERATOR 4
|
||||||
|
#define wxSTC_ASM_IDENTIFIER 5
|
||||||
|
#define wxSTC_ASM_CPUINSTRUCTION 6
|
||||||
|
#define wxSTC_ASM_MATHINSTRUCTION 7
|
||||||
|
#define wxSTC_ASM_REGISTER 8
|
||||||
|
#define wxSTC_ASM_DIRECTIVE 9
|
||||||
|
#define wxSTC_ASM_DIRECTIVEOPERAND 10
|
||||||
|
|
||||||
|
// Lexical states for SCLEX_FORTRAN
|
||||||
|
#define wxSTC_F_DEFAULT 0
|
||||||
|
#define wxSTC_F_COMMENT 1
|
||||||
|
#define wxSTC_F_NUMBER 2
|
||||||
|
#define wxSTC_F_STRING1 3
|
||||||
|
#define wxSTC_F_STRING2 4
|
||||||
|
#define wxSTC_F_STRINGEOL 5
|
||||||
|
#define wxSTC_F_OPERATOR 6
|
||||||
|
#define wxSTC_F_IDENTIFIER 7
|
||||||
|
#define wxSTC_F_WORD 8
|
||||||
|
#define wxSTC_F_WORD2 9
|
||||||
|
#define wxSTC_F_WORD3 10
|
||||||
|
#define wxSTC_F_PREPROCESSOR 11
|
||||||
|
#define wxSTC_F_OPERATOR2 12
|
||||||
|
#define wxSTC_F_LABEL 13
|
||||||
|
#define wxSTC_F_CONTINUATION 14
|
||||||
|
|
||||||
|
// Lexical states for SCLEX_CSS
|
||||||
|
#define wxSTC_CSS_DEFAULT 0
|
||||||
|
#define wxSTC_CSS_TAG 1
|
||||||
|
#define wxSTC_CSS_CLASS 2
|
||||||
|
#define wxSTC_CSS_PSEUDOCLASS 3
|
||||||
|
#define wxSTC_CSS_UNKNOWN_PSEUDOCLASS 4
|
||||||
|
#define wxSTC_CSS_OPERATOR 5
|
||||||
|
#define wxSTC_CSS_IDENTIFIER 6
|
||||||
|
#define wxSTC_CSS_UNKNOWN_IDENTIFIER 7
|
||||||
|
#define wxSTC_CSS_VALUE 8
|
||||||
|
#define wxSTC_CSS_COMMENT 9
|
||||||
|
#define wxSTC_CSS_ID 10
|
||||||
|
#define wxSTC_CSS_IMPORTANT 11
|
||||||
|
#define wxSTC_CSS_DIRECTIVE 12
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
// Commands that can be bound to keystrokes
|
// Commands that can be bound to keystrokes
|
||||||
@@ -867,6 +939,9 @@
|
|||||||
// Switch the current line with the previous.
|
// Switch the current line with the previous.
|
||||||
#define wxSTC_CMD_LINETRANSPOSE 2339
|
#define wxSTC_CMD_LINETRANSPOSE 2339
|
||||||
|
|
||||||
|
// Duplicate the current line.
|
||||||
|
#define wxSTC_CMD_LINEDUPLICATE 2404
|
||||||
|
|
||||||
// Transform the selection to lower case.
|
// Transform the selection to lower case.
|
||||||
#define wxSTC_CMD_LOWERCASE 2340
|
#define wxSTC_CMD_LOWERCASE 2340
|
||||||
|
|
||||||
@@ -1091,8 +1166,8 @@ public:
|
|||||||
// Set the symbol used for a particular marker number,
|
// Set the symbol used for a particular marker number,
|
||||||
// and optionally the fore and background colours.
|
// and optionally the fore and background colours.
|
||||||
void MarkerDefine(int markerNumber, int markerSymbol,
|
void MarkerDefine(int markerNumber, int markerSymbol,
|
||||||
const wxColour& foreground = wxNullColour,
|
const wxColour& foreground = wxNullColour,
|
||||||
const wxColour& background = wxNullColour);
|
const wxColour& background = wxNullColour);
|
||||||
|
|
||||||
// Set the foreground colour used for a particular marker number.
|
// Set the foreground colour used for a particular marker number.
|
||||||
void MarkerSetForeground(int markerNumber, const wxColour& fore);
|
void MarkerSetForeground(int markerNumber, const wxColour& fore);
|
||||||
@@ -1118,6 +1193,9 @@ public:
|
|||||||
// Find the previous line before lineStart that includes a marker in mask.
|
// Find the previous line before lineStart that includes a marker in mask.
|
||||||
int MarkerPrevious(int lineStart, int markerMask);
|
int MarkerPrevious(int lineStart, int markerMask);
|
||||||
|
|
||||||
|
// Define a marker from a bitmap
|
||||||
|
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
|
||||||
|
|
||||||
// Set a margin to be either numeric or symbolic.
|
// Set a margin to be either numeric or symbolic.
|
||||||
void SetMarginType(int margin, int marginType);
|
void SetMarginType(int margin, int marginType);
|
||||||
|
|
||||||
@@ -1339,6 +1417,19 @@ public:
|
|||||||
// after the inserted text upon completion.
|
// after the inserted text upon completion.
|
||||||
bool AutoCompGetDropRestOfWord();
|
bool AutoCompGetDropRestOfWord();
|
||||||
|
|
||||||
|
// Register an image for use in autocompletion lists.
|
||||||
|
void RegisterImage(int type, const wxBitmap& bmp);
|
||||||
|
|
||||||
|
// Clear all the registered images.
|
||||||
|
void ClearRegisteredImages();
|
||||||
|
|
||||||
|
// Retrieve the auto-completion list type-separator character.
|
||||||
|
int AutoCompGetTypeSeparator();
|
||||||
|
|
||||||
|
// Change the type-separator character in the string setting up an auto-completion list.
|
||||||
|
// Default is '?' but can be changed if items contain '?'.
|
||||||
|
void AutoCompSetTypeSeparator(int separatorCharacter);
|
||||||
|
|
||||||
// Set the number of spaces used for one level of indentation.
|
// Set the number of spaces used for one level of indentation.
|
||||||
void SetIndent(int indentSize);
|
void SetIndent(int indentSize);
|
||||||
|
|
||||||
@@ -1427,14 +1518,14 @@ public:
|
|||||||
|
|
||||||
// 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 FormatRange(bool doDraw,
|
||||||
int startPos,
|
int startPos,
|
||||||
int endPos,
|
int endPos,
|
||||||
wxDC* draw,
|
wxDC* draw,
|
||||||
wxDC* target, // Why does it use two? Can they be the same?
|
wxDC* target, // Why does it use two? Can they be the same?
|
||||||
wxRect renderRect,
|
wxRect renderRect,
|
||||||
wxRect pageRect);
|
wxRect pageRect);
|
||||||
|
|
||||||
// Retrieve the line at the top of the display.
|
// Retrieve the display line at the top of the display.
|
||||||
int GetFirstVisibleLine();
|
int GetFirstVisibleLine();
|
||||||
|
|
||||||
// Retrieve the contents of a line.
|
// Retrieve the contents of a line.
|
||||||
@@ -1630,7 +1721,7 @@ public:
|
|||||||
// Ensure a particular line is visible by expanding any header line hiding it.
|
// Ensure a particular line is visible by expanding any header line hiding it.
|
||||||
void EnsureVisible(int line);
|
void EnsureVisible(int line);
|
||||||
|
|
||||||
// Set some debugging options for folding.
|
// Set some style options for folding.
|
||||||
void SetFoldFlags(int flags);
|
void SetFoldFlags(int flags);
|
||||||
|
|
||||||
// Ensure a particular line is visible by expanding any header line hiding it.
|
// Ensure a particular line is visible by expanding any header line hiding it.
|
||||||
@@ -1696,6 +1787,40 @@ public:
|
|||||||
// Retrieve the height of a particular line of text in pixels.
|
// Retrieve the height of a particular line of text in pixels.
|
||||||
int TextHeight(int line);
|
int TextHeight(int line);
|
||||||
|
|
||||||
|
// Show or hide the vertical scroll bar.
|
||||||
|
void SetUseVerticalScrollBar(bool show);
|
||||||
|
|
||||||
|
// Is the vertical scroll bar visible?
|
||||||
|
bool GetUseVerticalScrollBar();
|
||||||
|
|
||||||
|
// Append a string to the end of the document without changing the selection.
|
||||||
|
void AppendText(int length, const wxString& text);
|
||||||
|
|
||||||
|
// Is drawing done in two phases with backgrounds drawn before foregrounds?
|
||||||
|
bool GetTwoPhaseDraw();
|
||||||
|
|
||||||
|
// In twoPhaseDraw mode, drawing is performed in two phases, first the background
|
||||||
|
// and then the foreground. This avoids chopping off characters that overlap the next run.
|
||||||
|
void SetTwoPhaseDraw(bool twoPhase);
|
||||||
|
|
||||||
|
// Make the target range start and end be the same as the selection range start and end.
|
||||||
|
void TargetFromSelection();
|
||||||
|
|
||||||
|
// Join the lines in the target.
|
||||||
|
// This is an experimental feature and may be changed or removed.
|
||||||
|
void LinesJoin();
|
||||||
|
|
||||||
|
// Split the lines in the target into lines that are less wide than pixelWidth
|
||||||
|
// where possible.
|
||||||
|
void LinesSplit(int pixelWidth);
|
||||||
|
|
||||||
|
// Set the colours used as a chequerboard pattern in the fold margin
|
||||||
|
void SetFoldMarginColour(bool useSetting, const wxColour& back);
|
||||||
|
void SetFoldMarginHiColour(bool useSetting, const wxColour& fore);
|
||||||
|
|
||||||
|
// Duplicate the current line.
|
||||||
|
void LineDuplicate();
|
||||||
|
|
||||||
// Move caret to first position on display line.
|
// Move caret to first position on display line.
|
||||||
void HomeDisplay();
|
void HomeDisplay();
|
||||||
|
|
||||||
@@ -1860,6 +1985,9 @@ public:
|
|||||||
void SetXOffset(int newOffset);
|
void SetXOffset(int newOffset);
|
||||||
int GetXOffset();
|
int GetXOffset();
|
||||||
|
|
||||||
|
// Set the last x chosen value to be the caret x position
|
||||||
|
void ChooseCaretX();
|
||||||
|
|
||||||
// Set the way the caret is kept visible when going sideway.
|
// Set the way the caret is kept visible when going sideway.
|
||||||
// The exclusion zone is given in pixels.
|
// The exclusion zone is given in pixels.
|
||||||
void SetXCaretPolicy(int caretPolicy, int caretSlop);
|
void SetXCaretPolicy(int caretPolicy, int caretSlop);
|
||||||
@@ -1868,6 +1996,12 @@ public:
|
|||||||
// The exclusion zone is given in lines.
|
// The exclusion zone is given in lines.
|
||||||
void SetYCaretPolicy(int caretPolicy, int caretSlop);
|
void SetYCaretPolicy(int caretPolicy, int caretSlop);
|
||||||
|
|
||||||
|
// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
|
||||||
|
void SetPrintWrapMode(int mode);
|
||||||
|
|
||||||
|
// Is printing line wrapped.
|
||||||
|
int GetPrintWrapMode();
|
||||||
|
|
||||||
// Start notifying the container of all key presses and commands.
|
// Start notifying the container of all key presses and commands.
|
||||||
void StartRecord();
|
void StartRecord();
|
||||||
|
|
||||||
|
@@ -34,14 +34,17 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \
|
|||||||
KeyMap.o \
|
KeyMap.o \
|
||||||
KeyWords.o \
|
KeyWords.o \
|
||||||
LexAVE.o \
|
LexAVE.o \
|
||||||
|
LexAda.o \
|
||||||
|
LexAsm.o \
|
||||||
LexBaan.o \
|
LexBaan.o \
|
||||||
LexBullant.o \
|
LexBullant.o \
|
||||||
LexMatlab.o \
|
LexMatlab.o \
|
||||||
LexAda.o \
|
|
||||||
LexCPP.o \
|
LexCPP.o \
|
||||||
LexConf.o \
|
LexConf.o \
|
||||||
LexCrontab.o \
|
LexCrontab.o \
|
||||||
|
LexCSS.o \
|
||||||
LexEiffel.o \
|
LexEiffel.o \
|
||||||
|
LexFortran.o \
|
||||||
LexHTML.o \
|
LexHTML.o \
|
||||||
LexLisp.o \
|
LexLisp.o \
|
||||||
LexLua.o \
|
LexLua.o \
|
||||||
@@ -61,6 +64,8 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \
|
|||||||
UniConversion.o \
|
UniConversion.o \
|
||||||
ViewStyle.o \
|
ViewStyle.o \
|
||||||
WindowAccessor.o \
|
WindowAccessor.o \
|
||||||
|
XPM.o \
|
||||||
|
|
||||||
|
|
||||||
DEPFILES=$(OBJECTS:.o=.d)
|
DEPFILES=$(OBJECTS:.o=.d)
|
||||||
|
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#include <wx/encconv.h>
|
#include <wx/encconv.h>
|
||||||
|
#include <wx/listctrl.h>
|
||||||
|
#include <wx/mstream.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
@@ -213,42 +215,44 @@ public:
|
|||||||
SurfaceImpl();
|
SurfaceImpl();
|
||||||
~SurfaceImpl();
|
~SurfaceImpl();
|
||||||
|
|
||||||
void Init();
|
virtual void Init();
|
||||||
void Init(SurfaceID sid);
|
virtual void Init(SurfaceID sid);
|
||||||
void InitPixMap(int width, int height, Surface *surface_);
|
virtual void InitPixMap(int width, int height, Surface *surface_);
|
||||||
|
|
||||||
void Release();
|
virtual void Release();
|
||||||
bool Initialised();
|
virtual bool Initialised();
|
||||||
void PenColour(ColourAllocated fore);
|
virtual void PenColour(ColourAllocated fore);
|
||||||
int LogPixelsY();
|
virtual int LogPixelsY();
|
||||||
int DeviceHeightFont(int points);
|
virtual int DeviceHeightFont(int points);
|
||||||
void MoveTo(int x_, int y_);
|
virtual void MoveTo(int x_, int y_);
|
||||||
void LineTo(int x_, int y_);
|
virtual void LineTo(int x_, int y_);
|
||||||
void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back);
|
virtual void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back);
|
||||||
void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back);
|
virtual void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back);
|
||||||
void FillRectangle(PRectangle rc, ColourAllocated back);
|
virtual void FillRectangle(PRectangle rc, ColourAllocated back);
|
||||||
void FillRectangle(PRectangle rc, Surface &surfacePattern);
|
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern);
|
||||||
void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
|
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
|
||||||
void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
|
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
|
||||||
void Copy(PRectangle rc, Point from, Surface &surfaceSource);
|
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource);
|
||||||
|
|
||||||
void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back);
|
virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back);
|
||||||
void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back);
|
virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back);
|
||||||
void MeasureWidths(Font &font_, const char *s, int len, int *positions);
|
virtual void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore);
|
||||||
int WidthText(Font &font_, const char *s, int len);
|
virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions);
|
||||||
int WidthChar(Font &font_, char ch);
|
virtual int WidthText(Font &font_, const char *s, int len);
|
||||||
int Ascent(Font &font_);
|
virtual int WidthChar(Font &font_, char ch);
|
||||||
int Descent(Font &font_);
|
virtual int Ascent(Font &font_);
|
||||||
int InternalLeading(Font &font_);
|
virtual int Descent(Font &font_);
|
||||||
int ExternalLeading(Font &font_);
|
virtual int InternalLeading(Font &font_);
|
||||||
int Height(Font &font_);
|
virtual int ExternalLeading(Font &font_);
|
||||||
int AverageCharWidth(Font &font_);
|
virtual int Height(Font &font_);
|
||||||
|
virtual int AverageCharWidth(Font &font_);
|
||||||
|
|
||||||
int SetPalette(Palette *pal, bool inBackGround);
|
virtual int SetPalette(Palette *pal, bool inBackGround);
|
||||||
void SetClip(PRectangle rc);
|
virtual void SetClip(PRectangle rc);
|
||||||
void FlushCachedState();
|
virtual void FlushCachedState();
|
||||||
|
|
||||||
void SetUnicodeMode(bool unicodeMode_);
|
virtual void SetUnicodeMode(bool unicodeMode_);
|
||||||
|
virtual void SetDBCSMode(int codePage);
|
||||||
|
|
||||||
void BrushColour(ColourAllocated back);
|
void BrushColour(ColourAllocated back);
|
||||||
void SetFont(Font &font_);
|
void SetFont(Font &font_);
|
||||||
@@ -265,24 +269,6 @@ SurfaceImpl::~SurfaceImpl() {
|
|||||||
Release();
|
Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceImpl::Release() {
|
|
||||||
if (bitmap) {
|
|
||||||
((wxMemoryDC*)hdc)->SelectObject(wxNullBitmap);
|
|
||||||
delete bitmap;
|
|
||||||
bitmap = 0;
|
|
||||||
}
|
|
||||||
if (hdcOwned) {
|
|
||||||
delete hdc;
|
|
||||||
hdc = 0;
|
|
||||||
hdcOwned = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SurfaceImpl::Initialised() {
|
|
||||||
return hdc != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SurfaceImpl::Init() {
|
void SurfaceImpl::Init() {
|
||||||
#if 0
|
#if 0
|
||||||
Release();
|
Release();
|
||||||
@@ -311,6 +297,26 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_) {
|
|||||||
((wxMemoryDC*)hdc)->SelectObject(*bitmap);
|
((wxMemoryDC*)hdc)->SelectObject(*bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SurfaceImpl::Release() {
|
||||||
|
if (bitmap) {
|
||||||
|
((wxMemoryDC*)hdc)->SelectObject(wxNullBitmap);
|
||||||
|
delete bitmap;
|
||||||
|
bitmap = 0;
|
||||||
|
}
|
||||||
|
if (hdcOwned) {
|
||||||
|
delete hdc;
|
||||||
|
hdc = 0;
|
||||||
|
hdcOwned = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SurfaceImpl::Initialised() {
|
||||||
|
return hdc != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SurfaceImpl::PenColour(ColourAllocated fore) {
|
void SurfaceImpl::PenColour(ColourAllocated fore) {
|
||||||
hdc->SetPen(wxPen(wxColourFromCA(fore), 1, wxSOLID));
|
hdc->SetPen(wxPen(wxColourFromCA(fore), 1, wxSOLID));
|
||||||
}
|
}
|
||||||
@@ -398,7 +404,7 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font, int ybase,
|
|||||||
SetFont(font);
|
SetFont(font);
|
||||||
hdc->SetTextForeground(wxColourFromCA(fore));
|
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||||
hdc->SetTextBackground(wxColourFromCA(back));
|
hdc->SetTextBackground(wxColourFromCA(back));
|
||||||
FillRectangle(rc, back);
|
//FillRectangle(rc, back);
|
||||||
|
|
||||||
// ybase is where the baseline should be, but wxWin uses the upper left
|
// ybase is where the baseline should be, but wxWin uses the upper left
|
||||||
// corner, so I need to calculate the real position for the text...
|
// corner, so I need to calculate the real position for the text...
|
||||||
@@ -411,21 +417,27 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font, int ybase,
|
|||||||
SetFont(font);
|
SetFont(font);
|
||||||
hdc->SetTextForeground(wxColourFromCA(fore));
|
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||||
hdc->SetTextBackground(wxColourFromCA(back));
|
hdc->SetTextBackground(wxColourFromCA(back));
|
||||||
FillRectangle(rc, back);
|
//FillRectangle(rc, back);
|
||||||
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
|
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
|
||||||
|
|
||||||
// see comments above
|
// see comments above
|
||||||
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
|
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
|
||||||
hdc->DestroyClippingRegion();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SurfaceImpl::WidthText(Font &font, const char *s, int len) {
|
|
||||||
SetFont(font);
|
|
||||||
int w;
|
|
||||||
int h;
|
|
||||||
|
|
||||||
hdc->GetTextExtent(stc2wx(s, len), &w, &h);
|
void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font, int ybase,
|
||||||
return w;
|
const char *s, int len,
|
||||||
|
ColourAllocated fore) {
|
||||||
|
|
||||||
|
SetFont(font);
|
||||||
|
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||||
|
hdc->SetBackgroundMode(wxTRANSPARENT);
|
||||||
|
|
||||||
|
// ybase is where the baseline should be, but wxWin uses the upper left
|
||||||
|
// corner, so I need to calculate the real position for the text...
|
||||||
|
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
|
||||||
|
|
||||||
|
hdc->SetBackgroundMode(wxSOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -450,7 +462,7 @@ void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positio
|
|||||||
// Instead of a running total, remeasure from the begining of the
|
// Instead of a running total, remeasure from the begining of the
|
||||||
// text for each character's position. This is because with AA fonts
|
// text for each character's position. This is because with AA fonts
|
||||||
// on OS X widths can be fractions of pixels wide when more than one
|
// on OS X widths can be fractions of pixels wide when more than one
|
||||||
// are drawn together, so the sum of all character widths is not necessariy
|
// are drawn together, so the sum of all character widths is not necessarily
|
||||||
// (and probably not) the same as the whole string width.
|
// (and probably not) the same as the whole string width.
|
||||||
int* tpos = new int[len];
|
int* tpos = new int[len];
|
||||||
size_t i;
|
size_t i;
|
||||||
@@ -491,6 +503,16 @@ void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positio
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SurfaceImpl::WidthText(Font &font, const char *s, int len) {
|
||||||
|
SetFont(font);
|
||||||
|
int w;
|
||||||
|
int h;
|
||||||
|
|
||||||
|
hdc->GetTextExtent(stc2wx(s, len), &w, &h);
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int SurfaceImpl::WidthChar(Font &font, char ch) {
|
int SurfaceImpl::WidthChar(Font &font, char ch) {
|
||||||
SetFont(font);
|
SetFont(font);
|
||||||
int w;
|
int w;
|
||||||
@@ -561,6 +583,11 @@ void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SurfaceImpl::SetDBCSMode(int codePage) {
|
||||||
|
// dbcsMode = codePage == SC_CP_DBCS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Surface *Surface::Allocate() {
|
Surface *Surface::Allocate() {
|
||||||
return new SurfaceImpl;
|
return new SurfaceImpl;
|
||||||
}
|
}
|
||||||
@@ -668,14 +695,52 @@ void Window::SetTitle(const char *s) {
|
|||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Helper classes for ListBox
|
// Helper classes for ListBox
|
||||||
|
|
||||||
|
const int IconWidth = 16;
|
||||||
|
|
||||||
#if 1 // defined(__WXMAC__)
|
|
||||||
class wxSTCListBoxWin : public wxListBox {
|
// This is a simple subclass of wxLIstView that just resets focus to the
|
||||||
|
// parent when it gets it.
|
||||||
|
class wxSTCListBox : public wxListView {
|
||||||
public:
|
public:
|
||||||
wxSTCListBoxWin(wxWindow* parent, wxWindowID id)
|
wxSTCListBox(wxWindow* parent, wxWindowID id,
|
||||||
: wxListBox(parent, id, wxDefaultPosition, wxSize(0,0),
|
const wxPoint& pos, const wxSize& size,
|
||||||
0, NULL, wxLB_SINGLE | wxSIMPLE_BORDER) {
|
long style)
|
||||||
SetCursor(wxCursor(wxCURSOR_ARROW));
|
: wxListView(parent, id, pos, size, style)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void OnFocus(wxFocusEvent& event) {
|
||||||
|
GetParent()->SetFocus();
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxSTCListBox, wxListView)
|
||||||
|
EVT_SET_FOCUS( wxSTCListBox::OnFocus)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// A window to place the wxSTCListBox upon
|
||||||
|
class wxSTCListBoxWin : public wxWindow {
|
||||||
|
private:
|
||||||
|
wxListView* lv;
|
||||||
|
CallBackAction doubleClickAction;
|
||||||
|
void* doubleClickActionData;
|
||||||
|
public:
|
||||||
|
wxSTCListBoxWin(wxWindow* parent, wxWindowID id) :
|
||||||
|
wxWindow(parent, id, wxDefaultPosition, wxSize(0,0), wxNO_BORDER )
|
||||||
|
{
|
||||||
|
|
||||||
|
SetBackgroundColour(*wxBLUE);
|
||||||
|
lv = new wxSTCListBox(this, id, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER);
|
||||||
|
lv->SetCursor(wxCursor(wxCURSOR_ARROW));
|
||||||
|
lv->InsertColumn(0, wxEmptyString);
|
||||||
|
lv->InsertColumn(1, wxEmptyString);
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -684,184 +749,286 @@ public:
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListBox* GetLB() { return this; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxSTCListBoxWin, wxListBox)
|
|
||||||
EVT_SET_FOCUS(wxSTCListBoxWin::OnFocus)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
class wxSTCListBox : public wxListBox {
|
|
||||||
public:
|
|
||||||
wxSTCListBox(wxWindow* parent, wxWindowID id)
|
|
||||||
: wxListBox(parent, id, wxDefaultPosition, wxDefaultSize,
|
|
||||||
0, NULL, wxLB_SINGLE | wxSIMPLE_BORDER | wxWANTS_CHARS)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void OnKeyDown(wxKeyEvent& event) {
|
|
||||||
// Give the key events to the STC. It will then update
|
|
||||||
// the listbox as needed.
|
|
||||||
GetGrandParent()->GetEventHandler()->ProcessEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxSTCListBox, wxListBox)
|
|
||||||
EVT_KEY_DOWN(wxSTCListBox::OnKeyDown)
|
|
||||||
EVT_CHAR(wxSTCListBox::OnKeyDown)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef wxSTC_USE_POPUP
|
|
||||||
#define wxSTC_USE_POPUP 0 // wxPopupWindow just doesn't work well in this case...
|
|
||||||
|
|
||||||
// A window to place the listbox upon. If wxPopupWindow is supported then
|
|
||||||
// that will be used so the listbox can extend beyond the client area of the
|
|
||||||
// wxSTC if needed.
|
|
||||||
#if wxUSE_POPUPWIN && wxSTC_USE_POPUP
|
|
||||||
#include <wx/popupwin.h>
|
|
||||||
#define wxSTCListBoxWinBase wxPopupWindow
|
|
||||||
#define param2 wxBORDER_NONE // popup's 2nd param is flags
|
|
||||||
#else
|
|
||||||
#define wxSTCListBoxWinBase wxWindow
|
|
||||||
#define param2 -1 // wxWindow's 2nd param is ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class wxSTCListBoxWin : public wxSTCListBoxWinBase {
|
|
||||||
public:
|
|
||||||
wxSTCListBoxWin(wxWindow* parent, wxWindowID id)
|
|
||||||
: wxSTCListBoxWinBase(parent, param2) {
|
|
||||||
lb = new wxSTCListBox(this, id);
|
|
||||||
lb->SetCursor(wxCursor(wxCURSOR_ARROW));
|
|
||||||
lb->SetFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnSize(wxSizeEvent& event) {
|
void OnSize(wxSizeEvent& event) {
|
||||||
lb->SetSize(GetSize());
|
// reset the column widths
|
||||||
|
wxSize sz = GetClientSize();
|
||||||
|
lv->SetSize(1, 1, sz.x-2, sz.y-2);
|
||||||
|
wxImageList* il = lv->GetImageList(wxIMAGE_LIST_SMALL);
|
||||||
|
if (il != NULL) {
|
||||||
|
int w, h;
|
||||||
|
il->GetSize(0, w, h);
|
||||||
|
w += 4;
|
||||||
|
lv->SetColumnWidth(0, w);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lv->SetColumnWidth(0, 0);
|
||||||
|
}
|
||||||
|
lv->SetColumnWidth(1, sz.x - lv->GetColumnWidth(0) -
|
||||||
|
wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListBox* GetLB() { return lb; }
|
|
||||||
|
|
||||||
#if wxUSE_POPUPWIN && wxSTC_USE_POPUP
|
void OnActivate(wxListEvent& event) {
|
||||||
virtual void DoSetSize(int x, int y,
|
doubleClickAction(doubleClickActionData);
|
||||||
int width, int height,
|
|
||||||
int sizeFlags = wxSIZE_AUTO) {
|
|
||||||
if (x != -1)
|
|
||||||
GetParent()->ClientToScreen(&x, NULL);
|
|
||||||
if (y != -1)
|
|
||||||
GetParent()->ClientToScreen(NULL, &y);
|
|
||||||
wxSTCListBoxWinBase::DoSetSize(x, y, width, height, sizeFlags);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
void SetDoubleClickAction(CallBackAction action, void *data) {
|
||||||
|
doubleClickAction = action;
|
||||||
|
doubleClickActionData = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxListView* GetLB() { return lv; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxSTCListBox* lb;
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxSTCListBoxWin, wxSTCListBoxWinBase)
|
|
||||||
EVT_SIZE(wxSTCListBoxWin::OnSize)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline wxListBox* GETLB(WindowID win) {
|
BEGIN_EVENT_TABLE(wxSTCListBoxWin, wxWindow)
|
||||||
|
EVT_SET_FOCUS ( wxSTCListBoxWin::OnFocus)
|
||||||
|
EVT_SIZE ( wxSTCListBoxWin::OnSize)
|
||||||
|
EVT_LIST_ITEM_ACTIVATED(-1, wxSTCListBoxWin::OnActivate)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inline wxListView* GETLB(WindowID win) {
|
||||||
return (((wxSTCListBoxWin*)win)->GetLB());
|
return (((wxSTCListBoxWin*)win)->GetLB());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
class ListBoxImpl : public ListBox {
|
||||||
|
private:
|
||||||
|
int lineHeight;
|
||||||
|
bool unicodeMode;
|
||||||
|
int desiredVisibleRows;
|
||||||
|
int aveCharWidth;
|
||||||
|
int maxStrWidth;
|
||||||
|
wxImageList* imgList;
|
||||||
|
wxArrayInt* imgTypeMap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ListBoxImpl();
|
||||||
|
~ListBoxImpl();
|
||||||
|
|
||||||
|
virtual void SetFont(Font &font);
|
||||||
|
virtual void Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_);
|
||||||
|
virtual void SetAverageCharWidth(int width);
|
||||||
|
virtual void SetVisibleRows(int rows);
|
||||||
|
virtual PRectangle GetDesiredRect();
|
||||||
|
virtual int CaretFromEdge();
|
||||||
|
virtual void Clear();
|
||||||
|
virtual void Append(char *s, int type = -1);
|
||||||
|
virtual int Length();
|
||||||
|
virtual void Select(int n);
|
||||||
|
virtual int GetSelection();
|
||||||
|
virtual int Find(const char *prefix);
|
||||||
|
virtual void GetValue(int n, char *value, int len);
|
||||||
|
virtual void Sort();
|
||||||
|
virtual void RegisterImage(int type, const char *xpm_data);
|
||||||
|
virtual void ClearRegisteredImages();
|
||||||
|
virtual void SetDoubleClickAction(CallBackAction, void *);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ListBoxImpl::ListBoxImpl()
|
||||||
|
: lineHeight(10), unicodeMode(false),
|
||||||
|
desiredVisibleRows(5), aveCharWidth(8), maxStrWidth(0),
|
||||||
|
imgList(NULL), imgTypeMap(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ListBoxImpl::~ListBoxImpl() {
|
||||||
|
if (imgList) {
|
||||||
|
delete imgList;
|
||||||
|
imgList = NULL;
|
||||||
|
}
|
||||||
|
if (imgTypeMap) {
|
||||||
|
delete imgTypeMap;
|
||||||
|
imgTypeMap = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::SetFont(Font &font) {
|
||||||
|
GETLB(id)->SetFont(*((wxFont*)font.GetID()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_) {
|
||||||
|
lineHeight = lineHeight_;
|
||||||
|
unicodeMode = unicodeMode_;
|
||||||
|
maxStrWidth = 0;
|
||||||
|
id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID);
|
||||||
|
if (imgList != NULL)
|
||||||
|
GETLB(id)->SetImageList(imgList, wxIMAGE_LIST_SMALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::SetAverageCharWidth(int width) {
|
||||||
|
aveCharWidth = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::SetVisibleRows(int rows) {
|
||||||
|
desiredVisibleRows = rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PRectangle ListBoxImpl::GetDesiredRect() {
|
||||||
|
// wxListCtrl doesn't have a DoGetBestSize, so instead we kept track of
|
||||||
|
// the max size in Append and calculate it here...
|
||||||
|
int maxw = maxStrWidth;
|
||||||
|
int maxh = 0;
|
||||||
|
|
||||||
|
// give it a default if there are no lines, and/or add a bit more
|
||||||
|
if (maxw == 0) maxw = 100;
|
||||||
|
maxw += aveCharWidth * 3 + IconWidth + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
|
||||||
|
if (maxw > 350)
|
||||||
|
maxw = 350;
|
||||||
|
|
||||||
|
// estimate a desired height
|
||||||
|
int count = GETLB(id)->GetItemCount();
|
||||||
|
if (count) {
|
||||||
|
wxRect rect;
|
||||||
|
GETLB(id)->GetItemRect(0, rect);
|
||||||
|
maxh = count * rect.GetHeight();
|
||||||
|
if (maxh > 140) // TODO: Use desiredVisibleRows??
|
||||||
|
maxh = 140;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
maxh = 100;
|
||||||
|
|
||||||
|
PRectangle rc;
|
||||||
|
rc.top = 0;
|
||||||
|
rc.left = 0;
|
||||||
|
rc.right = maxw;
|
||||||
|
rc.bottom = maxh;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ListBoxImpl::CaretFromEdge() {
|
||||||
|
return 0; // 4 + IconWidth(); TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::Clear() {
|
||||||
|
GETLB(id)->DeleteAllItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::Append(char *s, int type) {
|
||||||
|
wxString text = stc2wx(s);
|
||||||
|
long count = GETLB(id)->GetItemCount();
|
||||||
|
long itemID = GETLB(id)->InsertItem(count, wxEmptyString);
|
||||||
|
GETLB(id)->SetItem(itemID, 1, text);
|
||||||
|
int itemWidth = 0;
|
||||||
|
GETLB(id)->GetTextExtent(text, &itemWidth, NULL);
|
||||||
|
maxStrWidth = wxMax(maxStrWidth, itemWidth);
|
||||||
|
if (type != -1) {
|
||||||
|
wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap"));
|
||||||
|
long idx = imgTypeMap->Item(type);
|
||||||
|
GETLB(id)->SetItemImage(itemID, idx, idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ListBoxImpl::Length() {
|
||||||
|
return GETLB(id)->GetItemCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::Select(int n) {
|
||||||
|
bool select = TRUE;
|
||||||
|
if (n == -1) {
|
||||||
|
n = 0;
|
||||||
|
select = FALSE;
|
||||||
|
}
|
||||||
|
GETLB(id)->Focus(n);
|
||||||
|
GETLB(id)->Select(n, select);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ListBoxImpl::GetSelection() {
|
||||||
|
return GETLB(id)->GetFirstSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ListBoxImpl::Find(const char *prefix) {
|
||||||
|
// No longer used
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::GetValue(int n, char *value, int len) {
|
||||||
|
wxListItem item;
|
||||||
|
item.SetId(n);
|
||||||
|
item.SetColumn(1);
|
||||||
|
item.SetMask(wxLIST_MASK_TEXT);
|
||||||
|
GETLB(id)->GetItem(item);
|
||||||
|
strncpy(value, wx2stc(item.GetText()), len);
|
||||||
|
value[len-1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListBoxImpl::Sort() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::RegisterImage(int type, const char *xpm_data) {
|
||||||
|
wxMemoryInputStream stream(xpm_data, strlen(xpm_data)+1);
|
||||||
|
wxBitmap bmp(wxImage(stream, wxBITMAP_TYPE_XPM));
|
||||||
|
|
||||||
|
if (! imgList) {
|
||||||
|
// assumes all images are the same size
|
||||||
|
imgList = new wxImageList(bmp.GetWidth(), bmp.GetHeight(), TRUE);
|
||||||
|
imgTypeMap = new wxArrayInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
int idx = imgList->Add(bmp);
|
||||||
|
|
||||||
|
// do we need to extend the mapping array?
|
||||||
|
wxArrayInt& itm = *imgTypeMap;
|
||||||
|
if ( itm.GetCount() < type+1)
|
||||||
|
itm.Add(-1, type - itm.GetCount() + 1);
|
||||||
|
|
||||||
|
// Add an item that maps type to the image index
|
||||||
|
itm[type] = idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListBoxImpl::ClearRegisteredImages() {
|
||||||
|
printf("LB:ClearRegisteredImages\n");
|
||||||
|
if (imgList) {
|
||||||
|
delete imgList;
|
||||||
|
imgList = NULL;
|
||||||
|
}
|
||||||
|
if (imgTypeMap) {
|
||||||
|
delete imgTypeMap;
|
||||||
|
imgTypeMap = NULL;
|
||||||
|
}
|
||||||
|
if (id)
|
||||||
|
GETLB(id)->SetImageList(NULL, wxIMAGE_LIST_SMALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) {
|
||||||
|
((wxSTCListBoxWin*)id)->SetDoubleClickAction(action, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ListBox::ListBox() {
|
ListBox::ListBox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ListBox::~ListBox() {
|
ListBox::~ListBox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBox::Create(Window &parent, int ctrlID) {
|
ListBox *ListBox::Allocate() {
|
||||||
id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID);
|
return new ListBoxImpl();
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::SetVisibleRows(int rows) {
|
|
||||||
desiredVisibleRows = rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRectangle ListBox::GetDesiredRect() {
|
|
||||||
wxSize sz = GETLB(id)->GetBestSize();
|
|
||||||
PRectangle rc;
|
|
||||||
rc.top = 0;
|
|
||||||
rc.left = 0;
|
|
||||||
if (sz.x > 400)
|
|
||||||
sz.x = 400;
|
|
||||||
if (sz.y > 140) // TODO: Use desiredVisibleRows??
|
|
||||||
sz.y = 140;
|
|
||||||
rc.right = sz.x;
|
|
||||||
rc.bottom = sz.y;
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::SetAverageCharWidth(int width) {
|
|
||||||
aveCharWidth = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::SetFont(Font &font) {
|
|
||||||
GETLB(id)->SetFont(*((wxFont*)font.GetID()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::Clear() {
|
|
||||||
GETLB(id)->Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::Append(char *s) {
|
|
||||||
GETLB(id)->Append(stc2wx(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
int ListBox::Length() {
|
|
||||||
return GETLB(id)->GetCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::Select(int n) {
|
|
||||||
bool select = TRUE;
|
|
||||||
if (n == -1) {
|
|
||||||
n = 0;
|
|
||||||
select = FALSE;
|
|
||||||
}
|
|
||||||
GETLB(id)->SetSelection(n, select);
|
|
||||||
#ifdef __WXGTK__
|
|
||||||
if (n > 4)
|
|
||||||
n = n - 4;
|
|
||||||
else
|
|
||||||
n = 0;
|
|
||||||
GETLB(id)->SetFirstItem(n);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int ListBox::GetSelection() {
|
|
||||||
return GETLB(id)->GetSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
int ListBox::Find(const char *prefix) {
|
|
||||||
// No longer used
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::GetValue(int n, char *value, int len) {
|
|
||||||
wxString text = GETLB(id)->GetString(n);
|
|
||||||
strncpy(value, wx2stc(text), len);
|
|
||||||
value[len-1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::Sort() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -906,7 +1073,7 @@ const char *Platform::DefaultFont() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Platform::DefaultFontSize() {
|
int Platform::DefaultFontSize() {
|
||||||
return 8;
|
return wxNORMAL_FONT->GetPointSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Platform::DoubleClickTime() {
|
unsigned int Platform::DoubleClickTime() {
|
||||||
@@ -1014,6 +1181,13 @@ bool Platform::IsDBCSLeadByte(int codePage, char ch) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Platform::DBCSCharLength(int codePage, const char *s) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Platform::DBCSCharMaxLength() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@@ -67,7 +67,7 @@ void wxSTCDropTarget::OnLeave() {
|
|||||||
#define param2 wxBORDER_NONE // popup's 2nd param is flags
|
#define param2 wxBORDER_NONE // popup's 2nd param is flags
|
||||||
#else
|
#else
|
||||||
#define wxSTCCallTipBase wxWindow
|
#define wxSTCCallTipBase wxWindow
|
||||||
#define param2 -1 // wxWindows 2nd param is ID
|
#define param2 -1 // wxWindow's 2nd param is ID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class wxSTCCallTip : public wxSTCCallTipBase {
|
class wxSTCCallTip : public wxSTCCallTipBase {
|
||||||
@@ -438,9 +438,9 @@ long ScintillaWX::WndProc(unsigned int iMessage, unsigned long wParam, long lPar
|
|||||||
switch (iMessage) {
|
switch (iMessage) {
|
||||||
case SCI_CALLTIPSHOW: {
|
case SCI_CALLTIPSHOW: {
|
||||||
// NOTE: This is copied here from scintilla/src/ScintillaBase.cxx
|
// NOTE: This is copied here from scintilla/src/ScintillaBase.cxx
|
||||||
// because of the little tweak that needs done below. When updating
|
// because of the little tweak that needs done below for wxGTK.
|
||||||
// new versions double check that this is still needed, and that any
|
// When updating new versions double check that this is still
|
||||||
// new code there is copied here too.
|
// needed, and that any new code there is copied here too.
|
||||||
AutoCompleteCancel();
|
AutoCompleteCancel();
|
||||||
if (!ct.wCallTip.Created()) {
|
if (!ct.wCallTip.Created()) {
|
||||||
Point pt = LocationFromPosition(wParam);
|
Point pt = LocationFromPosition(wParam);
|
||||||
@@ -470,20 +470,6 @@ long ScintillaWX::WndProc(unsigned int iMessage, unsigned long wParam, long lPar
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SCI_SETCARETWIDTH:
|
|
||||||
// NOTE: Allows a caet width of zero. This one has been added to
|
|
||||||
// Scintilla CVS so it can be removed from here when we update to
|
|
||||||
// version 1.50.
|
|
||||||
if (wParam <= 0)
|
|
||||||
vs.caretWidth = 0;
|
|
||||||
else if (wParam >= 3)
|
|
||||||
vs.caretWidth = 3;
|
|
||||||
else
|
|
||||||
vs.caretWidth = wParam;
|
|
||||||
InvalidateStyleRedraw();
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return ScintillaBase::WndProc(iMessage, wParam, lParam);
|
return ScintillaBase::WndProc(iMessage, wParam, lParam);
|
||||||
}
|
}
|
||||||
@@ -500,21 +486,21 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
|
|||||||
paintState = painting;
|
paintState = painting;
|
||||||
Surface* surfaceWindow = Surface::Allocate();
|
Surface* surfaceWindow = Surface::Allocate();
|
||||||
surfaceWindow->Init(dc);
|
surfaceWindow->Init(dc);
|
||||||
PRectangle rcPaint = PRectangleFromwxRect(rect);
|
rcPaint = PRectangleFromwxRect(rect);
|
||||||
|
PRectangle rcClient = GetClientRectangle();
|
||||||
|
paintingAllText = rcPaint.Contains(rcClient);
|
||||||
|
|
||||||
dc->BeginDrawing();
|
dc->BeginDrawing();
|
||||||
|
ClipChildren(*dc, rcPaint);
|
||||||
Paint(surfaceWindow, rcPaint);
|
Paint(surfaceWindow, rcPaint);
|
||||||
dc->EndDrawing();
|
dc->EndDrawing();
|
||||||
|
|
||||||
delete surfaceWindow;
|
delete surfaceWindow;
|
||||||
if (paintState == paintAbandoned) {
|
if (paintState == paintAbandoned) {
|
||||||
// Painting area was insufficient to cover new styling or brace highlight positions
|
// Painting area was insufficient to cover new styling or brace highlight positions
|
||||||
FullPaint();
|
FullPaint();
|
||||||
}
|
}
|
||||||
paintState = notPainting;
|
paintState = notPainting;
|
||||||
#ifdef __WXGTK__
|
|
||||||
// On wxGTK the editor window paints can overwrite the listbox...
|
|
||||||
if (ac.Active())
|
|
||||||
((wxWindow*)ac.lb.GetID())->Refresh(TRUE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -791,16 +777,18 @@ void ScintillaWX::DoDragLeave() {
|
|||||||
// Redraw all of text area. This paint will not be abandoned.
|
// Redraw all of text area. This paint will not be abandoned.
|
||||||
void ScintillaWX::FullPaint() {
|
void ScintillaWX::FullPaint() {
|
||||||
paintState = painting;
|
paintState = painting;
|
||||||
rcPaint = GetTextRectangle();
|
rcPaint = GetClientRectangle();
|
||||||
paintingAllText = true;
|
paintingAllText = true;
|
||||||
wxClientDC dc(stc);
|
wxClientDC dc(stc);
|
||||||
Surface* surfaceWindow = Surface::Allocate();
|
Surface* surfaceWindow = Surface::Allocate();
|
||||||
surfaceWindow->Init(&dc);
|
surfaceWindow->Init(&dc);
|
||||||
|
|
||||||
|
dc.BeginDrawing();
|
||||||
|
ClipChildren(dc, rcPaint);
|
||||||
Paint(surfaceWindow, rcPaint);
|
Paint(surfaceWindow, rcPaint);
|
||||||
|
dc.EndDrawing();
|
||||||
|
|
||||||
delete surfaceWindow;
|
delete surfaceWindow;
|
||||||
|
|
||||||
// stc->Refresh(FALSE);
|
|
||||||
|
|
||||||
paintState = notPainting;
|
paintState = notPainting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -814,6 +802,21 @@ void ScintillaWX::DoScrollToColumn(int column) {
|
|||||||
HorizontalScrollTo(column * vs.spaceWidth);
|
HorizontalScrollTo(column * vs.spaceWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
wxRegion rgn(wxRectFromPRectangle(rect));
|
||||||
|
if (ac.Active()) {
|
||||||
|
wxRect childRect = ((wxWindow*)ac.lb->GetID())->GetRect();
|
||||||
|
rgn.Subtract(childRect);
|
||||||
|
}
|
||||||
|
if (ct.inCallTipMode) {
|
||||||
|
wxRect childRect = ((wxWindow*)ct.wCallTip.GetID())->GetRect();
|
||||||
|
rgn.Subtract(childRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.SetClippingRegion(rgn);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
#include "XPM.h"
|
||||||
#ifdef SCI_LEXER
|
#ifdef SCI_LEXER
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
#include "PropSet.h"
|
#include "PropSet.h"
|
||||||
@@ -149,6 +150,7 @@ public:
|
|||||||
bool GetHideSelection() { return hideSelection; }
|
bool GetHideSelection() { return hideSelection; }
|
||||||
void DoScrollToLine(int line);
|
void DoScrollToLine(int line);
|
||||||
void DoScrollToColumn(int column);
|
void DoScrollToColumn(int column);
|
||||||
|
void ClipChildren(wxDC& dc, PRectangle rect);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool capturedMouse;
|
bool capturedMouse;
|
||||||
|
@@ -282,6 +282,10 @@ SOURCE=.\scintilla\src\LexAda.cxx
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\scintilla\src\LexAsm.cxx
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\scintilla\src\LexAVE.cxx
|
SOURCE=.\scintilla\src\LexAVE.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -306,10 +310,18 @@ SOURCE=.\scintilla\src\LexCrontab.cxx
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\scintilla\src\LexCSS.cxx
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\scintilla\src\LexEiffel.cxx
|
SOURCE=.\scintilla\src\LexEiffel.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\scintilla\src\LexFortran.cxx
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\scintilla\src\LexHTML.cxx
|
SOURCE=.\scintilla\src\LexHTML.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -446,6 +458,10 @@ SOURCE=.\scintilla\src\WindowAccessor.cxx
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\scintilla\src\XPM.cxx
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\scintilla\include\WindowAccessor.h
|
SOURCE=.\scintilla\include\WindowAccessor.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
@@ -42,6 +42,7 @@ cmdValues = [ (2300, 2349),
|
|||||||
(2176, 2180),
|
(2176, 2180),
|
||||||
(2390, 2393),
|
(2390, 2393),
|
||||||
(2395, 2396),
|
(2395, 2396),
|
||||||
|
2404,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -88,90 +89,113 @@ methodOverrideMap = {
|
|||||||
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
|
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
|
||||||
'SetViewWS' : ( 'SetViewWhiteSpace', 0, 0, 0),
|
'SetViewWS' : ( 'SetViewWhiteSpace', 0, 0, 0),
|
||||||
|
|
||||||
'GetCharAt' : ( 0, 0,
|
'GetCharAt' :
|
||||||
'''int %s(int pos) {
|
( 0, 0,
|
||||||
return (unsigned char)SendMsg(%s, pos, 0);''',
|
'''int %s(int pos) {
|
||||||
0),
|
return (unsigned char)SendMsg(%s, pos, 0);''',
|
||||||
|
0),
|
||||||
|
|
||||||
'GetStyleAt' : ( 0, 0,
|
'GetStyleAt' :
|
||||||
'''int %s(int pos) {
|
( 0, 0,
|
||||||
return (unsigned char)SendMsg(%s, pos, 0);''',
|
'''int %s(int pos) {
|
||||||
0),
|
return (unsigned char)SendMsg(%s, pos, 0);''',
|
||||||
|
0),
|
||||||
|
|
||||||
'GetStyledText' : (0,
|
'GetStyledText' :
|
||||||
'wxMemoryBuffer %s(int startPos, int endPos);',
|
(0,
|
||||||
|
'wxMemoryBuffer %s(int startPos, int endPos);',
|
||||||
|
|
||||||
'''wxMemoryBuffer %s(int startPos, int endPos) {
|
'''wxMemoryBuffer %s(int startPos, int endPos) {
|
||||||
wxMemoryBuffer buf;
|
wxMemoryBuffer buf;
|
||||||
if (endPos < startPos) {
|
if (endPos < startPos) {
|
||||||
int temp = startPos;
|
int temp = startPos;
|
||||||
startPos = endPos;
|
startPos = endPos;
|
||||||
endPos = temp;
|
endPos = temp;
|
||||||
}
|
}
|
||||||
int len = endPos - startPos;
|
int len = endPos - startPos;
|
||||||
if (!len) return buf;
|
if (!len) return buf;
|
||||||
TextRange tr;
|
TextRange tr;
|
||||||
tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
|
tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
|
||||||
tr.chrg.cpMin = startPos;
|
tr.chrg.cpMin = startPos;
|
||||||
tr.chrg.cpMax = endPos;
|
tr.chrg.cpMax = endPos;
|
||||||
len = SendMsg(%s, 0, (long)&tr);
|
len = SendMsg(%s, 0, (long)&tr);
|
||||||
buf.UngetWriteBuf(len);
|
buf.UngetWriteBuf(len);
|
||||||
return buf;''',
|
return buf;''',
|
||||||
|
|
||||||
('Retrieve a buffer of cells.',)),
|
('Retrieve a buffer of cells.',)),
|
||||||
|
|
||||||
|
|
||||||
'PositionFromPoint' : (0,
|
'PositionFromPoint' :
|
||||||
'int %s(wxPoint pt);',
|
(0,
|
||||||
|
'int %s(wxPoint pt);',
|
||||||
|
|
||||||
'''int %s(wxPoint pt) {
|
'''int %s(wxPoint pt) {
|
||||||
return SendMsg(%s, pt.x, pt.y);''',
|
return SendMsg(%s, pt.x, pt.y);''',
|
||||||
|
0),
|
||||||
|
|
||||||
0),
|
'GetCurLine' :
|
||||||
|
(0,
|
||||||
|
'#ifdef SWIG\n wxString %s(int* OUTPUT);\n#else\n wxString GetCurLine(int* linePos=NULL);\n#endif',
|
||||||
|
|
||||||
'GetCurLine' : (0,
|
'''wxString %s(int* linePos) {
|
||||||
'#ifdef SWIG\n wxString %s(int* OUTPUT);\n#else\n wxString GetCurLine(int* linePos=NULL);\n#endif',
|
int len = LineLength(GetCurrentLine());
|
||||||
|
if (!len) {
|
||||||
|
if (linePos) *linePos = 0;
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
|
|
||||||
'''wxString %s(int* linePos) {
|
wxMemoryBuffer mbuf(len+1);
|
||||||
int len = LineLength(GetCurrentLine());
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
if (!len) {
|
|
||||||
if (linePos) *linePos = 0;
|
|
||||||
return wxEmptyString;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
int pos = SendMsg(%s, len+1, (long)buf);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
mbuf.UngetWriteBuf(len);
|
||||||
|
mbuf.AppendByte(0);
|
||||||
|
if (linePos) *linePos = pos;
|
||||||
|
return stc2wx(buf);''',
|
||||||
|
|
||||||
int pos = SendMsg(%s, len+1, (long)buf);
|
0),
|
||||||
mbuf.UngetWriteBuf(len);
|
|
||||||
mbuf.AppendByte(0);
|
|
||||||
if (linePos) *linePos = pos;
|
|
||||||
return stc2wx(buf);''',
|
|
||||||
|
|
||||||
0),
|
|
||||||
|
|
||||||
'SetUsePalette' : (None, 0,0,0),
|
'SetUsePalette' : (None, 0,0,0),
|
||||||
|
|
||||||
'MarkerSetFore' : ('MarkerSetForeground', 0, 0, 0),
|
'MarkerSetFore' : ('MarkerSetForeground', 0, 0, 0),
|
||||||
'MarkerSetBack' : ('MarkerSetBackground', 0, 0, 0),
|
'MarkerSetBack' : ('MarkerSetBackground', 0, 0, 0),
|
||||||
|
|
||||||
'MarkerDefine' : (0,
|
'MarkerDefine' :
|
||||||
'''void %s(int markerNumber, int markerSymbol,
|
(0,
|
||||||
const wxColour& foreground = wxNullColour,
|
'''void %s(int markerNumber, int markerSymbol,
|
||||||
const wxColour& background = wxNullColour);''',
|
const wxColour& foreground = wxNullColour,
|
||||||
|
const wxColour& background = wxNullColour);''',
|
||||||
|
|
||||||
'''void %s(int markerNumber, int markerSymbol,
|
'''void %s(int markerNumber, int markerSymbol,
|
||||||
const wxColour& foreground,
|
const wxColour& foreground,
|
||||||
const wxColour& background) {
|
const wxColour& background) {
|
||||||
|
|
||||||
SendMsg(%s, markerNumber, markerSymbol);
|
SendMsg(%s, markerNumber, markerSymbol);
|
||||||
if (foreground.Ok())
|
if (foreground.Ok())
|
||||||
MarkerSetForeground(markerNumber, foreground);
|
MarkerSetForeground(markerNumber, foreground);
|
||||||
if (background.Ok())
|
if (background.Ok())
|
||||||
MarkerSetBackground(markerNumber, background);''',
|
MarkerSetBackground(markerNumber, background);''',
|
||||||
|
|
||||||
|
('Set the symbol used for a particular marker number,',
|
||||||
|
'and optionally the fore and background colours.')),
|
||||||
|
|
||||||
|
|
||||||
|
'MarkerDefinePixmap' :
|
||||||
|
('MarkerDefineBitmap',
|
||||||
|
'''void %s(int markerNumber, const wxBitmap& bmp);''',
|
||||||
|
'''void %s(int markerNumber, const wxBitmap& bmp) {
|
||||||
|
// convert bmp to a xpm in a string
|
||||||
|
wxMemoryOutputStream strm;
|
||||||
|
wxImage(bmp).SaveFile(strm, wxBITMAP_TYPE_XPM);
|
||||||
|
size_t len = strm.GetSize();
|
||||||
|
char* buff = new char[len+1];
|
||||||
|
strm.CopyTo(buff, len);
|
||||||
|
buff[len+1] = 0;
|
||||||
|
SendMsg(%s, markerNumber, (long)buff);
|
||||||
|
delete [] buff;
|
||||||
|
''',
|
||||||
|
('Define a marker from a bitmap',)),
|
||||||
|
|
||||||
('Set the symbol used for a particular marker number,',
|
|
||||||
'and optionally the fore and background colours.')),
|
|
||||||
|
|
||||||
'SetMarginTypeN' : ('SetMarginType', 0, 0, 0),
|
'SetMarginTypeN' : ('SetMarginType', 0, 0, 0),
|
||||||
'GetMarginTypeN' : ('GetMarginType', 0, 0, 0),
|
'GetMarginTypeN' : ('GetMarginType', 0, 0, 0),
|
||||||
@@ -189,32 +213,33 @@ methodOverrideMap = {
|
|||||||
'SetCaretFore' : ('SetCaretForeground', 0, 0, 0),
|
'SetCaretFore' : ('SetCaretForeground', 0, 0, 0),
|
||||||
'StyleSetFont' : ('StyleSetFaceName', 0, 0, 0),
|
'StyleSetFont' : ('StyleSetFaceName', 0, 0, 0),
|
||||||
|
|
||||||
'AssignCmdKey' : ('CmdKeyAssign',
|
'AssignCmdKey' :
|
||||||
'void %s(int key, int modifiers, int cmd);',
|
('CmdKeyAssign',
|
||||||
|
'void %s(int key, int modifiers, int cmd);',
|
||||||
|
|
||||||
'''void %s(int key, int modifiers, int cmd) {
|
'''void %s(int key, int modifiers, int cmd) {
|
||||||
SendMsg(%s, MAKELONG(key, modifiers), cmd);''',
|
SendMsg(%s, MAKELONG(key, modifiers), cmd);''',
|
||||||
|
0),
|
||||||
|
|
||||||
0),
|
|
||||||
|
|
||||||
'ClearCmdKey' : ('CmdKeyClear',
|
'ClearCmdKey' :
|
||||||
'void %s(int key, int modifiers);',
|
('CmdKeyClear',
|
||||||
|
'void %s(int key, int modifiers);',
|
||||||
|
|
||||||
'''void %s(int key, int modifiers) {
|
'''void %s(int key, int modifiers) {
|
||||||
SendMsg(%s, MAKELONG(key, modifiers));''',
|
SendMsg(%s, MAKELONG(key, modifiers));''',
|
||||||
|
0),
|
||||||
0),
|
|
||||||
|
|
||||||
'ClearAllCmdKeys' : ('CmdKeyClearAll', 0, 0, 0),
|
'ClearAllCmdKeys' : ('CmdKeyClearAll', 0, 0, 0),
|
||||||
|
|
||||||
|
|
||||||
'SetStylingEx' : ('SetStyleBytes',
|
'SetStylingEx' :
|
||||||
'void %s(int length, char* styleBytes);',
|
('SetStyleBytes',
|
||||||
|
'void %s(int length, char* styleBytes);',
|
||||||
|
|
||||||
'''void %s(int length, char* styleBytes) {
|
'''void %s(int length, char* styleBytes) {
|
||||||
SendMsg(%s, length, (long)styleBytes);''',
|
SendMsg(%s, length, (long)styleBytes);''',
|
||||||
|
0),
|
||||||
0),
|
|
||||||
|
|
||||||
|
|
||||||
'IndicSetStyle' : ('IndicatorSetStyle', 0, 0, 0),
|
'IndicSetStyle' : ('IndicatorSetStyle', 0, 0, 0),
|
||||||
@@ -245,129 +270,161 @@ methodOverrideMap = {
|
|||||||
'AutoCGetAutoHide' : ('AutoCompGetAutoHide', 0, 0, 0),
|
'AutoCGetAutoHide' : ('AutoCompGetAutoHide', 0, 0, 0),
|
||||||
'AutoCSetDropRestOfWord' : ('AutoCompSetDropRestOfWord', 0,0,0),
|
'AutoCSetDropRestOfWord' : ('AutoCompSetDropRestOfWord', 0,0,0),
|
||||||
'AutoCGetDropRestOfWord' : ('AutoCompGetDropRestOfWord', 0,0,0),
|
'AutoCGetDropRestOfWord' : ('AutoCompGetDropRestOfWord', 0,0,0),
|
||||||
|
'AutoCGetTypeSeparator' : ('AutoCompGetTypeSeparator', 0, 0, 0),
|
||||||
|
'AutoCSetTypeSeparator' : ('AutoCompSetTypeSeparator', 0, 0, 0),
|
||||||
|
|
||||||
|
'RegisterImage' :
|
||||||
|
(0,
|
||||||
|
'''void %s(int type, const wxBitmap& bmp);''',
|
||||||
|
'''void %s(int type, const wxBitmap& bmp) {
|
||||||
|
// convert bmp to a xpm in a string
|
||||||
|
wxMemoryOutputStream strm;
|
||||||
|
wxImage(bmp).SaveFile(strm, wxBITMAP_TYPE_XPM);
|
||||||
|
size_t len = strm.GetSize();
|
||||||
|
char* buff = new char[len+1];
|
||||||
|
strm.CopyTo(buff, len);
|
||||||
|
buff[len+1] = 0;
|
||||||
|
SendMsg(%s, type, (long)buff);
|
||||||
|
delete [] buff;
|
||||||
|
''',
|
||||||
|
('Register an image for use in autocompletion lists.',)),
|
||||||
|
|
||||||
|
|
||||||
|
'ClearRegisteredImages' : (0, 0, 0,
|
||||||
|
('Clear all the registered images.',)),
|
||||||
|
|
||||||
|
|
||||||
'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0, 0),
|
'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0, 0),
|
||||||
'GetHScrollBar' : ('GetUseHorizontalScrollBar', 0, 0, 0),
|
'GetHScrollBar' : ('GetUseHorizontalScrollBar', 0, 0, 0),
|
||||||
|
|
||||||
|
'SetVScrollBar' : ('SetUseVerticalScrollBar', 0, 0, 0),
|
||||||
|
'GetVScrollBar' : ('GetUseVerticalScrollBar', 0, 0, 0),
|
||||||
|
|
||||||
'GetCaretFore' : ('GetCaretForeground', 0, 0, 0),
|
'GetCaretFore' : ('GetCaretForeground', 0, 0, 0),
|
||||||
|
|
||||||
'GetUsePalette' : (None, 0, 0, 0),
|
'GetUsePalette' : (None, 0, 0, 0),
|
||||||
|
|
||||||
'FindText' : (0,
|
'FindText' :
|
||||||
'''int %s(int minPos, int maxPos, const wxString& text, int flags=0);''',
|
(0,
|
||||||
|
'''int %s(int minPos, int maxPos, const wxString& text, int flags=0);''',
|
||||||
|
|
||||||
'''int %s(int minPos, int maxPos,
|
'''int %s(int minPos, int maxPos,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int flags) {
|
int flags) {
|
||||||
TextToFind ft;
|
TextToFind ft;
|
||||||
ft.chrg.cpMin = minPos;
|
ft.chrg.cpMin = minPos;
|
||||||
ft.chrg.cpMax = maxPos;
|
ft.chrg.cpMax = maxPos;
|
||||||
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
||||||
ft.lpstrText = (char*)(const char*)buf;
|
ft.lpstrText = (char*)(const char*)buf;
|
||||||
|
|
||||||
return SendMsg(%s, flags, (long)&ft);''',
|
return SendMsg(%s, flags, (long)&ft);''',
|
||||||
0),
|
0),
|
||||||
|
|
||||||
'FormatRange' : (0,
|
'FormatRange' :
|
||||||
'''int %s(bool doDraw,
|
(0,
|
||||||
int startPos,
|
'''int %s(bool doDraw,
|
||||||
int endPos,
|
int startPos,
|
||||||
wxDC* draw,
|
int endPos,
|
||||||
wxDC* target, // Why does it use two? Can they be the same?
|
wxDC* draw,
|
||||||
wxRect renderRect,
|
wxDC* target, // Why does it use two? Can they be the same?
|
||||||
wxRect pageRect);''',
|
wxRect renderRect,
|
||||||
''' int %s(bool doDraw,
|
wxRect pageRect);''',
|
||||||
int startPos,
|
''' int %s(bool doDraw,
|
||||||
int endPos,
|
int startPos,
|
||||||
wxDC* draw,
|
int endPos,
|
||||||
wxDC* target, // Why does it use two? Can they be the same?
|
wxDC* draw,
|
||||||
wxRect renderRect,
|
wxDC* target, // Why does it use two? Can they be the same?
|
||||||
wxRect pageRect) {
|
wxRect renderRect,
|
||||||
RangeToFormat fr;
|
wxRect pageRect) {
|
||||||
|
RangeToFormat fr;
|
||||||
|
|
||||||
if (endPos < startPos) {
|
if (endPos < startPos) {
|
||||||
int temp = startPos;
|
int temp = startPos;
|
||||||
startPos = endPos;
|
startPos = endPos;
|
||||||
endPos = temp;
|
endPos = temp;
|
||||||
}
|
}
|
||||||
fr.hdc = draw;
|
fr.hdc = draw;
|
||||||
fr.hdcTarget = target;
|
fr.hdcTarget = target;
|
||||||
fr.rc.top = renderRect.GetTop();
|
fr.rc.top = renderRect.GetTop();
|
||||||
fr.rc.left = renderRect.GetLeft();
|
fr.rc.left = renderRect.GetLeft();
|
||||||
fr.rc.right = renderRect.GetRight();
|
fr.rc.right = renderRect.GetRight();
|
||||||
fr.rc.bottom = renderRect.GetBottom();
|
fr.rc.bottom = renderRect.GetBottom();
|
||||||
fr.rcPage.top = pageRect.GetTop();
|
fr.rcPage.top = pageRect.GetTop();
|
||||||
fr.rcPage.left = pageRect.GetLeft();
|
fr.rcPage.left = pageRect.GetLeft();
|
||||||
fr.rcPage.right = pageRect.GetRight();
|
fr.rcPage.right = pageRect.GetRight();
|
||||||
fr.rcPage.bottom = pageRect.GetBottom();
|
fr.rcPage.bottom = pageRect.GetBottom();
|
||||||
fr.chrg.cpMin = startPos;
|
fr.chrg.cpMin = startPos;
|
||||||
fr.chrg.cpMax = endPos;
|
fr.chrg.cpMax = endPos;
|
||||||
|
|
||||||
return SendMsg(%s, doDraw, (long)&fr);''',
|
return SendMsg(%s, doDraw, (long)&fr);''',
|
||||||
0),
|
0),
|
||||||
|
|
||||||
|
|
||||||
'GetLine' : (0,
|
'GetLine' :
|
||||||
'wxString %s(int line);',
|
(0,
|
||||||
|
'wxString %s(int line);',
|
||||||
|
|
||||||
'''wxString %s(int line) {
|
'''wxString %s(int line) {
|
||||||
int len = LineLength(line);
|
int len = LineLength(line);
|
||||||
if (!len) return wxEmptyString;
|
if (!len) return wxEmptyString;
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+1);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(%s, line, (long)buf);
|
SendMsg(%s, line, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
mbuf.AppendByte(0);
|
mbuf.AppendByte(0);
|
||||||
return stc2wx(buf);''',
|
return stc2wx(buf);''',
|
||||||
|
|
||||||
('Retrieve the contents of a line.',)),
|
('Retrieve the contents of a line.',)),
|
||||||
|
|
||||||
'SetSel' : ('SetSelection', 0, 0, 0),
|
'SetSel' : ('SetSelection', 0, 0, 0),
|
||||||
'GetSelText' : ('GetSelectedText',
|
|
||||||
'wxString %s();',
|
|
||||||
|
|
||||||
'''wxString %s() {
|
'GetSelText' :
|
||||||
int start;
|
('GetSelectedText',
|
||||||
int end;
|
'wxString %s();',
|
||||||
|
|
||||||
GetSelection(&start, &end);
|
'''wxString %s() {
|
||||||
int len = end - start;
|
int start;
|
||||||
if (!len) return wxEmptyString;
|
int end;
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
GetSelection(&start, &end);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
int len = end - start;
|
||||||
SendMsg(%s, 0, (long)buf);
|
if (!len) return wxEmptyString;
|
||||||
mbuf.UngetWriteBuf(len);
|
|
||||||
mbuf.AppendByte(0);
|
|
||||||
return stc2wx(buf);''',
|
|
||||||
|
|
||||||
('Retrieve the selected text.',)),
|
wxMemoryBuffer mbuf(len+1);
|
||||||
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
|
SendMsg(%s, 0, (long)buf);
|
||||||
|
mbuf.UngetWriteBuf(len);
|
||||||
|
mbuf.AppendByte(0);
|
||||||
|
return stc2wx(buf);''',
|
||||||
|
|
||||||
'GetTextRange' : (0,
|
('Retrieve the selected text.',)),
|
||||||
'wxString %s(int startPos, int endPos);',
|
|
||||||
|
|
||||||
'''wxString %s(int startPos, int endPos) {
|
|
||||||
if (endPos < startPos) {
|
|
||||||
int temp = startPos;
|
|
||||||
startPos = endPos;
|
|
||||||
endPos = temp;
|
|
||||||
}
|
|
||||||
int len = endPos - startPos;
|
|
||||||
if (!len) return wxEmptyString;
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len);
|
|
||||||
TextRange tr;
|
|
||||||
tr.lpstrText = buf;
|
|
||||||
tr.chrg.cpMin = startPos;
|
|
||||||
tr.chrg.cpMax = endPos;
|
|
||||||
SendMsg(%s, 0, (long)&tr);
|
|
||||||
mbuf.UngetWriteBuf(len);
|
|
||||||
mbuf.AppendByte(0);
|
|
||||||
return stc2wx(buf);''',
|
|
||||||
|
|
||||||
('Retrieve a range of text.',)),
|
'GetTextRange' :
|
||||||
|
(0,
|
||||||
|
'wxString %s(int startPos, int endPos);',
|
||||||
|
|
||||||
|
'''wxString %s(int startPos, int endPos) {
|
||||||
|
if (endPos < startPos) {
|
||||||
|
int temp = startPos;
|
||||||
|
startPos = endPos;
|
||||||
|
endPos = temp;
|
||||||
|
}
|
||||||
|
int len = endPos - startPos;
|
||||||
|
if (!len) return wxEmptyString;
|
||||||
|
wxMemoryBuffer mbuf(len+1);
|
||||||
|
char* buf = (char*)mbuf.GetWriteBuf(len);
|
||||||
|
TextRange tr;
|
||||||
|
tr.lpstrText = buf;
|
||||||
|
tr.chrg.cpMin = startPos;
|
||||||
|
tr.chrg.cpMax = endPos;
|
||||||
|
SendMsg(%s, 0, (long)&tr);
|
||||||
|
mbuf.UngetWriteBuf(len);
|
||||||
|
mbuf.AppendByte(0);
|
||||||
|
return stc2wx(buf);''',
|
||||||
|
|
||||||
|
('Retrieve a range of text.',)),
|
||||||
|
|
||||||
'PointXFromPosition' : (None, 0, 0, 0),
|
'PointXFromPosition' : (None, 0, 0, 0),
|
||||||
'PointYFromPosition' : (None, 0, 0, 0),
|
'PointYFromPosition' : (None, 0, 0, 0),
|
||||||
@@ -376,19 +433,20 @@ methodOverrideMap = {
|
|||||||
'ReplaceSel' : ('ReplaceSelection', 0, 0, 0),
|
'ReplaceSel' : ('ReplaceSelection', 0, 0, 0),
|
||||||
'Null' : (None, 0, 0, 0),
|
'Null' : (None, 0, 0, 0),
|
||||||
|
|
||||||
'GetText' : (0,
|
'GetText' :
|
||||||
'wxString %s();',
|
(0,
|
||||||
|
'wxString %s();',
|
||||||
|
|
||||||
'''wxString %s() {
|
'''wxString %s() {
|
||||||
int len = GetTextLength();
|
int len = GetTextLength();
|
||||||
wxMemoryBuffer mbuf(len+1); // leave room for the null...
|
wxMemoryBuffer mbuf(len+1); // leave room for the null...
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(%s, len+1, (long)buf);
|
SendMsg(%s, len+1, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
mbuf.AppendByte(0);
|
mbuf.AppendByte(0);
|
||||||
return stc2wx(buf);''',
|
return stc2wx(buf);''',
|
||||||
|
|
||||||
('Retrieve all the text in the document.', )),
|
('Retrieve all the text in the document.', )),
|
||||||
|
|
||||||
'GetDirectFunction' : (None, 0, 0, 0),
|
'GetDirectFunction' : (None, 0, 0, 0),
|
||||||
'GetDirectPointer' : (None, 0, 0, 0),
|
'GetDirectPointer' : (None, 0, 0, 0),
|
||||||
@@ -398,66 +456,76 @@ methodOverrideMap = {
|
|||||||
'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
|
'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
|
||||||
|
|
||||||
|
|
||||||
'ReplaceTarget' : (0,
|
'ReplaceTarget' :
|
||||||
'int %s(const wxString& text);',
|
(0,
|
||||||
|
'int %s(const wxString& text);',
|
||||||
|
|
||||||
'''
|
'''
|
||||||
int %s(const wxString& text) {
|
int %s(const wxString& text) {
|
||||||
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
||||||
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
|
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
|
||||||
0),
|
0),
|
||||||
|
|
||||||
'ReplaceTargetRE' : (0,
|
'ReplaceTargetRE' :
|
||||||
'int %s(const wxString& text);',
|
(0,
|
||||||
|
'int %s(const wxString& text);',
|
||||||
|
|
||||||
'''
|
'''
|
||||||
int %s(const wxString& text) {
|
int %s(const wxString& text) {
|
||||||
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
||||||
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
|
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
|
||||||
0),
|
0),
|
||||||
|
|
||||||
'SearchInTarget' : (0,
|
'SearchInTarget' :
|
||||||
'int %s(const wxString& text);',
|
(0,
|
||||||
|
'int %s(const wxString& text);',
|
||||||
|
|
||||||
'''
|
'''
|
||||||
int %s(const wxString& text) {
|
int %s(const wxString& text) {
|
||||||
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
||||||
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
|
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
|
||||||
0),
|
0),
|
||||||
|
|
||||||
|
|
||||||
'GetDocPointer' : (0,
|
'GetDocPointer' :
|
||||||
'void* %s();',
|
(0,
|
||||||
'''void* %s() {
|
'void* %s();',
|
||||||
return (void*)SendMsg(%s);''',
|
'''void* %s() {
|
||||||
0),
|
return (void*)SendMsg(%s);''',
|
||||||
|
0),
|
||||||
|
|
||||||
'SetDocPointer' : (0,
|
'SetDocPointer' :
|
||||||
'void %s(void* docPointer);',
|
(0,
|
||||||
'''void %s(void* docPointer) {
|
'void %s(void* docPointer);',
|
||||||
SendMsg(%s, 0, (long)docPointer);''',
|
'''void %s(void* docPointer) {
|
||||||
0),
|
SendMsg(%s, 0, (long)docPointer);''',
|
||||||
|
0),
|
||||||
|
|
||||||
'CreateDocument' : (0,
|
'CreateDocument' :
|
||||||
'void* %s();',
|
(0,
|
||||||
'''void* %s() {
|
'void* %s();',
|
||||||
return (void*)SendMsg(%s);''',
|
'''void* %s() {
|
||||||
0),
|
return (void*)SendMsg(%s);''',
|
||||||
|
0),
|
||||||
|
|
||||||
'AddRefDocument' : (0,
|
'AddRefDocument' :
|
||||||
'void %s(void* docPointer);',
|
(0,
|
||||||
'''void %s(void* docPointer) {
|
'void %s(void* docPointer);',
|
||||||
SendMsg(%s, 0, (long)docPointer);''',
|
'''void %s(void* docPointer) {
|
||||||
0),
|
SendMsg(%s, 0, (long)docPointer);''',
|
||||||
|
0),
|
||||||
|
|
||||||
'ReleaseDocument' : (0,
|
'ReleaseDocument' :
|
||||||
'void %s(void* docPointer);',
|
(0,
|
||||||
'''void %s(void* docPointer) {
|
'void %s(void* docPointer);',
|
||||||
SendMsg(%s, 0, (long)docPointer);''',
|
'''void %s(void* docPointer) {
|
||||||
0),
|
SendMsg(%s, 0, (long)docPointer);''',
|
||||||
'SetCodePage' : (0,
|
0),
|
||||||
0,
|
|
||||||
'''void %s(int codePage) {
|
'SetCodePage' :
|
||||||
|
(0,
|
||||||
|
0,
|
||||||
|
'''void %s(int codePage) {
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
wxASSERT_MSG(codePage == wxSTC_CP_UTF8,
|
wxASSERT_MSG(codePage == wxSTC_CP_UTF8,
|
||||||
wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
|
wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
|
||||||
@@ -465,8 +533,8 @@ methodOverrideMap = {
|
|||||||
wxASSERT_MSG(codePage != wxSTC_CP_UTF8,
|
wxASSERT_MSG(codePage != wxSTC_CP_UTF8,
|
||||||
wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
|
wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
|
||||||
#endif
|
#endif
|
||||||
SendMsg(%s, codePage);''',
|
SendMsg(%s, codePage);''',
|
||||||
("Set the code page used to interpret the bytes of the document as characters.",) ),
|
("Set the code page used to interpret the bytes of the document as characters.",) ),
|
||||||
|
|
||||||
|
|
||||||
'GrabFocus' : (None, 0, 0, 0),
|
'GrabFocus' : (None, 0, 0, 0),
|
||||||
|
@@ -34,13 +34,16 @@ OBJECTS = \
|
|||||||
KeyWords.obj \
|
KeyWords.obj \
|
||||||
LexAVE.obj \
|
LexAVE.obj \
|
||||||
LexAda.obj \
|
LexAda.obj \
|
||||||
|
LexAsm.obj \
|
||||||
LexBaan.obj \
|
LexBaan.obj \
|
||||||
LexBullant.obj \
|
LexBullant.obj \
|
||||||
LexMatlab.obj \
|
LexMatlab.obj \
|
||||||
LexCPP.obj \
|
LexCPP.obj \
|
||||||
LexConf.obj \
|
LexConf.obj \
|
||||||
LexCrontab.obj \
|
LexCrontab.obj \
|
||||||
|
LexCSS.obj \
|
||||||
LexEiffel.obj \
|
LexEiffel.obj \
|
||||||
|
LexFortran.obj \
|
||||||
LexHTML.obj \
|
LexHTML.obj \
|
||||||
LexLisp.obj \
|
LexLisp.obj \
|
||||||
LexLua.obj \
|
LexLua.obj \
|
||||||
@@ -60,11 +63,13 @@ OBJECTS = \
|
|||||||
UniConversion.obj \
|
UniConversion.obj \
|
||||||
ViewStyle.obj \
|
ViewStyle.obj \
|
||||||
WindowAccessor.obj \
|
WindowAccessor.obj \
|
||||||
|
XPM.cxx \
|
||||||
\
|
\
|
||||||
PlatWX.obj \
|
PlatWX.obj \
|
||||||
ScintillaWX.obj \
|
ScintillaWX.obj \
|
||||||
stc.obj \
|
stc.obj \
|
||||||
|
|
||||||
|
|
||||||
STCCFG = stc.cfg
|
STCCFG = stc.cfg
|
||||||
STCCPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) @$(STCCFG)
|
STCCPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) @$(STCCFG)
|
||||||
|
|
||||||
|
@@ -22,13 +22,16 @@ OBJECTS = \
|
|||||||
$(S)/KeyWords.$(OBJSUFF) \
|
$(S)/KeyWords.$(OBJSUFF) \
|
||||||
$(S)/LexAVE.$(OBJSUFF) \
|
$(S)/LexAVE.$(OBJSUFF) \
|
||||||
$(S)/LexAda.$(OBJSUFF) \
|
$(S)/LexAda.$(OBJSUFF) \
|
||||||
|
$(S)/LexAsm.$(OBJSUFF) \
|
||||||
$(S)/LexBaan.$(OBJSUFF) \
|
$(S)/LexBaan.$(OBJSUFF) \
|
||||||
$(S)/LexBullant.$(OBJSUFF) \
|
$(S)/LexBullant.$(OBJSUFF) \
|
||||||
$(S)/LexMatlab.$(OBJSUFF) \
|
$(S)/LexMatlab.$(OBJSUFF) \
|
||||||
$(S)/LexCPP.$(OBJSUFF) \
|
$(S)/LexCPP.$(OBJSUFF) \
|
||||||
$(S)/LexConf.$(OBJSUFF) \
|
$(S)/LexConf.$(OBJSUFF) \
|
||||||
$(S)/LexCrontab.$(OBJSUFF) \
|
$(S)/LexCrontab.$(OBJSUFF) \
|
||||||
|
$(S)/LexCSS.$(OBJSUFF) \
|
||||||
$(S)/LexEiffel.$(OBJSUFF) \
|
$(S)/LexEiffel.$(OBJSUFF) \
|
||||||
|
$(S)/LexFortran.$(OBJSUFF) \
|
||||||
$(S)/LexHTML.$(OBJSUFF) \
|
$(S)/LexHTML.$(OBJSUFF) \
|
||||||
$(S)/LexLisp.$(OBJSUFF) \
|
$(S)/LexLisp.$(OBJSUFF) \
|
||||||
$(S)/LexLua.$(OBJSUFF) \
|
$(S)/LexLua.$(OBJSUFF) \
|
||||||
@@ -48,11 +51,13 @@ OBJECTS = \
|
|||||||
$(S)/UniConversion.$(OBJSUFF) \
|
$(S)/UniConversion.$(OBJSUFF) \
|
||||||
$(S)/ViewStyle.$(OBJSUFF) \
|
$(S)/ViewStyle.$(OBJSUFF) \
|
||||||
$(S)/WindowAccessor.$(OBJSUFF) \
|
$(S)/WindowAccessor.$(OBJSUFF) \
|
||||||
|
$(S)/XPM.$(OBJSUFF) \
|
||||||
\
|
\
|
||||||
PlatWX.$(OBJSUFF) \
|
PlatWX.$(OBJSUFF) \
|
||||||
ScintillaWX.$(OBJSUFF) \
|
ScintillaWX.$(OBJSUFF) \
|
||||||
stc.$(OBJSUFF)
|
stc.$(OBJSUFF)
|
||||||
|
|
||||||
|
|
||||||
LIBTARGET = $(WXDIR)/lib/libstc.a
|
LIBTARGET = $(WXDIR)/lib/libstc.a
|
||||||
|
|
||||||
include $(WXDIR)/src/makelib.g95
|
include $(WXDIR)/src/makelib.g95
|
@@ -27,13 +27,16 @@ OBJECTS = \
|
|||||||
$(D)\KeyWords.obj \
|
$(D)\KeyWords.obj \
|
||||||
$(D)\LexAVE.obj \
|
$(D)\LexAVE.obj \
|
||||||
$(D)\LexAda.obj \
|
$(D)\LexAda.obj \
|
||||||
|
$(D)\LexAsm.obj \
|
||||||
$(D)\LexBaan.obj \
|
$(D)\LexBaan.obj \
|
||||||
$(D)\LexBullant.obj \
|
$(D)\LexBullant.obj \
|
||||||
$(D)\LexMatlab.obj \
|
$(D)\LexMatlab.obj \
|
||||||
$(D)\LexCPP.obj \
|
$(D)\LexCPP.obj \
|
||||||
$(D)\LexConf.obj \
|
$(D)\LexConf.obj \
|
||||||
$(D)\LexCrontab.obj \
|
$(D)\LexCrontab.obj \
|
||||||
|
$(D)\LexCSS.obj \
|
||||||
$(D)\LexEiffel.obj \
|
$(D)\LexEiffel.obj \
|
||||||
|
$(D)\LexFortran.obj \
|
||||||
$(D)\LexHTML.obj \
|
$(D)\LexHTML.obj \
|
||||||
$(D)\LexLisp.obj \
|
$(D)\LexLisp.obj \
|
||||||
$(D)\LexLua.obj \
|
$(D)\LexLua.obj \
|
||||||
@@ -53,6 +56,7 @@ OBJECTS = \
|
|||||||
$(D)\UniConversion.obj \
|
$(D)\UniConversion.obj \
|
||||||
$(D)\ViewStyle.obj \
|
$(D)\ViewStyle.obj \
|
||||||
$(D)\WindowAccessor.obj \
|
$(D)\WindowAccessor.obj \
|
||||||
|
$(D)\XPM.obj \
|
||||||
\
|
\
|
||||||
$(D)\PlatWX.obj \
|
$(D)\PlatWX.obj \
|
||||||
$(D)\ScintillaWX.obj \
|
$(D)\ScintillaWX.obj \
|
||||||
|
@@ -31,13 +31,16 @@ OBJECTS = &
|
|||||||
KeyWords.obj &
|
KeyWords.obj &
|
||||||
LexAVE.obj &
|
LexAVE.obj &
|
||||||
LexAda.obj &
|
LexAda.obj &
|
||||||
|
LexAsm.obj &
|
||||||
LexBaan.obj &
|
LexBaan.obj &
|
||||||
LexBullant.obj &
|
LexBullant.obj &
|
||||||
LexMatlab.obj &
|
LexMatlab.obj &
|
||||||
LexCPP.obj &
|
LexCPP.obj &
|
||||||
LexConf.obj &
|
LexConf.obj &
|
||||||
LexCrontab.obj &
|
LexCrontab.obj &
|
||||||
|
LexCSS.obj &
|
||||||
LexEiffel.obj &
|
LexEiffel.obj &
|
||||||
|
LexFortran.obj &
|
||||||
LexHTML.obj &
|
LexHTML.obj &
|
||||||
LexLisp.obj &
|
LexLisp.obj &
|
||||||
LexLua.obj &
|
LexLua.obj &
|
||||||
@@ -57,6 +60,7 @@ OBJECTS = &
|
|||||||
UniConversion.obj &
|
UniConversion.obj &
|
||||||
ViewStyle.obj &
|
ViewStyle.obj &
|
||||||
WindowAccessor.obj &
|
WindowAccessor.obj &
|
||||||
|
XPM.obj &
|
||||||
PlatWX.obj &
|
PlatWX.obj &
|
||||||
ScintillaWX.obj &
|
ScintillaWX.obj &
|
||||||
stc.obj
|
stc.obj
|
||||||
|
@@ -3,5 +3,4 @@ scintilla/include directories from the Scintilla/SCiTE source
|
|||||||
distribution. All other code needed to implement Scintilla on top of
|
distribution. All other code needed to implement Scintilla on top of
|
||||||
wxWindows is located in the directory above this one.
|
wxWindows is located in the directory above this one.
|
||||||
|
|
||||||
The current version of the Scintilla code is 1.48
|
The current version of the Scintilla code is 1.51
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
** Interface to platform facilities. Also includes some basic utilities.
|
** Interface to platform facilities. Also includes some basic utilities.
|
||||||
** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows.
|
** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#ifndef PLATFORM_H
|
#ifndef PLATFORM_H
|
||||||
@@ -136,7 +136,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ColourDesired(unsigned int red, unsigned int green, unsigned int blue) {
|
ColourDesired(unsigned int red, unsigned int green, unsigned int blue) {
|
||||||
co = red | (green << 8) | (blue << 16);
|
Set(red, green, blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const ColourDesired &other) const {
|
bool operator==(const ColourDesired &other) const {
|
||||||
@@ -147,6 +147,31 @@ public:
|
|||||||
co = lcol;
|
co = lcol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Set(unsigned int red, unsigned int green, unsigned int blue) {
|
||||||
|
co = red | (green << 8) | (blue << 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned int ValueOfHex(const char ch) {
|
||||||
|
if (ch >= '0' && ch <= '9')
|
||||||
|
return ch - '0';
|
||||||
|
else if (ch >= 'A' && ch <= 'F')
|
||||||
|
return ch - 'A' + 10;
|
||||||
|
else if (ch >= 'a' && ch <= 'f')
|
||||||
|
return ch - 'a' + 10;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Set(const char *val) {
|
||||||
|
if (*val == '#') {
|
||||||
|
val++;
|
||||||
|
}
|
||||||
|
unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]);
|
||||||
|
unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]);
|
||||||
|
unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]);
|
||||||
|
Set(r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
long AsLong() const {
|
long AsLong() const {
|
||||||
return co;
|
return co;
|
||||||
}
|
}
|
||||||
@@ -196,6 +221,9 @@ struct ColourPair {
|
|||||||
desired = desired_;
|
desired = desired_;
|
||||||
allocated.Set(desired.AsLong());
|
allocated.Set(desired.AsLong());
|
||||||
}
|
}
|
||||||
|
void Copy() {
|
||||||
|
allocated.Set(desired.AsLong());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Window; // Forward declaration for Palette
|
class Window; // Forward declaration for Palette
|
||||||
@@ -292,6 +320,7 @@ public:
|
|||||||
|
|
||||||
virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0;
|
virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0;
|
||||||
virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0;
|
virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0;
|
||||||
|
virtual void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore)=0;
|
||||||
virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions)=0;
|
virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions)=0;
|
||||||
virtual int WidthText(Font &font_, const char *s, int len)=0;
|
virtual int WidthText(Font &font_, const char *s, int len)=0;
|
||||||
virtual int WidthChar(Font &font_, char ch)=0;
|
virtual int WidthChar(Font &font_, char ch)=0;
|
||||||
@@ -307,6 +336,7 @@ public:
|
|||||||
virtual void FlushCachedState()=0;
|
virtual void FlushCachedState()=0;
|
||||||
|
|
||||||
virtual void SetUnicodeMode(bool unicodeMode_)=0;
|
virtual void SetUnicodeMode(bool unicodeMode_)=0;
|
||||||
|
virtual void SetDBCSMode(int codePage)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,8 +359,8 @@ public:
|
|||||||
id = id_;
|
id = id_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
WindowID GetID() { return id; }
|
WindowID GetID() const { return id; }
|
||||||
bool Created() { return id != 0; }
|
bool Created() const { return id != 0; }
|
||||||
void Destroy();
|
void Destroy();
|
||||||
bool HasFocus();
|
bool HasFocus();
|
||||||
PRectangle GetPosition();
|
PRectangle GetPosition();
|
||||||
@@ -353,38 +383,28 @@ private:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class ListBox : public Window {
|
class ListBox : public Window {
|
||||||
private:
|
|
||||||
#if PLAT_GTK
|
|
||||||
WindowID list;
|
|
||||||
WindowID scroller;
|
|
||||||
int current;
|
|
||||||
#endif
|
|
||||||
int desiredVisibleRows;
|
|
||||||
unsigned int maxItemCharacters;
|
|
||||||
unsigned int aveCharWidth;
|
|
||||||
public:
|
|
||||||
CallBackAction doubleClickAction;
|
|
||||||
void *doubleClickActionData;
|
|
||||||
public:
|
public:
|
||||||
ListBox();
|
ListBox();
|
||||||
virtual ~ListBox();
|
virtual ~ListBox();
|
||||||
void Create(Window &parent, int ctrlID);
|
static ListBox *Allocate();
|
||||||
virtual void SetFont(Font &font);
|
|
||||||
void SetAverageCharWidth(int width);
|
virtual void SetFont(Font &font)=0;
|
||||||
void SetVisibleRows(int rows);
|
virtual void Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_)=0;
|
||||||
PRectangle GetDesiredRect();
|
virtual void SetAverageCharWidth(int width)=0;
|
||||||
void Clear();
|
virtual void SetVisibleRows(int rows)=0;
|
||||||
void Append(char *s);
|
virtual PRectangle GetDesiredRect()=0;
|
||||||
int Length();
|
virtual int CaretFromEdge()=0;
|
||||||
void Select(int n);
|
virtual void Clear()=0;
|
||||||
int GetSelection();
|
virtual void Append(char *s, int type = -1)=0;
|
||||||
int Find(const char *prefix);
|
virtual int Length()=0;
|
||||||
void GetValue(int n, char *value, int len);
|
virtual void Select(int n)=0;
|
||||||
void Sort();
|
virtual int GetSelection()=0;
|
||||||
void SetDoubleClickAction(CallBackAction action, void *data) {
|
virtual int Find(const char *prefix)=0;
|
||||||
doubleClickAction = action;
|
virtual void GetValue(int n, char *value, int len)=0;
|
||||||
doubleClickActionData = data;
|
virtual void Sort()=0;
|
||||||
}
|
virtual void RegisterImage(int type, const char *xpm_data)=0;
|
||||||
|
virtual void ClearRegisteredImages()=0;
|
||||||
|
virtual void SetDoubleClickAction(CallBackAction, void *)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -433,6 +453,8 @@ public:
|
|||||||
static long SendScintillaPointer(
|
static long SendScintillaPointer(
|
||||||
WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0);
|
WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0);
|
||||||
static bool IsDBCSLeadByte(int codePage, char ch);
|
static bool IsDBCSLeadByte(int codePage, char ch);
|
||||||
|
static int DBCSCharLength(int codePage, const char *s);
|
||||||
|
static int DBCSCharMaxLength();
|
||||||
|
|
||||||
// These are utility functions not really tied to a platform
|
// These are utility functions not really tied to a platform
|
||||||
static int Minimum(int a, int b);
|
static int Minimum(int a, int b);
|
||||||
|
@@ -238,7 +238,7 @@ public:
|
|||||||
return append(sOther, static_cast<lenpos_t>(measure_length));
|
return append(sOther, static_cast<lenpos_t>(measure_length));
|
||||||
}
|
}
|
||||||
SString &operator+=(const SString &sOther) {
|
SString &operator+=(const SString &sOther) {
|
||||||
return append(sOther.s, sOther.sSize);
|
return append(sOther.s, sOther.sLen);
|
||||||
}
|
}
|
||||||
SString &operator+=(char ch) {
|
SString &operator+=(char ch) {
|
||||||
return append(&ch, 1);
|
return append(&ch, 1);
|
||||||
@@ -369,11 +369,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline char *StringDup(
|
inline char *StringDup(
|
||||||
const char *s, ///< The string to duplicate
|
const char *s, ///< The string to duplicate
|
||||||
/* gcc 2.96 doesn't seem to like this syntax: gives
|
SString::lenpos_t len=SString::measure_length) ///< The length of memory to allocate. Optional.
|
||||||
'non-local function uses anonymous type'
|
|
||||||
SString::lenpos_t len=SString::measure_length) ///< The length of memory to allocate. Optional.
|
|
||||||
*/
|
|
||||||
SString::lenpos_t len=0xffffffffU) ///< The length of memory to allocate. Optional.
|
|
||||||
{
|
{
|
||||||
return SString::StringAllocate(s, len);
|
return SString::StringAllocate(s, len);
|
||||||
}
|
}
|
||||||
|
@@ -48,6 +48,11 @@
|
|||||||
#define SCLEX_BAAN 31
|
#define SCLEX_BAAN 31
|
||||||
#define SCLEX_MATLAB 32
|
#define SCLEX_MATLAB 32
|
||||||
#define SCLEX_SCRIPTOL 33
|
#define SCLEX_SCRIPTOL 33
|
||||||
|
#define SCLEX_ASM 34
|
||||||
|
#define SCLEX_CPPNOCASE 35
|
||||||
|
#define SCLEX_FORTRAN 36
|
||||||
|
#define SCLEX_F77 37
|
||||||
|
#define SCLEX_CSS 38
|
||||||
#define SCLEX_AUTOMATIC 1000
|
#define SCLEX_AUTOMATIC 1000
|
||||||
#define SCE_P_DEFAULT 0
|
#define SCE_P_DEFAULT 0
|
||||||
#define SCE_P_COMMENTLINE 1
|
#define SCE_P_COMMENTLINE 1
|
||||||
@@ -273,6 +278,7 @@
|
|||||||
#define SCE_ERR_DIFF_ADDITION 11
|
#define SCE_ERR_DIFF_ADDITION 11
|
||||||
#define SCE_ERR_DIFF_DELETION 12
|
#define SCE_ERR_DIFF_DELETION 12
|
||||||
#define SCE_ERR_DIFF_MESSAGE 13
|
#define SCE_ERR_DIFF_MESSAGE 13
|
||||||
|
#define SCE_ERR_PHP 14
|
||||||
#define SCE_BAT_DEFAULT 0
|
#define SCE_BAT_DEFAULT 0
|
||||||
#define SCE_BAT_COMMENT 1
|
#define SCE_BAT_COMMENT 1
|
||||||
#define SCE_BAT_WORD 2
|
#define SCE_BAT_WORD 2
|
||||||
@@ -309,22 +315,29 @@
|
|||||||
#define SCE_AVE_COMMENT 1
|
#define SCE_AVE_COMMENT 1
|
||||||
#define SCE_AVE_NUMBER 2
|
#define SCE_AVE_NUMBER 2
|
||||||
#define SCE_AVE_WORD 3
|
#define SCE_AVE_WORD 3
|
||||||
#define SCE_AVE_KEYWORD 4
|
|
||||||
#define SCE_AVE_STATEMENT 5
|
|
||||||
#define SCE_AVE_STRING 6
|
#define SCE_AVE_STRING 6
|
||||||
#define SCE_AVE_ENUM 7
|
#define SCE_AVE_ENUM 7
|
||||||
#define SCE_AVE_STRINGEOL 8
|
#define SCE_AVE_STRINGEOL 8
|
||||||
#define SCE_AVE_IDENTIFIER 9
|
#define SCE_AVE_IDENTIFIER 9
|
||||||
#define SCE_AVE_OPERATOR 10
|
#define SCE_AVE_OPERATOR 10
|
||||||
|
#define SCE_AVE_WORD1 11
|
||||||
|
#define SCE_AVE_WORD2 12
|
||||||
|
#define SCE_AVE_WORD3 13
|
||||||
|
#define SCE_AVE_WORD4 14
|
||||||
|
#define SCE_AVE_WORD5 15
|
||||||
|
#define SCE_AVE_WORD6 16
|
||||||
#define SCE_ADA_DEFAULT 0
|
#define SCE_ADA_DEFAULT 0
|
||||||
#define SCE_ADA_COMMENT 1
|
#define SCE_ADA_WORD 1
|
||||||
#define SCE_ADA_NUMBER 2
|
#define SCE_ADA_IDENTIFIER 2
|
||||||
#define SCE_ADA_WORD 3
|
#define SCE_ADA_NUMBER 3
|
||||||
#define SCE_ADA_STRING 4
|
#define SCE_ADA_DELIMITER 4
|
||||||
#define SCE_ADA_CHARACTER 5
|
#define SCE_ADA_CHARACTER 5
|
||||||
#define SCE_ADA_OPERATOR 6
|
#define SCE_ADA_CHARACTEREOL 6
|
||||||
#define SCE_ADA_IDENTIFIER 7
|
#define SCE_ADA_STRING 7
|
||||||
#define SCE_ADA_STRINGEOL 8
|
#define SCE_ADA_STRINGEOL 8
|
||||||
|
#define SCE_ADA_LABEL 9
|
||||||
|
#define SCE_ADA_COMMENTLINE 10
|
||||||
|
#define SCE_ADA_ILLEGAL 11
|
||||||
#define SCE_BAAN_DEFAULT 0
|
#define SCE_BAAN_DEFAULT 0
|
||||||
#define SCE_BAAN_COMMENT 1
|
#define SCE_BAAN_COMMENT 1
|
||||||
#define SCE_BAAN_COMMENTDOC 2
|
#define SCE_BAAN_COMMENTDOC 2
|
||||||
@@ -392,6 +405,45 @@
|
|||||||
#define SCE_SCRIPTOL_COMMENTDOCKEYWORD 17
|
#define SCE_SCRIPTOL_COMMENTDOCKEYWORD 17
|
||||||
#define SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
|
#define SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
|
||||||
#define SCE_SCRIPTOL_COMMENTBASIC 19
|
#define SCE_SCRIPTOL_COMMENTBASIC 19
|
||||||
|
#define SCE_ASM_DEFAULT 0
|
||||||
|
#define SCE_ASM_COMMENT 1
|
||||||
|
#define SCE_ASM_NUMBER 2
|
||||||
|
#define SCE_ASM_STRING 3
|
||||||
|
#define SCE_ASM_OPERATOR 4
|
||||||
|
#define SCE_ASM_IDENTIFIER 5
|
||||||
|
#define SCE_ASM_CPUINSTRUCTION 6
|
||||||
|
#define SCE_ASM_MATHINSTRUCTION 7
|
||||||
|
#define SCE_ASM_REGISTER 8
|
||||||
|
#define SCE_ASM_DIRECTIVE 9
|
||||||
|
#define SCE_ASM_DIRECTIVEOPERAND 10
|
||||||
|
#define SCE_F_DEFAULT 0
|
||||||
|
#define SCE_F_COMMENT 1
|
||||||
|
#define SCE_F_NUMBER 2
|
||||||
|
#define SCE_F_STRING1 3
|
||||||
|
#define SCE_F_STRING2 4
|
||||||
|
#define SCE_F_STRINGEOL 5
|
||||||
|
#define SCE_F_OPERATOR 6
|
||||||
|
#define SCE_F_IDENTIFIER 7
|
||||||
|
#define SCE_F_WORD 8
|
||||||
|
#define SCE_F_WORD2 9
|
||||||
|
#define SCE_F_WORD3 10
|
||||||
|
#define SCE_F_PREPROCESSOR 11
|
||||||
|
#define SCE_F_OPERATOR2 12
|
||||||
|
#define SCE_F_LABEL 13
|
||||||
|
#define SCE_F_CONTINUATION 14
|
||||||
|
#define SCE_CSS_DEFAULT 0
|
||||||
|
#define SCE_CSS_TAG 1
|
||||||
|
#define SCE_CSS_CLASS 2
|
||||||
|
#define SCE_CSS_PSEUDOCLASS 3
|
||||||
|
#define SCE_CSS_UNKNOWN_PSEUDOCLASS 4
|
||||||
|
#define SCE_CSS_OPERATOR 5
|
||||||
|
#define SCE_CSS_IDENTIFIER 6
|
||||||
|
#define SCE_CSS_UNKNOWN_IDENTIFIER 7
|
||||||
|
#define SCE_CSS_VALUE 8
|
||||||
|
#define SCE_CSS_COMMENT 9
|
||||||
|
#define SCE_CSS_ID 10
|
||||||
|
#define SCE_CSS_IMPORTANT 11
|
||||||
|
#define SCE_CSS_DIRECTIVE 12
|
||||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file Scintilla.h
|
/** @file Scintilla.h
|
||||||
** Interface to the edit control.
|
** Interface to the edit control.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
// Most of this file is automatically generated from the Scintilla.iface interface definition
|
// Most of this file is automatically generated from the Scintilla.iface interface definition
|
||||||
@@ -83,6 +83,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCI_SETTABWIDTH 2036
|
#define SCI_SETTABWIDTH 2036
|
||||||
#define SCI_GETTABWIDTH 2121
|
#define SCI_GETTABWIDTH 2121
|
||||||
#define SC_CP_UTF8 65001
|
#define SC_CP_UTF8 65001
|
||||||
|
#define SC_CP_DBCS 1
|
||||||
#define SCI_SETCODEPAGE 2037
|
#define SCI_SETCODEPAGE 2037
|
||||||
#define SCI_SETUSEPALETTE 2039
|
#define SCI_SETUSEPALETTE 2039
|
||||||
#define MARKER_MAX 31
|
#define MARKER_MAX 31
|
||||||
@@ -111,6 +112,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SC_MARK_BACKGROUND 22
|
#define SC_MARK_BACKGROUND 22
|
||||||
#define SC_MARK_DOTDOTDOT 23
|
#define SC_MARK_DOTDOTDOT 23
|
||||||
#define SC_MARK_ARROWS 24
|
#define SC_MARK_ARROWS 24
|
||||||
|
#define SC_MARK_PIXMAP 25
|
||||||
#define SC_MARK_CHARACTER 10000
|
#define SC_MARK_CHARACTER 10000
|
||||||
#define SC_MARKNUM_FOLDEREND 25
|
#define SC_MARKNUM_FOLDEREND 25
|
||||||
#define SC_MARKNUM_FOLDEROPENMID 26
|
#define SC_MARKNUM_FOLDEROPENMID 26
|
||||||
@@ -129,6 +131,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCI_MARKERGET 2046
|
#define SCI_MARKERGET 2046
|
||||||
#define SCI_MARKERNEXT 2047
|
#define SCI_MARKERNEXT 2047
|
||||||
#define SCI_MARKERPREVIOUS 2048
|
#define SCI_MARKERPREVIOUS 2048
|
||||||
|
#define SCI_MARKERDEFINEPIXMAP 2049
|
||||||
#define SC_MARGIN_SYMBOL 0
|
#define SC_MARGIN_SYMBOL 0
|
||||||
#define SC_MARGIN_NUMBER 1
|
#define SC_MARGIN_NUMBER 1
|
||||||
#define SCI_SETMARGINTYPEN 2240
|
#define SCI_SETMARGINTYPEN 2240
|
||||||
@@ -241,6 +244,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCI_AUTOCGETAUTOHIDE 2119
|
#define SCI_AUTOCGETAUTOHIDE 2119
|
||||||
#define SCI_AUTOCSETDROPRESTOFWORD 2270
|
#define SCI_AUTOCSETDROPRESTOFWORD 2270
|
||||||
#define SCI_AUTOCGETDROPRESTOFWORD 2271
|
#define SCI_AUTOCGETDROPRESTOFWORD 2271
|
||||||
|
#define SCI_REGISTERIMAGE 2405
|
||||||
|
#define SCI_CLEARREGISTEREDIMAGES 2408
|
||||||
|
#define SCI_AUTOCGETTYPESEPARATOR 2285
|
||||||
|
#define SCI_AUTOCSETTYPESEPARATOR 2286
|
||||||
#define SCI_SETINDENT 2122
|
#define SCI_SETINDENT 2122
|
||||||
#define SCI_GETINDENT 2123
|
#define SCI_GETINDENT 2123
|
||||||
#define SCI_SETUSETABS 2124
|
#define SCI_SETUSETABS 2124
|
||||||
@@ -338,6 +345,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SC_FOLDLEVELBASE 0x400
|
#define SC_FOLDLEVELBASE 0x400
|
||||||
#define SC_FOLDLEVELWHITEFLAG 0x1000
|
#define SC_FOLDLEVELWHITEFLAG 0x1000
|
||||||
#define SC_FOLDLEVELHEADERFLAG 0x2000
|
#define SC_FOLDLEVELHEADERFLAG 0x2000
|
||||||
|
#define SC_FOLDLEVELBOXHEADERFLAG 0x4000
|
||||||
|
#define SC_FOLDLEVELBOXFOOTERFLAG 0x8000
|
||||||
|
#define SC_FOLDLEVELCONTRACTED 0x10000
|
||||||
|
#define SC_FOLDLEVELUNINDENT 0x20000
|
||||||
#define SC_FOLDLEVELNUMBERMASK 0x0FFF
|
#define SC_FOLDLEVELNUMBERMASK 0x0FFF
|
||||||
#define SCI_SETFOLDLEVEL 2222
|
#define SCI_SETFOLDLEVEL 2222
|
||||||
#define SCI_GETFOLDLEVEL 2223
|
#define SCI_GETFOLDLEVEL 2223
|
||||||
@@ -350,6 +361,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCI_GETFOLDEXPANDED 2230
|
#define SCI_GETFOLDEXPANDED 2230
|
||||||
#define SCI_TOGGLEFOLD 2231
|
#define SCI_TOGGLEFOLD 2231
|
||||||
#define SCI_ENSUREVISIBLE 2232
|
#define SCI_ENSUREVISIBLE 2232
|
||||||
|
#define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002
|
||||||
|
#define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004
|
||||||
|
#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
|
||||||
|
#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
|
||||||
|
#define SC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||||
|
#define SC_FOLDFLAG_BOX 0x0001
|
||||||
#define SCI_SETFOLDFLAGS 2233
|
#define SCI_SETFOLDFLAGS 2233
|
||||||
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
|
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
|
||||||
#define SCI_SETTABINDENTS 2260
|
#define SCI_SETTABINDENTS 2260
|
||||||
@@ -377,6 +394,16 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCI_SETENDATLASTLINE 2277
|
#define SCI_SETENDATLASTLINE 2277
|
||||||
#define SCI_GETENDATLASTLINE 2278
|
#define SCI_GETENDATLASTLINE 2278
|
||||||
#define SCI_TEXTHEIGHT 2279
|
#define SCI_TEXTHEIGHT 2279
|
||||||
|
#define SCI_SETVSCROLLBAR 2280
|
||||||
|
#define SCI_GETVSCROLLBAR 2281
|
||||||
|
#define SCI_APPENDTEXT 2282
|
||||||
|
#define SCI_GETTWOPHASEDRAW 2283
|
||||||
|
#define SCI_SETTWOPHASEDRAW 2284
|
||||||
|
#define SCI_TARGETFROMSELECTION 2287
|
||||||
|
#define SCI_LINESJOIN 2288
|
||||||
|
#define SCI_LINESSPLIT 2289
|
||||||
|
#define SCI_SETFOLDMARGINCOLOUR 2290
|
||||||
|
#define SCI_SETFOLDMARGINHICOLOUR 2291
|
||||||
#define SCI_LINEDOWN 2300
|
#define SCI_LINEDOWN 2300
|
||||||
#define SCI_LINEDOWNEXTEND 2301
|
#define SCI_LINEDOWNEXTEND 2301
|
||||||
#define SCI_LINEUP 2302
|
#define SCI_LINEUP 2302
|
||||||
@@ -417,6 +444,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCI_LINECUT 2337
|
#define SCI_LINECUT 2337
|
||||||
#define SCI_LINEDELETE 2338
|
#define SCI_LINEDELETE 2338
|
||||||
#define SCI_LINETRANSPOSE 2339
|
#define SCI_LINETRANSPOSE 2339
|
||||||
|
#define SCI_LINEDUPLICATE 2404
|
||||||
#define SCI_LOWERCASE 2340
|
#define SCI_LOWERCASE 2340
|
||||||
#define SCI_UPPERCASE 2341
|
#define SCI_UPPERCASE 2341
|
||||||
#define SCI_LINESCROLLDOWN 2342
|
#define SCI_LINESCROLLDOWN 2342
|
||||||
@@ -464,7 +492,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCI_SETMOUSEDOWNCAPTURES 2384
|
#define SCI_SETMOUSEDOWNCAPTURES 2384
|
||||||
#define SCI_GETMOUSEDOWNCAPTURES 2385
|
#define SCI_GETMOUSEDOWNCAPTURES 2385
|
||||||
#define SC_CURSORNORMAL -1
|
#define SC_CURSORNORMAL -1
|
||||||
#define SC_CURSORWAIT 3
|
#define SC_CURSORWAIT 4
|
||||||
#define SCI_SETCURSOR 2386
|
#define SCI_SETCURSOR 2386
|
||||||
#define SCI_GETCURSOR 2387
|
#define SCI_GETCURSOR 2387
|
||||||
#define SCI_SETCONTROLCHARSYMBOL 2388
|
#define SCI_SETCONTROLCHARSYMBOL 2388
|
||||||
@@ -480,6 +508,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define SCI_DELLINERIGHT 2396
|
#define SCI_DELLINERIGHT 2396
|
||||||
#define SCI_SETXOFFSET 2397
|
#define SCI_SETXOFFSET 2397
|
||||||
#define SCI_GETXOFFSET 2398
|
#define SCI_GETXOFFSET 2398
|
||||||
|
#define SCI_CHOOSECARETX 2399
|
||||||
#define SCI_GRABFOCUS 2400
|
#define SCI_GRABFOCUS 2400
|
||||||
#define CARET_SLOP 0x01
|
#define CARET_SLOP 0x01
|
||||||
#define CARET_STRICT 0x04
|
#define CARET_STRICT 0x04
|
||||||
@@ -487,6 +516,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
|||||||
#define CARET_EVEN 0x08
|
#define CARET_EVEN 0x08
|
||||||
#define SCI_SETXCARETPOLICY 2402
|
#define SCI_SETXCARETPOLICY 2402
|
||||||
#define SCI_SETYCARETPOLICY 2403
|
#define SCI_SETYCARETPOLICY 2403
|
||||||
|
#define SCI_SETPRINTWRAPMODE 2406
|
||||||
|
#define SCI_GETPRINTWRAPMODE 2407
|
||||||
#define SCI_STARTRECORD 3001
|
#define SCI_STARTRECORD 3001
|
||||||
#define SCI_STOPRECORD 3002
|
#define SCI_STOPRECORD 3002
|
||||||
#define SCI_SETLEXER 4001
|
#define SCI_SETLEXER 4001
|
||||||
|
@@ -221,6 +221,9 @@ get int GetTabWidth=2121(,)
|
|||||||
# This is the same value as CP_UTF8 in Windows
|
# This is the same value as CP_UTF8 in Windows
|
||||||
val SC_CP_UTF8=65001
|
val SC_CP_UTF8=65001
|
||||||
|
|
||||||
|
# The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+.
|
||||||
|
val SC_CP_DBCS=1
|
||||||
|
|
||||||
# Set the code page used to interpret the bytes of the document as characters.
|
# Set the code page used to interpret the bytes of the document as characters.
|
||||||
# The SC_CP_UTF8 value can be used to enter Unicode mode.
|
# The SC_CP_UTF8 value can be used to enter Unicode mode.
|
||||||
set void SetCodePage=2037(int codePage,)
|
set void SetCodePage=2037(int codePage,)
|
||||||
@@ -260,6 +263,7 @@ val SC_MARK_CIRCLEMINUSCONNECTED=21
|
|||||||
val SC_MARK_BACKGROUND=22
|
val SC_MARK_BACKGROUND=22
|
||||||
val SC_MARK_DOTDOTDOT=23
|
val SC_MARK_DOTDOTDOT=23
|
||||||
val SC_MARK_ARROWS=24
|
val SC_MARK_ARROWS=24
|
||||||
|
val SC_MARK_PIXMAP=25
|
||||||
|
|
||||||
val SC_MARK_CHARACTER=10000
|
val SC_MARK_CHARACTER=10000
|
||||||
|
|
||||||
@@ -302,6 +306,9 @@ fun int MarkerNext=2047(int lineStart, int markerMask)
|
|||||||
# Find the previous line before lineStart that includes a marker in mask.
|
# Find the previous line before lineStart that includes a marker in mask.
|
||||||
fun int MarkerPrevious=2048(int lineStart, int markerMask)
|
fun int MarkerPrevious=2048(int lineStart, int markerMask)
|
||||||
|
|
||||||
|
# Define a marker from a pixmap.
|
||||||
|
fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap)
|
||||||
|
|
||||||
enu MarginType=SC_MARGIN_
|
enu MarginType=SC_MARGIN_
|
||||||
val SC_MARGIN_SYMBOL=0
|
val SC_MARGIN_SYMBOL=0
|
||||||
val SC_MARGIN_NUMBER=1
|
val SC_MARGIN_NUMBER=1
|
||||||
@@ -578,6 +585,19 @@ set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,)
|
|||||||
# after the inserted text upon completion.
|
# after the inserted text upon completion.
|
||||||
get bool AutoCGetDropRestOfWord=2271(,)
|
get bool AutoCGetDropRestOfWord=2271(,)
|
||||||
|
|
||||||
|
# Register an XPM image for use in autocompletion lists.
|
||||||
|
fun void RegisterImage=2405(int type, string xpmData)
|
||||||
|
|
||||||
|
# Clear all the registered XPM images.
|
||||||
|
fun void ClearRegisteredImages=2408(,)
|
||||||
|
|
||||||
|
# Retrieve the auto-completion list type-separator character.
|
||||||
|
get int AutoCGetTypeSeparator=2285(,)
|
||||||
|
|
||||||
|
# Change the type-separator character in the string setting up an auto-completion list.
|
||||||
|
# Default is '?' but can be changed if items contain '?'.
|
||||||
|
set void AutoCSetTypeSeparator=2286(int separatorCharacter,)
|
||||||
|
|
||||||
# Set the number of spaces used for one level of indentation.
|
# Set the number of spaces used for one level of indentation.
|
||||||
set void SetIndent=2122(int indentSize,)
|
set void SetIndent=2122(int indentSize,)
|
||||||
|
|
||||||
@@ -688,7 +708,7 @@ 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)
|
fun void FormatRange=2151(bool draw, formatrange fr)
|
||||||
|
|
||||||
# Retrieve the line at the top of the display.
|
# Retrieve the display line at the top of the display.
|
||||||
get int GetFirstVisibleLine=2152(,)
|
get int GetFirstVisibleLine=2152(,)
|
||||||
|
|
||||||
# Retrieve the contents of a line.
|
# Retrieve the contents of a line.
|
||||||
@@ -873,6 +893,10 @@ enu FoldLevel=SC_FOLDLEVEL
|
|||||||
val SC_FOLDLEVELBASE=0x400
|
val SC_FOLDLEVELBASE=0x400
|
||||||
val SC_FOLDLEVELWHITEFLAG=0x1000
|
val SC_FOLDLEVELWHITEFLAG=0x1000
|
||||||
val SC_FOLDLEVELHEADERFLAG=0x2000
|
val SC_FOLDLEVELHEADERFLAG=0x2000
|
||||||
|
val SC_FOLDLEVELBOXHEADERFLAG=0x4000
|
||||||
|
val SC_FOLDLEVELBOXFOOTERFLAG=0x8000
|
||||||
|
val SC_FOLDLEVELCONTRACTED=0x10000
|
||||||
|
val SC_FOLDLEVELUNINDENT=0x20000
|
||||||
val SC_FOLDLEVELNUMBERMASK=0x0FFF
|
val SC_FOLDLEVELNUMBERMASK=0x0FFF
|
||||||
|
|
||||||
# Set the fold level of a line.
|
# Set the fold level of a line.
|
||||||
@@ -910,7 +934,15 @@ fun void ToggleFold=2231(int line,)
|
|||||||
# Ensure a particular line is visible by expanding any header line hiding it.
|
# Ensure a particular line is visible by expanding any header line hiding it.
|
||||||
fun void EnsureVisible=2232(int line,)
|
fun void EnsureVisible=2232(int line,)
|
||||||
|
|
||||||
# Set some debugging options for folding.
|
enu FoldFlag=SC_FOLDFLAG_
|
||||||
|
val SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002
|
||||||
|
val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004
|
||||||
|
val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008
|
||||||
|
val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010
|
||||||
|
val SC_FOLDFLAG_LEVELNUMBERS=0x0040
|
||||||
|
val SC_FOLDFLAG_BOX=0x0001
|
||||||
|
|
||||||
|
# Set some style options for folding.
|
||||||
fun void SetFoldFlags=2233(int flags,)
|
fun void SetFoldFlags=2233(int flags,)
|
||||||
|
|
||||||
# Ensure a particular line is visible by expanding any header line hiding it.
|
# Ensure a particular line is visible by expanding any header line hiding it.
|
||||||
@@ -988,6 +1020,39 @@ get int GetEndAtLastLine=2278(,)
|
|||||||
# Retrieve the height of a particular line of text in pixels.
|
# Retrieve the height of a particular line of text in pixels.
|
||||||
fun int TextHeight=2279(int line,)
|
fun int TextHeight=2279(int line,)
|
||||||
|
|
||||||
|
# Show or hide the vertical scroll bar.
|
||||||
|
set void SetVScrollBar=2280(bool show,)
|
||||||
|
|
||||||
|
# Is the vertical scroll bar visible?
|
||||||
|
get bool GetVScrollBar=2281(,)
|
||||||
|
|
||||||
|
# Append a string to the end of the document without changing the selection.
|
||||||
|
fun void AppendText=2282(int length, string text)
|
||||||
|
|
||||||
|
# Is drawing done in two phases with backgrounds drawn before foregrounds?
|
||||||
|
get bool GetTwoPhaseDraw=2283(,)
|
||||||
|
|
||||||
|
# In twoPhaseDraw mode, drawing is performed in two phases, first the background
|
||||||
|
# and then the foreground. This avoids chopping off characters that overlap the next run.
|
||||||
|
set void SetTwoPhaseDraw=2284(bool twoPhase,)
|
||||||
|
|
||||||
|
# Make the target range start and end be the same as the selection range start and end.
|
||||||
|
fun void TargetFromSelection=2287(,)
|
||||||
|
|
||||||
|
# Join the lines in the target.
|
||||||
|
# This is an experimental feature and may be changed or removed.
|
||||||
|
fun void LinesJoin=2288(,)
|
||||||
|
|
||||||
|
# Split the lines in the target into lines that are less wide than pixelWidth
|
||||||
|
# where possible.
|
||||||
|
fun void LinesSplit=2289(int pixelWidth,)
|
||||||
|
|
||||||
|
# Set the colours used as a chequerboard pattern in the fold margin
|
||||||
|
fun void SetFoldMarginColour=2290(bool useSetting, colour back)
|
||||||
|
fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore)
|
||||||
|
|
||||||
|
## New messages go here
|
||||||
|
|
||||||
## Start of key messages
|
## Start of key messages
|
||||||
# Move caret down one line.
|
# Move caret down one line.
|
||||||
fun void LineDown=2300(,)
|
fun void LineDown=2300(,)
|
||||||
@@ -1111,6 +1176,9 @@ fun void LineDelete=2338(,)
|
|||||||
# Switch the current line with the previous.
|
# Switch the current line with the previous.
|
||||||
fun void LineTranspose=2339(,)
|
fun void LineTranspose=2339(,)
|
||||||
|
|
||||||
|
# Duplicate the current line.
|
||||||
|
fun void LineDuplicate=2404(,)
|
||||||
|
|
||||||
# Transform the selection to lower case.
|
# Transform the selection to lower case.
|
||||||
fun void LowerCase=2340(,)
|
fun void LowerCase=2340(,)
|
||||||
|
|
||||||
@@ -1251,7 +1319,7 @@ get bool GetMouseDownCaptures=2385(,)
|
|||||||
|
|
||||||
enu CursorShape=SC_CURSOR
|
enu CursorShape=SC_CURSOR
|
||||||
val SC_CURSORNORMAL=-1
|
val SC_CURSORNORMAL=-1
|
||||||
val SC_CURSORWAIT=3
|
val SC_CURSORWAIT=4
|
||||||
# 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,)
|
set void SetCursor=2386(int cursorType,)
|
||||||
# Get cursor type.
|
# Get cursor type.
|
||||||
@@ -1291,6 +1359,9 @@ fun void DelLineRight=2396(,)
|
|||||||
set void SetXOffset=2397(int newOffset,)
|
set void SetXOffset=2397(int newOffset,)
|
||||||
get int GetXOffset=2398(,)
|
get int GetXOffset=2398(,)
|
||||||
|
|
||||||
|
# Set the last x chosen value to be the caret x position
|
||||||
|
fun void ChooseCaretX=2399(,)
|
||||||
|
|
||||||
# Set the focus to this Scintilla widget.
|
# Set the focus to this Scintilla widget.
|
||||||
# GTK+ Specific.
|
# GTK+ Specific.
|
||||||
fun void GrabFocus=2400(,)
|
fun void GrabFocus=2400(,)
|
||||||
@@ -1327,6 +1398,12 @@ fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop)
|
|||||||
# The exclusion zone is given in lines.
|
# The exclusion zone is given in lines.
|
||||||
fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop)
|
fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop)
|
||||||
|
|
||||||
|
# Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
|
||||||
|
set void SetPrintWrapMode=2406(int mode,)
|
||||||
|
|
||||||
|
# Is printing line wrapped.
|
||||||
|
get int GetPrintWrapMode=2407(,)
|
||||||
|
|
||||||
# Start notifying the container of all key presses and commands.
|
# Start notifying the container of all key presses and commands.
|
||||||
fun void StartRecord=3001(,)
|
fun void StartRecord=3001(,)
|
||||||
|
|
||||||
@@ -1442,6 +1519,11 @@ val SCLEX_PHP=30
|
|||||||
val SCLEX_BAAN=31
|
val SCLEX_BAAN=31
|
||||||
val SCLEX_MATLAB=32
|
val SCLEX_MATLAB=32
|
||||||
val SCLEX_SCRIPTOL=33
|
val SCLEX_SCRIPTOL=33
|
||||||
|
val SCLEX_ASM=34
|
||||||
|
val SCLEX_CPPNOCASE=35
|
||||||
|
val SCLEX_FORTRAN=36
|
||||||
|
val SCLEX_F77=37
|
||||||
|
val SCLEX_CSS=38
|
||||||
|
|
||||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||||
@@ -1708,6 +1790,7 @@ val SCE_ERR_DIFF_CHANGED=10
|
|||||||
val SCE_ERR_DIFF_ADDITION=11
|
val SCE_ERR_DIFF_ADDITION=11
|
||||||
val SCE_ERR_DIFF_DELETION=12
|
val SCE_ERR_DIFF_DELETION=12
|
||||||
val SCE_ERR_DIFF_MESSAGE=13
|
val SCE_ERR_DIFF_MESSAGE=13
|
||||||
|
val SCE_ERR_PHP=14
|
||||||
# Lexical states for SCLEX_BATCH
|
# Lexical states for SCLEX_BATCH
|
||||||
lex Batch=SCLEX_BATCH SCE_BAT_
|
lex Batch=SCLEX_BATCH SCE_BAT_
|
||||||
val SCE_BAT_DEFAULT=0
|
val SCE_BAT_DEFAULT=0
|
||||||
@@ -1754,24 +1837,31 @@ val SCE_AVE_DEFAULT=0
|
|||||||
val SCE_AVE_COMMENT=1
|
val SCE_AVE_COMMENT=1
|
||||||
val SCE_AVE_NUMBER=2
|
val SCE_AVE_NUMBER=2
|
||||||
val SCE_AVE_WORD=3
|
val SCE_AVE_WORD=3
|
||||||
val SCE_AVE_KEYWORD=4
|
|
||||||
val SCE_AVE_STATEMENT=5
|
|
||||||
val SCE_AVE_STRING=6
|
val SCE_AVE_STRING=6
|
||||||
val SCE_AVE_ENUM=7
|
val SCE_AVE_ENUM=7
|
||||||
val SCE_AVE_STRINGEOL=8
|
val SCE_AVE_STRINGEOL=8
|
||||||
val SCE_AVE_IDENTIFIER=9
|
val SCE_AVE_IDENTIFIER=9
|
||||||
val SCE_AVE_OPERATOR=10
|
val SCE_AVE_OPERATOR=10
|
||||||
|
val SCE_AVE_WORD1=11
|
||||||
|
val SCE_AVE_WORD2=12
|
||||||
|
val SCE_AVE_WORD3=13
|
||||||
|
val SCE_AVE_WORD4=14
|
||||||
|
val SCE_AVE_WORD5=15
|
||||||
|
val SCE_AVE_WORD6=16
|
||||||
# Lexical states for SCLEX_ADA
|
# Lexical states for SCLEX_ADA
|
||||||
lex Ada=SCLEX_ADA SCE_ADA_
|
lex Ada=SCLEX_ADA SCE_ADA_
|
||||||
val SCE_ADA_DEFAULT=0
|
val SCE_ADA_DEFAULT=0
|
||||||
val SCE_ADA_COMMENT=1
|
val SCE_ADA_WORD=1
|
||||||
val SCE_ADA_NUMBER=2
|
val SCE_ADA_IDENTIFIER=2
|
||||||
val SCE_ADA_WORD=3
|
val SCE_ADA_NUMBER=3
|
||||||
val SCE_ADA_STRING=4
|
val SCE_ADA_DELIMITER=4
|
||||||
val SCE_ADA_CHARACTER=5
|
val SCE_ADA_CHARACTER=5
|
||||||
val SCE_ADA_OPERATOR=6
|
val SCE_ADA_CHARACTEREOL=6
|
||||||
val SCE_ADA_IDENTIFIER=7
|
val SCE_ADA_STRING=7
|
||||||
val SCE_ADA_STRINGEOL=8
|
val SCE_ADA_STRINGEOL=8
|
||||||
|
val SCE_ADA_LABEL=9
|
||||||
|
val SCE_ADA_COMMENTLINE=10
|
||||||
|
val SCE_ADA_ILLEGAL=11
|
||||||
# Lexical states for SCLEX_BAAN
|
# Lexical states for SCLEX_BAAN
|
||||||
lex Baan=SCLEX_BAAN SCE_BAAN_
|
lex Baan=SCLEX_BAAN SCE_BAAN_
|
||||||
val SCE_BAAN_DEFAULT=0
|
val SCE_BAAN_DEFAULT=0
|
||||||
@@ -1852,6 +1942,52 @@ val SCE_SCRIPTOL_WORD2=16
|
|||||||
val SCE_SCRIPTOL_COMMENTDOCKEYWORD=17
|
val SCE_SCRIPTOL_COMMENTDOCKEYWORD=17
|
||||||
val SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR=18
|
val SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR=18
|
||||||
val SCE_SCRIPTOL_COMMENTBASIC=19
|
val SCE_SCRIPTOL_COMMENTBASIC=19
|
||||||
|
# Lexical states for SCLEX_ASM
|
||||||
|
lex Asm=SCLEX_ASM SCE_ASM_
|
||||||
|
val SCE_ASM_DEFAULT=0
|
||||||
|
val SCE_ASM_COMMENT=1
|
||||||
|
val SCE_ASM_NUMBER=2
|
||||||
|
val SCE_ASM_STRING=3
|
||||||
|
val SCE_ASM_OPERATOR=4
|
||||||
|
val SCE_ASM_IDENTIFIER=5
|
||||||
|
val SCE_ASM_CPUINSTRUCTION=6
|
||||||
|
val SCE_ASM_MATHINSTRUCTION=7
|
||||||
|
val SCE_ASM_REGISTER=8
|
||||||
|
val SCE_ASM_DIRECTIVE=9
|
||||||
|
val SCE_ASM_DIRECTIVEOPERAND=10
|
||||||
|
# Lexical states for SCLEX_FORTRAN
|
||||||
|
lex Fortran=SCLEX_FORTRAN SCE_F_
|
||||||
|
lex F77=SCLEX_F77 SCE_F_
|
||||||
|
val SCE_F_DEFAULT=0
|
||||||
|
val SCE_F_COMMENT=1
|
||||||
|
val SCE_F_NUMBER=2
|
||||||
|
val SCE_F_STRING1=3
|
||||||
|
val SCE_F_STRING2=4
|
||||||
|
val SCE_F_STRINGEOL=5
|
||||||
|
val SCE_F_OPERATOR=6
|
||||||
|
val SCE_F_IDENTIFIER=7
|
||||||
|
val SCE_F_WORD=8
|
||||||
|
val SCE_F_WORD2=9
|
||||||
|
val SCE_F_WORD3=10
|
||||||
|
val SCE_F_PREPROCESSOR=11
|
||||||
|
val SCE_F_OPERATOR2=12
|
||||||
|
val SCE_F_LABEL=13
|
||||||
|
val SCE_F_CONTINUATION=14
|
||||||
|
# Lexical states for SCLEX_CSS
|
||||||
|
lex CSS=SCLEX_CSS SCE_CSS_
|
||||||
|
val SCE_CSS_DEFAULT=0
|
||||||
|
val SCE_CSS_TAG=1
|
||||||
|
val SCE_CSS_CLASS=2
|
||||||
|
val SCE_CSS_PSEUDOCLASS=3
|
||||||
|
val SCE_CSS_UNKNOWN_PSEUDOCLASS=4
|
||||||
|
val SCE_CSS_OPERATOR=5
|
||||||
|
val SCE_CSS_IDENTIFIER=6
|
||||||
|
val SCE_CSS_UNKNOWN_IDENTIFIER=7
|
||||||
|
val SCE_CSS_VALUE=8
|
||||||
|
val SCE_CSS_COMMENT=9
|
||||||
|
val SCE_CSS_ID=10
|
||||||
|
val SCE_CSS_IMPORTANT=11
|
||||||
|
val SCE_CSS_DIRECTIVE=12
|
||||||
|
|
||||||
# Events
|
# Events
|
||||||
|
|
||||||
|
@@ -37,7 +37,8 @@ struct _ScintillaClass {
|
|||||||
guint scintilla_get_type (void);
|
guint scintilla_get_type (void);
|
||||||
GtkWidget* scintilla_new (void);
|
GtkWidget* scintilla_new (void);
|
||||||
void scintilla_set_id (ScintillaObject *sci,int id);
|
void scintilla_set_id (ScintillaObject *sci,int id);
|
||||||
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
|
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
|
||||||
|
void scintilla_release_resources(void);
|
||||||
|
|
||||||
#if GTK_MAJOR_VERSION < 2
|
#if GTK_MAJOR_VERSION < 2
|
||||||
#define SCINTILLA_NOTIFY "notify"
|
#define SCINTILLA_NOTIFY "notify"
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file AutoComplete.cxx
|
/** @file AutoComplete.cxx
|
||||||
** Defines the auto completion list box.
|
** Defines the auto completion list box.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -17,30 +17,39 @@
|
|||||||
AutoComplete::AutoComplete() :
|
AutoComplete::AutoComplete() :
|
||||||
active(false),
|
active(false),
|
||||||
separator(' '),
|
separator(' '),
|
||||||
|
typesep('?'),
|
||||||
ignoreCase(false),
|
ignoreCase(false),
|
||||||
chooseSingle(false),
|
chooseSingle(false),
|
||||||
|
lb(0),
|
||||||
posStart(0),
|
posStart(0),
|
||||||
startLen(0),
|
startLen(0),
|
||||||
cancelAtStartPos(true),
|
cancelAtStartPos(true),
|
||||||
autoHide(true),
|
autoHide(true),
|
||||||
dropRestOfWord(false) {
|
dropRestOfWord(false) {
|
||||||
|
lb = ListBox::Allocate();
|
||||||
stopChars[0] = '\0';
|
stopChars[0] = '\0';
|
||||||
fillUpChars[0] = '\0';
|
fillUpChars[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoComplete::~AutoComplete() {
|
AutoComplete::~AutoComplete() {
|
||||||
lb.Destroy();
|
if (lb) {
|
||||||
|
lb->Destroy();
|
||||||
|
delete lb;
|
||||||
|
lb = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoComplete::Active() {
|
bool AutoComplete::Active() {
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoComplete::Start(Window &parent, int ctrlID, int position, int startLen_) {
|
void AutoComplete::Start(Window &parent, int ctrlID, int position,
|
||||||
if (!lb.Created()) {
|
int startLen_, int lineHeight, bool unicodeMode) {
|
||||||
lb.Create(parent, ctrlID);
|
if (active) {
|
||||||
|
Cancel();
|
||||||
}
|
}
|
||||||
lb.Clear();
|
lb->Create(parent, ctrlID, lineHeight, unicodeMode);
|
||||||
|
lb->Clear();
|
||||||
active = true;
|
active = true;
|
||||||
startLen = startLen_;
|
startLen = startLen_;
|
||||||
posStart = position;
|
posStart = position;
|
||||||
@@ -72,49 +81,65 @@ char AutoComplete::GetSeparator() {
|
|||||||
return separator;
|
return separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoComplete::SetTypesep(char separator_) {
|
||||||
|
typesep = separator_;
|
||||||
|
}
|
||||||
|
|
||||||
|
char AutoComplete::GetTypesep() {
|
||||||
|
return typesep;
|
||||||
|
}
|
||||||
|
|
||||||
void AutoComplete::SetList(const char *list) {
|
void AutoComplete::SetList(const char *list) {
|
||||||
lb.Clear();
|
lb->Clear();
|
||||||
char *words = new char[strlen(list) + 1];
|
char *words = new char[strlen(list) + 1];
|
||||||
if (words) {
|
if (words) {
|
||||||
strcpy(words, list);
|
strcpy(words, list);
|
||||||
char *startword = words;
|
char *startword = words;
|
||||||
|
char *numword = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; words && words[i]; i++) {
|
for (; words && words[i]; i++) {
|
||||||
if (words[i] == separator) {
|
if (words[i] == separator) {
|
||||||
words[i] = '\0';
|
words[i] = '\0';
|
||||||
lb.Append(startword);
|
if (numword)
|
||||||
|
*numword = '\0';
|
||||||
|
lb->Append(startword, numword?atoi(numword + 1):-1);
|
||||||
startword = words + i + 1;
|
startword = words + i + 1;
|
||||||
|
numword = NULL;
|
||||||
|
} else if (words[i] == typesep) {
|
||||||
|
numword = words + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (startword) {
|
if (startword) {
|
||||||
lb.Append(startword);
|
if (numword)
|
||||||
|
*numword = '\0';
|
||||||
|
lb->Append(startword, numword?atoi(numword + 1):-1);
|
||||||
}
|
}
|
||||||
delete []words;
|
delete []words;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoComplete::Show() {
|
void AutoComplete::Show() {
|
||||||
lb.Show();
|
lb->Show();
|
||||||
lb.Select(0);
|
lb->Select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoComplete::Cancel() {
|
void AutoComplete::Cancel() {
|
||||||
if (lb.Created()) {
|
if (lb->Created()) {
|
||||||
lb.Destroy();
|
lb->Destroy();
|
||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AutoComplete::Move(int delta) {
|
void AutoComplete::Move(int delta) {
|
||||||
int count = lb.Length();
|
int count = lb->Length();
|
||||||
int current = lb.GetSelection();
|
int current = lb->GetSelection();
|
||||||
current += delta;
|
current += delta;
|
||||||
if (current >= count)
|
if (current >= count)
|
||||||
current = count - 1;
|
current = count - 1;
|
||||||
if (current < 0)
|
if (current < 0)
|
||||||
current = 0;
|
current = 0;
|
||||||
lb.Select(current);
|
lb->Select(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoComplete::Select(const char *word) {
|
void AutoComplete::Select(const char *word) {
|
||||||
@@ -123,10 +148,10 @@ void AutoComplete::Select(const char *word) {
|
|||||||
const int maxItemLen=1000;
|
const int maxItemLen=1000;
|
||||||
char item[maxItemLen];
|
char item[maxItemLen];
|
||||||
int start = 0; // lower bound of the api array block to search
|
int start = 0; // lower bound of the api array block to search
|
||||||
int end = lb.Length() - 1; // upper bound of the api array block to search
|
int end = lb->Length() - 1; // upper bound of the api array block to search
|
||||||
while ((start <= end) && (location == -1)) { // Binary searching loop
|
while ((start <= end) && (location == -1)) { // Binary searching loop
|
||||||
int pivot = (start + end) / 2;
|
int pivot = (start + end) / 2;
|
||||||
lb.GetValue(pivot, item, maxItemLen);
|
lb->GetValue(pivot, item, maxItemLen);
|
||||||
int cond;
|
int cond;
|
||||||
if (ignoreCase)
|
if (ignoreCase)
|
||||||
cond = CompareNCaseInsensitive(word, item, lenWord);
|
cond = CompareNCaseInsensitive(word, item, lenWord);
|
||||||
@@ -135,7 +160,7 @@ void AutoComplete::Select(const char *word) {
|
|||||||
if (!cond) {
|
if (!cond) {
|
||||||
// Find first match
|
// Find first match
|
||||||
while (pivot > start) {
|
while (pivot > start) {
|
||||||
lb.GetValue(pivot-1, item, maxItemLen);
|
lb->GetValue(pivot-1, item, maxItemLen);
|
||||||
if (ignoreCase)
|
if (ignoreCase)
|
||||||
cond = CompareNCaseInsensitive(word, item, lenWord);
|
cond = CompareNCaseInsensitive(word, item, lenWord);
|
||||||
else
|
else
|
||||||
@@ -154,6 +179,6 @@ void AutoComplete::Select(const char *word) {
|
|||||||
if (location == -1 && autoHide)
|
if (location == -1 && autoHide)
|
||||||
Cancel();
|
Cancel();
|
||||||
else
|
else
|
||||||
lb.Select(location);
|
lb->Select(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file AutoComplete.h
|
/** @file AutoComplete.h
|
||||||
** Defines the auto completion list box.
|
** Defines the auto completion list box.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#ifndef AUTOCOMPLETE_H
|
#ifndef AUTOCOMPLETE_H
|
||||||
@@ -15,11 +15,12 @@ class AutoComplete {
|
|||||||
char stopChars[256];
|
char stopChars[256];
|
||||||
char fillUpChars[256];
|
char fillUpChars[256];
|
||||||
char separator;
|
char separator;
|
||||||
|
char typesep; // Type seperator
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool ignoreCase;
|
bool ignoreCase;
|
||||||
bool chooseSingle;
|
bool chooseSingle;
|
||||||
ListBox lb;
|
ListBox *lb;
|
||||||
int posStart;
|
int posStart;
|
||||||
int startLen;
|
int startLen;
|
||||||
/// Should autocompletion be canceled if editor's currentPos <= startPos?
|
/// Should autocompletion be canceled if editor's currentPos <= startPos?
|
||||||
@@ -34,7 +35,8 @@ public:
|
|||||||
bool Active();
|
bool Active();
|
||||||
|
|
||||||
/// Display the auto completion list positioned to be near a character position
|
/// Display the auto completion list positioned to be near a character position
|
||||||
void Start(Window &parent, int ctrlID, int position, int startLen_);
|
void Start(Window &parent, int ctrlID, int position,
|
||||||
|
int startLen_, int lineHeight, bool unicodeMode);
|
||||||
|
|
||||||
/// The stop chars are characters which, when typed, cause the auto completion list to disappear
|
/// The stop chars are characters which, when typed, cause the auto completion list to disappear
|
||||||
void SetStopChars(const char *stopChars_);
|
void SetStopChars(const char *stopChars_);
|
||||||
@@ -48,6 +50,10 @@ public:
|
|||||||
void SetSeparator(char separator_);
|
void SetSeparator(char separator_);
|
||||||
char GetSeparator();
|
char GetSeparator();
|
||||||
|
|
||||||
|
/// The typesep character is used for seperating the word from the type
|
||||||
|
void SetTypesep(char separator_);
|
||||||
|
char GetTypesep();
|
||||||
|
|
||||||
/// The list string contains a sequence of words separated by the separator character
|
/// The list string contains a sequence of words separated by the separator character
|
||||||
void SetList(const char *list);
|
void SetList(const char *list);
|
||||||
|
|
||||||
|
@@ -117,19 +117,21 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
|
PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
|
||||||
const char *faceName, int size, bool unicodeMode_) {
|
const char *faceName, int size,
|
||||||
|
int codePage_) {
|
||||||
if (val)
|
if (val)
|
||||||
delete []val;
|
delete []val;
|
||||||
val = new char[strlen(defn) + 1];
|
val = new char[strlen(defn) + 1];
|
||||||
if (!val)
|
if (!val)
|
||||||
return PRectangle();
|
return PRectangle();
|
||||||
strcpy(val, defn);
|
strcpy(val, defn);
|
||||||
unicodeMode = unicodeMode_;
|
codePage = codePage_;
|
||||||
Surface *surfaceMeasure = Surface::Allocate();
|
Surface *surfaceMeasure = Surface::Allocate();
|
||||||
if (!surfaceMeasure)
|
if (!surfaceMeasure)
|
||||||
return PRectangle();
|
return PRectangle();
|
||||||
surfaceMeasure->Init();
|
surfaceMeasure->Init();
|
||||||
surfaceMeasure->SetUnicodeMode(unicodeMode);
|
surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage);
|
||||||
|
surfaceMeasure->SetDBCSMode(codePage);
|
||||||
startHighlight = 0;
|
startHighlight = 0;
|
||||||
endHighlight = 0;
|
endHighlight = 0;
|
||||||
inCallTipMode = true;
|
inCallTipMode = true;
|
||||||
|
@@ -29,7 +29,7 @@ public:
|
|||||||
ColourPair colourSel;
|
ColourPair colourSel;
|
||||||
ColourPair colourShade;
|
ColourPair colourShade;
|
||||||
ColourPair colourLight;
|
ColourPair colourLight;
|
||||||
bool unicodeMode;
|
int codePage;
|
||||||
|
|
||||||
CallTip();
|
CallTip();
|
||||||
~CallTip();
|
~CallTip();
|
||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
/// Setup the calltip and return a rectangle of the area required.
|
/// Setup the calltip and return a rectangle of the area required.
|
||||||
PRectangle CallTipStart(int pos, Point pt, const char *defn,
|
PRectangle CallTipStart(int pos, Point pt, const char *defn,
|
||||||
const char *faceName, int size, bool unicodeMode_);
|
const char *faceName, int size, int codePage_);
|
||||||
|
|
||||||
void CallTipCancel();
|
void CallTipCancel();
|
||||||
|
|
||||||
|
@@ -739,6 +739,7 @@ void CellBuffer::InsertCharStyle(int position, char ch, char style) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CellBuffer::SetStyleAt(int position, char style, char mask) {
|
bool CellBuffer::SetStyleAt(int position, char style, char mask) {
|
||||||
|
style &= mask;
|
||||||
char curVal = ByteAt(position * 2 + 1);
|
char curVal = ByteAt(position * 2 + 1);
|
||||||
if ((curVal & mask) != style) {
|
if ((curVal & mask) != style) {
|
||||||
SetByteAt(position*2 + 1, static_cast<char>((curVal & ~mask) | style));
|
SetByteAt(position*2 + 1, static_cast<char>((curVal & ~mask) | style));
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file Document.cxx
|
/** @file Document.cxx
|
||||||
** Text document that handles notifications, DBCS, styling, words and end of line.
|
** Text document that handles notifications, DBCS, styling, words and end of line.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -23,6 +23,22 @@ static inline bool isspacechar(unsigned char ch) {
|
|||||||
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool IsPunctuation(char ch) {
|
||||||
|
return isascii(ch) && ispunct(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsADigit(char ch) {
|
||||||
|
return isascii(ch) && isdigit(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsLowerCase(char ch) {
|
||||||
|
return isascii(ch) && islower(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsUpperCase(char ch) {
|
||||||
|
return isascii(ch) && isupper(ch);
|
||||||
|
}
|
||||||
|
|
||||||
Document::Document() {
|
Document::Document() {
|
||||||
refCount = 0;
|
refCount = 0;
|
||||||
#ifdef unix
|
#ifdef unix
|
||||||
@@ -218,32 +234,12 @@ bool Document::IsCrLf(int pos) {
|
|||||||
return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n');
|
return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Document::IsDBCS(int pos) {
|
static const int maxBytesInDBCSCharacter=5;
|
||||||
if (dbcsCodePage) {
|
|
||||||
if (SC_CP_UTF8 == dbcsCodePage) {
|
|
||||||
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
|
|
||||||
return ch >= 0x80;
|
|
||||||
} else {
|
|
||||||
// Anchor DBCS calculations at start of line because start of line can
|
|
||||||
// not be a DBCS trail byte.
|
|
||||||
int startLine = pos;
|
|
||||||
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
|
|
||||||
startLine--;
|
|
||||||
while (startLine <= pos) {
|
|
||||||
if (Platform::IsDBCSLeadByte(dbcsCodePage, cb.CharAt(startLine))) {
|
|
||||||
startLine++;
|
|
||||||
if (startLine >= pos)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
startLine++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Document::LenChar(int pos) {
|
int Document::LenChar(int pos) {
|
||||||
if (IsCrLf(pos)) {
|
if (pos < 0) {
|
||||||
|
return 1;
|
||||||
|
} else if (IsCrLf(pos)) {
|
||||||
return 2;
|
return 2;
|
||||||
} else if (SC_CP_UTF8 == dbcsCodePage) {
|
} else if (SC_CP_UTF8 == dbcsCodePage) {
|
||||||
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
|
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
|
||||||
@@ -257,8 +253,14 @@ int Document::LenChar(int pos) {
|
|||||||
return lengthDoc -pos;
|
return lengthDoc -pos;
|
||||||
else
|
else
|
||||||
return len;
|
return len;
|
||||||
} else if (IsDBCS(pos)) {
|
} else if (dbcsCodePage) {
|
||||||
return 2;
|
char mbstr[maxBytesInDBCSCharacter+1];
|
||||||
|
int i;
|
||||||
|
for (i=0; i<Platform::DBCSCharMaxLength(); i++) {
|
||||||
|
mbstr[i] = cb.CharAt(pos+i);
|
||||||
|
}
|
||||||
|
mbstr[i] = '\0';
|
||||||
|
return Platform::DBCSCharLength(dbcsCodePage, mbstr);
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -308,26 +310,28 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
|
|||||||
// Anchor DBCS calculations at start of line because start of line can
|
// Anchor DBCS calculations at start of line because start of line can
|
||||||
// not be a DBCS trail byte.
|
// not be a DBCS trail byte.
|
||||||
int startLine = pos;
|
int startLine = pos;
|
||||||
|
|
||||||
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
|
while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')
|
||||||
startLine--;
|
startLine--;
|
||||||
bool atLeadByte = false;
|
|
||||||
while (startLine < pos) {
|
while (startLine < pos) {
|
||||||
if (atLeadByte)
|
char mbstr[maxBytesInDBCSCharacter+1];
|
||||||
atLeadByte = false;
|
int i;
|
||||||
else if (Platform::IsDBCSLeadByte(dbcsCodePage, cb.CharAt(startLine)))
|
for(i=0;i<Platform::DBCSCharMaxLength();i++) {
|
||||||
atLeadByte = true;
|
mbstr[i] = cb.CharAt(startLine+i);
|
||||||
else
|
}
|
||||||
atLeadByte = false;
|
mbstr[i] = '\0';
|
||||||
startLine++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int mbsize = Platform::DBCSCharLength(dbcsCodePage, mbstr);
|
||||||
if (atLeadByte) {
|
if (startLine + mbsize == pos) {
|
||||||
// Position is between a lead byte and a trail byte
|
return pos;
|
||||||
if (moveDir > 0)
|
} else if (startLine + mbsize > pos) {
|
||||||
return pos + 1;
|
if (moveDir > 0) {
|
||||||
else
|
return startLine + mbsize;
|
||||||
return pos - 1;
|
} else {
|
||||||
|
return startLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
startLine += mbsize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -545,11 +549,9 @@ void Document::DelCharBack(int pos) {
|
|||||||
return;
|
return;
|
||||||
} else if (IsCrLf(pos - 2)) {
|
} else if (IsCrLf(pos - 2)) {
|
||||||
DeleteChars(pos - 2, 2);
|
DeleteChars(pos - 2, 2);
|
||||||
} else if (SC_CP_UTF8 == dbcsCodePage) {
|
} else if (dbcsCodePage) {
|
||||||
int startChar = MovePositionOutsideChar(pos - 1, -1, false);
|
int startChar = MovePositionOutsideChar(pos - 1, -1, false);
|
||||||
DeleteChars(startChar, pos - startChar);
|
DeleteChars(startChar, pos - startChar);
|
||||||
} else if (IsDBCS(pos - 1)) {
|
|
||||||
DeleteChars(pos - 2, 2);
|
|
||||||
} else {
|
} else {
|
||||||
DeleteChars(pos - 1, 1);
|
DeleteChars(pos - 1, 1);
|
||||||
}
|
}
|
||||||
@@ -853,16 +855,10 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
|||||||
if (!pre)
|
if (!pre)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int startPos;
|
int increment = (minPos <= maxPos) ? 1 : -1;
|
||||||
int endPos;
|
|
||||||
|
|
||||||
if (minPos <= maxPos) {
|
int startPos = minPos;
|
||||||
startPos = minPos;
|
int endPos = maxPos;
|
||||||
endPos = maxPos;
|
|
||||||
} else {
|
|
||||||
startPos = maxPos;
|
|
||||||
endPos = minPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Range endpoints should not be inside DBCS characters, but just in case, move them.
|
// Range endpoints should not be inside DBCS characters, but just in case, move them.
|
||||||
startPos = MovePositionOutsideChar(startPos, 1, false);
|
startPos = MovePositionOutsideChar(startPos, 1, false);
|
||||||
@@ -878,7 +874,9 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
|||||||
// Replace: $(\1-\2)
|
// Replace: $(\1-\2)
|
||||||
int lineRangeStart = LineFromPosition(startPos);
|
int lineRangeStart = LineFromPosition(startPos);
|
||||||
int lineRangeEnd = LineFromPosition(endPos);
|
int lineRangeEnd = LineFromPosition(endPos);
|
||||||
if ((startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) {
|
if ((increment == 1) &&
|
||||||
|
(startPos >= LineEnd(lineRangeStart)) &&
|
||||||
|
(lineRangeStart < lineRangeEnd)) {
|
||||||
// the start position is at end of line or between line end characters.
|
// the start position is at end of line or between line end characters.
|
||||||
lineRangeStart++;
|
lineRangeStart++;
|
||||||
startPos = LineStart(lineRangeStart);
|
startPos = LineStart(lineRangeStart);
|
||||||
@@ -886,27 +884,16 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
|||||||
int pos = -1;
|
int pos = -1;
|
||||||
int lenRet = 0;
|
int lenRet = 0;
|
||||||
char searchEnd = s[*length - 1];
|
char searchEnd = s[*length - 1];
|
||||||
if (*length == 1) {
|
int lineRangeBreak = lineRangeEnd + increment;
|
||||||
// These produce empty selections so nudge them on if needed
|
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
|
||||||
if (s[0] == '^') {
|
|
||||||
if (startPos == LineStart(lineRangeStart))
|
|
||||||
startPos++;
|
|
||||||
} else if (s[0] == '$') {
|
|
||||||
if ((startPos == LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd))
|
|
||||||
startPos = LineStart(lineRangeStart + 1);
|
|
||||||
}
|
|
||||||
lineRangeStart = LineFromPosition(startPos);
|
|
||||||
lineRangeEnd = LineFromPosition(endPos);
|
|
||||||
}
|
|
||||||
for (int line = lineRangeStart; line <= lineRangeEnd; line++) {
|
|
||||||
int startOfLine = LineStart(line);
|
int startOfLine = LineStart(line);
|
||||||
int endOfLine = LineEnd(line);
|
int endOfLine = LineEnd(line);
|
||||||
if (line == lineRangeStart) {
|
if ((increment == 1) && (line == lineRangeStart)) {
|
||||||
if ((startPos != startOfLine) && (s[0] == '^'))
|
if ((startPos != startOfLine) && (s[0] == '^'))
|
||||||
continue; // Can't match start of line if start position after start of line
|
continue; // Can't match start of line if start position after start of line
|
||||||
startOfLine = startPos;
|
startOfLine = startPos;
|
||||||
}
|
}
|
||||||
if (line == lineRangeEnd) {
|
if ((increment == 1) && (line == lineRangeEnd)) {
|
||||||
if ((endPos != endOfLine) && (searchEnd == '$'))
|
if ((endPos != endOfLine) && (searchEnd == '$'))
|
||||||
continue; // Can't match end of line if end position before end of line
|
continue; // Can't match end of line if end position before end of line
|
||||||
endOfLine = endPos;
|
endOfLine = endPos;
|
||||||
@@ -916,6 +903,20 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
|||||||
if (success) {
|
if (success) {
|
||||||
pos = pre->bopat[0];
|
pos = pre->bopat[0];
|
||||||
lenRet = pre->eopat[0] - pre->bopat[0];
|
lenRet = pre->eopat[0] - pre->bopat[0];
|
||||||
|
if (increment == -1) {
|
||||||
|
// Check for the last match on this line.
|
||||||
|
while (success && (pre->eopat[0] < endOfLine)) {
|
||||||
|
success = pre->Execute(di, pre->eopat[0], endOfLine);
|
||||||
|
if (success) {
|
||||||
|
if (pre->eopat[0] <= minPos) {
|
||||||
|
pos = pre->bopat[0];
|
||||||
|
lenRet = pre->eopat[0] - pre->bopat[0];
|
||||||
|
} else {
|
||||||
|
success = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1033,16 +1034,17 @@ int Document::LinesTotal() {
|
|||||||
|
|
||||||
void Document::ChangeCase(Range r, bool makeUpperCase) {
|
void Document::ChangeCase(Range r, bool makeUpperCase) {
|
||||||
for (int pos = r.start; pos < r.end; pos++) {
|
for (int pos = r.start; pos < r.end; pos++) {
|
||||||
char ch = CharAt(pos);
|
int len = LenChar(pos);
|
||||||
if (dbcsCodePage && IsDBCS(pos)) {
|
if (dbcsCodePage && (len > 1)) {
|
||||||
pos += LenChar(pos);
|
pos += len;
|
||||||
} else {
|
} else {
|
||||||
|
char ch = CharAt(pos);
|
||||||
if (makeUpperCase) {
|
if (makeUpperCase) {
|
||||||
if (islower(ch)) {
|
if (IsLowerCase(ch)) {
|
||||||
ChangeChar(pos, static_cast<char>(MakeUpperCase(ch)));
|
ChangeChar(pos, static_cast<char>(MakeUpperCase(ch)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isupper(ch)) {
|
if (IsUpperCase(ch)) {
|
||||||
ChangeChar(pos, static_cast<char>(MakeLowerCase(ch)));
|
ChangeChar(pos, static_cast<char>(MakeLowerCase(ch)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1092,6 +1094,7 @@ bool Document::SetStyleFor(int length, char style) {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
enteredCount++;
|
enteredCount++;
|
||||||
|
style &= stylingMask;
|
||||||
int prevEndStyled = endStyled;
|
int prevEndStyled = endStyled;
|
||||||
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
|
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
|
||||||
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
||||||
@@ -1206,7 +1209,7 @@ void Document::NotifyModified(DocModification mh) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Document::IsWordPartSeparator(char ch) {
|
bool Document::IsWordPartSeparator(char ch) {
|
||||||
return ispunct(ch) && (WordCharClass(ch) == ccWord);
|
return (WordCharClass(ch) == ccWord) && IsPunctuation(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::WordPartLeft(int pos) {
|
int Document::WordPartLeft(int pos) {
|
||||||
@@ -1221,31 +1224,38 @@ int Document::WordPartLeft(int pos) {
|
|||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
startChar = cb.CharAt(pos);
|
startChar = cb.CharAt(pos);
|
||||||
--pos;
|
--pos;
|
||||||
if (islower(startChar)) {
|
if (IsLowerCase(startChar)) {
|
||||||
while (pos > 0 && islower(cb.CharAt(pos)))
|
while (pos > 0 && IsLowerCase(cb.CharAt(pos)))
|
||||||
--pos;
|
--pos;
|
||||||
if (!isupper(cb.CharAt(pos)) && !islower(cb.CharAt(pos)))
|
if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
} else if (isupper(startChar)) {
|
} else if (IsUpperCase(startChar)) {
|
||||||
while (pos > 0 && isupper(cb.CharAt(pos)))
|
while (pos > 0 && IsUpperCase(cb.CharAt(pos)))
|
||||||
--pos;
|
--pos;
|
||||||
if (!isupper(cb.CharAt(pos)))
|
if (!IsUpperCase(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
} else if (isdigit(startChar)) {
|
} else if (IsADigit(startChar)) {
|
||||||
while (pos > 0 && isdigit(cb.CharAt(pos)))
|
while (pos > 0 && IsADigit(cb.CharAt(pos)))
|
||||||
--pos;
|
--pos;
|
||||||
if (!isdigit(cb.CharAt(pos)))
|
if (!IsADigit(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
} else if (ispunct(startChar)) {
|
} else if (IsPunctuation(startChar)) {
|
||||||
while (pos > 0 && ispunct(cb.CharAt(pos)))
|
while (pos > 0 && IsPunctuation(cb.CharAt(pos)))
|
||||||
--pos;
|
--pos;
|
||||||
if (!ispunct(cb.CharAt(pos)))
|
if (!IsPunctuation(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
} else if (isspacechar(startChar)) {
|
} else if (isspacechar(startChar)) {
|
||||||
while (pos > 0 && isspacechar(cb.CharAt(pos)))
|
while (pos > 0 && isspacechar(cb.CharAt(pos)))
|
||||||
--pos;
|
--pos;
|
||||||
if (!isspacechar(cb.CharAt(pos)))
|
if (!isspacechar(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
|
} else if (!isascii(startChar)) {
|
||||||
|
while (pos > 0 && !isascii(cb.CharAt(pos)))
|
||||||
|
--pos;
|
||||||
|
if (isascii(cb.CharAt(pos)))
|
||||||
|
++pos;
|
||||||
|
} else {
|
||||||
|
++pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1260,29 +1270,34 @@ int Document::WordPartRight(int pos) {
|
|||||||
++pos;
|
++pos;
|
||||||
startChar = cb.CharAt(pos);
|
startChar = cb.CharAt(pos);
|
||||||
}
|
}
|
||||||
if (islower(startChar)) {
|
if (!isascii(startChar)) {
|
||||||
while (pos < length && islower(cb.CharAt(pos)))
|
while (pos < length && !isascii(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
} else if (isupper(startChar)) {
|
} else if (IsLowerCase(startChar)) {
|
||||||
if (islower(cb.CharAt(pos + 1))) {
|
while (pos < length && IsLowerCase(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
while (pos < length && islower(cb.CharAt(pos)))
|
} else if (IsUpperCase(startChar)) {
|
||||||
|
if (IsLowerCase(cb.CharAt(pos + 1))) {
|
||||||
|
++pos;
|
||||||
|
while (pos < length && IsLowerCase(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
} else {
|
} else {
|
||||||
while (pos < length && isupper(cb.CharAt(pos)))
|
while (pos < length && IsUpperCase(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
if (islower(cb.CharAt(pos)) && isupper(cb.CharAt(pos - 1)))
|
if (IsLowerCase(cb.CharAt(pos)) && IsUpperCase(cb.CharAt(pos - 1)))
|
||||||
--pos;
|
--pos;
|
||||||
} else if (isdigit(startChar)) {
|
} else if (IsADigit(startChar)) {
|
||||||
while (pos < length && isdigit(cb.CharAt(pos)))
|
while (pos < length && IsADigit(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
} else if (ispunct(startChar)) {
|
} else if (IsPunctuation(startChar)) {
|
||||||
while (pos < length && ispunct(cb.CharAt(pos)))
|
while (pos < length && IsPunctuation(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
} else if (isspacechar(startChar)) {
|
} else if (isspacechar(startChar)) {
|
||||||
while (pos < length && isspacechar(cb.CharAt(pos)))
|
while (pos < length && isspacechar(cb.CharAt(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
|
} else {
|
||||||
|
++pos;
|
||||||
}
|
}
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file Document.h
|
/** @file Document.h
|
||||||
** Text document that handles notifications, DBCS, styling, words and end of line.
|
** Text document that handles notifications, DBCS, styling, words and end of line.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#ifndef DOCUMENT_H
|
#ifndef DOCUMENT_H
|
||||||
@@ -222,7 +222,6 @@ public:
|
|||||||
int WordPartRight(int pos);
|
int WordPartRight(int pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsDBCS(int pos);
|
|
||||||
charClassification WordCharClass(unsigned char ch);
|
charClassification WordCharClass(unsigned char ch);
|
||||||
bool IsWordStartAt(int pos);
|
bool IsWordStartAt(int pos);
|
||||||
bool IsWordEndAt(int pos);
|
bool IsWordEndAt(int pos);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
/** @file Editor.h
|
/** @file Editor.h
|
||||||
** Defines the main editor class.
|
** Defines the main editor class.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#ifndef EDITOR_H
|
#ifndef EDITOR_H
|
||||||
@@ -138,18 +138,20 @@ class AutoSurface {
|
|||||||
private:
|
private:
|
||||||
Surface *surf;
|
Surface *surf;
|
||||||
public:
|
public:
|
||||||
AutoSurface(bool unicodeMode) {
|
AutoSurface(int codePage) {
|
||||||
surf = Surface::Allocate();
|
surf = Surface::Allocate();
|
||||||
if (surf) {
|
if (surf) {
|
||||||
surf->Init();
|
surf->Init();
|
||||||
surf->SetUnicodeMode(unicodeMode);
|
surf->SetUnicodeMode(SC_CP_UTF8 == codePage);
|
||||||
|
surf->SetDBCSMode(codePage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AutoSurface(SurfaceID sid, bool unicodeMode) {
|
AutoSurface(SurfaceID sid, int codePage) {
|
||||||
surf = Surface::Allocate();
|
surf = Surface::Allocate();
|
||||||
if (surf) {
|
if (surf) {
|
||||||
surf->Init(sid);
|
surf->Init(sid);
|
||||||
surf->SetUnicodeMode(unicodeMode);
|
surf->SetUnicodeMode(SC_CP_UTF8 == codePage);
|
||||||
|
surf->SetDBCSMode(codePage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
~AutoSurface() {
|
~AutoSurface() {
|
||||||
@@ -184,6 +186,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
|
|
||||||
int printMagnification;
|
int printMagnification;
|
||||||
int printColourMode;
|
int printColourMode;
|
||||||
|
int printWrapState;
|
||||||
int cursorMode;
|
int cursorMode;
|
||||||
int controlCharSymbol;
|
int controlCharSymbol;
|
||||||
|
|
||||||
@@ -196,11 +199,15 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
/** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
|
/** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
|
||||||
* the screen. This avoids flashing but is about 30% slower. */
|
* the screen. This avoids flashing but is about 30% slower. */
|
||||||
bool bufferedDraw;
|
bool bufferedDraw;
|
||||||
|
/** In twoPhaseDraw mode, drawing is performed in two phases, first the background
|
||||||
|
* and then the foreground. This avoids chopping off characters that overlap the next run. */
|
||||||
|
bool twoPhaseDraw;
|
||||||
|
|
||||||
int xOffset; ///< Horizontal scrolled amount in pixels
|
int xOffset; ///< Horizontal scrolled amount in pixels
|
||||||
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret
|
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret
|
||||||
bool horizontalScrollBarVisible;
|
bool horizontalScrollBarVisible;
|
||||||
int scrollWidth;
|
int scrollWidth;
|
||||||
|
bool verticalScrollBarVisible;
|
||||||
bool endAtLastLine;
|
bool endAtLastLine;
|
||||||
|
|
||||||
Surface *pixmapLine;
|
Surface *pixmapLine;
|
||||||
@@ -321,12 +328,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
void SetSelection(int currentPos_, int anchor_);
|
void SetSelection(int currentPos_, int anchor_);
|
||||||
void SetSelection(int currentPos_);
|
void SetSelection(int currentPos_);
|
||||||
void SetEmptySelection(int currentPos_);
|
void SetEmptySelection(int currentPos_);
|
||||||
|
bool RangeContainsProtected(int start, int end) const;
|
||||||
|
bool SelectionContainsProtected() const;
|
||||||
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
|
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
|
||||||
int MovePositionTo(int newPos, bool extend=false, bool ensureVisible=true);
|
int MovePositionTo(int newPos, bool extend=false, bool ensureVisible=true);
|
||||||
int MovePositionSoVisible(int pos, int moveDir);
|
int MovePositionSoVisible(int pos, int moveDir);
|
||||||
void SetLastXChosen();
|
void SetLastXChosen();
|
||||||
|
|
||||||
void ScrollTo(int line);
|
void ScrollTo(int line, bool moveThumb=true);
|
||||||
virtual void ScrollText(int linesToMove);
|
virtual void ScrollText(int linesToMove);
|
||||||
void HorizontalScrollTo(int xPos);
|
void HorizontalScrollTo(int xPos);
|
||||||
void MoveCaretInsideView(bool ensureVisible=true);
|
void MoveCaretInsideView(bool ensureVisible=true);
|
||||||
@@ -338,14 +347,22 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
|
|
||||||
void NeedWrapping(int docLineStartWrapping=0);
|
void NeedWrapping(int docLineStartWrapping=0);
|
||||||
bool WrapLines();
|
bool WrapLines();
|
||||||
|
void LinesJoin();
|
||||||
|
void LinesSplit(int pixelWidth);
|
||||||
|
|
||||||
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
|
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
|
||||||
void PaintSelMargin(Surface *surface, PRectangle &rc);
|
void PaintSelMargin(Surface *surface, PRectangle &rc);
|
||||||
LineLayout *RetrieveLineLayout(int lineNumber);
|
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);
|
int width=LineLayout::wrapWidthInfinite);
|
||||||
|
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, int styleMain, int i, LineLayout *ll);
|
||||||
|
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
|
||||||
|
void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
|
||||||
|
int line, int lineEnd, int xStart, int subLine, int subLineStart,
|
||||||
|
bool overrideBackground, ColourAllocated background);
|
||||||
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
|
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
|
||||||
PRectangle rcLine, LineLayout *ll, int subLine=0);
|
PRectangle rcLine, LineLayout *ll, int subLine=0);
|
||||||
|
void RefreshPixMaps(Surface *surfaceWindow);
|
||||||
void Paint(Surface *surfaceWindow, PRectangle rcArea);
|
void Paint(Surface *surfaceWindow, PRectangle rcArea);
|
||||||
long FormatRange(bool draw, RangeToFormat *pfr);
|
long FormatRange(bool draw, RangeToFormat *pfr);
|
||||||
int TextWidth(int style, const char *text);
|
int TextWidth(int style, const char *text);
|
||||||
@@ -403,6 +420,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
void PageMove(int direction, bool extend=false);
|
void PageMove(int direction, bool extend=false);
|
||||||
void ChangeCaseOfSelection(bool makeUpperCase);
|
void ChangeCaseOfSelection(bool makeUpperCase);
|
||||||
void LineTranspose();
|
void LineTranspose();
|
||||||
|
void LineDuplicate();
|
||||||
virtual void CancelModes();
|
virtual void CancelModes();
|
||||||
void NewLine();
|
void NewLine();
|
||||||
void CursorUpOrDown(int direction, bool extend=false);
|
void CursorUpOrDown(int direction, bool extend=false);
|
||||||
@@ -456,6 +474,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
|||||||
void EnsureLineVisible(int lineDoc, bool enforcePolicy);
|
void EnsureLineVisible(int lineDoc, bool enforcePolicy);
|
||||||
int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
|
int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
|
||||||
|
|
||||||
|
int CodePage() const;
|
||||||
|
|
||||||
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
|
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -127,6 +127,7 @@ const KeyToCommand KeyMap::MapDefault[] = {
|
|||||||
{'L', SCI_CTRL, SCI_LINECUT},
|
{'L', SCI_CTRL, SCI_LINECUT},
|
||||||
{'L', SCI_CSHIFT, SCI_LINEDELETE},
|
{'L', SCI_CSHIFT, SCI_LINEDELETE},
|
||||||
{'T', SCI_CTRL, SCI_LINETRANSPOSE},
|
{'T', SCI_CTRL, SCI_LINETRANSPOSE},
|
||||||
|
{'D', SCI_CTRL, SCI_LINEDUPLICATE},
|
||||||
{'U', SCI_CTRL, SCI_LOWERCASE},
|
{'U', SCI_CTRL, SCI_LOWERCASE},
|
||||||
{'U', SCI_CSHIFT, SCI_UPPERCASE},
|
{'U', SCI_CSHIFT, SCI_UPPERCASE},
|
||||||
{0,0,0},
|
{0,0,0},
|
||||||
|
@@ -142,15 +142,20 @@ int Scintilla_LinkLexers() {
|
|||||||
//++Autogenerated -- run src/LexGen.py to regenerate
|
//++Autogenerated -- run src/LexGen.py to regenerate
|
||||||
//**\(\tLINK_LEXER(\*);\n\)
|
//**\(\tLINK_LEXER(\*);\n\)
|
||||||
LINK_LEXER(lmAda);
|
LINK_LEXER(lmAda);
|
||||||
|
LINK_LEXER(lmAsm);
|
||||||
LINK_LEXER(lmAVE);
|
LINK_LEXER(lmAVE);
|
||||||
LINK_LEXER(lmBaan);
|
LINK_LEXER(lmBaan);
|
||||||
LINK_LEXER(lmBullant);
|
LINK_LEXER(lmBullant);
|
||||||
LINK_LEXER(lmConf);
|
LINK_LEXER(lmConf);
|
||||||
LINK_LEXER(lmCPP);
|
LINK_LEXER(lmCPP);
|
||||||
|
LINK_LEXER(lmCPPNoCase);
|
||||||
LINK_LEXER(lmTCL);
|
LINK_LEXER(lmTCL);
|
||||||
LINK_LEXER(lmNncrontab);
|
LINK_LEXER(lmNncrontab);
|
||||||
|
LINK_LEXER(lmCss);
|
||||||
LINK_LEXER(lmEiffel);
|
LINK_LEXER(lmEiffel);
|
||||||
LINK_LEXER(lmEiffelkw);
|
LINK_LEXER(lmEiffelkw);
|
||||||
|
LINK_LEXER(lmFortran);
|
||||||
|
LINK_LEXER(lmF77);
|
||||||
LINK_LEXER(lmHTML);
|
LINK_LEXER(lmHTML);
|
||||||
LINK_LEXER(lmXML);
|
LINK_LEXER(lmXML);
|
||||||
LINK_LEXER(lmASP);
|
LINK_LEXER(lmASP);
|
||||||
|
@@ -1,188 +1,224 @@
|
|||||||
// SciTE - Scintilla based Text Editor
|
// SciTE - Scintilla based Text Editor
|
||||||
/** @file LexAVE.cxx
|
/** @file LexAVE.cxx
|
||||||
** Lexer for Avenue.
|
** Lexer for Avenue.
|
||||||
|
**
|
||||||
|
** Written by Alexey Yutkin <yutkin@geol.msu.ru>.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#include "PropSet.h"
|
#include "PropSet.h"
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
#include "KeyWords.h"
|
#include "KeyWords.h"
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
|
||||||
static void ColouriseAveDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
|
||||||
|
|
||||||
|
static inline bool IsAWordChar(const int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||||
|
}
|
||||||
|
static inline bool IsEnumChar(const int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch)|| ch == '_');
|
||||||
|
}
|
||||||
|
static inline bool IsANumberChar(const int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsAWordStart(const int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isAveOperator(char ch) {
|
||||||
|
if (isalnum(ch))
|
||||||
|
return false;
|
||||||
|
// '.' left out as it is used to make up numbers
|
||||||
|
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
|
||||||
|
ch == '(' || ch == ')' || ch == '=' ||
|
||||||
|
ch == '{' || ch == '}' ||
|
||||||
|
ch == '[' || ch == ']' || ch == ';' ||
|
||||||
|
ch == '<' || ch == '>' || ch == ',' ||
|
||||||
|
ch == '.' )
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseAveDoc(
|
||||||
|
unsigned int startPos,
|
||||||
|
int length,
|
||||||
|
int initStyle,
|
||||||
|
WordList *keywordlists[],
|
||||||
Accessor &styler) {
|
Accessor &styler) {
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
|
WordList &keywords2 = *keywordlists[1];
|
||||||
|
WordList &keywords3 = *keywordlists[2];
|
||||||
|
WordList &keywords4 = *keywordlists[3];
|
||||||
|
WordList &keywords5 = *keywordlists[4];
|
||||||
|
WordList &keywords6 = *keywordlists[5];
|
||||||
|
|
||||||
styler.StartAt(startPos);
|
// Do not leak onto next line
|
||||||
|
if (initStyle == SCE_AVE_STRINGEOL) {
|
||||||
|
initStyle = SCE_AVE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
bool fold = styler.GetPropertyInt("fold") != 0;
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
if (sc.atLineEnd) {
|
||||||
|
// Update the line state, so it can be seen by next line
|
||||||
|
int currentLine = styler.GetLine(sc.currentPos);
|
||||||
|
styler.SetLineState(currentLine, 0);
|
||||||
|
}
|
||||||
|
if (sc.atLineStart && (sc.state == SCE_AVE_STRING)) {
|
||||||
|
// Prevent SCE_AVE_STRINGEOL from leaking back to previous line
|
||||||
|
sc.SetState(SCE_AVE_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Determine if the current state should terminate.
|
||||||
|
if (sc.state == SCE_AVE_OPERATOR) {
|
||||||
|
sc.SetState(SCE_AVE_DEFAULT);
|
||||||
|
} else if (sc.state == SCE_AVE_NUMBER) {
|
||||||
|
if (!IsANumberChar(sc.ch)) {
|
||||||
|
sc.SetState(SCE_AVE_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_AVE_ENUM) {
|
||||||
|
if (!IsEnumChar(sc.ch)) {
|
||||||
|
sc.SetState(SCE_AVE_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_AVE_IDENTIFIER) {
|
||||||
|
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
||||||
|
char s[100];
|
||||||
|
//sc.GetCurrent(s, sizeof(s));
|
||||||
|
sc.GetCurrentLowered(s, sizeof(s));
|
||||||
|
if (keywords.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_AVE_WORD);
|
||||||
|
} else if (keywords2.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_AVE_WORD2);
|
||||||
|
} else if (keywords3.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_AVE_WORD3);
|
||||||
|
} else if (keywords4.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_AVE_WORD4);
|
||||||
|
} else if (keywords5.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_AVE_WORD5);
|
||||||
|
} else if (keywords6.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_AVE_WORD6);
|
||||||
|
}
|
||||||
|
sc.SetState(SCE_AVE_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_AVE_COMMENT) {
|
||||||
|
if (sc.atLineEnd) {
|
||||||
|
sc.SetState(SCE_AVE_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_AVE_STRING) {
|
||||||
|
if (sc.ch == '\"') {
|
||||||
|
sc.ForwardSetState(SCE_AVE_DEFAULT);
|
||||||
|
} else if (sc.atLineEnd) {
|
||||||
|
sc.ChangeState(SCE_AVE_STRINGEOL);
|
||||||
|
sc.ForwardSetState(SCE_AVE_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if a new state should be entered.
|
||||||
|
if (sc.state == SCE_AVE_DEFAULT) {
|
||||||
|
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||||
|
sc.SetState(SCE_AVE_NUMBER);
|
||||||
|
} else if (IsAWordStart(sc.ch)) {
|
||||||
|
sc.SetState(SCE_AVE_IDENTIFIER);
|
||||||
|
} else if (sc.Match('\"')) {
|
||||||
|
sc.SetState(SCE_AVE_STRING);
|
||||||
|
} else if (sc.Match('\'')) {
|
||||||
|
sc.SetState(SCE_AVE_COMMENT);
|
||||||
|
sc.Forward();
|
||||||
|
} else if (isAveOperator(static_cast<char>(sc.ch))) {
|
||||||
|
sc.SetState(SCE_AVE_OPERATOR);
|
||||||
|
} else if (sc.Match('#')) {
|
||||||
|
sc.SetState(SCE_AVE_ENUM);
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sc.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
||||||
|
Accessor &styler) {
|
||||||
|
unsigned int lengthDoc = startPos + length;
|
||||||
|
int visibleChars = 0;
|
||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
int levelCurrent = levelPrev;
|
int levelCurrent = levelPrev;
|
||||||
|
char chNext = static_cast<char>(tolower(styler[startPos]));
|
||||||
int state = initStyle;
|
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||||
if (state == SCE_AVE_STRINGEOL) // Does not leak onto next line
|
int styleNext = styler.StyleAt(startPos);
|
||||||
state = SCE_AVE_DEFAULT;
|
char s[10];
|
||||||
char chNext = styler[startPos];
|
|
||||||
unsigned int lengthDoc = startPos + length;
|
|
||||||
int visibleChars = 0;
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
|
|
||||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||||
char ch = chNext;
|
char ch = static_cast<char>(tolower(chNext));
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1)));
|
||||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
|
int style = styleNext;
|
||||||
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
styleNext = styler.StyleAt(i + 1);
|
||||||
// Avoid triggering two times on Dos/Win
|
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||||
// End of line
|
if (style == SCE_AVE_WORD) {
|
||||||
if (state == SCE_AVE_STRINGEOL) {
|
if (ch == 't' || ch == 'f' || ch == 'w' || ch == 'e') {
|
||||||
styler.ColourTo(i, state);
|
for (unsigned int j = 0; j < 6; j++) {
|
||||||
state = SCE_AVE_DEFAULT;
|
if (!iswordchar(styler[i + j])) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s[j] = static_cast<char>(tolower(styler[i + j]));
|
||||||
|
s[j + 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((strcmp(s, "then") == 0) || (strcmp(s, "for") == 0) || (strcmp(s, "while") == 0)) {
|
||||||
|
levelCurrent++;
|
||||||
|
}
|
||||||
|
if ((strcmp(s, "end") == 0)) {
|
||||||
|
levelCurrent--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fold) {
|
} else if (style == SCE_AVE_OPERATOR) {
|
||||||
int lev = levelPrev;
|
if (ch == '{' || ch == '(') {
|
||||||
if (visibleChars == 0)
|
levelCurrent++;
|
||||||
lev |= SC_FOLDLEVELWHITEFLAG;
|
} else if (ch == '}' || ch == ')') {
|
||||||
if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
levelCurrent--;
|
||||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (atEOL) {
|
||||||
|
int lev = levelPrev;
|
||||||
|
if (visibleChars == 0 && foldCompact) {
|
||||||
|
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||||
|
}
|
||||||
|
if ((levelCurrent > levelPrev) && (visibleChars > 0)) {
|
||||||
|
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||||
|
}
|
||||||
|
if (lev != styler.LevelAt(lineCurrent)) {
|
||||||
styler.SetLevel(lineCurrent, lev);
|
styler.SetLevel(lineCurrent, lev);
|
||||||
lineCurrent++;
|
|
||||||
levelPrev = levelCurrent;
|
|
||||||
}
|
}
|
||||||
|
lineCurrent++;
|
||||||
|
levelPrev = levelCurrent;
|
||||||
visibleChars = 0;
|
visibleChars = 0;
|
||||||
}
|
}
|
||||||
if (!isspace(ch))
|
if (!isspacechar(ch)) {
|
||||||
visibleChars++;
|
visibleChars++;
|
||||||
if (styler.IsLeadByte(ch)) {
|
|
||||||
chNext = styler.SafeGetCharAt(i + 2);
|
|
||||||
i += 1;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == SCE_AVE_DEFAULT) {
|
|
||||||
if (iswordstart(ch) || (ch == '.') ) {
|
|
||||||
styler.ColourTo(i-1, state);
|
|
||||||
state = SCE_AVE_IDENTIFIER;
|
|
||||||
} else if (ch == '\'') {
|
|
||||||
styler.ColourTo(i-1, state);
|
|
||||||
state = SCE_AVE_COMMENT;
|
|
||||||
} else if (ch == '\"') {
|
|
||||||
styler.ColourTo(i-1, state);
|
|
||||||
state = SCE_AVE_STRING;
|
|
||||||
} else if (ch == '#') {
|
|
||||||
styler.ColourTo(i-1, state);
|
|
||||||
state = SCE_AVE_ENUM;
|
|
||||||
} else if (isoperator(ch) ) {
|
|
||||||
styler.ColourTo(i-1, state);
|
|
||||||
styler.ColourTo(i, SCE_AVE_OPERATOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (state == SCE_AVE_COMMENT) {
|
|
||||||
if (ch == '\r' || ch == '\n') {
|
|
||||||
styler.ColourTo(i-1, state);
|
|
||||||
state = SCE_AVE_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (state == SCE_AVE_ENUM) {
|
|
||||||
if (isoperator(ch) || ch == ' ' || ch == '\'' || ch == '\r' || ch == '\n') {
|
|
||||||
styler.ColourTo(i-1, state);
|
|
||||||
state = SCE_AVE_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (state == SCE_AVE_STRING) {
|
|
||||||
if (ch == '\"') {
|
|
||||||
if (chNext == '\"') {
|
|
||||||
i++;
|
|
||||||
ch = chNext;
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_AVE_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (chNext == '\r' || chNext == '\n') {
|
|
||||||
styler.ColourTo(i-1, SCE_AVE_STRINGEOL);
|
|
||||||
state = SCE_AVE_STRINGEOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((state == SCE_AVE_IDENTIFIER)) {
|
|
||||||
if (!iswordchar(ch) || ch == '.' ) {
|
|
||||||
char s[100];
|
|
||||||
unsigned int start = styler.GetStartSegment();
|
|
||||||
unsigned int end = i - 1;
|
|
||||||
for (unsigned int ii = 0; ii < end - start + 1 && ii < 30; ii++) {
|
|
||||||
s[ii] = static_cast<char>(tolower(styler[start + ii]));
|
|
||||||
s[ii + 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
char chAttr = SCE_AVE_IDENTIFIER;
|
|
||||||
|
|
||||||
if (isdigit(s[0]))
|
|
||||||
chAttr = SCE_AVE_NUMBER;
|
|
||||||
else {
|
|
||||||
if ((strcmp(s, "for") == 0) || (strcmp(s, "if") == 0) || (strcmp(s, "while") == 0))
|
|
||||||
{
|
|
||||||
levelCurrent +=1;
|
|
||||||
chAttr = SCE_AVE_STATEMENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(s, "end") == 0)
|
|
||||||
{
|
|
||||||
levelCurrent -=1;
|
|
||||||
chAttr = SCE_AVE_STATEMENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (strcmp(s, "then") == 0) || (strcmp(s, "else") == 0) || (strcmp(s, "break") == 0) ||
|
|
||||||
(strcmp(s, "each") == 0) ||
|
|
||||||
(strcmp(s, "exit") == 0) || (strcmp(s, "continue") == 0) || (strcmp(s, "return") == 0) ||
|
|
||||||
(strcmp(s, "by") == 0) || (strcmp(s, "in") == 0) || (strcmp(s, "elseif") == 0))
|
|
||||||
{
|
|
||||||
chAttr = SCE_AVE_STATEMENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((strcmp(s, "av") == 0) || (strcmp(s, "self") == 0))
|
|
||||||
{
|
|
||||||
chAttr = SCE_AVE_KEYWORD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keywords.InList(s))
|
|
||||||
{
|
|
||||||
chAttr = SCE_AVE_WORD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
styler.ColourTo(end, chAttr);
|
|
||||||
state = SCE_AVE_DEFAULT;
|
|
||||||
|
|
||||||
if (ch == '\'') {
|
|
||||||
state = SCE_AVE_COMMENT;
|
|
||||||
} else if (ch == '\"') {
|
|
||||||
state = SCE_AVE_STRING;
|
|
||||||
} else if (isoperator(ch)) {
|
|
||||||
styler.ColourTo(i, SCE_AVE_OPERATOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
styler.ColourTo(lengthDoc - 1, state);
|
|
||||||
|
|
||||||
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||||
if (fold) {
|
|
||||||
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
|
||||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
|
||||||
|
|
||||||
}
|
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||||
|
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave");
|
LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave", FoldAveDoc);
|
||||||
|
|
||||||
|
@@ -1,198 +1,515 @@
|
|||||||
// SciTE - Scintilla based Text Editor
|
// Scintilla source code edit control
|
||||||
// LexAda.cxx - lexer for Ada95
|
/** @file LexAda.cxx
|
||||||
// by Tahir Karaca <tahir@bigfoot.de>
|
** Lexer for Ada 95
|
||||||
|
**/
|
||||||
|
// Copyright 2002 by Sergey Koshcheyev <sergey.k@seznam.cz>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#include "PropSet.h"
|
|
||||||
#include "Accessor.h"
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
|
#include "PropSet.h"
|
||||||
#include "KeyWords.h"
|
#include "KeyWords.h"
|
||||||
#include "Scintilla.h"
|
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
#include "SString.h"
|
||||||
|
|
||||||
inline void classifyWordAda(unsigned int start, unsigned int end,
|
/*
|
||||||
WordList &keywords, Accessor &styler) {
|
* Interface
|
||||||
|
*/
|
||||||
|
|
||||||
static const unsigned KEWORD_LEN_MAX = 30;
|
static void ColouriseDocument(
|
||||||
|
unsigned int startPos,
|
||||||
|
int length,
|
||||||
|
int initStyle,
|
||||||
|
WordList *keywordlists[],
|
||||||
|
Accessor &styler);
|
||||||
|
|
||||||
char wordLower[KEWORD_LEN_MAX + 1];
|
LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada");
|
||||||
unsigned i;
|
|
||||||
for(i = 0; ( i < KEWORD_LEN_MAX ) && ( i < end - start + 1 ); i++) {
|
|
||||||
wordLower[i] = static_cast<char>(tolower(styler[start + i]));
|
|
||||||
}
|
|
||||||
wordLower[i] = '\0';
|
|
||||||
|
|
||||||
// int levelChange = 0;
|
/*
|
||||||
char chAttr = SCE_ADA_IDENTIFIER;
|
* Implementation
|
||||||
if (keywords.InList(wordLower)) {
|
*/
|
||||||
chAttr = SCE_ADA_WORD;
|
|
||||||
|
|
||||||
// Folding doesn't work this way since the semantics of some keywords depends
|
// Functions that have apostropheStartsAttribute as a parameter set it according to whether
|
||||||
// on the current context.
|
// an apostrophe encountered after processing the current token will start an attribute or
|
||||||
// E.g. - "cond1 and THEN cond2" <-> "if ... THEN ..."
|
// a character literal.
|
||||||
// - "procedure X IS ... end X;" <-> "procedure X IS new Y;"
|
static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute);
|
||||||
// if (strcmp(wordLower, "is") == 0 || strcmp(wordLower, "then") == 0)
|
static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute);
|
||||||
// levelChange=1;
|
static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL);
|
||||||
// else if (strcmp(wordLower, "end") == 0)
|
static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute);
|
||||||
// levelChange=-1;
|
static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute);
|
||||||
}
|
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute);
|
||||||
styler.ColourTo(end, chAttr);
|
static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute);
|
||||||
|
static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute);
|
||||||
|
static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute);
|
||||||
|
|
||||||
// return levelChange;
|
static inline bool IsDelimiterCharacter(int ch);
|
||||||
|
static inline bool IsNumberStartCharacter(int ch);
|
||||||
|
static inline bool IsNumberCharacter(int ch);
|
||||||
|
static inline bool IsSeparatorOrDelimiterCharacter(int ch);
|
||||||
|
static bool IsValidIdentifier(const SString& identifier);
|
||||||
|
static bool IsValidNumber(const SString& number);
|
||||||
|
static inline bool IsWordStartCharacter(int ch);
|
||||||
|
static inline bool IsWordCharacter(int ch);
|
||||||
|
|
||||||
|
static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute) {
|
||||||
|
apostropheStartsAttribute = true;
|
||||||
|
|
||||||
|
sc.SetState(SCE_ADA_CHARACTER);
|
||||||
|
|
||||||
|
// Skip the apostrophe and one more character (so that '' is shown as non-terminated and '''
|
||||||
|
// is handled correctly)
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
|
||||||
|
ColouriseContext(sc, '\'', SCE_ADA_CHARACTEREOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL) {
|
||||||
|
while (!sc.atLineEnd && !sc.Match(chEnd)) {
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool isAdaOperator(char ch) {
|
if (!sc.atLineEnd) {
|
||||||
|
sc.ForwardSetState(SCE_ADA_DEFAULT);
|
||||||
if (ch == '&' || ch == '\'' || ch == '(' || ch == ')' ||
|
} else {
|
||||||
ch == '*' || ch == '+' || ch == ',' || ch == '-' ||
|
sc.ChangeState(stateEOL);
|
||||||
ch == '.' || ch == '/' || ch == ':' || ch == ';' ||
|
|
||||||
ch == '<' || ch == '=' || ch == '>')
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void styleTokenBegin(char beginChar, unsigned int pos, int &state,
|
|
||||||
Accessor &styler) {
|
|
||||||
|
|
||||||
if (isalpha(beginChar)) {
|
|
||||||
styler.ColourTo(pos-1, state);
|
|
||||||
state = SCE_ADA_IDENTIFIER;
|
|
||||||
} else if (isdigit(beginChar)) {
|
|
||||||
styler.ColourTo(pos-1, state);
|
|
||||||
state = SCE_ADA_NUMBER;
|
|
||||||
} else if (beginChar == '-' && styler.SafeGetCharAt(pos + 1) == '-') {
|
|
||||||
styler.ColourTo(pos-1, state);
|
|
||||||
state = SCE_ADA_COMMENT;
|
|
||||||
} else if (beginChar == '\"') {
|
|
||||||
styler.ColourTo(pos-1, state);
|
|
||||||
state = SCE_ADA_STRING;
|
|
||||||
} else if (beginChar == '\'' && styler.SafeGetCharAt(pos + 2) == '\'') {
|
|
||||||
styler.ColourTo(pos-1, state);
|
|
||||||
state = SCE_ADA_CHARACTER;
|
|
||||||
} else if (isAdaOperator(beginChar)) {
|
|
||||||
styler.ColourTo(pos-1, state);
|
|
||||||
styler.ColourTo(pos, SCE_ADA_OPERATOR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ColouriseComment(StyleContext& sc, bool& /*apostropheStartsAttribute*/) {
|
||||||
|
// Apostrophe meaning is not changed, but the parameter is present for uniformity
|
||||||
|
|
||||||
static void ColouriseAdaDoc(unsigned int startPos, int length, int initStyle,
|
sc.SetState(SCE_ADA_COMMENTLINE);
|
||||||
WordList *keywordlists[], Accessor &styler) {
|
|
||||||
|
|
||||||
|
while (!sc.atLineEnd) {
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) {
|
||||||
|
apostropheStartsAttribute = sc.Match (')');
|
||||||
|
sc.SetState(SCE_ADA_DELIMITER);
|
||||||
|
sc.ForwardSetState(SCE_ADA_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) {
|
||||||
|
apostropheStartsAttribute = false;
|
||||||
|
|
||||||
|
sc.SetState(SCE_ADA_LABEL);
|
||||||
|
|
||||||
|
// Skip "<<"
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
|
||||||
|
SString identifier;
|
||||||
|
|
||||||
|
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
|
||||||
|
identifier += static_cast<char>(tolower(sc.ch));
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip ">>"
|
||||||
|
if (sc.Match('>', '>')) {
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
} else {
|
||||||
|
sc.ChangeState(SCE_ADA_ILLEGAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the name is an invalid identifier or a keyword, then make it invalid label
|
||||||
|
if (!IsValidIdentifier(identifier) || keywords.InList(identifier.c_str())) {
|
||||||
|
sc.ChangeState(SCE_ADA_ILLEGAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
sc.SetState(SCE_ADA_DEFAULT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
|
||||||
|
apostropheStartsAttribute = true;
|
||||||
|
|
||||||
|
SString number;
|
||||||
|
sc.SetState(SCE_ADA_NUMBER);
|
||||||
|
|
||||||
|
// Get all characters up to a delimiter or a separator, including points, but excluding
|
||||||
|
// double points (ranges).
|
||||||
|
while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) {
|
||||||
|
number += static_cast<char>(sc.ch);
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special case: exponent with sign
|
||||||
|
if ((sc.chPrev == 'e' || sc.chPrev == 'E') &&
|
||||||
|
(sc.ch == '+' || sc.ch == '-')) {
|
||||||
|
number += static_cast<char>(sc.ch);
|
||||||
|
sc.Forward ();
|
||||||
|
|
||||||
|
while (!IsSeparatorOrDelimiterCharacter(sc.ch)) {
|
||||||
|
number += static_cast<char>(sc.ch);
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsValidNumber(number)) {
|
||||||
|
sc.ChangeState(SCE_ADA_ILLEGAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
sc.SetState(SCE_ADA_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute) {
|
||||||
|
apostropheStartsAttribute = true;
|
||||||
|
|
||||||
|
sc.SetState(SCE_ADA_STRING);
|
||||||
|
sc.Forward();
|
||||||
|
|
||||||
|
ColouriseContext(sc, '"', SCE_ADA_STRINGEOL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseWhiteSpace(StyleContext& sc, bool& /*apostropheStartsAttribute*/) {
|
||||||
|
// Apostrophe meaning is not changed, but the parameter is present for uniformity
|
||||||
|
sc.SetState(SCE_ADA_DEFAULT);
|
||||||
|
sc.ForwardSetState(SCE_ADA_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) {
|
||||||
|
apostropheStartsAttribute = true;
|
||||||
|
sc.SetState(SCE_ADA_IDENTIFIER);
|
||||||
|
|
||||||
|
SString word;
|
||||||
|
|
||||||
|
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
|
||||||
|
word += static_cast<char>(tolower(sc.ch));
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsValidIdentifier(word)) {
|
||||||
|
sc.ChangeState(SCE_ADA_ILLEGAL);
|
||||||
|
|
||||||
|
} else if (keywords.InList(word.c_str())) {
|
||||||
|
sc.ChangeState(SCE_ADA_WORD);
|
||||||
|
|
||||||
|
if (word != "all") {
|
||||||
|
apostropheStartsAttribute = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sc.SetState(SCE_ADA_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// ColouriseDocument
|
||||||
|
//
|
||||||
|
|
||||||
|
static void ColouriseDocument(
|
||||||
|
unsigned int startPos,
|
||||||
|
int length,
|
||||||
|
int initStyle,
|
||||||
|
WordList *keywordlists[],
|
||||||
|
Accessor &styler) {
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
|
|
||||||
styler.StartAt(startPos);
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
// bool fold = styler.GetPropertyInt("fold");
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
// int lineCurrent = styler.GetLine(startPos);
|
bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
|
||||||
// int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
|
||||||
// int levelCurrent = levelPrev;
|
|
||||||
|
|
||||||
int state = initStyle;
|
while (sc.More()) {
|
||||||
if (state == SCE_ADA_STRINGEOL) // Does not leak onto next line
|
if (sc.atLineEnd) {
|
||||||
state = SCE_ADA_DEFAULT;
|
// Go to the next line
|
||||||
char chNext = styler[startPos];
|
sc.Forward();
|
||||||
const unsigned int lengthDoc = startPos + length;
|
lineCurrent++;
|
||||||
//int visibleChars = 0;
|
|
||||||
styler.StartSegment(startPos);
|
|
||||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
|
||||||
char ch = chNext;
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
|
|
||||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
|
// Remember the line state for future incremental lexing
|
||||||
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
styler.SetLineState(lineCurrent, apostropheStartsAttribute);
|
||||||
// Avoid triggering two times on Dos/Win
|
|
||||||
if (state == SCE_ADA_STRINGEOL) {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_ADA_DEFAULT;
|
|
||||||
}
|
|
||||||
// if (fold) {
|
|
||||||
// int lev = levelPrev;
|
|
||||||
// if (visibleChars == 0)
|
|
||||||
// lev |= SC_FOLDLEVELWHITEFLAG;
|
|
||||||
// if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
|
||||||
// lev |= SC_FOLDLEVELHEADERFLAG;
|
|
||||||
// styler.SetLevel(lineCurrent, lev);
|
|
||||||
// lineCurrent++;
|
|
||||||
// levelPrev = levelCurrent;
|
|
||||||
// }
|
|
||||||
//visibleChars = 0;
|
|
||||||
}
|
|
||||||
//if (!isspacechar(ch))
|
|
||||||
// visibleChars++;
|
|
||||||
|
|
||||||
if (styler.IsLeadByte(ch)) {
|
// Don't continue any styles on the next line
|
||||||
chNext = styler.SafeGetCharAt(i + 2);
|
sc.SetState(SCE_ADA_DEFAULT);
|
||||||
i += 1;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == SCE_ADA_DEFAULT) {
|
// Comments
|
||||||
styleTokenBegin(ch, i, state, styler);
|
if (sc.Match('-', '-')) {
|
||||||
} else if (state == SCE_ADA_IDENTIFIER) {
|
ColouriseComment(sc, apostropheStartsAttribute);
|
||||||
if (!iswordchar(ch)) {
|
|
||||||
classifyWordAda(styler.GetStartSegment(),
|
|
||||||
i - 1,
|
|
||||||
keywords,
|
|
||||||
styler);
|
|
||||||
state = SCE_ADA_DEFAULT;
|
|
||||||
styleTokenBegin(ch, i, state, styler);
|
|
||||||
}
|
|
||||||
} else if (state == SCE_ADA_COMMENT) {
|
|
||||||
if (ch == '\r' || ch == '\n') {
|
|
||||||
styler.ColourTo(i-1, state);
|
|
||||||
state = SCE_ADA_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_ADA_STRING) {
|
|
||||||
if (ch == '"' ) {
|
|
||||||
if( chNext == '"' ) {
|
|
||||||
i++;
|
|
||||||
chNext = styler.SafeGetCharAt(i + 1);
|
|
||||||
} else {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_ADA_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (chNext == '\r' || chNext == '\n') {
|
|
||||||
styler.ColourTo(i-1, SCE_ADA_STRINGEOL);
|
|
||||||
state = SCE_ADA_STRINGEOL;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_ADA_CHARACTER) {
|
|
||||||
if (ch == '\r' || ch == '\n') {
|
|
||||||
styler.ColourTo(i-1, SCE_ADA_STRINGEOL);
|
|
||||||
state = SCE_ADA_STRINGEOL;
|
|
||||||
} else if (ch == '\'' && styler.SafeGetCharAt(i - 2) == '\'') {
|
|
||||||
styler.ColourTo(i, state);
|
|
||||||
state = SCE_ADA_DEFAULT;
|
|
||||||
}
|
|
||||||
} else if (state == SCE_ADA_NUMBER) {
|
|
||||||
if ( !( isdigit(ch) || ch == '.' || ch == '_' || ch == '#'
|
|
||||||
|| ch == 'A' || ch == 'B' || ch == 'C' || ch == 'D'
|
|
||||||
|| ch == 'E' || ch == 'F'
|
|
||||||
|| ch == 'a' || ch == 'b' || ch == 'c' || ch == 'd'
|
|
||||||
|| ch == 'e' || ch == 'f' ) ) {
|
|
||||||
styler.ColourTo(i-1, SCE_ADA_NUMBER);
|
|
||||||
state = SCE_ADA_DEFAULT;
|
|
||||||
styleTokenBegin(ch, i, state, styler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Strings
|
||||||
|
} else if (sc.Match('"')) {
|
||||||
|
ColouriseString(sc, apostropheStartsAttribute);
|
||||||
|
|
||||||
|
// Characters
|
||||||
|
} else if (sc.Match('\'') && !apostropheStartsAttribute) {
|
||||||
|
ColouriseCharacter(sc, apostropheStartsAttribute);
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
} else if (sc.Match('<', '<')) {
|
||||||
|
ColouriseLabel(sc, keywords, apostropheStartsAttribute);
|
||||||
|
|
||||||
|
// Whitespace
|
||||||
|
} else if (isspace(sc.ch)) {
|
||||||
|
ColouriseWhiteSpace(sc, apostropheStartsAttribute);
|
||||||
|
|
||||||
|
// Delimiters
|
||||||
|
} else if (IsDelimiterCharacter(sc.ch)) {
|
||||||
|
ColouriseDelimiter(sc, apostropheStartsAttribute);
|
||||||
|
|
||||||
|
// Numbers
|
||||||
|
} else if (isdigit(sc.ch) || sc.ch == '#') {
|
||||||
|
ColouriseNumber(sc, apostropheStartsAttribute);
|
||||||
|
|
||||||
|
// Keywords or identifiers
|
||||||
|
} else {
|
||||||
|
ColouriseWord(sc, keywords, apostropheStartsAttribute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
styler.ColourTo(lengthDoc - 1, state);
|
|
||||||
|
|
||||||
// // Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
sc.Complete();
|
||||||
// if (fold) {
|
|
||||||
// int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
|
||||||
// styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LexerModule lmAda(SCLEX_ADA, ColouriseAdaDoc, "ada");
|
static inline bool IsDelimiterCharacter(int ch) {
|
||||||
|
switch (ch) {
|
||||||
|
case '&':
|
||||||
|
case '\'':
|
||||||
|
case '(':
|
||||||
|
case ')':
|
||||||
|
case '*':
|
||||||
|
case '+':
|
||||||
|
case ',':
|
||||||
|
case '-':
|
||||||
|
case '.':
|
||||||
|
case '/':
|
||||||
|
case ':':
|
||||||
|
case ';':
|
||||||
|
case '<':
|
||||||
|
case '=':
|
||||||
|
case '>':
|
||||||
|
case '|':
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsNumberCharacter(int ch) {
|
||||||
|
return IsNumberStartCharacter(ch) ||
|
||||||
|
ch == '_' ||
|
||||||
|
ch == '.' ||
|
||||||
|
ch == '#' ||
|
||||||
|
(ch >= 'a' && ch <= 'f') ||
|
||||||
|
(ch >= 'A' && ch <= 'F');
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsNumberStartCharacter(int ch) {
|
||||||
|
return isdigit(ch) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
|
||||||
|
return isspace(ch) || IsDelimiterCharacter(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool IsValidIdentifier(const SString& identifier) {
|
||||||
|
// First character can't be '_', so initialize the flag to true
|
||||||
|
bool lastWasUnderscore = true;
|
||||||
|
|
||||||
|
int length = identifier.length();
|
||||||
|
|
||||||
|
// Zero-length identifiers are not valid (these can occur inside labels)
|
||||||
|
if (length == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for valid character at the start
|
||||||
|
if (!IsWordStartCharacter(identifier[0])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for only valid characters and no double underscores
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
if (!IsWordCharacter(identifier[i]) ||
|
||||||
|
(identifier[i] == '_' && lastWasUnderscore)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lastWasUnderscore = identifier[i] == '_';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for underscore at the end
|
||||||
|
if (lastWasUnderscore == true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// All checks passed
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool IsValidNumber(const SString& number) {
|
||||||
|
int hashPos = number.search("#");
|
||||||
|
bool seenDot = false;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
int length = number.length();
|
||||||
|
|
||||||
|
if (length == 0)
|
||||||
|
return false; // Just in case
|
||||||
|
|
||||||
|
// Decimal number
|
||||||
|
if (hashPos == -1) {
|
||||||
|
bool canBeSpecial = false;
|
||||||
|
|
||||||
|
for (; i < length; i++) {
|
||||||
|
if (number[i] == '_') {
|
||||||
|
if (!canBeSpecial) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
canBeSpecial = false;
|
||||||
|
} else if (number[i] == '.') {
|
||||||
|
if (!canBeSpecial || seenDot) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
canBeSpecial = false;
|
||||||
|
seenDot = true;
|
||||||
|
} else if (isdigit(number[i])) {
|
||||||
|
canBeSpecial = true;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!canBeSpecial)
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// Based number
|
||||||
|
bool canBeSpecial = false;
|
||||||
|
int base = 0;
|
||||||
|
|
||||||
|
// Parse base
|
||||||
|
for (; i < length; i++) {
|
||||||
|
int ch = number[i];
|
||||||
|
if (ch == '_') {
|
||||||
|
if (!canBeSpecial)
|
||||||
|
return false;
|
||||||
|
canBeSpecial = false;
|
||||||
|
} else if (isdigit (ch)) {
|
||||||
|
base = base * 10 + (ch - '0');
|
||||||
|
if (base > 16)
|
||||||
|
return false;
|
||||||
|
canBeSpecial = true;
|
||||||
|
} else if (ch == '#' && canBeSpecial) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (base < 2)
|
||||||
|
return false;
|
||||||
|
if (i == length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
i++; // Skip over '#'
|
||||||
|
|
||||||
|
// Parse number
|
||||||
|
canBeSpecial = false;
|
||||||
|
|
||||||
|
for (; i < length; i++) {
|
||||||
|
int ch = tolower(number[i]);
|
||||||
|
|
||||||
|
if (ch == '_') {
|
||||||
|
if (!canBeSpecial) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
canBeSpecial = false;
|
||||||
|
|
||||||
|
} else if (ch == '.') {
|
||||||
|
if (!canBeSpecial || seenDot) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
canBeSpecial = false;
|
||||||
|
seenDot = true;
|
||||||
|
|
||||||
|
} else if (isdigit (ch)) {
|
||||||
|
if (ch - '0' >= base) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
canBeSpecial = true;
|
||||||
|
|
||||||
|
} else if (ch >= 'a' && ch <= 'f') {
|
||||||
|
if (ch - 'a' + 10 >= base) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
canBeSpecial = true;
|
||||||
|
|
||||||
|
} else if (ch == '#' && canBeSpecial) {
|
||||||
|
break;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exponent (optional)
|
||||||
|
if (i < length) {
|
||||||
|
if (number[i] != 'e' && number[i] != 'E')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
i++; // Move past 'E'
|
||||||
|
|
||||||
|
if (i == length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (number[i] == '+')
|
||||||
|
i++;
|
||||||
|
else if (number[i] == '-') {
|
||||||
|
if (seenDot) {
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
return false; // Integer literals should not have negative exponents
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool canBeSpecial = false;
|
||||||
|
|
||||||
|
for (; i < length; i++) {
|
||||||
|
if (number[i] == '_') {
|
||||||
|
if (!canBeSpecial) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
canBeSpecial = false;
|
||||||
|
} else if (isdigit(number[i])) {
|
||||||
|
canBeSpecial = true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!canBeSpecial)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if i == length, number was parsed successfully.
|
||||||
|
return i == length;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsWordCharacter(int ch) {
|
||||||
|
return IsWordStartCharacter(ch) || isdigit(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsWordStartCharacter(int ch) {
|
||||||
|
return isalpha(ch) || ch == '_';
|
||||||
|
}
|
||||||
|
133
contrib/src/stc/scintilla/src/LexAsm.cxx
Normal file
133
contrib/src/stc/scintilla/src/LexAsm.cxx
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file LexAsm.cxx
|
||||||
|
** Lexer for Assembler, just for the Masm Syntax
|
||||||
|
** Written by The Black Horus
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "PropSet.h"
|
||||||
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
|
#include "KeyWords.h"
|
||||||
|
#include "Scintilla.h"
|
||||||
|
#include "SciLexer.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static inline bool IsAWordChar(const int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch =='\\');
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsAWordStart(const int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isAsmOperator(char ch) {
|
||||||
|
if (isalnum(ch))
|
||||||
|
return false;
|
||||||
|
// '.' left out as it is used to make up numbers
|
||||||
|
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
|
||||||
|
ch == '(' || ch == ')' || ch == '=' ||
|
||||||
|
ch == '[' || ch == ']' || ch == '<' ||
|
||||||
|
ch == '>' || ch == ',' ||
|
||||||
|
ch == '.' || ch == '%' || ch == ':')
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
|
Accessor &styler) {
|
||||||
|
|
||||||
|
WordList &cpuInstruction = *keywordlists[0];
|
||||||
|
WordList &mathInstruction = *keywordlists[1];
|
||||||
|
WordList ®isters = *keywordlists[2];
|
||||||
|
WordList &directive = *keywordlists[3];
|
||||||
|
WordList &directiveOperand = *keywordlists[4];
|
||||||
|
|
||||||
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
|
for (; sc.More(); sc.Forward())
|
||||||
|
{
|
||||||
|
// Handle line continuation generically.
|
||||||
|
if (sc.ch == '\\') {
|
||||||
|
if (sc.Match("\\\n")) {
|
||||||
|
sc.Forward();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (sc.Match("\\\r\n")) {
|
||||||
|
sc.Forward();
|
||||||
|
sc.Forward();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if the current state should terminate.
|
||||||
|
if (sc.state == SCE_ASM_OPERATOR) {
|
||||||
|
sc.SetState(SCE_ASM_DEFAULT);
|
||||||
|
}else if (sc.state == SCE_ASM_NUMBER) {
|
||||||
|
if (!IsAWordChar(sc.ch)) {
|
||||||
|
sc.SetState(SCE_ASM_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_ASM_IDENTIFIER) {
|
||||||
|
if (!IsAWordChar(sc.ch) ) {
|
||||||
|
char s[100];
|
||||||
|
sc.GetCurrentLowered(s, sizeof(s));
|
||||||
|
|
||||||
|
if (cpuInstruction.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_ASM_CPUINSTRUCTION);
|
||||||
|
} else if (mathInstruction.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_ASM_MATHINSTRUCTION);
|
||||||
|
} else if (registers.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_ASM_REGISTER);
|
||||||
|
} else if (directive.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_ASM_DIRECTIVE);
|
||||||
|
} else if (directiveOperand.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND);
|
||||||
|
}
|
||||||
|
sc.SetState(SCE_ASM_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sc.state == SCE_ASM_COMMENT ) {
|
||||||
|
if (sc.atLineEnd) {
|
||||||
|
sc.SetState(SCE_ASM_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_ASM_STRING) {
|
||||||
|
if (sc.ch == '\\') {
|
||||||
|
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
} else if (sc.ch == '\"') {
|
||||||
|
sc.ForwardSetState(SCE_ASM_DEFAULT);
|
||||||
|
} else if (sc.atLineEnd) {
|
||||||
|
sc.ForwardSetState(SCE_ASM_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if a new state should be entered.
|
||||||
|
else if (sc.state == SCE_ASM_DEFAULT) {
|
||||||
|
if (sc.ch == ';'){
|
||||||
|
sc.SetState(SCE_ASM_COMMENT);
|
||||||
|
} else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) {
|
||||||
|
sc.SetState(SCE_ASM_NUMBER);
|
||||||
|
} else if (IsAWordStart(sc.ch)) {
|
||||||
|
sc.SetState(SCE_ASM_IDENTIFIER);
|
||||||
|
} else if (sc.Match('\"')) {
|
||||||
|
sc.SetState(SCE_ASM_STRING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
sc.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm");
|
||||||
|
|
@@ -20,6 +20,9 @@
|
|||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
|
||||||
|
#define KEYWORD_BOXHEADER 1
|
||||||
|
#define KEYWORD_FOLDCONTRACTED 2
|
||||||
|
|
||||||
static bool IsOKBeforeRE(const int ch) {
|
static bool IsOKBeforeRE(const int ch) {
|
||||||
return (ch == '(') || (ch == '=') || (ch == ',');
|
return (ch == '(') || (ch == '=') || (ch == ',');
|
||||||
}
|
}
|
||||||
@@ -34,17 +37,17 @@ static inline bool IsAWordStart(const int ch) {
|
|||||||
|
|
||||||
static inline bool IsADoxygenChar(const int ch) {
|
static inline bool IsADoxygenChar(const int ch) {
|
||||||
return (islower(ch) || ch == '$' || ch == '@' ||
|
return (islower(ch) || ch == '$' || ch == '@' ||
|
||||||
ch == '\\' || ch == '&' || ch == '<' ||
|
ch == '\\' || ch == '&' || ch == '<' ||
|
||||||
ch == '>' || ch == '#' || ch == '{' ||
|
ch == '>' || ch == '#' || ch == '{' ||
|
||||||
ch == '}' || ch == '[' || ch == ']');
|
ch == '}' || ch == '[' || ch == ']');
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsStateComment(const int state) {
|
static inline bool IsStateComment(const int state) {
|
||||||
return ((state == SCE_C_COMMENT) ||
|
return ((state == SCE_C_COMMENT) ||
|
||||||
(state == SCE_C_COMMENTLINE) ||
|
(state == SCE_C_COMMENTLINE) ||
|
||||||
(state == SCE_C_COMMENTDOC) ||
|
(state == SCE_C_COMMENTDOC) ||
|
||||||
(state == SCE_C_COMMENTDOCKEYWORD) ||
|
(state == SCE_C_COMMENTDOCKEYWORD) ||
|
||||||
(state == SCE_C_COMMENTDOCKEYWORDERROR));
|
(state == SCE_C_COMMENTDOCKEYWORDERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsStateString(const int state) {
|
static inline bool IsStateString(const int state) {
|
||||||
@@ -52,7 +55,7 @@ static inline bool IsStateString(const int state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
Accessor &styler) {
|
Accessor &styler, bool caseSensitive) {
|
||||||
|
|
||||||
WordList &keywords = *keywordlists[0];
|
WordList &keywords = *keywordlists[0];
|
||||||
WordList &keywords2 = *keywordlists[1];
|
WordList &keywords2 = *keywordlists[1];
|
||||||
@@ -98,7 +101,11 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
|
|||||||
} else if (sc.state == SCE_C_IDENTIFIER) {
|
} else if (sc.state == SCE_C_IDENTIFIER) {
|
||||||
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
||||||
char s[100];
|
char s[100];
|
||||||
sc.GetCurrent(s, sizeof(s));
|
if (caseSensitive) {
|
||||||
|
sc.GetCurrent(s, sizeof(s));
|
||||||
|
} else {
|
||||||
|
sc.GetCurrentLowered(s, sizeof(s));
|
||||||
|
}
|
||||||
if (keywords.InList(s)) {
|
if (keywords.InList(s)) {
|
||||||
lastWordWasUUID = strcmp(s, "uuid") == 0;
|
lastWordWasUUID = strcmp(s, "uuid") == 0;
|
||||||
sc.ChangeState(SCE_C_WORD);
|
sc.ChangeState(SCE_C_WORD);
|
||||||
@@ -141,8 +148,12 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
|
|||||||
sc.ForwardSetState(SCE_C_DEFAULT);
|
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||||
} else if (!IsADoxygenChar(sc.ch)) {
|
} else if (!IsADoxygenChar(sc.ch)) {
|
||||||
char s[100];
|
char s[100];
|
||||||
sc.GetCurrent(s, sizeof(s));
|
if (caseSensitive) {
|
||||||
if (!isspace(sc.ch) || !keywords3.InList(s+1)) {
|
sc.GetCurrent(s, sizeof(s));
|
||||||
|
} else {
|
||||||
|
sc.GetCurrentLowered(s, sizeof(s));
|
||||||
|
}
|
||||||
|
if (!isspace(sc.ch) || !keywords3.InList(s + 1)) {
|
||||||
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
|
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
|
||||||
}
|
}
|
||||||
sc.SetState(SCE_C_COMMENTDOC);
|
sc.SetState(SCE_C_COMMENTDOC);
|
||||||
@@ -237,7 +248,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
|
|||||||
// Skip whitespace between # and preprocessor word
|
// Skip whitespace between # and preprocessor word
|
||||||
do {
|
do {
|
||||||
sc.Forward();
|
sc.Forward();
|
||||||
} while ((sc.ch == ' ') && (sc.ch == '\t') && sc.More());
|
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
|
||||||
if (sc.atLineEnd) {
|
if (sc.atLineEnd) {
|
||||||
sc.SetState(SCE_C_DEFAULT);
|
sc.SetState(SCE_C_DEFAULT);
|
||||||
}
|
}
|
||||||
@@ -263,12 +274,233 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
|
|||||||
|
|
||||||
static bool IsStreamCommentStyle(int style) {
|
static bool IsStreamCommentStyle(int style) {
|
||||||
return style == SCE_C_COMMENT ||
|
return style == SCE_C_COMMENT ||
|
||||||
style == SCE_C_COMMENTDOC ||
|
style == SCE_C_COMMENTDOC ||
|
||||||
style == SCE_C_COMMENTDOCKEYWORD ||
|
style == SCE_C_COMMENTDOCKEYWORD ||
|
||||||
style == SCE_C_COMMENTDOCKEYWORDERROR;
|
style == SCE_C_COMMENTDOCKEYWORDERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
static bool matchKeyword(unsigned int start, WordList &keywords, Accessor &styler, int keywordtype) {
|
||||||
|
bool FoundKeyword = false;
|
||||||
|
|
||||||
|
for (unsigned int i = 0;
|
||||||
|
strlen(keywords[i]) > 0 && !FoundKeyword;
|
||||||
|
i++) {
|
||||||
|
if (atoi(keywords[i]) == keywordtype) {
|
||||||
|
FoundKeyword = styler.Match(start, ((char *)keywords[i]) + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FoundKeyword;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool IsCommentLine(int line, Accessor &styler) {
|
||||||
|
unsigned int Pos = styler.LineStart(line);
|
||||||
|
while (styler.GetLine(Pos) == line) {
|
||||||
|
int PosStyle = styler.StyleAt(Pos);
|
||||||
|
|
||||||
|
if ( !IsStreamCommentStyle(PosStyle)
|
||||||
|
&&
|
||||||
|
PosStyle != SCE_C_COMMENTLINEDOC
|
||||||
|
&&
|
||||||
|
PosStyle != SCE_C_COMMENTLINE
|
||||||
|
&&
|
||||||
|
!IsASpace(styler.SafeGetCharAt(Pos))
|
||||||
|
)
|
||||||
|
return false;
|
||||||
|
Pos++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FoldBoxCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
|
Accessor &styler) {
|
||||||
|
|
||||||
|
WordList &keywords4 = *keywordlists[3];
|
||||||
|
|
||||||
|
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||||
|
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
|
||||||
|
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||||
|
bool firstLine = true;
|
||||||
|
unsigned int endPos = startPos + length;
|
||||||
|
int visibleChars = 0;
|
||||||
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
|
int levelCurrent = levelPrev;
|
||||||
|
int levelPrevPrev;
|
||||||
|
int levelFlags = 0;
|
||||||
|
int levelUnindent = 0;
|
||||||
|
char chNext = styler[startPos];
|
||||||
|
int styleNext = styler.StyleAt(startPos);
|
||||||
|
int style = initStyle;
|
||||||
|
|
||||||
|
if (lineCurrent == 0) {
|
||||||
|
levelPrevPrev = levelPrev;
|
||||||
|
} else {
|
||||||
|
levelPrevPrev = styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = startPos; i < endPos; i++) {
|
||||||
|
char ch = chNext;
|
||||||
|
chNext = styler.SafeGetCharAt(i + 1);
|
||||||
|
int stylePrev = style;
|
||||||
|
style = styleNext;
|
||||||
|
styleNext = styler.StyleAt(i + 1);
|
||||||
|
|
||||||
|
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||||
|
|
||||||
|
if (foldComment && IsStreamCommentStyle(style)) {
|
||||||
|
if (!IsStreamCommentStyle(stylePrev)) {
|
||||||
|
levelCurrent++;
|
||||||
|
} 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
|
||||||
|
||
|
||||||
|
style == SCE_C_COMMENT
|
||||||
|
||
|
||||||
|
style == SCE_C_COMMENTLINE) {
|
||||||
|
|
||||||
|
if (ch == '{') {
|
||||||
|
levelCurrent++;
|
||||||
|
// Special handling if line has closing brace followed by opening brace.
|
||||||
|
if (levelCurrent == levelPrev) {
|
||||||
|
if (firstLine)
|
||||||
|
levelUnindent = 1;
|
||||||
|
else
|
||||||
|
levelUnindent = -1;
|
||||||
|
}
|
||||||
|
} else if (ch == '}') {
|
||||||
|
levelCurrent--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for fold header keyword at beginning of word */
|
||||||
|
if ((style == SCE_C_WORD || style == SCE_C_COMMENT || style == SCE_C_COMMENTLINE)
|
||||||
|
&&
|
||||||
|
(style != stylePrev)) {
|
||||||
|
if (matchKeyword(i, keywords4, styler, KEYWORD_BOXHEADER)) {
|
||||||
|
int line;
|
||||||
|
/* Loop backwards all empty or comment lines */
|
||||||
|
for (line = lineCurrent - 1;
|
||||||
|
line >= 0
|
||||||
|
&&
|
||||||
|
levelCurrent == (styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK)
|
||||||
|
&&
|
||||||
|
(styler.LevelAt(line) & SC_FOLDLEVELBOXFOOTERFLAG) == 0
|
||||||
|
&&
|
||||||
|
IsCommentLine(line, styler);
|
||||||
|
line--) {
|
||||||
|
/* just loop backwards */;
|
||||||
|
}
|
||||||
|
|
||||||
|
line++;
|
||||||
|
/* Set Box header flag (if the previous line has no footer line) */
|
||||||
|
if ((styler.LevelAt(line) & SC_FOLDLEVELBOXFOOTERFLAG) == 0) {
|
||||||
|
if (line == lineCurrent) {
|
||||||
|
/* in current line */
|
||||||
|
levelFlags |= SC_FOLDLEVELBOXHEADERFLAG;
|
||||||
|
} else {
|
||||||
|
/* at top of all preceding comment lines */
|
||||||
|
styler.SetLevel(line, styler.LevelAt(line)
|
||||||
|
| SC_FOLDLEVELBOXHEADERFLAG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matchKeyword(i, keywords4, styler, KEYWORD_FOLDCONTRACTED)) {
|
||||||
|
levelFlags |= SC_FOLDLEVELCONTRACTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (atEOL) {
|
||||||
|
int lev;
|
||||||
|
// Compute level correction for special case: '} else {'
|
||||||
|
if (levelUnindent < 0) {
|
||||||
|
levelPrev += levelUnindent;
|
||||||
|
} else {
|
||||||
|
levelCurrent += levelUnindent;
|
||||||
|
}
|
||||||
|
|
||||||
|
lev = levelPrev;
|
||||||
|
if (visibleChars == 0 && foldCompact)
|
||||||
|
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||||
|
// Produce additional footer line (e.g. after closed if)
|
||||||
|
if (visibleChars == 0
|
||||||
|
&&
|
||||||
|
(levelPrev < levelPrevPrev))
|
||||||
|
lev |= SC_FOLDLEVELBOXFOOTERFLAG;
|
||||||
|
// Produce footer line at line before (special handling for '} else {'
|
||||||
|
if (levelPrev < levelPrevPrev) {
|
||||||
|
styler.SetLevel(lineCurrent - 1,
|
||||||
|
styler.LevelAt(lineCurrent - 1) | SC_FOLDLEVELBOXFOOTERFLAG);
|
||||||
|
}
|
||||||
|
// Mark the fold header (the line that is always visible)
|
||||||
|
if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
||||||
|
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||||
|
// Show a footer line at end of fold
|
||||||
|
if (levelCurrent < levelPrev)
|
||||||
|
lev |= SC_FOLDLEVELBOXFOOTERFLAG;
|
||||||
|
/* Show a footer line at the end of each procedure (level == SC_FOLDLEVELBASE) */
|
||||||
|
if ((levelPrev == SC_FOLDLEVELBASE)
|
||||||
|
&&
|
||||||
|
(levelPrevPrev > SC_FOLDLEVELBASE)
|
||||||
|
&&
|
||||||
|
(visibleChars == 0)) {
|
||||||
|
lev |= SC_FOLDLEVELBOXFOOTERFLAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
lev |= levelFlags;
|
||||||
|
if (lev != styler.LevelAt(lineCurrent)) {
|
||||||
|
styler.SetLevel(lineCurrent, lev);
|
||||||
|
}
|
||||||
|
|
||||||
|
lineCurrent++;
|
||||||
|
levelPrevPrev = levelPrev;
|
||||||
|
levelPrev = levelCurrent;
|
||||||
|
levelUnindent = 0;
|
||||||
|
visibleChars = 0;
|
||||||
|
levelFlags = 0;
|
||||||
|
firstLine = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isspacechar(ch))
|
||||||
|
visibleChars++;
|
||||||
|
}
|
||||||
|
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||||
|
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||||
|
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FoldNoBoxCppDoc(unsigned int startPos, int length, int initStyle,
|
||||||
Accessor &styler) {
|
Accessor &styler) {
|
||||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||||
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
|
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
|
||||||
@@ -308,8 +540,8 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis
|
|||||||
}
|
}
|
||||||
if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
|
if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
|
||||||
if (ch == '#') {
|
if (ch == '#') {
|
||||||
unsigned int j=i+1;
|
unsigned int j = i + 1;
|
||||||
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if (styler.Match(j, "region") || styler.Match(j, "if")) {
|
if (styler.Match(j, "region") || styler.Match(j, "if")) {
|
||||||
@@ -347,12 +579,37 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis
|
|||||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const cppWordLists[] = {
|
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
"Primary keywords and identifiers",
|
Accessor &styler) {
|
||||||
"Secondary keywords and identifiers",
|
|
||||||
"Documentation comment keywords",
|
|
||||||
0,
|
|
||||||
};
|
|
||||||
|
|
||||||
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc, cppWordLists);
|
int foldFlags = styler.GetPropertyInt("fold.flags") ;
|
||||||
LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc, cppWordLists);
|
bool foldBox = ((foldFlags & SC_FOLDFLAG_BOX) == SC_FOLDFLAG_BOX);
|
||||||
|
|
||||||
|
if (foldBox) {
|
||||||
|
FoldBoxCppDoc(startPos, length, initStyle, keywordlists, styler);
|
||||||
|
} else {
|
||||||
|
FoldNoBoxCppDoc(startPos, length, initStyle, styler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char * const cppWordLists[] = {
|
||||||
|
"Primary keywords and identifiers",
|
||||||
|
"Secondary keywords and identifiers",
|
||||||
|
"Documentation comment keywords",
|
||||||
|
"Fold header keywords",
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void ColouriseCppDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
|
Accessor &styler) {
|
||||||
|
ColouriseCppDoc(startPos, length, initStyle, keywordlists, styler, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseCppDocInsensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
|
Accessor &styler) {
|
||||||
|
ColouriseCppDoc(startPos, length, initStyle, keywordlists, styler, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDocSensitive, "cpp", FoldCppDoc, cppWordLists);
|
||||||
|
LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, ColouriseCppDocInsensitive, "cppnocase", FoldCppDoc, cppWordLists);
|
||||||
|
LexerModule lmTCL(SCLEX_TCL, ColouriseCppDocSensitive, "tcl", FoldCppDoc, cppWordLists);
|
||||||
|
246
contrib/src/stc/scintilla/src/LexCSS.cxx
Normal file
246
contrib/src/stc/scintilla/src/LexCSS.cxx
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file LexCSS.cxx
|
||||||
|
** Lexer for Cascade Style Sheets
|
||||||
|
** Written by Jakub Vr<56>na
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "PropSet.h"
|
||||||
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
|
#include "KeyWords.h"
|
||||||
|
#include "Scintilla.h"
|
||||||
|
#include "SciLexer.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static inline bool IsAWordChar(const unsigned int ch) {
|
||||||
|
return (isalnum(ch) || ch == '-' || ch >= 161);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsCssOperator(const char ch) {
|
||||||
|
if (!isalnum(ch) && (ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' || ch == '.' || ch == '#' || ch == '!' || ch == '@'))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||||
|
WordList &keywords = *keywordlists[0];
|
||||||
|
WordList &pseudoClasses = *keywordlists[1];
|
||||||
|
|
||||||
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
|
|
||||||
|
int lastState = -1; // before operator
|
||||||
|
int lastStateC = -1; // before comment
|
||||||
|
int op = ' '; // last operator
|
||||||
|
|
||||||
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
if (sc.state == SCE_CSS_COMMENT && sc.Match('*', '/')) {
|
||||||
|
if (lastStateC == -1) {
|
||||||
|
// backtrack to get last state
|
||||||
|
unsigned int i = startPos;
|
||||||
|
for (; i > 0; i--) {
|
||||||
|
if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) {
|
||||||
|
if (lastStateC == SCE_CSS_OPERATOR) {
|
||||||
|
op = styler.SafeGetCharAt(i-1);
|
||||||
|
while (--i) {
|
||||||
|
lastState = styler.StyleAt(i-1);
|
||||||
|
if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == 0)
|
||||||
|
lastState = SCE_CSS_DEFAULT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == 0)
|
||||||
|
lastStateC = SCE_CSS_DEFAULT;
|
||||||
|
}
|
||||||
|
sc.Forward();
|
||||||
|
sc.ForwardSetState(lastStateC);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sc.state == SCE_CSS_COMMENT)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (sc.state == SCE_CSS_OPERATOR) {
|
||||||
|
if (op == ' ') {
|
||||||
|
unsigned int i = startPos;
|
||||||
|
op = styler.SafeGetCharAt(i-1);
|
||||||
|
while (--i) {
|
||||||
|
lastState = styler.StyleAt(i-1);
|
||||||
|
if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (op) {
|
||||||
|
case '@':
|
||||||
|
if (lastState == SCE_CSS_DEFAULT)
|
||||||
|
sc.SetState(SCE_CSS_DIRECTIVE);
|
||||||
|
break;
|
||||||
|
case '{':
|
||||||
|
if (lastState == SCE_CSS_DIRECTIVE)
|
||||||
|
sc.SetState(SCE_CSS_DEFAULT);
|
||||||
|
else if (lastState == SCE_CSS_TAG)
|
||||||
|
sc.SetState(SCE_CSS_IDENTIFIER);
|
||||||
|
break;
|
||||||
|
case '}':
|
||||||
|
if (lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT || lastState == SCE_CSS_IDENTIFIER)
|
||||||
|
sc.SetState(SCE_CSS_DEFAULT);
|
||||||
|
break;
|
||||||
|
case ':':
|
||||||
|
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID)
|
||||||
|
sc.SetState(SCE_CSS_PSEUDOCLASS);
|
||||||
|
else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_UNKNOWN_IDENTIFIER)
|
||||||
|
sc.SetState(SCE_CSS_VALUE);
|
||||||
|
break;
|
||||||
|
case '.':
|
||||||
|
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT)
|
||||||
|
sc.SetState(SCE_CSS_CLASS);
|
||||||
|
break;
|
||||||
|
case '#':
|
||||||
|
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT)
|
||||||
|
sc.SetState(SCE_CSS_ID);
|
||||||
|
break;
|
||||||
|
case ',':
|
||||||
|
if (lastState == SCE_CSS_TAG)
|
||||||
|
sc.SetState(SCE_CSS_DEFAULT);
|
||||||
|
break;
|
||||||
|
case ';':
|
||||||
|
if (lastState == SCE_CSS_DIRECTIVE)
|
||||||
|
sc.SetState(SCE_CSS_DEFAULT);
|
||||||
|
else if (lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT)
|
||||||
|
sc.SetState(SCE_CSS_IDENTIFIER);
|
||||||
|
break;
|
||||||
|
case '!':
|
||||||
|
if (lastState == SCE_CSS_VALUE)
|
||||||
|
sc.SetState(SCE_CSS_IMPORTANT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsAWordChar(sc.ch)) {
|
||||||
|
if (sc.state == SCE_CSS_DEFAULT)
|
||||||
|
sc.SetState(SCE_CSS_TAG);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsAWordChar(sc.chPrev) && (
|
||||||
|
sc.state == SCE_CSS_IDENTIFIER || sc.state == SCE_CSS_UNKNOWN_IDENTIFIER
|
||||||
|
|| sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS
|
||||||
|
|| sc.state == SCE_CSS_IMPORTANT
|
||||||
|
)) {
|
||||||
|
char s[100];
|
||||||
|
sc.GetCurrentLowered(s, sizeof(s));
|
||||||
|
char *s2 = s;
|
||||||
|
while (*s2 && !IsAWordChar(*s2))
|
||||||
|
s2++;
|
||||||
|
switch (sc.state) {
|
||||||
|
case SCE_CSS_IDENTIFIER:
|
||||||
|
if (!keywords.InList(s2))
|
||||||
|
sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER);
|
||||||
|
break;
|
||||||
|
case SCE_CSS_UNKNOWN_IDENTIFIER:
|
||||||
|
if (keywords.InList(s2))
|
||||||
|
sc.ChangeState(SCE_CSS_IDENTIFIER);
|
||||||
|
break;
|
||||||
|
case SCE_CSS_PSEUDOCLASS:
|
||||||
|
if (!pseudoClasses.InList(s2))
|
||||||
|
sc.ChangeState(SCE_CSS_UNKNOWN_PSEUDOCLASS);
|
||||||
|
break;
|
||||||
|
case SCE_CSS_UNKNOWN_PSEUDOCLASS:
|
||||||
|
if (pseudoClasses.InList(s2))
|
||||||
|
sc.ChangeState(SCE_CSS_PSEUDOCLASS);
|
||||||
|
break;
|
||||||
|
case SCE_CSS_IMPORTANT:
|
||||||
|
if (strcmp(s2, "important") != 0)
|
||||||
|
sc.ChangeState(SCE_CSS_VALUE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && (sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_ID))
|
||||||
|
sc.SetState(SCE_CSS_TAG);
|
||||||
|
|
||||||
|
if (sc.Match('/', '*')) {
|
||||||
|
lastStateC = sc.state;
|
||||||
|
sc.SetState(SCE_CSS_COMMENT);
|
||||||
|
sc.Forward();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsCssOperator(static_cast<char>(sc.ch))
|
||||||
|
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
|
||||||
|
&& (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{')
|
||||||
|
) {
|
||||||
|
if (sc.state != SCE_CSS_OPERATOR)
|
||||||
|
lastState = sc.state;
|
||||||
|
sc.SetState(SCE_CSS_OPERATOR);
|
||||||
|
op = sc.ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sc.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||||
|
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||||
|
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||||
|
unsigned int endPos = startPos + length;
|
||||||
|
int visibleChars = 0;
|
||||||
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
|
int levelCurrent = levelPrev;
|
||||||
|
char chNext = styler[startPos];
|
||||||
|
bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT);
|
||||||
|
for (unsigned int i = startPos; i < endPos; i++) {
|
||||||
|
char ch = chNext;
|
||||||
|
chNext = styler.SafeGetCharAt(i + 1);
|
||||||
|
int style = styler.StyleAt(i);
|
||||||
|
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||||
|
if (foldComment) {
|
||||||
|
if (!inComment && (style == SCE_CSS_COMMENT))
|
||||||
|
levelCurrent++;
|
||||||
|
else if (inComment && (style != SCE_CSS_COMMENT))
|
||||||
|
levelCurrent--;
|
||||||
|
inComment = (style == SCE_CSS_COMMENT);
|
||||||
|
}
|
||||||
|
if (style == SCE_CSS_OPERATOR) {
|
||||||
|
if (ch == '{') {
|
||||||
|
levelCurrent++;
|
||||||
|
} else if (ch == '}') {
|
||||||
|
levelCurrent--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (atEOL) {
|
||||||
|
int lev = levelPrev;
|
||||||
|
if (visibleChars == 0 && foldCompact)
|
||||||
|
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||||
|
if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
||||||
|
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||||
|
if (lev != styler.LevelAt(lineCurrent)) {
|
||||||
|
styler.SetLevel(lineCurrent, lev);
|
||||||
|
}
|
||||||
|
lineCurrent++;
|
||||||
|
levelPrev = levelCurrent;
|
||||||
|
visibleChars = 0;
|
||||||
|
}
|
||||||
|
if (!isspacechar(ch))
|
||||||
|
visibleChars++;
|
||||||
|
}
|
||||||
|
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||||
|
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||||
|
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||||
|
}
|
||||||
|
|
||||||
|
LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc);
|
310
contrib/src/stc/scintilla/src/LexFortran.cxx
Normal file
310
contrib/src/stc/scintilla/src/LexFortran.cxx
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file LexFortran.cxx
|
||||||
|
** Lexer for Fortran.
|
||||||
|
** Writen by Chuan-jian Shen, Last changed Nov. 2002
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "PropSet.h"
|
||||||
|
#include "Accessor.h"
|
||||||
|
#include "StyleContext.h"
|
||||||
|
#include "KeyWords.h"
|
||||||
|
#include "Scintilla.h"
|
||||||
|
#include "SciLexer.h"
|
||||||
|
|
||||||
|
static inline bool IsAWordChar(const int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsAWordStart(const int ch) {
|
||||||
|
return (ch < 0x80) && (isalnum(ch));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsABlank(unsigned int ch) {
|
||||||
|
return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
|
||||||
|
}
|
||||||
|
static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
|
Accessor &styler, bool isFixFormat) {
|
||||||
|
|
||||||
|
WordList &keywords = *keywordlists[0];
|
||||||
|
WordList &keywords2 = *keywordlists[1];
|
||||||
|
WordList &keywords3 = *keywordlists[2];
|
||||||
|
|
||||||
|
int posLineStart = 0, prevState = 0;
|
||||||
|
int endPos = startPos + length;
|
||||||
|
|
||||||
|
// backtrack to the beginning of the document, this may be slow for big documents.
|
||||||
|
// initStyle = SCE_F_DEFAULT;
|
||||||
|
// StyleContext sc(0, startPos+length, initStyle, styler);
|
||||||
|
|
||||||
|
// backtrack to the nearest keyword
|
||||||
|
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) {
|
||||||
|
startPos--;
|
||||||
|
}
|
||||||
|
startPos = styler.LineStart(styler.GetLine(startPos));
|
||||||
|
initStyle = styler.StyleAt(startPos - 1);
|
||||||
|
StyleContext sc(startPos, endPos-startPos, initStyle, styler);
|
||||||
|
|
||||||
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
|
||||||
|
// remember the position of the line
|
||||||
|
if (sc.atLineStart) {
|
||||||
|
posLineStart = sc.currentPos;
|
||||||
|
sc.SetState(SCE_F_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle line continuation generically.
|
||||||
|
if (sc.ch == '&') {
|
||||||
|
char chTemp = ' ';
|
||||||
|
int j = 1;
|
||||||
|
while (IsABlank(chTemp) && j<132) {
|
||||||
|
chTemp = static_cast<char>(sc.GetRelative(j));
|
||||||
|
j ++;
|
||||||
|
}
|
||||||
|
if (chTemp == '!') {
|
||||||
|
sc.SetState(SCE_F_CONTINUATION);
|
||||||
|
if (sc.chNext == '!') sc.ForwardSetState(SCE_F_COMMENT);
|
||||||
|
} else if (chTemp == '\r' || chTemp == '\n') {
|
||||||
|
int currentState = sc.state;
|
||||||
|
sc.SetState(SCE_F_CONTINUATION);
|
||||||
|
if (currentState == SCE_F_STRING1 || currentState == SCE_F_STRING2) {
|
||||||
|
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||||
|
while (IsASpace(sc.ch) && sc.More()) sc.Forward();
|
||||||
|
if (sc.ch == '&') {
|
||||||
|
sc.SetState(SCE_F_CONTINUATION);
|
||||||
|
sc.Forward();
|
||||||
|
}
|
||||||
|
sc.SetState(currentState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if the current state should terminate.
|
||||||
|
if (sc.state == SCE_F_OPERATOR) {
|
||||||
|
sc.SetState(SCE_F_DEFAULT);
|
||||||
|
} else if (sc.state == SCE_F_NUMBER) {
|
||||||
|
if (!IsAWordChar(sc.ch)) {
|
||||||
|
sc.SetState(SCE_F_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_F_IDENTIFIER) {
|
||||||
|
if (!IsAWordChar(sc.ch) || (sc.ch == '%')) {
|
||||||
|
char s[100];
|
||||||
|
sc.GetCurrentLowered(s, sizeof(s));
|
||||||
|
if (keywords.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_F_WORD);
|
||||||
|
} else if (keywords2.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_F_WORD2);
|
||||||
|
} else if (keywords3.InList(s)) {
|
||||||
|
sc.ChangeState(SCE_F_WORD3);
|
||||||
|
}
|
||||||
|
sc.SetState(SCE_F_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_F_COMMENT) {
|
||||||
|
if (sc.ch == '\r' || sc.ch == '\n') {
|
||||||
|
sc.SetState(SCE_F_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_F_STRING1) {
|
||||||
|
prevState = sc.state;
|
||||||
|
if (sc.ch == '\'') {
|
||||||
|
if (sc.chNext == '\'') {
|
||||||
|
sc.Forward();
|
||||||
|
} else {
|
||||||
|
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||||
|
prevState = SCE_F_DEFAULT;
|
||||||
|
}
|
||||||
|
} else if (sc.atLineEnd) {
|
||||||
|
if (isFixFormat) {
|
||||||
|
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||||
|
posLineStart = sc.currentPos;
|
||||||
|
} else {
|
||||||
|
sc.ChangeState(SCE_F_STRINGEOL);
|
||||||
|
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_F_STRING2) {
|
||||||
|
prevState = sc.state;
|
||||||
|
if (sc.atLineEnd) {
|
||||||
|
if (isFixFormat) {
|
||||||
|
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||||
|
posLineStart = sc.currentPos;
|
||||||
|
} else {
|
||||||
|
sc.ChangeState(SCE_F_STRINGEOL);
|
||||||
|
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.ch == '\"') {
|
||||||
|
if (sc.chNext == '\"') {
|
||||||
|
sc.Forward();
|
||||||
|
} else {
|
||||||
|
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||||
|
prevState = SCE_F_DEFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_F_OPERATOR2) {
|
||||||
|
if (sc.ch == '.') {
|
||||||
|
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (sc.state == SCE_F_CONTINUATION) {
|
||||||
|
sc.SetState(SCE_F_DEFAULT);
|
||||||
|
} else if (sc.state == SCE_F_LABEL) {
|
||||||
|
if (sc.currentPos >= static_cast<unsigned int>(posLineStart+5)) {
|
||||||
|
sc.SetState(SCE_F_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if a new state should be entered.
|
||||||
|
if (sc.state == SCE_F_DEFAULT) {
|
||||||
|
int toLineStart = sc.currentPos - posLineStart;
|
||||||
|
if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) {
|
||||||
|
if (sc.atLineStart && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') {
|
||||||
|
sc.SetState(SCE_F_COMMENT);
|
||||||
|
} else if (toLineStart > 72) {
|
||||||
|
sc.SetState(SCE_F_COMMENT);
|
||||||
|
} else if (toLineStart < 5 && !IsASpace(sc.ch)) {
|
||||||
|
sc.SetState(SCE_F_LABEL);
|
||||||
|
} else if (toLineStart == 5 && (!IsASpace(sc.ch) && sc.ch != '0')) {
|
||||||
|
sc.SetState(SCE_F_CONTINUATION);
|
||||||
|
sc.ForwardSetState(prevState);
|
||||||
|
}
|
||||||
|
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||||
|
sc.SetState(SCE_F_NUMBER);
|
||||||
|
} else if (sc.ch == '.' && isalpha(sc.chNext)) {
|
||||||
|
sc.SetState(SCE_F_OPERATOR2);
|
||||||
|
} else if (IsAWordStart(sc.ch)) {
|
||||||
|
sc.SetState(SCE_F_IDENTIFIER);
|
||||||
|
} else if (sc.ch == '!') {
|
||||||
|
sc.SetState(SCE_F_COMMENT);
|
||||||
|
} else if (sc.ch == '\"') {
|
||||||
|
sc.SetState(SCE_F_STRING2);
|
||||||
|
} else if (sc.ch == '\'') {
|
||||||
|
sc.SetState(SCE_F_STRING1);
|
||||||
|
} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||||
|
sc.SetState(SCE_F_OPERATOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sc.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// The folding depends on the mercy of the programer.
|
||||||
|
static int classifyFoldPointFortran(const char* s, const char* prevWord) {
|
||||||
|
int lev = 0;
|
||||||
|
if (strcmp(prevWord, "end") == 0) return lev;
|
||||||
|
if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0)
|
||||||
|
return -1;
|
||||||
|
if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0
|
||||||
|
|| strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0
|
||||||
|
|| strcmp(s, "do") == 0 || strcmp(s, "enum") ==0
|
||||||
|
|| strcmp(s, "forall") == 0 || strcmp(s, "function") == 0
|
||||||
|
|| strcmp(s, "interface") == 0 || strcmp(s, "module") == 0
|
||||||
|
|| strcmp(s, "program") == 0 || strcmp(s, "subroutine") == 0
|
||||||
|
|| strcmp(s, "then") == 0 || strcmp(s, "where") == 0) {
|
||||||
|
lev = 1;
|
||||||
|
} else if (strcmp(s, "end") == 0 || strcmp(s, "continue") == 0
|
||||||
|
|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
|
||||||
|
|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
|
||||||
|
|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0
|
||||||
|
|| strcmp(s, "endif") == 0
|
||||||
|
|| strcmp(s, "endforall") == 0 || strcmp(s, "endfunction") == 0
|
||||||
|
|| strcmp(s, "endinterface") == 0 || strcmp(s, "endmodule") == 0
|
||||||
|
|| strcmp(s, "endprogram") == 0 || strcmp(s, "endsubroutine") == 0
|
||||||
|
|| strcmp(s, "endwhere") == 0 || strcmp(s, "procedure") == 0 ) {
|
||||||
|
lev = -1;
|
||||||
|
}
|
||||||
|
return lev;
|
||||||
|
}
|
||||||
|
static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
|
||||||
|
//~ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||||
|
// Do not know how to fold the comment at the moment.
|
||||||
|
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||||
|
unsigned int endPos = startPos + length;
|
||||||
|
int visibleChars = 0;
|
||||||
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
|
int levelCurrent = levelPrev;
|
||||||
|
char chNext = styler[startPos];
|
||||||
|
int styleNext = styler.StyleAt(startPos);
|
||||||
|
int style = initStyle;
|
||||||
|
|
||||||
|
int lastStart = 0;
|
||||||
|
char prevWord[32] = "";
|
||||||
|
|
||||||
|
for (unsigned int i = startPos; i < endPos; i++) {
|
||||||
|
char ch = chNext;
|
||||||
|
chNext = styler.SafeGetCharAt(i + 1);
|
||||||
|
int stylePrev = style;
|
||||||
|
style = styleNext;
|
||||||
|
styleNext = styler.StyleAt(i + 1);
|
||||||
|
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||||
|
|
||||||
|
if (stylePrev == SCE_F_DEFAULT && style == SCE_F_WORD)
|
||||||
|
{
|
||||||
|
// Store last word start point.
|
||||||
|
lastStart = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (style == SCE_F_WORD) {
|
||||||
|
if(iswordchar(ch) && !iswordchar(chNext)) {
|
||||||
|
char s[32];
|
||||||
|
unsigned int j;
|
||||||
|
for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) {
|
||||||
|
s[j] = static_cast<char>(tolower(styler[lastStart + j]));
|
||||||
|
}
|
||||||
|
s[j] = '\0';
|
||||||
|
levelCurrent += classifyFoldPointFortran(s, prevWord);
|
||||||
|
strcpy(prevWord, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (atEOL) {
|
||||||
|
int lev = levelPrev;
|
||||||
|
if (visibleChars == 0 && foldCompact)
|
||||||
|
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||||
|
if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
||||||
|
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||||
|
if (lev != styler.LevelAt(lineCurrent)) {
|
||||||
|
styler.SetLevel(lineCurrent, lev);
|
||||||
|
}
|
||||||
|
lineCurrent++;
|
||||||
|
levelPrev = levelCurrent;
|
||||||
|
visibleChars = 0;
|
||||||
|
strcpy(prevWord, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isspacechar(ch))
|
||||||
|
visibleChars++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||||
|
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||||
|
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char * const FortranWordLists[] = {
|
||||||
|
"Primary keywords and identifiers",
|
||||||
|
"Intrinsic functions",
|
||||||
|
"Extended and user defined functions",
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
|
Accessor &styler) {
|
||||||
|
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||||
|
Accessor &styler) {
|
||||||
|
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDoc, FortranWordLists);
|
||||||
|
LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDoc, FortranWordLists);
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file LexHTML.cxx
|
/** @file LexHTML.cxx
|
||||||
** Lexer for HTML.
|
** Lexer for HTML.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -197,16 +197,30 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int classifyTagHTML(unsigned int start, unsigned int end,
|
static int classifyTagHTML(unsigned int start, unsigned int end,
|
||||||
WordList &keywords, Accessor &styler) {
|
WordList &keywords, Accessor &styler, bool &tagDontFold,
|
||||||
char s[30 + 1];
|
bool caseSensitive) {
|
||||||
|
char s[30 + 2];
|
||||||
// Copy after the '<'
|
// Copy after the '<'
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
|
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
|
||||||
char ch = styler[cPos];
|
char ch = styler[cPos];
|
||||||
if ((ch != '<') && (ch != '/'))
|
if ((ch != '<') && (ch != '/')) {
|
||||||
s[i++] = static_cast<char>(tolower(ch));
|
s[i++] = caseSensitive ? ch : static_cast<char>(tolower(ch));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//The following is only a quick hack, to see if this whole thing would work
|
||||||
|
//we first need the tagname with a trailing space...
|
||||||
|
s[i] = ' ';
|
||||||
|
s[i+1] = '\0';
|
||||||
|
|
||||||
|
//...to find it in the list of no-container-tags
|
||||||
|
// (There are many more. We will need a keywordlist in the property file for this)
|
||||||
|
tagDontFold = (NULL != strstr("meta link img area br hr input ",s));
|
||||||
|
|
||||||
|
//now we can remove the trailing space
|
||||||
s[i] = '\0';
|
s[i] = '\0';
|
||||||
|
|
||||||
bool isScript = false;
|
bool isScript = false;
|
||||||
char chAttr = SCE_H_TAGUNKNOWN;
|
char chAttr = SCE_H_TAGUNKNOWN;
|
||||||
if (s[0] == '!') {
|
if (s[0] == '!') {
|
||||||
@@ -368,6 +382,14 @@ static inline bool issgmlwordchar(char ch) {
|
|||||||
return isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[';
|
return isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool IsPhpWordStart(const unsigned char ch) {
|
||||||
|
return isalpha(ch) || (ch == '_') || (ch >= 0x7f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsPhpWordChar(char ch) {
|
||||||
|
return isdigit(ch) || IsPhpWordStart(ch);
|
||||||
|
}
|
||||||
|
|
||||||
static bool InTagState(int state) {
|
static bool InTagState(int state) {
|
||||||
return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN ||
|
return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN ||
|
||||||
state == SCE_H_SCRIPT ||
|
state == SCE_H_SCRIPT ||
|
||||||
@@ -433,6 +455,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
script_mode inScriptType = script_mode((lineState >> 0) & 0x03); // 2 bits of scripting mode
|
script_mode inScriptType = script_mode((lineState >> 0) & 0x03); // 2 bits of scripting mode
|
||||||
bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
|
bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
|
||||||
bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
|
bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
|
||||||
|
bool tagDontFold = false; //some HTML tags should not be folded
|
||||||
script_type aspScript = script_type((lineState >> 4) & 0x0F); // 4 bits of script name
|
script_type aspScript = script_type((lineState >> 4) & 0x0F); // 4 bits of script name
|
||||||
script_type clientScript = script_type((lineState >> 8) & 0x0F); // 4 bits of script name
|
script_type clientScript = script_type((lineState >> 8) & 0x0F); // 4 bits of script name
|
||||||
int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state
|
int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state
|
||||||
@@ -440,8 +463,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
script_type scriptLanguage = ScriptOfState(state);
|
script_type scriptLanguage = ScriptOfState(state);
|
||||||
|
|
||||||
const bool foldHTML = styler.GetPropertyInt("fold.html", 0) != 0;
|
const bool foldHTML = styler.GetPropertyInt("fold.html", 0) != 0;
|
||||||
const bool fold = foldHTML && styler.GetPropertyInt("fold");
|
const bool fold = foldHTML && styler.GetPropertyInt("fold", 0);
|
||||||
|
const bool foldHTMLPreprocessor = foldHTML && styler.GetPropertyInt("fold.html.preprocessor", 1);
|
||||||
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||||
|
const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0;
|
||||||
|
|
||||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
int levelCurrent = levelPrev;
|
int levelCurrent = levelPrev;
|
||||||
@@ -481,7 +506,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
case eScriptPHP:
|
case eScriptPHP:
|
||||||
//not currently supported case eScriptVBS:
|
//not currently supported case eScriptVBS:
|
||||||
|
|
||||||
if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC)) {
|
if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC) && (!isStringState(state))) {
|
||||||
|
//Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle);
|
||||||
|
//if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) {
|
||||||
if ((ch == '{') || (ch == '}')) {
|
if ((ch == '{') || (ch == '}')) {
|
||||||
levelCurrent += (ch == '{') ? 1 : -1;
|
levelCurrent += (ch == '{') ? 1 : -1;
|
||||||
}
|
}
|
||||||
@@ -600,9 +627,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
else
|
else
|
||||||
inScriptType = eNonHtmlPreProc;
|
inScriptType = eNonHtmlPreProc;
|
||||||
// fold whole script
|
// fold whole script
|
||||||
levelCurrent++;
|
if (foldHTMLPreprocessor){
|
||||||
if (scriptLanguage == eScriptXML)
|
levelCurrent++;
|
||||||
levelCurrent--; // no folding of the XML first tag (all XML-like tags in this case)
|
if (scriptLanguage == eScriptXML)
|
||||||
|
levelCurrent--; // no folding of the XML first tag (all XML-like tags in this case)
|
||||||
|
}
|
||||||
// should be better
|
// should be better
|
||||||
ch = styler.SafeGetCharAt(i);
|
ch = styler.SafeGetCharAt(i);
|
||||||
continue;
|
continue;
|
||||||
@@ -640,7 +669,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
scriptLanguage = eScriptVBS;
|
scriptLanguage = eScriptVBS;
|
||||||
styler.ColourTo(i, SCE_H_ASP);
|
styler.ColourTo(i, SCE_H_ASP);
|
||||||
// fold whole script
|
// fold whole script
|
||||||
levelCurrent++;
|
if (foldHTMLPreprocessor)
|
||||||
|
levelCurrent++;
|
||||||
// should be better
|
// should be better
|
||||||
ch = styler.SafeGetCharAt(i);
|
ch = styler.SafeGetCharAt(i);
|
||||||
continue;
|
continue;
|
||||||
@@ -665,8 +695,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_H_SGML_COMMAND; // wait for a pending command
|
state = SCE_H_SGML_COMMAND; // wait for a pending command
|
||||||
}
|
}
|
||||||
// fold whole tag (-- when closing the tag)
|
// fold whole tag (-- when closing the tag)
|
||||||
|
if (foldHTMLPreprocessor)
|
||||||
levelCurrent++;
|
levelCurrent++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -723,7 +753,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
inScriptType = eHtml;
|
inScriptType = eHtml;
|
||||||
scriptLanguage = eScriptNone;
|
scriptLanguage = eScriptNone;
|
||||||
// unfold all scripting languages
|
// unfold all scripting languages
|
||||||
levelCurrent--;
|
if (foldHTMLPreprocessor)
|
||||||
|
levelCurrent--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
@@ -904,7 +935,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
break;
|
break;
|
||||||
case SCE_H_TAGUNKNOWN:
|
case SCE_H_TAGUNKNOWN:
|
||||||
if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
|
if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
|
||||||
int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
|
int eClass = classifyTagHTML(styler.GetStartSegment(),
|
||||||
|
i - 1, keywords, styler, tagDontFold, caseSensitive);
|
||||||
if (eClass == SCE_H_SCRIPT) {
|
if (eClass == SCE_H_SCRIPT) {
|
||||||
if (!tagClosing) {
|
if (!tagClosing) {
|
||||||
inScriptType = eNonHtmlScript;
|
inScriptType = eNonHtmlScript;
|
||||||
@@ -923,10 +955,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
tagOpened = false;
|
tagOpened = false;
|
||||||
if (tagClosing) {
|
if (!tagDontFold){
|
||||||
levelCurrent--;
|
if (tagClosing) {
|
||||||
} else {
|
levelCurrent--;
|
||||||
levelCurrent++;
|
} else {
|
||||||
|
levelCurrent++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tagClosing = false;
|
tagClosing = false;
|
||||||
} else if (ch == '/' && chNext == '>') {
|
} else if (ch == '/' && chNext == '>') {
|
||||||
@@ -969,10 +1003,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
tagOpened = false;
|
tagOpened = false;
|
||||||
if (tagClosing)
|
if (!tagDontFold){
|
||||||
levelCurrent--;
|
if (tagClosing){
|
||||||
else
|
levelCurrent--;
|
||||||
levelCurrent++;
|
} else {
|
||||||
|
levelCurrent++;
|
||||||
|
}
|
||||||
|
}
|
||||||
tagClosing = false;
|
tagClosing = false;
|
||||||
} else if (ch == '=') {
|
} else if (ch == '=') {
|
||||||
styler.ColourTo(i, SCE_H_OTHER);
|
styler.ColourTo(i, SCE_H_OTHER);
|
||||||
@@ -992,10 +1029,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
tagOpened = false;
|
tagOpened = false;
|
||||||
if (tagClosing)
|
if (!tagDontFold){
|
||||||
levelCurrent--;
|
if (tagClosing){
|
||||||
else
|
levelCurrent--;
|
||||||
levelCurrent++;
|
} else {
|
||||||
|
levelCurrent++;
|
||||||
|
}
|
||||||
|
}
|
||||||
tagClosing = false;
|
tagClosing = false;
|
||||||
} else if (ch == '\"') {
|
} else if (ch == '\"') {
|
||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
@@ -1044,10 +1084,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
break;
|
break;
|
||||||
case SCE_H_VALUE:
|
case SCE_H_VALUE:
|
||||||
if (!ishtmlwordchar(ch)) {
|
if (!ishtmlwordchar(ch)) {
|
||||||
if (ch == '\"') {
|
if (ch == '\"' && chPrev == '=') {
|
||||||
// Should really test for being first character
|
// Should really test for being first character
|
||||||
state = SCE_H_DOUBLESTRING;
|
state = SCE_H_DOUBLESTRING;
|
||||||
} else if (ch == '\'') {
|
} else if (ch == '\'' && chPrev == '=') {
|
||||||
state = SCE_H_SINGLESTRING;
|
state = SCE_H_SINGLESTRING;
|
||||||
} else {
|
} else {
|
||||||
if (IsNumber(styler.GetStartSegment(), styler)) {
|
if (IsNumber(styler.GetStartSegment(), styler)) {
|
||||||
@@ -1063,10 +1103,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_H_DEFAULT;
|
state = SCE_H_DEFAULT;
|
||||||
}
|
}
|
||||||
tagOpened = false;
|
tagOpened = false;
|
||||||
if (tagClosing)
|
if (!tagDontFold){
|
||||||
levelCurrent--;
|
if (tagClosing){
|
||||||
else
|
levelCurrent--;
|
||||||
levelCurrent++;
|
} else {
|
||||||
|
levelCurrent++;
|
||||||
|
}
|
||||||
|
}
|
||||||
tagClosing = false;
|
tagClosing = false;
|
||||||
} else {
|
} else {
|
||||||
state = SCE_H_OTHER;
|
state = SCE_H_OTHER;
|
||||||
@@ -1397,7 +1440,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
break;
|
break;
|
||||||
///////////// start - PHP state handling
|
///////////// start - PHP state handling
|
||||||
case SCE_HPHP_WORD:
|
case SCE_HPHP_WORD:
|
||||||
if (!iswordstart(ch)) {
|
if (!iswordchar(ch)) {
|
||||||
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
|
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
|
||||||
if (ch == '/' && chNext == '*') {
|
if (ch == '/' && chNext == '*') {
|
||||||
i++;
|
i++;
|
||||||
@@ -1411,7 +1454,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_HPHP_HSTRING;
|
state = SCE_HPHP_HSTRING;
|
||||||
} else if (ch == '\'') {
|
} else if (ch == '\'') {
|
||||||
state = SCE_HPHP_SIMPLESTRING;
|
state = SCE_HPHP_SIMPLESTRING;
|
||||||
} else if (ch == '$') {
|
} else if (ch == '$' && IsPhpWordStart(chNext)) {
|
||||||
state = SCE_HPHP_VARIABLE;
|
state = SCE_HPHP_VARIABLE;
|
||||||
} else if (isoperator(ch)) {
|
} else if (isoperator(ch)) {
|
||||||
state = SCE_HPHP_OPERATOR;
|
state = SCE_HPHP_OPERATOR;
|
||||||
@@ -1430,7 +1473,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_HPHP_VARIABLE:
|
case SCE_HPHP_VARIABLE:
|
||||||
if (!iswordstart(ch)) {
|
if (!IsPhpWordChar(ch)) {
|
||||||
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
|
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
|
||||||
if (isoperator(ch))
|
if (isoperator(ch))
|
||||||
state = SCE_HPHP_OPERATOR;
|
state = SCE_HPHP_OPERATOR;
|
||||||
@@ -1454,7 +1497,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
if (ch == '\\') {
|
if (ch == '\\') {
|
||||||
// skip the next char
|
// skip the next char
|
||||||
i++;
|
i++;
|
||||||
} else if (ch == '$') {
|
} else if (ch == '$' && IsPhpWordStart(chNext)) {
|
||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
state = SCE_HPHP_HSTRING_VARIABLE;
|
state = SCE_HPHP_HSTRING_VARIABLE;
|
||||||
} else if (ch == '\"') {
|
} else if (ch == '\"') {
|
||||||
@@ -1472,7 +1515,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCE_HPHP_HSTRING_VARIABLE:
|
case SCE_HPHP_HSTRING_VARIABLE:
|
||||||
if (!iswordstart(ch)) {
|
if (!IsPhpWordChar(ch)) {
|
||||||
styler.ColourTo(i - 1, StateToPrint);
|
styler.ColourTo(i - 1, StateToPrint);
|
||||||
i--; // strange but it works
|
i--; // strange but it works
|
||||||
state = SCE_HPHP_HSTRING;
|
state = SCE_HPHP_HSTRING;
|
||||||
@@ -1497,7 +1540,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
state = SCE_HPHP_HSTRING;
|
state = SCE_HPHP_HSTRING;
|
||||||
} else if (ch == '\'') {
|
} else if (ch == '\'') {
|
||||||
state = SCE_HPHP_SIMPLESTRING;
|
state = SCE_HPHP_SIMPLESTRING;
|
||||||
} else if (ch == '$') {
|
} else if (ch == '$' && IsPhpWordStart(chNext)) {
|
||||||
state = SCE_HPHP_VARIABLE;
|
state = SCE_HPHP_VARIABLE;
|
||||||
} else if (isoperator(ch)) {
|
} else if (isoperator(ch)) {
|
||||||
state = SCE_HPHP_OPERATOR;
|
state = SCE_HPHP_OPERATOR;
|
||||||
@@ -1553,7 +1596,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
|||||||
}
|
}
|
||||||
|
|
||||||
StateToPrint = statePrintForState(state, inScriptType);
|
StateToPrint = statePrintForState(state, inScriptType);
|
||||||
styler.ColourTo(lengthDoc - 1, StateToPrint);
|
styler.ColourTo(lengthDoc - 1, StateToPrint);
|
||||||
|
|
||||||
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||||
if (fold) {
|
if (fold) {
|
||||||
@@ -1701,9 +1744,9 @@ static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) {
|
|||||||
sc.SetState(SCE_H_ENTITY);
|
sc.SetState(SCE_H_ENTITY);
|
||||||
}
|
}
|
||||||
} else if ((sc.state == SCE_H_OTHER) || (sc.state == SCE_H_VALUE)) {
|
} else if ((sc.state == SCE_H_OTHER) || (sc.state == SCE_H_VALUE)) {
|
||||||
if (sc.ch == '\"') {
|
if (sc.ch == '\"' && sc.chPrev == '=') {
|
||||||
sc.SetState(SCE_H_DOUBLESTRING);
|
sc.SetState(SCE_H_DOUBLESTRING);
|
||||||
} else if (sc.ch == '\'') {
|
} else if (sc.ch == '\'' && sc.chPrev == '=') {
|
||||||
sc.SetState(SCE_H_SINGLESTRING);
|
sc.SetState(SCE_H_SINGLESTRING);
|
||||||
} else if (IsADigit(sc.ch)) {
|
} else if (IsADigit(sc.ch)) {
|
||||||
sc.SetState(SCE_H_NUMBER);
|
sc.SetState(SCE_H_NUMBER);
|
||||||
@@ -1780,7 +1823,7 @@ static void ColourisePHPPiece(StyleContext &sc, WordList *keywordlists[]) {
|
|||||||
|
|
||||||
// Handle some PHP script
|
// Handle some PHP script
|
||||||
if (sc.state == SCE_HPHP_WORD) {
|
if (sc.state == SCE_HPHP_WORD) {
|
||||||
if (!IsAWordStart(sc.ch)) {
|
if (!IsPhpWordChar(static_cast<char>(sc.ch))) {
|
||||||
sc.SetState(SCE_HPHP_DEFAULT);
|
sc.SetState(SCE_HPHP_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (sc.state == SCE_HPHP_COMMENTLINE) {
|
} else if (sc.state == SCE_HPHP_COMMENTLINE) {
|
||||||
@@ -1802,7 +1845,7 @@ static void ColourisePHPPiece(StyleContext &sc, WordList *keywordlists[]) {
|
|||||||
sc.ForwardSetState(SCE_HPHP_DEFAULT);
|
sc.ForwardSetState(SCE_HPHP_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (sc.state == SCE_HPHP_VARIABLE) {
|
} else if (sc.state == SCE_HPHP_VARIABLE) {
|
||||||
if (!IsAWordStart(sc.ch)) {
|
if (!IsPhpWordChar(static_cast<char>(sc.ch))) {
|
||||||
sc.SetState(SCE_HPHP_DEFAULT);
|
sc.SetState(SCE_HPHP_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (sc.state == SCE_HPHP_OPERATOR) {
|
} else if (sc.state == SCE_HPHP_OPERATOR) {
|
||||||
@@ -1822,7 +1865,7 @@ static void ColourisePHPPiece(StyleContext &sc, WordList *keywordlists[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sc.state == SCE_HPHP_DEFAULT) {
|
if (sc.state == SCE_HPHP_DEFAULT) {
|
||||||
if (IsAWordStart(sc.ch)) {
|
if (IsPhpWordStart(static_cast<char>(sc.ch))) {
|
||||||
sc.SetState(SCE_HPHP_WORD);
|
sc.SetState(SCE_HPHP_WORD);
|
||||||
} else if (sc.ch == '#') {
|
} else if (sc.ch == '#') {
|
||||||
sc.SetState(SCE_HPHP_COMMENTLINE);
|
sc.SetState(SCE_HPHP_COMMENTLINE);
|
||||||
@@ -1836,7 +1879,7 @@ static void ColourisePHPPiece(StyleContext &sc, WordList *keywordlists[]) {
|
|||||||
sc.SetState(SCE_HPHP_HSTRING);
|
sc.SetState(SCE_HPHP_HSTRING);
|
||||||
} else if (sc.ch == '\'') {
|
} else if (sc.ch == '\'') {
|
||||||
sc.SetState(SCE_HPHP_SIMPLESTRING);
|
sc.SetState(SCE_HPHP_SIMPLESTRING);
|
||||||
} else if (sc.ch == '$') {
|
} else if (sc.ch == '$' && IsPhpWordStart(static_cast<char>(sc.chNext))) {
|
||||||
sc.SetState(SCE_HPHP_VARIABLE);
|
sc.SetState(SCE_HPHP_VARIABLE);
|
||||||
} else if (isoperator(static_cast<char>(sc.ch))) {
|
} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||||
sc.SetState(SCE_HPHP_OPERATOR);
|
sc.SetState(SCE_HPHP_OPERATOR);
|
||||||
|
@@ -23,8 +23,6 @@
|
|||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "SciLexer.h"
|
#include "SciLexer.h"
|
||||||
|
|
||||||
#define SCE_LUA_LAST_STYLE SCE_LUA_WORD6
|
|
||||||
|
|
||||||
static inline bool IsAWordChar(const int ch) {
|
static inline bool IsAWordChar(const int ch) {
|
||||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||||
}
|
}
|
||||||
@@ -61,14 +59,16 @@ static void ColouriseLuaDoc(
|
|||||||
WordList &keywords5 = *keywordlists[4];
|
WordList &keywords5 = *keywordlists[4];
|
||||||
WordList &keywords6 = *keywordlists[5];
|
WordList &keywords6 = *keywordlists[5];
|
||||||
|
|
||||||
// Must initialize the literal string nesting level, if we are inside such a string.
|
int currentLine = styler.GetLine(startPos);
|
||||||
|
// Initialize the literal string [[ ... ]] nesting level, if we are inside such a string.
|
||||||
int literalStringLevel = 0;
|
int literalStringLevel = 0;
|
||||||
if (initStyle == SCE_LUA_LITERALSTRING) {
|
if (initStyle == SCE_LUA_LITERALSTRING) {
|
||||||
literalStringLevel = 1;
|
literalStringLevel = styler.GetLineState(currentLine - 1);
|
||||||
}
|
}
|
||||||
// We use states above the last one to indicate nesting level of literal strings
|
// Initialize the block comment --[[ ... ]] nesting level, if we are inside such a comment
|
||||||
if (initStyle > SCE_LUA_LAST_STYLE) {
|
int blockCommentLevel = 0;
|
||||||
literalStringLevel = initStyle - SCE_LUA_LAST_STYLE + 1;
|
if (initStyle == SCE_LUA_COMMENT) {
|
||||||
|
blockCommentLevel = styler.GetLineState(currentLine - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not leak onto next line
|
// Do not leak onto next line
|
||||||
@@ -78,9 +78,28 @@ static void ColouriseLuaDoc(
|
|||||||
|
|
||||||
StyleContext sc(startPos, length, initStyle, styler);
|
StyleContext sc(startPos, length, initStyle, styler);
|
||||||
if (startPos == 0 && sc.ch == '#') {
|
if (startPos == 0 && sc.ch == '#') {
|
||||||
|
// shbang line: # is a comment only if first char of the script
|
||||||
sc.SetState(SCE_LUA_COMMENTLINE);
|
sc.SetState(SCE_LUA_COMMENTLINE);
|
||||||
}
|
}
|
||||||
for (; sc.More(); sc.Forward()) {
|
for (; sc.More(); sc.Forward()) {
|
||||||
|
if (sc.atLineEnd) {
|
||||||
|
// Update the line state, so it can be seen by next line
|
||||||
|
currentLine = styler.GetLine(sc.currentPos);
|
||||||
|
switch (sc.state) {
|
||||||
|
case SCE_LUA_LITERALSTRING:
|
||||||
|
// Inside a literal string, we set the line state
|
||||||
|
styler.SetLineState(currentLine, literalStringLevel);
|
||||||
|
break;
|
||||||
|
case SCE_LUA_COMMENT: // Block comment
|
||||||
|
// Inside a block comment, we set the line state
|
||||||
|
styler.SetLineState(currentLine, blockCommentLevel);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Reset the line state
|
||||||
|
styler.SetLineState(currentLine, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) {
|
if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) {
|
||||||
// Prevent SCE_LUA_STRINGEOL from leaking back to previous line
|
// Prevent SCE_LUA_STRINGEOL from leaking back to previous line
|
||||||
sc.SetState(SCE_LUA_STRING);
|
sc.SetState(SCE_LUA_STRING);
|
||||||
@@ -88,7 +107,7 @@ static void ColouriseLuaDoc(
|
|||||||
|
|
||||||
// Handle string line continuation
|
// Handle string line continuation
|
||||||
if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) &&
|
if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) &&
|
||||||
sc.ch == '\\') {
|
sc.ch == '\\') {
|
||||||
if (sc.chNext == '\n' || sc.chNext == '\r') {
|
if (sc.chNext == '\n' || sc.chNext == '\r') {
|
||||||
sc.Forward();
|
sc.Forward();
|
||||||
if (sc.ch == '\r' && sc.chNext == '\n') {
|
if (sc.ch == '\r' && sc.chNext == '\n') {
|
||||||
@@ -154,22 +173,31 @@ static void ColouriseLuaDoc(
|
|||||||
sc.ChangeState(SCE_LUA_STRINGEOL);
|
sc.ChangeState(SCE_LUA_STRINGEOL);
|
||||||
sc.ForwardSetState(SCE_LUA_DEFAULT);
|
sc.ForwardSetState(SCE_LUA_DEFAULT);
|
||||||
}
|
}
|
||||||
} else if (sc.state == SCE_LUA_LITERALSTRING || sc.state > SCE_LUA_LAST_STYLE) {
|
} else if (sc.state == SCE_LUA_LITERALSTRING) {
|
||||||
if (sc.Match('[', '[')) {
|
if (sc.Match('[', '[')) {
|
||||||
literalStringLevel++;
|
literalStringLevel++;
|
||||||
sc.SetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
|
sc.Forward();
|
||||||
|
sc.SetState(SCE_LUA_LITERALSTRING);
|
||||||
} else if (sc.Match(']', ']') && literalStringLevel > 0) {
|
} else if (sc.Match(']', ']') && literalStringLevel > 0) {
|
||||||
literalStringLevel--;
|
literalStringLevel--;
|
||||||
sc.Forward();
|
sc.Forward();
|
||||||
if (literalStringLevel == 0) {
|
if (literalStringLevel == 0) {
|
||||||
sc.ForwardSetState(SCE_LUA_DEFAULT);
|
sc.ForwardSetState(SCE_LUA_DEFAULT);
|
||||||
} else if (literalStringLevel == 1) {
|
}
|
||||||
sc.ForwardSetState(SCE_LUA_LITERALSTRING);
|
}
|
||||||
} else {
|
} else if (sc.state == SCE_LUA_COMMENT) { // Lua 5.0's block comment
|
||||||
sc.ForwardSetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
|
if (sc.Match('[', '[')) {
|
||||||
|
blockCommentLevel++;
|
||||||
|
sc.Forward();
|
||||||
|
} else if (sc.Match(']', ']') && blockCommentLevel > 0) {
|
||||||
|
blockCommentLevel--;
|
||||||
|
sc.Forward();
|
||||||
|
if (blockCommentLevel == 0) {
|
||||||
|
sc.ForwardSetState(SCE_LUA_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if a new state should be entered.
|
// Determine if a new state should be entered.
|
||||||
if (sc.state == SCE_LUA_DEFAULT) {
|
if (sc.state == SCE_LUA_DEFAULT) {
|
||||||
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||||
@@ -184,12 +212,16 @@ static void ColouriseLuaDoc(
|
|||||||
literalStringLevel = 1;
|
literalStringLevel = 1;
|
||||||
sc.SetState(SCE_LUA_LITERALSTRING);
|
sc.SetState(SCE_LUA_LITERALSTRING);
|
||||||
sc.Forward();
|
sc.Forward();
|
||||||
|
} else if (sc.Match("--[[")) { // Lua 5.0's block comment
|
||||||
|
blockCommentLevel = 1;
|
||||||
|
sc.SetState(SCE_LUA_COMMENT);
|
||||||
|
sc.Forward(3);
|
||||||
} else if (sc.Match('-', '-')) {
|
} else if (sc.Match('-', '-')) {
|
||||||
sc.SetState(SCE_LUA_COMMENTLINE);
|
sc.SetState(SCE_LUA_COMMENTLINE);
|
||||||
sc.Forward();
|
sc.Forward();
|
||||||
} else if (sc.Match('$') && sc.atLineStart) {
|
} else if (sc.atLineStart && sc.Match('$')) {
|
||||||
sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code
|
sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code
|
||||||
} else if (isLuaOperator(static_cast<char>(sc.ch))) {
|
} else if (isLuaOperator(static_cast<char>(sc.ch))) {
|
||||||
sc.SetState(SCE_LUA_OPERATOR);
|
sc.SetState(SCE_LUA_OPERATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +229,6 @@ static void ColouriseLuaDoc(
|
|||||||
sc.Complete();
|
sc.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
||||||
Accessor &styler) {
|
Accessor &styler) {
|
||||||
unsigned int lengthDoc = startPos + length;
|
unsigned int lengthDoc = startPos + length;
|
||||||
|
@@ -164,13 +164,17 @@ static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
|
|||||||
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||||
} else if (0 == strncmp(lineBuffer, "+++ ", 3)) {
|
} else if (0 == strncmp(lineBuffer, "+++ ", 3)) {
|
||||||
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||||
} else if (0 == strncmp(lineBuffer, "***", 3)) {
|
} else if (0 == strncmp(lineBuffer, "====", 4)) { // For p4's diff
|
||||||
|
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||||
|
} else if (0 == strncmp(lineBuffer, "***", 3)) {
|
||||||
|
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||||
|
} else if (0 == strncmp(lineBuffer, "? ", 2)) { // For difflib
|
||||||
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||||
} else if (lineBuffer[0] == '@') {
|
} else if (lineBuffer[0] == '@') {
|
||||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||||
} else if (lineBuffer[0] == '-') {
|
} else if (lineBuffer[0] == '-' || lineBuffer[0] == '<') {
|
||||||
styler.ColourTo(endLine, SCE_DIFF_DELETED);
|
styler.ColourTo(endLine, SCE_DIFF_DELETED);
|
||||||
} else if (lineBuffer[0] == '+') {
|
} else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') {
|
||||||
styler.ColourTo(endLine, SCE_DIFF_ADDED);
|
styler.ColourTo(endLine, SCE_DIFF_ADDED);
|
||||||
} else if (lineBuffer[0] != ' ') {
|
} else if (lineBuffer[0] != ' ') {
|
||||||
styler.ColourTo(endLine, SCE_DIFF_COMMENT);
|
styler.ColourTo(endLine, SCE_DIFF_COMMENT);
|
||||||
@@ -264,7 +268,7 @@ static void ColouriseMakeLine(
|
|||||||
Accessor &styler) {
|
Accessor &styler) {
|
||||||
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
unsigned int lastNonSpace = 0;
|
int lastNonSpace = -1;
|
||||||
unsigned int state = SCE_MAKE_DEFAULT;
|
unsigned int state = SCE_MAKE_DEFAULT;
|
||||||
bool bSpecial = false;
|
bool bSpecial = false;
|
||||||
// Skip initial spaces
|
// Skip initial spaces
|
||||||
@@ -291,13 +295,15 @@ static void ColouriseMakeLine(
|
|||||||
if (lineBuffer[i] == ':') {
|
if (lineBuffer[i] == ':') {
|
||||||
// We should check that no colouring was made since the beginning of the line,
|
// We should check that no colouring was made since the beginning of the line,
|
||||||
// to avoid colouring stuff like /OUT:file
|
// to avoid colouring stuff like /OUT:file
|
||||||
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
|
if (lastNonSpace >= 0)
|
||||||
|
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
|
||||||
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
|
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
|
||||||
styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
|
styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
|
||||||
bSpecial = true; // Only react to the first ':' of the line
|
bSpecial = true; // Only react to the first ':' of the line
|
||||||
state = SCE_MAKE_DEFAULT;
|
state = SCE_MAKE_DEFAULT;
|
||||||
} else if (lineBuffer[i] == '=') {
|
} else if (lineBuffer[i] == '=') {
|
||||||
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
|
if (lastNonSpace >= 0)
|
||||||
|
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
|
||||||
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
|
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
|
||||||
styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
|
styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
|
||||||
bSpecial = true; // Only react to the first '=' of the line
|
bSpecial = true; // Only react to the first '=' of the line
|
||||||
@@ -359,6 +365,8 @@ static void ColouriseErrorListLine(
|
|||||||
styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION);
|
styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION);
|
||||||
} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
|
} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
|
||||||
styler.ColourTo(endPos, SCE_ERR_PYTHON);
|
styler.ColourTo(endPos, SCE_ERR_PYTHON);
|
||||||
|
} else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) {
|
||||||
|
styler.ColourTo(endPos, SCE_ERR_PHP);
|
||||||
} else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) {
|
} else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) {
|
||||||
// Borland error message
|
// Borland error message
|
||||||
styler.ColourTo(endPos, SCE_ERR_BORLAND);
|
styler.ColourTo(endPos, SCE_ERR_BORLAND);
|
||||||
|
@@ -659,9 +659,64 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
styler.ColourTo(lengthDoc - 1, state);
|
styler.ColourTo(lengthDoc - 1, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
|
||||||
|
Accessor &styler) {
|
||||||
|
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||||
|
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||||
|
unsigned int endPos = startPos + length;
|
||||||
|
int visibleChars = 0;
|
||||||
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
|
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||||
|
int levelCurrent = levelPrev;
|
||||||
|
char chNext = styler[startPos];
|
||||||
|
int styleNext = styler.StyleAt(startPos);
|
||||||
|
for (unsigned int i = startPos; i < endPos; i++) {
|
||||||
|
char ch = chNext;
|
||||||
|
chNext = styler.SafeGetCharAt(i + 1);
|
||||||
|
int style = styleNext;
|
||||||
|
styleNext = styler.StyleAt(i + 1);
|
||||||
|
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||||
|
if (foldComment && (style == SCE_PL_COMMENTLINE)) {
|
||||||
|
if ((ch == '/') && (chNext == '/')) {
|
||||||
|
char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||||
|
if (chNext2 == '{') {
|
||||||
|
levelCurrent++;
|
||||||
|
} else if (chNext2 == '}') {
|
||||||
|
levelCurrent--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (style == SCE_C_OPERATOR) {
|
||||||
|
if (ch == '{') {
|
||||||
|
levelCurrent++;
|
||||||
|
} else if (ch == '}') {
|
||||||
|
levelCurrent--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (atEOL) {
|
||||||
|
int lev = levelPrev;
|
||||||
|
if (visibleChars == 0 && foldCompact)
|
||||||
|
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||||
|
if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
||||||
|
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||||
|
if (lev != styler.LevelAt(lineCurrent)) {
|
||||||
|
styler.SetLevel(lineCurrent, lev);
|
||||||
|
}
|
||||||
|
lineCurrent++;
|
||||||
|
levelPrev = levelCurrent;
|
||||||
|
visibleChars = 0;
|
||||||
|
}
|
||||||
|
if (!isspacechar(ch))
|
||||||
|
visibleChars++;
|
||||||
|
}
|
||||||
|
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||||
|
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||||
|
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||||
|
}
|
||||||
|
|
||||||
static const char * const perlWordListDesc[] = {
|
static const char * const perlWordListDesc[] = {
|
||||||
"Perl keywords",
|
"Perl keywords",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", 0, perlWordListDesc);
|
LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", FoldPerlDoc, perlWordListDesc);
|
||||||
|
@@ -42,7 +42,7 @@ static bool IsPyStringStart(int ch, int chNext, int chNext2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
|
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
|
||||||
static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
|
static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex) {
|
||||||
char ch = styler.SafeGetCharAt(i);
|
char ch = styler.SafeGetCharAt(i);
|
||||||
char chNext = styler.SafeGetCharAt(i + 1);
|
char chNext = styler.SafeGetCharAt(i + 1);
|
||||||
|
|
||||||
@@ -99,7 +99,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
int lineCurrent = styler.GetLine(startPos);
|
int lineCurrent = styler.GetLine(startPos);
|
||||||
if (startPos > 0) {
|
if (startPos > 0) {
|
||||||
if (lineCurrent > 0) {
|
if (lineCurrent > 0) {
|
||||||
startPos = styler.LineStart(lineCurrent - 1);
|
lineCurrent--;
|
||||||
|
startPos = styler.LineStart(lineCurrent);
|
||||||
if (startPos == 0)
|
if (startPos == 0)
|
||||||
initStyle = SCE_P_DEFAULT;
|
initStyle = SCE_P_DEFAULT;
|
||||||
else
|
else
|
||||||
@@ -139,6 +140,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
} else if (whingeLevel == 4) {
|
} else if (whingeLevel == 4) {
|
||||||
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
||||||
}
|
}
|
||||||
|
sc.SetState(sc.state);
|
||||||
styler.SetFlags(chFlags, static_cast<char>(sc.state));
|
styler.SetFlags(chFlags, static_cast<char>(sc.state));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +150,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
(sc.state == SCE_P_TRIPLEDOUBLE)) {
|
(sc.state == SCE_P_TRIPLEDOUBLE)) {
|
||||||
// Perform colourisation of white space and triple quoted strings at end of each line to allow
|
// Perform colourisation of white space and triple quoted strings at end of each line to allow
|
||||||
// tab marking to work inside white space and triple quoted strings
|
// tab marking to work inside white space and triple quoted strings
|
||||||
sc.ForwardSetState(sc.state);
|
sc.SetState(sc.state);
|
||||||
}
|
}
|
||||||
lineCurrent++;
|
lineCurrent++;
|
||||||
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||||
@@ -160,6 +162,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool needEOLCheck = false;
|
||||||
|
|
||||||
// Check for a state end
|
// Check for a state end
|
||||||
if (sc.state == SCE_P_OPERATOR) {
|
if (sc.state == SCE_P_OPERATOR) {
|
||||||
kwLast = kwOther;
|
kwLast = kwOther;
|
||||||
@@ -212,8 +216,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
sc.Forward();
|
sc.Forward();
|
||||||
} else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) {
|
} else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) {
|
||||||
sc.ForwardSetState(SCE_P_DEFAULT);
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
needEOLCheck = true;
|
||||||
} else if ((sc.state == SCE_P_CHARACTER) && (sc.ch == '\'')) {
|
} else if ((sc.state == SCE_P_CHARACTER) && (sc.ch == '\'')) {
|
||||||
sc.ForwardSetState(SCE_P_DEFAULT);
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
needEOLCheck = true;
|
||||||
}
|
}
|
||||||
} else if (sc.state == SCE_P_TRIPLE) {
|
} else if (sc.state == SCE_P_TRIPLE) {
|
||||||
if (sc.ch == '\\') {
|
if (sc.ch == '\\') {
|
||||||
@@ -222,6 +228,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
sc.Forward();
|
sc.Forward();
|
||||||
sc.Forward();
|
sc.Forward();
|
||||||
sc.ForwardSetState(SCE_P_DEFAULT);
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
needEOLCheck = true;
|
||||||
}
|
}
|
||||||
} else if (sc.state == SCE_P_TRIPLEDOUBLE) {
|
} else if (sc.state == SCE_P_TRIPLEDOUBLE) {
|
||||||
if (sc.ch == '\\') {
|
if (sc.ch == '\\') {
|
||||||
@@ -230,9 +237,18 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
sc.Forward();
|
sc.Forward();
|
||||||
sc.Forward();
|
sc.Forward();
|
||||||
sc.ForwardSetState(SCE_P_DEFAULT);
|
sc.ForwardSetState(SCE_P_DEFAULT);
|
||||||
|
needEOLCheck = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// State exit code may have moved on to end of line
|
||||||
|
if (needEOLCheck && sc.atLineEnd) {
|
||||||
|
lineCurrent++;
|
||||||
|
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||||
|
if (!sc.More())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for a new state starting character
|
// Check for a new state starting character
|
||||||
if (sc.state == SCE_P_DEFAULT) {
|
if (sc.state == SCE_P_DEFAULT) {
|
||||||
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||||
@@ -247,7 +263,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
|||||||
} else if (sc.ch == '#') {
|
} else if (sc.ch == '#') {
|
||||||
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
|
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
|
||||||
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2))) {
|
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2))) {
|
||||||
int nextIndex = 0;
|
unsigned int nextIndex = 0;
|
||||||
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex));
|
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex));
|
||||||
while (nextIndex > (sc.currentPos + 1)) {
|
while (nextIndex > (sc.currentPos + 1)) {
|
||||||
sc.Forward();
|
sc.Forward();
|
||||||
@@ -357,34 +373,40 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
|||||||
lev = lev + 1;
|
lev = lev + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip past any blank lines for next indent level info; we skip also comments
|
// Skip past any blank lines for next indent level info; we skip also
|
||||||
// starting in column 0 which effectively folds them into surrounding code rather
|
// comments (all comments, not just those starting in column 0)
|
||||||
|
// which effectively folds them into surrounding code rather
|
||||||
// than screwing up folding.
|
// than screwing up folding.
|
||||||
const int saveIndentNext = indentNext;
|
|
||||||
while (!quote &&
|
while (!quote &&
|
||||||
(lineNext < docLines) &&
|
(lineNext < docLines) &&
|
||||||
((indentNext & SC_FOLDLEVELWHITEFLAG) ||
|
((indentNext & SC_FOLDLEVELWHITEFLAG) ||
|
||||||
(lineNext <= docLines && styler[styler.LineStart(lineNext)] == '#'))) {
|
(lineNext <= docLines && IsCommentLine(lineNext, styler)))) {
|
||||||
|
|
||||||
lineNext++;
|
lineNext++;
|
||||||
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next compute max indent level of current line and next non-blank line.
|
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
|
||||||
// This is the level to which we set all the intervening blank or comment lines.
|
const int levelBeforeComments = Platform::Maximum(indentCurrentLevel,levelAfterComments);
|
||||||
const int skip_level = Platform::Maximum(indentCurrentLevel,
|
|
||||||
indentNext & SC_FOLDLEVELNUMBERMASK);
|
|
||||||
|
|
||||||
// Now set all the indent levels on the lines we skipped
|
// Now set all the indent levels on the lines we skipped
|
||||||
int skipLine = lineCurrent + 1;
|
// Do this from end to start. Once we encounter one line
|
||||||
int skipIndentNext = saveIndentNext;
|
// which is indented more than the line after the end of
|
||||||
while (skipLine < lineNext) {
|
// the comment-block, use the level of the block before
|
||||||
int skipLineLevel = skip_level;
|
|
||||||
if (skipIndentNext & SC_FOLDLEVELWHITEFLAG)
|
int skipLine = lineNext;
|
||||||
skipLineLevel = SC_FOLDLEVELWHITEFLAG | skipLineLevel;
|
int skipLevel = levelAfterComments;
|
||||||
styler.SetLevel(skipLine, skipLineLevel);
|
|
||||||
skipLine++;
|
while (--skipLine > lineCurrent) {
|
||||||
skipIndentNext = styler.IndentAmount(skipLine, &spaceFlags, NULL);
|
int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL);
|
||||||
|
|
||||||
|
if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments)
|
||||||
|
skipLevel = levelBeforeComments;
|
||||||
|
|
||||||
|
int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG;
|
||||||
|
|
||||||
|
styler.SetLevel(skipLine, skipLevel | whiteFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set fold header on non-quote/non-comment line
|
// Set fold header on non-quote/non-comment line
|
||||||
|
@@ -2,14 +2,37 @@
|
|||||||
/** @file LineMarker.cxx
|
/** @file LineMarker.cxx
|
||||||
** Defines the look of a line marker in the margin .
|
** Defines the look of a line marker in the margin .
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
|
#include "XPM.h"
|
||||||
#include "LineMarker.h"
|
#include "LineMarker.h"
|
||||||
|
|
||||||
|
void LineMarker::RefreshColourPalette(Palette &pal, bool want) {
|
||||||
|
pal.WantFind(fore, want);
|
||||||
|
pal.WantFind(back, want);
|
||||||
|
if (pxpm) {
|
||||||
|
pxpm->RefreshColourPalette(pal, want);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LineMarker::SetXPM(const char *textForm) {
|
||||||
|
delete pxpm;
|
||||||
|
pxpm = new XPM(textForm);
|
||||||
|
markType = SC_MARK_PIXMAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LineMarker::SetXPM(const char * const *linesForm) {
|
||||||
|
delete pxpm;
|
||||||
|
pxpm = new XPM(linesForm);
|
||||||
|
markType = SC_MARK_PIXMAP;
|
||||||
|
}
|
||||||
|
|
||||||
static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) {
|
static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) {
|
||||||
PRectangle rc;
|
PRectangle rc;
|
||||||
rc.left = centreX - armSize;
|
rc.left = centreX - armSize;
|
||||||
@@ -41,6 +64,10 @@ static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, C
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter) {
|
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter) {
|
||||||
|
if ((markType == SC_MARK_PIXMAP) && (pxpm)) {
|
||||||
|
pxpm->Draw(surface, rcWhole);
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Restrict most shapes a bit
|
// Restrict most shapes a bit
|
||||||
PRectangle rc = rcWhole;
|
PRectangle rc = rcWhole;
|
||||||
rc.top++;
|
rc.top++;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file LineMarker.h
|
/** @file LineMarker.h
|
||||||
** Defines the look of a line marker in the margin .
|
** Defines the look of a line marker in the margin .
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#ifndef LINEMARKER_H
|
#ifndef LINEMARKER_H
|
||||||
@@ -15,11 +15,34 @@ public:
|
|||||||
int markType;
|
int markType;
|
||||||
ColourPair fore;
|
ColourPair fore;
|
||||||
ColourPair back;
|
ColourPair back;
|
||||||
|
XPM *pxpm;
|
||||||
LineMarker() {
|
LineMarker() {
|
||||||
markType = SC_MARK_CIRCLE;
|
markType = SC_MARK_CIRCLE;
|
||||||
fore = ColourDesired(0,0,0);
|
fore = ColourDesired(0,0,0);
|
||||||
back = ColourDesired(0xff,0xff,0xff);
|
back = ColourDesired(0xff,0xff,0xff);
|
||||||
|
pxpm = NULL;
|
||||||
}
|
}
|
||||||
|
LineMarker(const LineMarker &) {
|
||||||
|
// Defined to avoid pxpm being blindly copied, not as real copy constructor
|
||||||
|
markType = SC_MARK_CIRCLE;
|
||||||
|
fore = ColourDesired(0,0,0);
|
||||||
|
back = ColourDesired(0xff,0xff,0xff);
|
||||||
|
pxpm = NULL;
|
||||||
|
}
|
||||||
|
~LineMarker() {
|
||||||
|
delete pxpm;
|
||||||
|
}
|
||||||
|
LineMarker &operator=(const LineMarker &) {
|
||||||
|
// Defined to avoid pxpm being blindly copied, not as real assignment operator
|
||||||
|
markType = SC_MARK_CIRCLE;
|
||||||
|
fore = ColourDesired(0,0,0);
|
||||||
|
back = ColourDesired(0xff,0xff,0xff);
|
||||||
|
pxpm = NULL;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
void RefreshColourPalette(Palette &pal, bool want);
|
||||||
|
void SetXPM(const char *textForm);
|
||||||
|
void SetXPM(const char * const *linesForm);
|
||||||
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);
|
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
/** @file PropSet.cxx
|
/** @file PropSet.cxx
|
||||||
** A Java style properties file module.
|
** A Java style properties file module.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
// Maintain a dictionary of properties
|
// Maintain a dictionary of properties
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
//#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
@@ -30,6 +30,10 @@ static inline bool IsLetter(char ch) {
|
|||||||
return ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'));
|
return ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IsASpace(unsigned int ch) {
|
||||||
|
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
|
||||||
|
}
|
||||||
|
|
||||||
int CompareCaseInsensitive(const char *a, const char *b) {
|
int CompareCaseInsensitive(const char *a, const char *b) {
|
||||||
while (*a && *b) {
|
while (*a && *b) {
|
||||||
if (*a != *b) {
|
if (*a != *b) {
|
||||||
@@ -104,7 +108,7 @@ void PropSet::Set(const char *key, const char *val, int lenKey, int lenVal) {
|
|||||||
// Replace current value
|
// Replace current value
|
||||||
delete [](p->val);
|
delete [](p->val);
|
||||||
p->val = StringDup(val, lenVal);
|
p->val = StringDup(val, lenVal);
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Not found
|
// Not found
|
||||||
@@ -119,7 +123,7 @@ void PropSet::Set(const char *key, const char *val, int lenKey, int lenVal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PropSet::Set(const char *keyVal) {
|
void PropSet::Set(const char *keyVal) {
|
||||||
while (isspace(*keyVal))
|
while (IsASpace(*keyVal))
|
||||||
keyVal++;
|
keyVal++;
|
||||||
const char *endVal = keyVal;
|
const char *endVal = keyVal;
|
||||||
while (*endVal && (*endVal != '\n'))
|
while (*endVal && (*endVal != '\n'))
|
||||||
@@ -257,7 +261,7 @@ SString PropSet::GetWild(const char *keybase, const char *filename) {
|
|||||||
if (keyfile == NULL)
|
if (keyfile == NULL)
|
||||||
keyfile = orgkeyfile;
|
keyfile = orgkeyfile;
|
||||||
|
|
||||||
for (; ; ) {
|
for (;;) {
|
||||||
char *del = strchr(keyfile, ';');
|
char *del = strchr(keyfile, ';');
|
||||||
if (del == NULL)
|
if (del == NULL)
|
||||||
del = keyfile + strlen(keyfile);
|
del = keyfile + strlen(keyfile);
|
||||||
@@ -328,9 +332,9 @@ void PropSet::Clear() {
|
|||||||
while (p) {
|
while (p) {
|
||||||
Property *pNext = p->next;
|
Property *pNext = p->next;
|
||||||
p->hash = 0;
|
p->hash = 0;
|
||||||
delete p->key;
|
delete []p->key;
|
||||||
p->key = 0;
|
p->key = 0;
|
||||||
delete p->val;
|
delete []p->val;
|
||||||
p->val = 0;
|
p->val = 0;
|
||||||
delete p;
|
delete p;
|
||||||
p = pNext;
|
p = pNext;
|
||||||
@@ -626,7 +630,7 @@ static unsigned int LengthWord(const char *word, char otherSeparator) {
|
|||||||
if (endWord > word) {
|
if (endWord > word) {
|
||||||
endWord--; // Back from the '(', ':', or '\0'
|
endWord--; // Back from the '(', ':', or '\0'
|
||||||
// Move backwards over any spaces
|
// Move backwards over any spaces
|
||||||
while ((endWord > word) && (isspace(*endWord))) {
|
while ((endWord > word) && (IsASpace(*endWord))) {
|
||||||
endWord--;
|
endWord--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,8 +30,11 @@
|
|||||||
* Modification history:
|
* Modification history:
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.5 2002/09/11 00:55:27 RD
|
* Revision 1.5.2.1 2003/04/08 22:40:19 RD
|
||||||
* Update to Scintilla 1.48
|
* Updated wxSTC to Scintilla 1.51
|
||||||
|
*
|
||||||
|
* Revision 1.7 2002/09/28 00:33:28 nyamatongwe
|
||||||
|
* Fixed problem with character ranges caused by expansion to 8 bits.
|
||||||
*
|
*
|
||||||
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
|
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
|
||||||
* Addition of new target methods - versions of ReplaceTarget that take counted
|
* Addition of new target methods - versions of ReplaceTarget that take counted
|
||||||
@@ -688,7 +691,7 @@ static char chrtyp[MAXCHR] = {
|
|||||||
|
|
||||||
#define ANYSKIP 2 /* [CLO] ANY END ... */
|
#define ANYSKIP 2 /* [CLO] ANY END ... */
|
||||||
#define CHRSKIP 3 /* [CLO] CHR chr END ... */
|
#define CHRSKIP 3 /* [CLO] CHR chr END ... */
|
||||||
#define CCLSKIP 18 /* [CLO] CCL 16bytes END ... */
|
#define CCLSKIP 34 /* [CLO] CCL 32bytes END ... */
|
||||||
|
|
||||||
int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
|
int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
|
||||||
int op, c, n;
|
int op, c, n;
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
* The following defines are not meant to be changeable.
|
* The following defines are not meant to be changeable.
|
||||||
* They are for readability only.
|
* They are for readability only.
|
||||||
*/
|
*/
|
||||||
#define MAXCHR 128
|
#define MAXCHR 256
|
||||||
#define CHRBIT 8
|
#define CHRBIT 8
|
||||||
#define BITBLK MAXCHR/CHRBIT
|
#define BITBLK MAXCHR/CHRBIT
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file ScintillaBase.cxx
|
/** @file ScintillaBase.cxx
|
||||||
** An enhanced subclass of Editor with calltips, autocomplete and context menu.
|
** An enhanced subclass of Editor with calltips, autocomplete and context menu.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "CallTip.h"
|
#include "CallTip.h"
|
||||||
#include "KeyMap.h"
|
#include "KeyMap.h"
|
||||||
#include "Indicator.h"
|
#include "Indicator.h"
|
||||||
|
#include "XPM.h"
|
||||||
#include "LineMarker.h"
|
#include "LineMarker.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "ViewStyle.h"
|
#include "ViewStyle.h"
|
||||||
@@ -211,7 +212,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ac.Start(wMain, idAutoComplete, currentPos, lenEntered);
|
ac.Start(wMain, idAutoComplete, currentPos, lenEntered, vs.lineHeight, IsUnicodeMode());
|
||||||
|
|
||||||
PRectangle rcClient = GetClientRectangle();
|
PRectangle rcClient = GetClientRectangle();
|
||||||
Point pt = LocationFromPosition(currentPos - lenEntered);
|
Point pt = LocationFromPosition(currentPos - lenEntered);
|
||||||
@@ -224,7 +225,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
|||||||
pt = LocationFromPosition(currentPos);
|
pt = LocationFromPosition(currentPos);
|
||||||
}
|
}
|
||||||
PRectangle rcac;
|
PRectangle rcac;
|
||||||
rcac.left = pt.x - 5;
|
rcac.left = pt.x - ac.lb->CaretFromEdge();
|
||||||
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
|
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
|
||||||
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
|
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
|
||||||
rcac.top = pt.y - heightLB;
|
rcac.top = pt.y - heightLB;
|
||||||
@@ -237,19 +238,19 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
|||||||
}
|
}
|
||||||
rcac.right = rcac.left + widthLB;
|
rcac.right = rcac.left + widthLB;
|
||||||
rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom);
|
rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom);
|
||||||
ac.lb.SetPositionRelative(rcac, wMain);
|
ac.lb->SetPositionRelative(rcac, wMain);
|
||||||
ac.lb.SetFont(vs.styles[STYLE_DEFAULT].font);
|
ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
|
||||||
ac.lb.SetAverageCharWidth(vs.styles[STYLE_DEFAULT].aveCharWidth);
|
ac.lb->SetAverageCharWidth(vs.styles[STYLE_DEFAULT].aveCharWidth);
|
||||||
ac.lb.SetDoubleClickAction(AutoCompleteDoubleClick, this);
|
ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
|
||||||
|
|
||||||
ac.SetList(list);
|
ac.SetList(list);
|
||||||
|
|
||||||
// Fiddle the position of the list so it is right next to the target and wide enough for all its strings
|
// Fiddle the position of the list so it is right next to the target and wide enough for all its strings
|
||||||
PRectangle rcList = ac.lb.GetDesiredRect();
|
PRectangle rcList = ac.lb->GetDesiredRect();
|
||||||
int heightAlloced = rcList.bottom - rcList.top;
|
int heightAlloced = rcList.bottom - rcList.top;
|
||||||
widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
|
widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
|
||||||
// Make an allowance for large strings in list
|
// Make an allowance for large strings in list
|
||||||
rcList.left = pt.x - 5;
|
rcList.left = pt.x - ac.lb->CaretFromEdge();
|
||||||
rcList.right = rcList.left + widthLB;
|
rcList.right = rcList.left + widthLB;
|
||||||
if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) && // Wont fit below.
|
if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) && // Wont fit below.
|
||||||
((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above.
|
((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above.
|
||||||
@@ -258,7 +259,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
|||||||
rcList.top = pt.y + vs.lineHeight;
|
rcList.top = pt.y + vs.lineHeight;
|
||||||
}
|
}
|
||||||
rcList.bottom = rcList.top + heightAlloced;
|
rcList.bottom = rcList.top + heightAlloced;
|
||||||
ac.lb.SetPositionRelative(rcList, wMain);
|
ac.lb->SetPositionRelative(rcList, wMain);
|
||||||
ac.Show();
|
ac.Show();
|
||||||
if (lenEntered != 0) {
|
if (lenEntered != 0) {
|
||||||
AutoCompleteMoveToCurrentWord();
|
AutoCompleteMoveToCurrentWord();
|
||||||
@@ -304,10 +305,10 @@ void ScintillaBase::AutoCompleteCharacterDeleted() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaBase::AutoCompleteCompleted() {
|
void ScintillaBase::AutoCompleteCompleted() {
|
||||||
int item = ac.lb.GetSelection();
|
int item = ac.lb->GetSelection();
|
||||||
char selected[1000];
|
char selected[1000];
|
||||||
if (item != -1) {
|
if (item != -1) {
|
||||||
ac.lb.GetValue(item, selected, sizeof(selected));
|
ac.lb->GetValue(item, selected, sizeof(selected));
|
||||||
}
|
}
|
||||||
ac.Cancel();
|
ac.Cancel();
|
||||||
|
|
||||||
@@ -509,6 +510,21 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
|||||||
case SCI_AUTOCGETDROPRESTOFWORD:
|
case SCI_AUTOCGETDROPRESTOFWORD:
|
||||||
return ac.dropRestOfWord;
|
return ac.dropRestOfWord;
|
||||||
|
|
||||||
|
case SCI_REGISTERIMAGE:
|
||||||
|
ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCI_CLEARREGISTEREDIMAGES:
|
||||||
|
ac.lb->ClearRegisteredImages();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCI_AUTOCSETTYPESEPARATOR:
|
||||||
|
ac.SetTypesep(static_cast<char>(wParam));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCI_AUTOCGETTYPESEPARATOR:
|
||||||
|
return ac.GetTypesep();
|
||||||
|
|
||||||
case SCI_CALLTIPSHOW: {
|
case SCI_CALLTIPSHOW: {
|
||||||
AutoCompleteCancel();
|
AutoCompleteCancel();
|
||||||
if (!ct.wCallTip.Created()) {
|
if (!ct.wCallTip.Created()) {
|
||||||
|
@@ -43,7 +43,7 @@ protected:
|
|||||||
int lexLanguage;
|
int lexLanguage;
|
||||||
const LexerModule *lexCurrent;
|
const LexerModule *lexCurrent;
|
||||||
PropSet props;
|
PropSet props;
|
||||||
enum {numWordLists=6};
|
enum {numWordLists=9};
|
||||||
WordList *keyWordLists[numWordLists+1];
|
WordList *keyWordLists[numWordLists+1];
|
||||||
void SetLexer(uptr_t wParam);
|
void SetLexer(uptr_t wParam);
|
||||||
void SetLexerLanguage(const char *languageName);
|
void SetLexerLanguage(const char *languageName);
|
||||||
|
@@ -49,7 +49,7 @@ public:
|
|||||||
void ClearTo(const Style &source);
|
void ClearTo(const Style &source);
|
||||||
bool EquivalentFontTo(const Style *other) const;
|
bool EquivalentFontTo(const Style *other) const;
|
||||||
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0);
|
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0);
|
||||||
bool IsProtected() { return !(changeable && visible);} ;
|
bool IsProtected() const { return !(changeable && visible);};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -29,7 +29,7 @@ static void getRange(unsigned int start,
|
|||||||
s[i] = '\0';
|
s[i] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void StyleContext::GetCurrent(char *s, int len) {
|
void StyleContext::GetCurrent(char *s, unsigned int len) {
|
||||||
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,6 +46,6 @@ static void getRangeLowered(unsigned int start,
|
|||||||
s[i] = '\0';
|
s[i] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void StyleContext::GetCurrentLowered(char *s, int len) {
|
void StyleContext::GetCurrentLowered(char *s, unsigned int len) {
|
||||||
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file StyleContext.cxx
|
/** @file StyleContext.cxx
|
||||||
** Lexer infrastructure.
|
** Lexer infrastructure.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// This file is in the public domain.
|
// This file is in the public domain.
|
||||||
|
|
||||||
// All languages handled so far can treat all characters >= 0x80 as one class
|
// All languages handled so far can treat all characters >= 0x80 as one class
|
||||||
@@ -11,12 +11,26 @@
|
|||||||
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
|
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
|
||||||
class StyleContext {
|
class StyleContext {
|
||||||
Accessor &styler;
|
Accessor &styler;
|
||||||
int endPos;
|
unsigned int endPos;
|
||||||
StyleContext& operator=(const StyleContext&) {
|
StyleContext& operator=(const StyleContext&) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
void GetNextChar(unsigned int pos) {
|
||||||
|
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
|
||||||
|
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
||||||
|
chNext = chNext << 8;
|
||||||
|
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
|
||||||
|
}
|
||||||
|
// End of line?
|
||||||
|
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win)
|
||||||
|
// or on LF alone (Unix). Avoid triggering two times on Dos/Win.
|
||||||
|
atLineEnd = (ch == '\r' && chNext != '\n') ||
|
||||||
|
(ch == '\n') ||
|
||||||
|
(currentPos >= endPos);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int currentPos;
|
unsigned int currentPos;
|
||||||
bool atLineStart;
|
bool atLineStart;
|
||||||
bool atLineEnd;
|
bool atLineEnd;
|
||||||
int state;
|
int state;
|
||||||
@@ -24,7 +38,7 @@ public:
|
|||||||
int ch;
|
int ch;
|
||||||
int chNext;
|
int chNext;
|
||||||
|
|
||||||
StyleContext(unsigned int startPos, int length,
|
StyleContext(unsigned int startPos, unsigned int length,
|
||||||
int initStyle, Accessor &styler_, char chMask=31) :
|
int initStyle, Accessor &styler_, char chMask=31) :
|
||||||
styler(styler_),
|
styler(styler_),
|
||||||
endPos(startPos + length),
|
endPos(startPos + length),
|
||||||
@@ -37,19 +51,14 @@ public:
|
|||||||
chNext(0) {
|
chNext(0) {
|
||||||
styler.StartAt(startPos, chMask);
|
styler.StartAt(startPos, chMask);
|
||||||
styler.StartSegment(startPos);
|
styler.StartSegment(startPos);
|
||||||
int pos = currentPos;
|
unsigned int pos = currentPos;
|
||||||
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
||||||
if (styler.IsLeadByte(static_cast<char>(ch))) {
|
if (styler.IsLeadByte(static_cast<char>(ch))) {
|
||||||
pos++;
|
pos++;
|
||||||
ch = ch << 8;
|
ch = ch << 8;
|
||||||
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
|
||||||
}
|
}
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
|
GetNextChar(pos);
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
|
|
||||||
}
|
|
||||||
atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n') || (currentPos >= endPos);
|
|
||||||
}
|
}
|
||||||
void Complete() {
|
void Complete() {
|
||||||
styler.ColourTo(currentPos - 1, state);
|
styler.ColourTo(currentPos - 1, state);
|
||||||
@@ -60,21 +69,12 @@ public:
|
|||||||
void Forward() {
|
void Forward() {
|
||||||
if (currentPos < endPos) {
|
if (currentPos < endPos) {
|
||||||
atLineStart = atLineEnd;
|
atLineStart = atLineEnd;
|
||||||
// A lot of this is repeated from the constructor - TODO: merge code
|
|
||||||
chPrev = ch;
|
chPrev = ch;
|
||||||
currentPos++;
|
currentPos++;
|
||||||
if (ch >= 0x100)
|
if (ch >= 0x100)
|
||||||
currentPos++;
|
currentPos++;
|
||||||
ch = chNext;
|
ch = chNext;
|
||||||
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
|
GetNextChar(currentPos);
|
||||||
if (styler.IsLeadByte(static_cast<char>(chNext))) {
|
|
||||||
chNext = chNext << 8;
|
|
||||||
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
|
|
||||||
}
|
|
||||||
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
|
||||||
// Avoid triggering two times on Dos/Win
|
|
||||||
// End of line
|
|
||||||
atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n') || (currentPos >= endPos);
|
|
||||||
} else {
|
} else {
|
||||||
atLineStart = false;
|
atLineStart = false;
|
||||||
chPrev = ' ';
|
chPrev = ' ';
|
||||||
@@ -83,6 +83,11 @@ public:
|
|||||||
atLineEnd = true;
|
atLineEnd = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void Forward(int nb) {
|
||||||
|
for (int i = 0; i < nb; i++) {
|
||||||
|
Forward();
|
||||||
|
}
|
||||||
|
}
|
||||||
void ChangeState(int state_) {
|
void ChangeState(int state_) {
|
||||||
state = state_;
|
state = state_;
|
||||||
}
|
}
|
||||||
@@ -136,8 +141,8 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Non-inline
|
// Non-inline
|
||||||
void GetCurrent(char *s, int len);
|
void GetCurrent(char *s, unsigned int len);
|
||||||
void GetCurrentLowered(char *s, int len);
|
void GetCurrentLowered(char *s, unsigned int len);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool IsASpace(unsigned int ch) {
|
inline bool IsASpace(unsigned int ch) {
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/** @file ViewStyle.cxx
|
/** @file ViewStyle.cxx
|
||||||
** Store information on how the document is to be viewed.
|
** Store information on how the document is to be viewed.
|
||||||
**/
|
**/
|
||||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "Indicator.h"
|
#include "Indicator.h"
|
||||||
|
#include "XPM.h"
|
||||||
#include "LineMarker.h"
|
#include "LineMarker.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "ViewStyle.h"
|
#include "ViewStyle.h"
|
||||||
@@ -72,6 +73,12 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
|
|||||||
selbackset = source.selbackset;
|
selbackset = source.selbackset;
|
||||||
selbackground.desired = source.selbackground.desired;
|
selbackground.desired = source.selbackground.desired;
|
||||||
selbackground2.desired = source.selbackground2.desired;
|
selbackground2.desired = source.selbackground2.desired;
|
||||||
|
|
||||||
|
foldmarginColourSet = source.foldmarginColourSet;
|
||||||
|
foldmarginColour.desired = source.foldmarginColour.desired;
|
||||||
|
foldmarginHighlightColourSet = source.foldmarginHighlightColourSet;
|
||||||
|
foldmarginHighlightColour.desired = source.foldmarginHighlightColour.desired;
|
||||||
|
|
||||||
whitespaceForegroundSet = source.whitespaceForegroundSet;
|
whitespaceForegroundSet = source.whitespaceForegroundSet;
|
||||||
whitespaceForeground.desired = source.whitespaceForeground.desired;
|
whitespaceForeground.desired = source.whitespaceForeground.desired;
|
||||||
whitespaceBackgroundSet = source.whitespaceBackgroundSet;
|
whitespaceBackgroundSet = source.whitespaceBackgroundSet;
|
||||||
@@ -124,6 +131,12 @@ void ViewStyle::Init() {
|
|||||||
selbackset = true;
|
selbackset = true;
|
||||||
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
|
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
|
||||||
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
|
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
|
||||||
|
|
||||||
|
foldmarginColourSet = false;
|
||||||
|
foldmarginColour.desired = ColourDesired(0xff, 0, 0);
|
||||||
|
foldmarginHighlightColourSet = false;
|
||||||
|
foldmarginHighlightColour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
|
||||||
|
|
||||||
whitespaceForegroundSet = false;
|
whitespaceForegroundSet = false;
|
||||||
whitespaceForeground.desired = ColourDesired(0, 0, 0);
|
whitespaceForeground.desired = ColourDesired(0, 0, 0);
|
||||||
whitespaceBackgroundSet = false;
|
whitespaceBackgroundSet = false;
|
||||||
@@ -138,6 +151,7 @@ void ViewStyle::Init() {
|
|||||||
edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
|
edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
|
||||||
edgeState = EDGE_NONE;
|
edgeState = EDGE_NONE;
|
||||||
caretWidth = 1;
|
caretWidth = 1;
|
||||||
|
someStylesProtected = false;
|
||||||
|
|
||||||
leftMarginWidth = 1;
|
leftMarginWidth = 1;
|
||||||
rightMarginWidth = 1;
|
rightMarginWidth = 1;
|
||||||
@@ -148,9 +162,7 @@ void ViewStyle::Init() {
|
|||||||
ms[1].width = 16;
|
ms[1].width = 16;
|
||||||
ms[1].mask = ~SC_MASK_FOLDERS;
|
ms[1].mask = ~SC_MASK_FOLDERS;
|
||||||
ms[2].symbol = true;
|
ms[2].symbol = true;
|
||||||
ms[2].width = 14; // Nice width for arrows
|
ms[2].width = 0;
|
||||||
ms[2].mask = SC_MASK_FOLDERS;
|
|
||||||
ms[2].width = 0; // Nice width for arrows
|
|
||||||
ms[2].mask = 0;
|
ms[2].mask = 0;
|
||||||
fixedColumnWidth = leftMarginWidth;
|
fixedColumnWidth = leftMarginWidth;
|
||||||
symbolMargin = false;
|
symbolMargin = false;
|
||||||
@@ -178,12 +190,15 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
|
|||||||
pal.WantFind(indicators[i].fore, want);
|
pal.WantFind(indicators[i].fore, want);
|
||||||
}
|
}
|
||||||
for (i=0;i<(sizeof(markers)/sizeof(markers[0]));i++) {
|
for (i=0;i<(sizeof(markers)/sizeof(markers[0]));i++) {
|
||||||
pal.WantFind(markers[i].fore, want);
|
markers[i].RefreshColourPalette(pal, want);
|
||||||
pal.WantFind(markers[i].back, want);
|
|
||||||
}
|
}
|
||||||
pal.WantFind(selforeground, want);
|
pal.WantFind(selforeground, want);
|
||||||
pal.WantFind(selbackground, want);
|
pal.WantFind(selbackground, want);
|
||||||
pal.WantFind(selbackground2, want);
|
pal.WantFind(selbackground2, want);
|
||||||
|
|
||||||
|
pal.WantFind(foldmarginColour, want);
|
||||||
|
pal.WantFind(foldmarginHighlightColour, want);
|
||||||
|
|
||||||
pal.WantFind(whitespaceForeground, want);
|
pal.WantFind(whitespaceForeground, want);
|
||||||
pal.WantFind(whitespaceBackground, want);
|
pal.WantFind(whitespaceBackground, want);
|
||||||
pal.WantFind(selbar, want);
|
pal.WantFind(selbar, want);
|
||||||
@@ -199,6 +214,7 @@ void ViewStyle::Refresh(Surface &surface) {
|
|||||||
styles[STYLE_DEFAULT].Realise(surface, zoomLevel);
|
styles[STYLE_DEFAULT].Realise(surface, zoomLevel);
|
||||||
maxAscent = styles[STYLE_DEFAULT].ascent;
|
maxAscent = styles[STYLE_DEFAULT].ascent;
|
||||||
maxDescent = styles[STYLE_DEFAULT].descent;
|
maxDescent = styles[STYLE_DEFAULT].descent;
|
||||||
|
someStylesProtected = false;
|
||||||
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
|
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
|
||||||
if (i != STYLE_DEFAULT) {
|
if (i != STYLE_DEFAULT) {
|
||||||
styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT]);
|
styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT]);
|
||||||
@@ -207,6 +223,9 @@ void ViewStyle::Refresh(Surface &surface) {
|
|||||||
if (maxDescent < styles[i].descent)
|
if (maxDescent < styles[i].descent)
|
||||||
maxDescent = styles[i].descent;
|
maxDescent = styles[i].descent;
|
||||||
}
|
}
|
||||||
|
if (styles[i].IsProtected()) {
|
||||||
|
someStylesProtected = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lineHeight = maxAscent + maxDescent;
|
lineHeight = maxAscent + maxDescent;
|
||||||
@@ -245,3 +264,7 @@ void ViewStyle::ClearStyles() {
|
|||||||
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
|
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
|
||||||
styles[styleIndex].fontName = fontNames.Save(name);
|
styles[styleIndex].fontName = fontNames.Save(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ViewStyle::ProtectionActive() const {
|
||||||
|
return someStylesProtected;
|
||||||
|
}
|
||||||
|
@@ -59,6 +59,10 @@ public:
|
|||||||
ColourPair whitespaceBackground;
|
ColourPair whitespaceBackground;
|
||||||
ColourPair selbar;
|
ColourPair selbar;
|
||||||
ColourPair selbarlight;
|
ColourPair selbarlight;
|
||||||
|
bool foldmarginColourSet;
|
||||||
|
ColourPair foldmarginColour;
|
||||||
|
bool foldmarginHighlightColourSet;
|
||||||
|
ColourPair foldmarginHighlightColour;
|
||||||
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
|
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
|
||||||
enum { margins=3 };
|
enum { margins=3 };
|
||||||
int leftMarginWidth; ///< Spacing margin on left of text
|
int leftMarginWidth; ///< Spacing margin on left of text
|
||||||
@@ -78,6 +82,7 @@ public:
|
|||||||
ColourPair edgecolour;
|
ColourPair edgecolour;
|
||||||
int edgeState;
|
int edgeState;
|
||||||
int caretWidth;
|
int caretWidth;
|
||||||
|
bool someStylesProtected;
|
||||||
|
|
||||||
ViewStyle();
|
ViewStyle();
|
||||||
ViewStyle(const ViewStyle &source);
|
ViewStyle(const ViewStyle &source);
|
||||||
@@ -88,6 +93,7 @@ public:
|
|||||||
void ResetDefaultStyle();
|
void ResetDefaultStyle();
|
||||||
void ClearStyles();
|
void ClearStyles();
|
||||||
void SetStyleFontName(int styleIndex, const char *name);
|
void SetStyleFontName(int styleIndex, const char *name);
|
||||||
|
bool ProtectionActive() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
297
contrib/src/stc/scintilla/src/XPM.cxx
Normal file
297
contrib/src/stc/scintilla/src/XPM.cxx
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file XPM.cxx
|
||||||
|
** Define a class that holds data in the X Pixmap (XPM) format,
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include "XPM.h"
|
||||||
|
|
||||||
|
static const char *NextField(const char *s) {
|
||||||
|
while (*s && *s != ' ') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
while (*s && *s == ' ') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data lines in XPM can be terminated either with NUL or "
|
||||||
|
static size_t MeasureLength(const char *s) {
|
||||||
|
size_t i = 0;
|
||||||
|
while (s[i] && (s[i] != '\"'))
|
||||||
|
i++;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
ColourAllocated XPM::ColourFromCode(int ch) {
|
||||||
|
return colourCodeTable[ch]->allocated;
|
||||||
|
#ifdef SLOW
|
||||||
|
for (int i=0;i<nColours;i++) {
|
||||||
|
if (codes[i] == ch) {
|
||||||
|
return colours[i].allocated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return colours[0].allocated;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPM::FillRun(Surface *surface, int code, int startX, int y, int x) {
|
||||||
|
if ((code != codeTransparent) && (startX != x)) {
|
||||||
|
PRectangle rc(startX, y, x, y+1);
|
||||||
|
surface->FillRectangle(rc, ColourFromCode(code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XPM::XPM(const char *textForm) :
|
||||||
|
data(0), codes(0), colours(0), lines(0) {
|
||||||
|
Init(textForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
XPM::XPM(const char * const *linesForm) :
|
||||||
|
data(0), codes(0), colours(0), lines(0) {
|
||||||
|
Init(linesForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
XPM::~XPM() {
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPM::Init(const char *textForm) {
|
||||||
|
Clear();
|
||||||
|
// Test done is two parts to avoid possibility of overstepping the memory
|
||||||
|
// if memcmp implemented strangely. Must be 4 bytes at least at destination.
|
||||||
|
if ((0 == memcmp(textForm, "/* X", 4)) && (0 == memcmp(textForm, "/* XPM */", 9))) {
|
||||||
|
// Build the lines form out of the text form
|
||||||
|
const char **linesForm = LinesFormFromTextForm(textForm);
|
||||||
|
Init(linesForm);
|
||||||
|
delete []linesForm;
|
||||||
|
} else {
|
||||||
|
// It is really in line form
|
||||||
|
Init(reinterpret_cast<const char * const *>(textForm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPM::Init(const char * const *linesForm) {
|
||||||
|
Clear();
|
||||||
|
height = 1;
|
||||||
|
width = 1;
|
||||||
|
nColours = 1;
|
||||||
|
data = NULL;
|
||||||
|
codeTransparent = ' ';
|
||||||
|
codes = NULL;
|
||||||
|
colours = NULL;
|
||||||
|
lines = NULL;
|
||||||
|
if (!linesForm)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char *line0 = linesForm[0];
|
||||||
|
width = atoi(line0);
|
||||||
|
line0 = NextField(line0);
|
||||||
|
height = atoi(line0);
|
||||||
|
line0 = NextField(line0);
|
||||||
|
nColours = atoi(line0);
|
||||||
|
codes = new char[nColours];
|
||||||
|
colours = new ColourPair[nColours];
|
||||||
|
|
||||||
|
int strings = 1+height+nColours;
|
||||||
|
lines = new char *[strings];
|
||||||
|
int allocation = 0;
|
||||||
|
for (int i=0; i<strings; i++) {
|
||||||
|
allocation += MeasureLength(linesForm[i]) + 1;
|
||||||
|
}
|
||||||
|
data = new char[allocation];
|
||||||
|
char *nextBit = data;
|
||||||
|
for (int j=0; j<strings; j++) {
|
||||||
|
lines[j] = nextBit;
|
||||||
|
size_t len = MeasureLength(linesForm[j]);
|
||||||
|
memcpy(nextBit, linesForm[j], len);
|
||||||
|
nextBit += len;
|
||||||
|
*nextBit++ = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int code=0;code<256; code++) {
|
||||||
|
colourCodeTable[code] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int c=0; c<nColours; c++) {
|
||||||
|
const char *colourDef = linesForm[c+1];
|
||||||
|
codes[c] = colourDef[0];
|
||||||
|
colourDef += 4;
|
||||||
|
if (*colourDef == '#') {
|
||||||
|
colours[c].desired.Set(colourDef);
|
||||||
|
} else {
|
||||||
|
colours[c].desired = ColourDesired(0xff, 0xff, 0xff);
|
||||||
|
codeTransparent = codes[c];
|
||||||
|
}
|
||||||
|
colourCodeTable[static_cast<unsigned char>(codes[c])] = &(colours[c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPM::Clear() {
|
||||||
|
delete []data;
|
||||||
|
data = 0;
|
||||||
|
delete []codes;
|
||||||
|
codes = 0;
|
||||||
|
delete []colours;
|
||||||
|
colours = 0;
|
||||||
|
delete []lines;
|
||||||
|
lines = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPM::RefreshColourPalette(Palette &pal, bool want) {
|
||||||
|
if (!data || !codes || !colours || !lines) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i=0;i<nColours;i++) {
|
||||||
|
pal.WantFind(colours[i], want);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPM::CopyDesiredColours() {
|
||||||
|
if (!data || !codes || !colours || !lines) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i=0;i<nColours;i++) {
|
||||||
|
colours[i].Copy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPM::Draw(Surface *surface, PRectangle &rc) {
|
||||||
|
if (!data || !codes || !colours || !lines) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Centre the pixmap
|
||||||
|
int startY = rc.top + (rc.Height() - height) / 2;
|
||||||
|
int startX = rc.left + (rc.Width() - width) / 2;
|
||||||
|
for (int y=0;y<height;y++) {
|
||||||
|
int prevCode = 0;
|
||||||
|
int xStartRun = 0;
|
||||||
|
for (int x=0; x<width; x++) {
|
||||||
|
int code = lines[y+nColours+1][x];
|
||||||
|
if (code != prevCode) {
|
||||||
|
FillRun(surface, prevCode, startX + xStartRun, startY + y, startX + x);
|
||||||
|
xStartRun = x;
|
||||||
|
prevCode = code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FillRun(surface, prevCode, startX + xStartRun, startY + y, startX + width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char **XPM::LinesFormFromTextForm(const char *textForm) {
|
||||||
|
// Build the lines form out of the text form
|
||||||
|
const char **linesForm = 0;
|
||||||
|
int countQuotes = 0;
|
||||||
|
int strings=1;
|
||||||
|
for (int j=0; countQuotes < (2*strings); j++) {
|
||||||
|
if (textForm[j] == '\"') {
|
||||||
|
if (countQuotes == 0) {
|
||||||
|
const char *line0 = textForm + j + 1;
|
||||||
|
// Skip width
|
||||||
|
line0 = NextField(line0);
|
||||||
|
// Add 1 line for each pixel of height
|
||||||
|
strings += atoi(line0);
|
||||||
|
line0 = NextField(line0);
|
||||||
|
// Add 1 line for each colour
|
||||||
|
strings += atoi(line0);
|
||||||
|
linesForm = new const char *[strings];
|
||||||
|
}
|
||||||
|
if (linesForm && ((countQuotes & 1) == 0)) {
|
||||||
|
linesForm[countQuotes / 2] = textForm + j + 1;
|
||||||
|
}
|
||||||
|
countQuotes++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return linesForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In future, may want to minimize search time by sorting and using a binary search.
|
||||||
|
|
||||||
|
XPMSet::XPMSet() : set(0), len(0), maximum(0), height(-1), width(-1) {
|
||||||
|
}
|
||||||
|
|
||||||
|
XPMSet::~XPMSet() {
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPMSet::Clear() {
|
||||||
|
for (int i=0;i<maximum;i++) {
|
||||||
|
delete set[i];
|
||||||
|
}
|
||||||
|
delete []set;
|
||||||
|
set = 0;
|
||||||
|
len = 0;
|
||||||
|
maximum = 0;
|
||||||
|
height = -1;
|
||||||
|
width = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPMSet::Add(int id, const char *textForm) {
|
||||||
|
// Invalidate cached dimensions
|
||||||
|
height = -1;
|
||||||
|
width = -1;
|
||||||
|
|
||||||
|
// Replace if this id already present
|
||||||
|
for (int i=0;i<maximum;i++) {
|
||||||
|
if (set[i]->GetId() == id) {
|
||||||
|
set[i]->Init(textForm);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No present, so add to end
|
||||||
|
XPM *pxpm = new XPM(textForm);
|
||||||
|
if (pxpm) {
|
||||||
|
pxpm->SetId(id);
|
||||||
|
pxpm->CopyDesiredColours();
|
||||||
|
if (len == maximum) {
|
||||||
|
int lenNew = len + 100;
|
||||||
|
XPM **setNew = new XPM *[lenNew];
|
||||||
|
for (int i=0; i<maximum; i++) {
|
||||||
|
setNew[i] = set[i];
|
||||||
|
}
|
||||||
|
delete []set;
|
||||||
|
set = setNew;
|
||||||
|
}
|
||||||
|
set[maximum] = pxpm;
|
||||||
|
maximum++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XPM *XPMSet::Get(int id) {
|
||||||
|
for (int i=0;i<maximum;i++) {
|
||||||
|
if (set[i]->GetId() == id) {
|
||||||
|
return set[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XPMSet::GetHeight() {
|
||||||
|
if (height < 0) {
|
||||||
|
for (int i=0; i<maximum; i++) {
|
||||||
|
if (height < set[i]->GetHeight()) {
|
||||||
|
height = set[i]->GetHeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (height > 0) ? height : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XPMSet::GetWidth() {
|
||||||
|
if (width < 0) {
|
||||||
|
for (int i=0; i<maximum; i++) {
|
||||||
|
if (width < set[i]->GetWidth()) {
|
||||||
|
width = set[i]->GetWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (width > 0) ? width : 0;
|
||||||
|
}
|
67
contrib/src/stc/scintilla/src/XPM.h
Normal file
67
contrib/src/stc/scintilla/src/XPM.h
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
// Scintilla source code edit control
|
||||||
|
/** @file XPM.h
|
||||||
|
** Define a class that holds data in the X Pixmap (XPM) format,
|
||||||
|
**/
|
||||||
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||||
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
|
#ifndef XPM_H
|
||||||
|
#define XPM_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hold a pixmap in XPM format.
|
||||||
|
*/
|
||||||
|
class XPM {
|
||||||
|
int id; // Assigned by container
|
||||||
|
int height;
|
||||||
|
int width;
|
||||||
|
int nColours;
|
||||||
|
char *data;
|
||||||
|
char codeTransparent;
|
||||||
|
char *codes;
|
||||||
|
ColourPair *colours;
|
||||||
|
ColourAllocated ColourFromCode(int ch);
|
||||||
|
void FillRun(Surface *surface, int code, int startX, int y, int x);
|
||||||
|
char **lines;
|
||||||
|
ColourPair *colourCodeTable[256];
|
||||||
|
public:
|
||||||
|
XPM(const char *textForm);
|
||||||
|
XPM(const char * const *linesForm);
|
||||||
|
~XPM();
|
||||||
|
void Init(const char *textForm);
|
||||||
|
void Init(const char * const *linesForm);
|
||||||
|
void Clear();
|
||||||
|
// Similar to same named method in ViewStyle:
|
||||||
|
void RefreshColourPalette(Palette &pal, bool want);
|
||||||
|
// No palette used, so just copy the desired colours to the allocated colours:
|
||||||
|
void CopyDesiredColours();
|
||||||
|
// Decompose image into runs and use FillRectangle for each run:
|
||||||
|
void Draw(Surface *surface, PRectangle &rc);
|
||||||
|
char **InLinesForm() { return lines; }
|
||||||
|
void SetId(int id_) { id = id_; }
|
||||||
|
int GetId() { return id; }
|
||||||
|
int GetHeight() { return height; }
|
||||||
|
int GetWidth() { return width; }
|
||||||
|
static const char **LinesFormFromTextForm(const char *textForm);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of pixmaps indexed by integer id.
|
||||||
|
*/
|
||||||
|
class XPMSet {
|
||||||
|
XPM **set;
|
||||||
|
int len;
|
||||||
|
int maximum;
|
||||||
|
int height;
|
||||||
|
int width;
|
||||||
|
public:
|
||||||
|
XPMSet();
|
||||||
|
~XPMSet();
|
||||||
|
void Clear();
|
||||||
|
void Add(int id, const char *textForm);
|
||||||
|
XPM *Get(int id);
|
||||||
|
int GetHeight();
|
||||||
|
int GetWidth();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@@ -21,6 +21,7 @@
|
|||||||
#include "ScintillaWX.h"
|
#include "ScintillaWX.h"
|
||||||
|
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
|
#include <wx/mstream.h>
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -201,7 +202,7 @@ int wxStyledTextCtrl::GetLength() {
|
|||||||
|
|
||||||
// Returns the character byte at the position.
|
// Returns the character byte at the position.
|
||||||
int wxStyledTextCtrl::GetCharAt(int pos) {
|
int wxStyledTextCtrl::GetCharAt(int pos) {
|
||||||
return (unsigned char)SendMsg(2007, pos, 0);
|
return (unsigned char)SendMsg(2007, pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the position of the caret.
|
// Returns the position of the caret.
|
||||||
@@ -216,7 +217,7 @@ int wxStyledTextCtrl::GetAnchor() {
|
|||||||
|
|
||||||
// Returns the style byte at the position.
|
// Returns the style byte at the position.
|
||||||
int wxStyledTextCtrl::GetStyleAt(int pos) {
|
int wxStyledTextCtrl::GetStyleAt(int pos) {
|
||||||
return (unsigned char)SendMsg(2010, pos, 0);
|
return (unsigned char)SendMsg(2010, pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redoes the next action on the undo history.
|
// Redoes the next action on the undo history.
|
||||||
@@ -243,21 +244,21 @@ void wxStyledTextCtrl::SetSavePoint() {
|
|||||||
|
|
||||||
// Retrieve a buffer of cells.
|
// Retrieve a buffer of cells.
|
||||||
wxMemoryBuffer wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
|
wxMemoryBuffer wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
|
||||||
wxMemoryBuffer buf;
|
wxMemoryBuffer buf;
|
||||||
if (endPos < startPos) {
|
if (endPos < startPos) {
|
||||||
int temp = startPos;
|
int temp = startPos;
|
||||||
startPos = endPos;
|
startPos = endPos;
|
||||||
endPos = temp;
|
endPos = temp;
|
||||||
}
|
}
|
||||||
int len = endPos - startPos;
|
int len = endPos - startPos;
|
||||||
if (!len) return buf;
|
if (!len) return buf;
|
||||||
TextRange tr;
|
TextRange tr;
|
||||||
tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
|
tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
|
||||||
tr.chrg.cpMin = startPos;
|
tr.chrg.cpMin = startPos;
|
||||||
tr.chrg.cpMax = endPos;
|
tr.chrg.cpMax = endPos;
|
||||||
len = SendMsg(2015, 0, (long)&tr);
|
len = SendMsg(2015, 0, (long)&tr);
|
||||||
buf.UngetWriteBuf(len);
|
buf.UngetWriteBuf(len);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are there any redoable actions in the undo history?
|
// Are there any redoable actions in the undo history?
|
||||||
@@ -293,7 +294,7 @@ void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS) {
|
|||||||
|
|
||||||
// Find the position from a point within the window.
|
// Find the position from a point within the window.
|
||||||
int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) {
|
int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) {
|
||||||
return SendMsg(2022, pt.x, pt.y);
|
return SendMsg(2022, pt.x, pt.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the position from a point within the window but return
|
// Find the position from a point within the window but return
|
||||||
@@ -321,20 +322,20 @@ void wxStyledTextCtrl::SetAnchor(int posAnchor) {
|
|||||||
// Retrieve the text of the line containing the caret.
|
// Retrieve the text of the line containing the caret.
|
||||||
// Returns the index of the caret on the line.
|
// Returns the index of the caret on the line.
|
||||||
wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
|
wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
|
||||||
int len = LineLength(GetCurrentLine());
|
int len = LineLength(GetCurrentLine());
|
||||||
if (!len) {
|
if (!len) {
|
||||||
if (linePos) *linePos = 0;
|
if (linePos) *linePos = 0;
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+1);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
|
|
||||||
int pos = SendMsg(2027, len+1, (long)buf);
|
int pos = SendMsg(2027, len+1, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
mbuf.AppendByte(0);
|
mbuf.AppendByte(0);
|
||||||
if (linePos) *linePos = pos;
|
if (linePos) *linePos = pos;
|
||||||
return stc2wx(buf);
|
return stc2wx(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the position of the last correctly styled character.
|
// Retrieve the position of the last correctly styled character.
|
||||||
@@ -399,20 +400,20 @@ void wxStyledTextCtrl::SetCodePage(int codePage) {
|
|||||||
wxASSERT_MSG(codePage != wxSTC_CP_UTF8,
|
wxASSERT_MSG(codePage != wxSTC_CP_UTF8,
|
||||||
wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
|
wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
|
||||||
#endif
|
#endif
|
||||||
SendMsg(2037, codePage);
|
SendMsg(2037, codePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the symbol used for a particular marker number,
|
// Set the symbol used for a particular marker number,
|
||||||
// and optionally the fore and background colours.
|
// and optionally the fore and background colours.
|
||||||
void wxStyledTextCtrl::MarkerDefine(int markerNumber, int markerSymbol,
|
void wxStyledTextCtrl::MarkerDefine(int markerNumber, int markerSymbol,
|
||||||
const wxColour& foreground,
|
const wxColour& foreground,
|
||||||
const wxColour& background) {
|
const wxColour& background) {
|
||||||
|
|
||||||
SendMsg(2040, markerNumber, markerSymbol);
|
SendMsg(2040, markerNumber, markerSymbol);
|
||||||
if (foreground.Ok())
|
if (foreground.Ok())
|
||||||
MarkerSetForeground(markerNumber, foreground);
|
MarkerSetForeground(markerNumber, foreground);
|
||||||
if (background.Ok())
|
if (background.Ok())
|
||||||
MarkerSetBackground(markerNumber, background);
|
MarkerSetBackground(markerNumber, background);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the foreground colour used for a particular marker number.
|
// Set the foreground colour used for a particular marker number.
|
||||||
@@ -455,6 +456,20 @@ int wxStyledTextCtrl::MarkerPrevious(int lineStart, int markerMask) {
|
|||||||
return SendMsg(2048, lineStart, markerMask);
|
return SendMsg(2048, lineStart, markerMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Define a marker from a bitmap
|
||||||
|
void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) {
|
||||||
|
// convert bmp to a xpm in a string
|
||||||
|
wxMemoryOutputStream strm;
|
||||||
|
wxImage(bmp).SaveFile(strm, wxBITMAP_TYPE_XPM);
|
||||||
|
size_t len = strm.GetSize();
|
||||||
|
char* buff = new char[len+1];
|
||||||
|
strm.CopyTo(buff, len);
|
||||||
|
buff[len+1] = 0;
|
||||||
|
SendMsg(2049, markerNumber, (long)buff);
|
||||||
|
delete [] buff;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Set a margin to be either numeric or symbolic.
|
// Set a margin to be either numeric or symbolic.
|
||||||
void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
|
void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
|
||||||
SendMsg(2240, margin, marginType);
|
SendMsg(2240, margin, marginType);
|
||||||
@@ -572,12 +587,12 @@ void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
|
|||||||
|
|
||||||
// When key+modifier combination km is pressed perform msg.
|
// When key+modifier combination km is pressed perform msg.
|
||||||
void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) {
|
void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) {
|
||||||
SendMsg(2070, MAKELONG(key, modifiers), cmd);
|
SendMsg(2070, MAKELONG(key, modifiers), cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When key+modifier combination km do nothing.
|
// When key+modifier combination km do nothing.
|
||||||
void wxStyledTextCtrl::CmdKeyClear(int key, int modifiers) {
|
void wxStyledTextCtrl::CmdKeyClear(int key, int modifiers) {
|
||||||
SendMsg(2071, MAKELONG(key, modifiers));
|
SendMsg(2071, MAKELONG(key, modifiers));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop all key mappings.
|
// Drop all key mappings.
|
||||||
@@ -587,7 +602,7 @@ void wxStyledTextCtrl::CmdKeyClearAll() {
|
|||||||
|
|
||||||
// Set the styles for a segment of the document.
|
// Set the styles for a segment of the document.
|
||||||
void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
|
void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
|
||||||
SendMsg(2073, length, (long)styleBytes);
|
SendMsg(2073, length, (long)styleBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a style to be visible or not.
|
// Set a style to be visible or not.
|
||||||
@@ -818,6 +833,36 @@ bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
|
|||||||
return SendMsg(2271, 0, 0) != 0;
|
return SendMsg(2271, 0, 0) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register an image for use in autocompletion lists.
|
||||||
|
void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
|
||||||
|
// convert bmp to a xpm in a string
|
||||||
|
wxMemoryOutputStream strm;
|
||||||
|
wxImage(bmp).SaveFile(strm, wxBITMAP_TYPE_XPM);
|
||||||
|
size_t len = strm.GetSize();
|
||||||
|
char* buff = new char[len+1];
|
||||||
|
strm.CopyTo(buff, len);
|
||||||
|
buff[len+1] = 0;
|
||||||
|
SendMsg(2405, type, (long)buff);
|
||||||
|
delete [] buff;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear all the registered images.
|
||||||
|
void wxStyledTextCtrl::ClearRegisteredImages() {
|
||||||
|
SendMsg(2408, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the auto-completion list type-separator character.
|
||||||
|
int wxStyledTextCtrl::AutoCompGetTypeSeparator() {
|
||||||
|
return SendMsg(2285, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change the type-separator character in the string setting up an auto-completion list.
|
||||||
|
// Default is '?' but can be changed if items contain '?'.
|
||||||
|
void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter) {
|
||||||
|
SendMsg(2286, separatorCharacter, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Set the number of spaces used for one level of indentation.
|
// Set the number of spaces used for one level of indentation.
|
||||||
void wxStyledTextCtrl::SetIndent(int indentSize) {
|
void wxStyledTextCtrl::SetIndent(int indentSize) {
|
||||||
SendMsg(2122, indentSize, 0);
|
SendMsg(2122, indentSize, 0);
|
||||||
@@ -958,64 +1003,64 @@ int wxStyledTextCtrl::GetPrintColourMode() {
|
|||||||
|
|
||||||
// Find some text in the document.
|
// Find some text in the document.
|
||||||
int wxStyledTextCtrl::FindText(int minPos, int maxPos,
|
int wxStyledTextCtrl::FindText(int minPos, int maxPos,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int flags) {
|
int flags) {
|
||||||
TextToFind ft;
|
TextToFind ft;
|
||||||
ft.chrg.cpMin = minPos;
|
ft.chrg.cpMin = minPos;
|
||||||
ft.chrg.cpMax = maxPos;
|
ft.chrg.cpMax = maxPos;
|
||||||
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
||||||
ft.lpstrText = (char*)(const char*)buf;
|
ft.lpstrText = (char*)(const char*)buf;
|
||||||
|
|
||||||
return SendMsg(2150, flags, (long)&ft);
|
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 wxStyledTextCtrl::FormatRange(bool doDraw,
|
||||||
int startPos,
|
int startPos,
|
||||||
int endPos,
|
int endPos,
|
||||||
wxDC* draw,
|
wxDC* draw,
|
||||||
wxDC* target, // Why does it use two? Can they be the same?
|
wxDC* target, // Why does it use two? Can they be the same?
|
||||||
wxRect renderRect,
|
wxRect renderRect,
|
||||||
wxRect pageRect) {
|
wxRect pageRect) {
|
||||||
RangeToFormat fr;
|
RangeToFormat fr;
|
||||||
|
|
||||||
if (endPos < startPos) {
|
if (endPos < startPos) {
|
||||||
int temp = startPos;
|
int temp = startPos;
|
||||||
startPos = endPos;
|
startPos = endPos;
|
||||||
endPos = temp;
|
endPos = temp;
|
||||||
}
|
}
|
||||||
fr.hdc = draw;
|
fr.hdc = draw;
|
||||||
fr.hdcTarget = target;
|
fr.hdcTarget = target;
|
||||||
fr.rc.top = renderRect.GetTop();
|
fr.rc.top = renderRect.GetTop();
|
||||||
fr.rc.left = renderRect.GetLeft();
|
fr.rc.left = renderRect.GetLeft();
|
||||||
fr.rc.right = renderRect.GetRight();
|
fr.rc.right = renderRect.GetRight();
|
||||||
fr.rc.bottom = renderRect.GetBottom();
|
fr.rc.bottom = renderRect.GetBottom();
|
||||||
fr.rcPage.top = pageRect.GetTop();
|
fr.rcPage.top = pageRect.GetTop();
|
||||||
fr.rcPage.left = pageRect.GetLeft();
|
fr.rcPage.left = pageRect.GetLeft();
|
||||||
fr.rcPage.right = pageRect.GetRight();
|
fr.rcPage.right = pageRect.GetRight();
|
||||||
fr.rcPage.bottom = pageRect.GetBottom();
|
fr.rcPage.bottom = pageRect.GetBottom();
|
||||||
fr.chrg.cpMin = startPos;
|
fr.chrg.cpMin = startPos;
|
||||||
fr.chrg.cpMax = endPos;
|
fr.chrg.cpMax = endPos;
|
||||||
|
|
||||||
return SendMsg(2151, doDraw, (long)&fr);
|
return SendMsg(2151, doDraw, (long)&fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the line at the top of the display.
|
// Retrieve the display line at the top of the display.
|
||||||
int wxStyledTextCtrl::GetFirstVisibleLine() {
|
int wxStyledTextCtrl::GetFirstVisibleLine() {
|
||||||
return SendMsg(2152, 0, 0);
|
return SendMsg(2152, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the contents of a line.
|
// Retrieve the contents of a line.
|
||||||
wxString wxStyledTextCtrl::GetLine(int line) {
|
wxString wxStyledTextCtrl::GetLine(int line) {
|
||||||
int len = LineLength(line);
|
int len = LineLength(line);
|
||||||
if (!len) return wxEmptyString;
|
if (!len) return wxEmptyString;
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+1);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(2153, line, (long)buf);
|
SendMsg(2153, line, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
mbuf.AppendByte(0);
|
mbuf.AppendByte(0);
|
||||||
return stc2wx(buf);
|
return stc2wx(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the number of lines in the document. There is always at least one.
|
// Returns the number of lines in the document. There is always at least one.
|
||||||
@@ -1055,40 +1100,40 @@ void wxStyledTextCtrl::SetSelection(int start, int end) {
|
|||||||
|
|
||||||
// Retrieve the selected text.
|
// Retrieve the selected text.
|
||||||
wxString wxStyledTextCtrl::GetSelectedText() {
|
wxString wxStyledTextCtrl::GetSelectedText() {
|
||||||
int start;
|
int start;
|
||||||
int end;
|
int end;
|
||||||
|
|
||||||
GetSelection(&start, &end);
|
GetSelection(&start, &end);
|
||||||
int len = end - start;
|
int len = end - start;
|
||||||
if (!len) return wxEmptyString;
|
if (!len) return wxEmptyString;
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+1);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(2161, 0, (long)buf);
|
SendMsg(2161, 0, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
mbuf.AppendByte(0);
|
mbuf.AppendByte(0);
|
||||||
return stc2wx(buf);
|
return stc2wx(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve a range of text.
|
// Retrieve a range of text.
|
||||||
wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
|
wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
|
||||||
if (endPos < startPos) {
|
if (endPos < startPos) {
|
||||||
int temp = startPos;
|
int temp = startPos;
|
||||||
startPos = endPos;
|
startPos = endPos;
|
||||||
endPos = temp;
|
endPos = temp;
|
||||||
}
|
}
|
||||||
int len = endPos - startPos;
|
int len = endPos - startPos;
|
||||||
if (!len) return wxEmptyString;
|
if (!len) return wxEmptyString;
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+1);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len);
|
char* buf = (char*)mbuf.GetWriteBuf(len);
|
||||||
TextRange tr;
|
TextRange tr;
|
||||||
tr.lpstrText = buf;
|
tr.lpstrText = buf;
|
||||||
tr.chrg.cpMin = startPos;
|
tr.chrg.cpMin = startPos;
|
||||||
tr.chrg.cpMax = endPos;
|
tr.chrg.cpMax = endPos;
|
||||||
SendMsg(2162, 0, (long)&tr);
|
SendMsg(2162, 0, (long)&tr);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
mbuf.AppendByte(0);
|
mbuf.AppendByte(0);
|
||||||
return stc2wx(buf);
|
return stc2wx(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the selection in normal style or with selection highlighted.
|
// Draw the selection in normal style or with selection highlighted.
|
||||||
@@ -1173,13 +1218,13 @@ void wxStyledTextCtrl::SetText(const wxString& text) {
|
|||||||
|
|
||||||
// Retrieve all the text in the document.
|
// Retrieve all the text in the document.
|
||||||
wxString wxStyledTextCtrl::GetText() {
|
wxString wxStyledTextCtrl::GetText() {
|
||||||
int len = GetTextLength();
|
int len = GetTextLength();
|
||||||
wxMemoryBuffer mbuf(len+1); // leave room for the null...
|
wxMemoryBuffer mbuf(len+1); // leave room for the null...
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(2182, len+1, (long)buf);
|
SendMsg(2182, len+1, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
mbuf.AppendByte(0);
|
mbuf.AppendByte(0);
|
||||||
return stc2wx(buf);
|
return stc2wx(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the number of characters in the document.
|
// Retrieve the number of characters in the document.
|
||||||
@@ -1233,9 +1278,9 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
|||||||
// Text is counted so it can contain nulls.
|
// Text is counted so it can contain nulls.
|
||||||
// Returns the length of the replacement text.
|
// Returns the length of the replacement text.
|
||||||
|
|
||||||
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
|
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
|
||||||
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
||||||
return SendMsg(2194, strlen(buf), (long)(const char*)buf);
|
return SendMsg(2194, strlen(buf), (long)(const char*)buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the target text with the argument text after \d processing.
|
// Replace the target text with the argument text after \d processing.
|
||||||
@@ -1245,18 +1290,18 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
|||||||
// Returns the length of the replacement text including any change
|
// Returns the length of the replacement text including any change
|
||||||
// caused by processing the \d patterns.
|
// caused by processing the \d patterns.
|
||||||
|
|
||||||
int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
|
int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
|
||||||
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
||||||
return SendMsg(2195, strlen(buf), (long)(const char*)buf);
|
return SendMsg(2195, strlen(buf), (long)(const char*)buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for a counted string in the target and set the target to the found
|
// Search for a counted string in the target and set the target to the found
|
||||||
// range. Text is counted so it can contain nulls.
|
// range. Text is counted so it can contain nulls.
|
||||||
// Returns length of range or -1 for failure in which case target is not moved.
|
// Returns length of range or -1 for failure in which case target is not moved.
|
||||||
|
|
||||||
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
|
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
|
||||||
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
|
||||||
return SendMsg(2197, strlen(buf), (long)(const char*)buf);
|
return SendMsg(2197, strlen(buf), (long)(const char*)buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the search flags used by SearchInTarget.
|
// Set the search flags used by SearchInTarget.
|
||||||
@@ -1366,7 +1411,7 @@ void wxStyledTextCtrl::EnsureVisible(int line) {
|
|||||||
SendMsg(2232, line, 0);
|
SendMsg(2232, line, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set some debugging options for folding.
|
// Set some style options for folding.
|
||||||
void wxStyledTextCtrl::SetFoldFlags(int flags) {
|
void wxStyledTextCtrl::SetFoldFlags(int flags) {
|
||||||
SendMsg(2233, flags, 0);
|
SendMsg(2233, flags, 0);
|
||||||
}
|
}
|
||||||
@@ -1472,6 +1517,62 @@ int wxStyledTextCtrl::TextHeight(int line) {
|
|||||||
return SendMsg(2279, line, 0);
|
return SendMsg(2279, line, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show or hide the vertical scroll bar.
|
||||||
|
void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show) {
|
||||||
|
SendMsg(2280, show, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is the vertical scroll bar visible?
|
||||||
|
bool wxStyledTextCtrl::GetUseVerticalScrollBar() {
|
||||||
|
return SendMsg(2281, 0, 0) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append a string to the end of the document without changing the selection.
|
||||||
|
void wxStyledTextCtrl::AppendText(int length, const wxString& text) {
|
||||||
|
SendMsg(2282, length, (long)(const char*)wx2stc(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is drawing done in two phases with backgrounds drawn before foregrounds?
|
||||||
|
bool wxStyledTextCtrl::GetTwoPhaseDraw() {
|
||||||
|
return SendMsg(2283, 0, 0) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In twoPhaseDraw mode, drawing is performed in two phases, first the background
|
||||||
|
// and then the foreground. This avoids chopping off characters that overlap the next run.
|
||||||
|
void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase) {
|
||||||
|
SendMsg(2284, twoPhase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make the target range start and end be the same as the selection range start and end.
|
||||||
|
void wxStyledTextCtrl::TargetFromSelection() {
|
||||||
|
SendMsg(2287, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Join the lines in the target.
|
||||||
|
// This is an experimental feature and may be changed or removed.
|
||||||
|
void wxStyledTextCtrl::LinesJoin() {
|
||||||
|
SendMsg(2288, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split the lines in the target into lines that are less wide than pixelWidth
|
||||||
|
// where possible.
|
||||||
|
void wxStyledTextCtrl::LinesSplit(int pixelWidth) {
|
||||||
|
SendMsg(2289, pixelWidth, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the colours used as a chequerboard pattern in the fold margin
|
||||||
|
void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting, const wxColour& back) {
|
||||||
|
SendMsg(2290, useSetting, wxColourAsLong(back));
|
||||||
|
}
|
||||||
|
void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting, const wxColour& fore) {
|
||||||
|
SendMsg(2291, useSetting, wxColourAsLong(fore));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duplicate the current line.
|
||||||
|
void wxStyledTextCtrl::LineDuplicate() {
|
||||||
|
SendMsg(2404, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Move caret to first position on display line.
|
// Move caret to first position on display line.
|
||||||
void wxStyledTextCtrl::HomeDisplay() {
|
void wxStyledTextCtrl::HomeDisplay() {
|
||||||
SendMsg(2345, 0, 0);
|
SendMsg(2345, 0, 0);
|
||||||
@@ -1531,12 +1632,12 @@ void wxStyledTextCtrl::SetViewEOL(bool visible) {
|
|||||||
|
|
||||||
// Retrieve a pointer to the document object.
|
// Retrieve a pointer to the document object.
|
||||||
void* wxStyledTextCtrl::GetDocPointer() {
|
void* wxStyledTextCtrl::GetDocPointer() {
|
||||||
return (void*)SendMsg(2357);
|
return (void*)SendMsg(2357);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the document object used.
|
// Change the document object used.
|
||||||
void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
|
void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
|
||||||
SendMsg(2358, 0, (long)docPointer);
|
SendMsg(2358, 0, (long)docPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set which document modification events are sent to the container.
|
// Set which document modification events are sent to the container.
|
||||||
@@ -1624,17 +1725,17 @@ int wxStyledTextCtrl::GetZoom() {
|
|||||||
// Create a new document object.
|
// Create a new document object.
|
||||||
// Starts with reference count of 1 and not selected into editor.
|
// Starts with reference count of 1 and not selected into editor.
|
||||||
void* wxStyledTextCtrl::CreateDocument() {
|
void* wxStyledTextCtrl::CreateDocument() {
|
||||||
return (void*)SendMsg(2375);
|
return (void*)SendMsg(2375);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extend life of document.
|
// Extend life of document.
|
||||||
void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
|
void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
|
||||||
SendMsg(2376, 0, (long)docPointer);
|
SendMsg(2376, 0, (long)docPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release a reference to the document, deleting document if it fades to black.
|
// Release a reference to the document, deleting document if it fades to black.
|
||||||
void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
|
void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
|
||||||
SendMsg(2377, 0, (long)docPointer);
|
SendMsg(2377, 0, (long)docPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get which document modification events are sent to the container.
|
// Get which document modification events are sent to the container.
|
||||||
@@ -1739,6 +1840,11 @@ int wxStyledTextCtrl::GetXOffset() {
|
|||||||
return SendMsg(2398, 0, 0);
|
return SendMsg(2398, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the last x chosen value to be the caret x position
|
||||||
|
void wxStyledTextCtrl::ChooseCaretX() {
|
||||||
|
SendMsg(2399, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Set the way the caret is kept visible when going sideway.
|
// Set the way the caret is kept visible when going sideway.
|
||||||
// The exclusion zone is given in pixels.
|
// The exclusion zone is given in pixels.
|
||||||
void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop) {
|
void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop) {
|
||||||
@@ -1751,6 +1857,16 @@ void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop) {
|
|||||||
SendMsg(2403, caretPolicy, caretSlop);
|
SendMsg(2403, caretPolicy, caretSlop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
|
||||||
|
void wxStyledTextCtrl::SetPrintWrapMode(int mode) {
|
||||||
|
SendMsg(2406, mode, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is printing line wrapped.
|
||||||
|
int wxStyledTextCtrl::GetPrintWrapMode() {
|
||||||
|
return SendMsg(2407, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Start notifying the container of all key presses and commands.
|
// Start notifying the container of all key presses and commands.
|
||||||
void wxStyledTextCtrl::StartRecord() {
|
void wxStyledTextCtrl::StartRecord() {
|
||||||
SendMsg(3001, 0, 0);
|
SendMsg(3001, 0, 0);
|
||||||
@@ -1928,9 +2044,7 @@ void wxStyledTextCtrl::ScrollToColumn(int column) {
|
|||||||
|
|
||||||
void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
|
void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
wxRegion region = GetUpdateRegion();
|
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
|
||||||
|
|
||||||
m_swx->DoPaint(&dc, region.GetBox());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
|
void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include "ScintillaWX.h"
|
#include "ScintillaWX.h"
|
||||||
|
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
|
#include <wx/mstream.h>
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -306,9 +307,7 @@ void wxStyledTextCtrl::ScrollToColumn(int column) {
|
|||||||
|
|
||||||
void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
|
void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
wxRegion region = GetUpdateRegion();
|
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
|
||||||
|
|
||||||
m_swx->DoPaint(&dc, region.GetBox());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
|
void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
|
||||||
|
@@ -282,6 +282,10 @@ SOURCE=.\scintilla\src\LexAda.cxx
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\scintilla\src\LexAsm.cxx
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\scintilla\src\LexAVE.cxx
|
SOURCE=.\scintilla\src\LexAVE.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -306,10 +310,18 @@ SOURCE=.\scintilla\src\LexCrontab.cxx
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\scintilla\src\LexCSS.cxx
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\scintilla\src\LexEiffel.cxx
|
SOURCE=.\scintilla\src\LexEiffel.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\scintilla\src\LexFortran.cxx
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\scintilla\src\LexHTML.cxx
|
SOURCE=.\scintilla\src\LexHTML.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -446,6 +458,10 @@ SOURCE=.\scintilla\src\WindowAccessor.cxx
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\scintilla\src\XPM.cxx
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\scintilla\include\WindowAccessor.h
|
SOURCE=.\scintilla\include\WindowAccessor.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
@@ -34,13 +34,16 @@ OBJECTS = \
|
|||||||
KeyWords.obj \
|
KeyWords.obj \
|
||||||
LexAVE.obj \
|
LexAVE.obj \
|
||||||
LexAda.obj \
|
LexAda.obj \
|
||||||
|
LexAsm.obj \
|
||||||
LexBaan.obj \
|
LexBaan.obj \
|
||||||
LexBullant.obj \
|
LexBullant.obj \
|
||||||
LexMatlab.obj \
|
LexMatlab.obj \
|
||||||
LexCPP.obj \
|
LexCPP.obj \
|
||||||
LexConf.obj \
|
LexConf.obj \
|
||||||
LexCrontab.obj \
|
LexCrontab.obj \
|
||||||
|
LexCSS.obj \
|
||||||
LexEiffel.obj \
|
LexEiffel.obj \
|
||||||
|
LexFortran.obj \
|
||||||
LexHTML.obj \
|
LexHTML.obj \
|
||||||
LexLisp.obj \
|
LexLisp.obj \
|
||||||
LexLua.obj \
|
LexLua.obj \
|
||||||
@@ -60,11 +63,13 @@ OBJECTS = \
|
|||||||
UniConversion.obj \
|
UniConversion.obj \
|
||||||
ViewStyle.obj \
|
ViewStyle.obj \
|
||||||
WindowAccessor.obj \
|
WindowAccessor.obj \
|
||||||
|
XPM.cxx \
|
||||||
\
|
\
|
||||||
PlatWX.obj \
|
PlatWX.obj \
|
||||||
ScintillaWX.obj \
|
ScintillaWX.obj \
|
||||||
stc.obj \
|
stc.obj \
|
||||||
|
|
||||||
|
|
||||||
STCCFG = stc.cfg
|
STCCFG = stc.cfg
|
||||||
STCCPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) @$(STCCFG)
|
STCCPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) @$(STCCFG)
|
||||||
|
|
||||||
|
@@ -22,13 +22,16 @@ OBJECTS = \
|
|||||||
$(S)/KeyWords.$(OBJSUFF) \
|
$(S)/KeyWords.$(OBJSUFF) \
|
||||||
$(S)/LexAVE.$(OBJSUFF) \
|
$(S)/LexAVE.$(OBJSUFF) \
|
||||||
$(S)/LexAda.$(OBJSUFF) \
|
$(S)/LexAda.$(OBJSUFF) \
|
||||||
|
$(S)/LexAsm.$(OBJSUFF) \
|
||||||
$(S)/LexBaan.$(OBJSUFF) \
|
$(S)/LexBaan.$(OBJSUFF) \
|
||||||
$(S)/LexBullant.$(OBJSUFF) \
|
$(S)/LexBullant.$(OBJSUFF) \
|
||||||
$(S)/LexMatlab.$(OBJSUFF) \
|
$(S)/LexMatlab.$(OBJSUFF) \
|
||||||
$(S)/LexCPP.$(OBJSUFF) \
|
$(S)/LexCPP.$(OBJSUFF) \
|
||||||
$(S)/LexConf.$(OBJSUFF) \
|
$(S)/LexConf.$(OBJSUFF) \
|
||||||
$(S)/LexCrontab.$(OBJSUFF) \
|
$(S)/LexCrontab.$(OBJSUFF) \
|
||||||
|
$(S)/LexCSS.$(OBJSUFF) \
|
||||||
$(S)/LexEiffel.$(OBJSUFF) \
|
$(S)/LexEiffel.$(OBJSUFF) \
|
||||||
|
$(S)/LexFortran.$(OBJSUFF) \
|
||||||
$(S)/LexHTML.$(OBJSUFF) \
|
$(S)/LexHTML.$(OBJSUFF) \
|
||||||
$(S)/LexLisp.$(OBJSUFF) \
|
$(S)/LexLisp.$(OBJSUFF) \
|
||||||
$(S)/LexLua.$(OBJSUFF) \
|
$(S)/LexLua.$(OBJSUFF) \
|
||||||
@@ -48,11 +51,13 @@ OBJECTS = \
|
|||||||
$(S)/UniConversion.$(OBJSUFF) \
|
$(S)/UniConversion.$(OBJSUFF) \
|
||||||
$(S)/ViewStyle.$(OBJSUFF) \
|
$(S)/ViewStyle.$(OBJSUFF) \
|
||||||
$(S)/WindowAccessor.$(OBJSUFF) \
|
$(S)/WindowAccessor.$(OBJSUFF) \
|
||||||
|
$(S)/XPM.$(OBJSUFF) \
|
||||||
\
|
\
|
||||||
PlatWX.$(OBJSUFF) \
|
PlatWX.$(OBJSUFF) \
|
||||||
ScintillaWX.$(OBJSUFF) \
|
ScintillaWX.$(OBJSUFF) \
|
||||||
stc.$(OBJSUFF)
|
stc.$(OBJSUFF)
|
||||||
|
|
||||||
|
|
||||||
LIBTARGET = $(WXDIR)/lib/libstc.a
|
LIBTARGET = $(WXDIR)/lib/libstc.a
|
||||||
|
|
||||||
include $(WXDIR)/src/makelib.g95
|
include $(WXDIR)/src/makelib.g95
|
@@ -27,13 +27,16 @@ OBJECTS = \
|
|||||||
$(D)\KeyWords.obj \
|
$(D)\KeyWords.obj \
|
||||||
$(D)\LexAVE.obj \
|
$(D)\LexAVE.obj \
|
||||||
$(D)\LexAda.obj \
|
$(D)\LexAda.obj \
|
||||||
|
$(D)\LexAsm.obj \
|
||||||
$(D)\LexBaan.obj \
|
$(D)\LexBaan.obj \
|
||||||
$(D)\LexBullant.obj \
|
$(D)\LexBullant.obj \
|
||||||
$(D)\LexMatlab.obj \
|
$(D)\LexMatlab.obj \
|
||||||
$(D)\LexCPP.obj \
|
$(D)\LexCPP.obj \
|
||||||
$(D)\LexConf.obj \
|
$(D)\LexConf.obj \
|
||||||
$(D)\LexCrontab.obj \
|
$(D)\LexCrontab.obj \
|
||||||
|
$(D)\LexCSS.obj \
|
||||||
$(D)\LexEiffel.obj \
|
$(D)\LexEiffel.obj \
|
||||||
|
$(D)\LexFortran.obj \
|
||||||
$(D)\LexHTML.obj \
|
$(D)\LexHTML.obj \
|
||||||
$(D)\LexLisp.obj \
|
$(D)\LexLisp.obj \
|
||||||
$(D)\LexLua.obj \
|
$(D)\LexLua.obj \
|
||||||
@@ -53,6 +56,7 @@ OBJECTS = \
|
|||||||
$(D)\UniConversion.obj \
|
$(D)\UniConversion.obj \
|
||||||
$(D)\ViewStyle.obj \
|
$(D)\ViewStyle.obj \
|
||||||
$(D)\WindowAccessor.obj \
|
$(D)\WindowAccessor.obj \
|
||||||
|
$(D)\XPM.obj \
|
||||||
\
|
\
|
||||||
$(D)\PlatWX.obj \
|
$(D)\PlatWX.obj \
|
||||||
$(D)\ScintillaWX.obj \
|
$(D)\ScintillaWX.obj \
|
||||||
|
@@ -31,13 +31,16 @@ OBJECTS = &
|
|||||||
KeyWords.obj &
|
KeyWords.obj &
|
||||||
LexAVE.obj &
|
LexAVE.obj &
|
||||||
LexAda.obj &
|
LexAda.obj &
|
||||||
|
LexAsm.obj &
|
||||||
LexBaan.obj &
|
LexBaan.obj &
|
||||||
LexBullant.obj &
|
LexBullant.obj &
|
||||||
LexMatlab.obj &
|
LexMatlab.obj &
|
||||||
LexCPP.obj &
|
LexCPP.obj &
|
||||||
LexConf.obj &
|
LexConf.obj &
|
||||||
LexCrontab.obj &
|
LexCrontab.obj &
|
||||||
|
LexCSS.obj &
|
||||||
LexEiffel.obj &
|
LexEiffel.obj &
|
||||||
|
LexFortran.obj &
|
||||||
LexHTML.obj &
|
LexHTML.obj &
|
||||||
LexLisp.obj &
|
LexLisp.obj &
|
||||||
LexLua.obj &
|
LexLua.obj &
|
||||||
@@ -57,6 +60,7 @@ OBJECTS = &
|
|||||||
UniConversion.obj &
|
UniConversion.obj &
|
||||||
ViewStyle.obj &
|
ViewStyle.obj &
|
||||||
WindowAccessor.obj &
|
WindowAccessor.obj &
|
||||||
|
XPM.obj &
|
||||||
PlatWX.obj &
|
PlatWX.obj &
|
||||||
ScintillaWX.obj &
|
ScintillaWX.obj &
|
||||||
stc.obj
|
stc.obj
|
||||||
|
Reference in New Issue
Block a user