Update Scintilla from 3.4.1 to 3.4.2
This commit is contained in:
committed by
Vadim Zeitlin
parent
b23c6512b6
commit
40a18a74f9
@@ -249,6 +249,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
wxscintilla_LexCSS.o \
|
||||
wxscintilla_LexD.o \
|
||||
wxscintilla_LexDMAP.o \
|
||||
wxscintilla_LexDMIS.o \
|
||||
wxscintilla_LexECL.o \
|
||||
wxscintilla_LexEiffel.o \
|
||||
wxscintilla_LexErlang.o \
|
||||
@@ -17098,6 +17099,9 @@ wxscintilla_LexD.o: $(srcdir)/src/stc/scintilla/lexers/LexD.cxx
|
||||
wxscintilla_LexDMAP.o: $(srcdir)/src/stc/scintilla/lexers/LexDMAP.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexDMAP.cxx
|
||||
|
||||
wxscintilla_LexDMIS.o: $(srcdir)/src/stc/scintilla/lexers/LexDMIS.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexDMIS.cxx
|
||||
|
||||
wxscintilla_LexECL.o: $(srcdir)/src/stc/scintilla/lexers/LexECL.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexECL.cxx
|
||||
|
||||
|
@@ -82,6 +82,7 @@
|
||||
src/stc/scintilla/lexers/LexCSS.cxx
|
||||
src/stc/scintilla/lexers/LexD.cxx
|
||||
src/stc/scintilla/lexers/LexDMAP.cxx
|
||||
src/stc/scintilla/lexers/LexDMIS.cxx
|
||||
src/stc/scintilla/lexers/LexECL.cxx
|
||||
src/stc/scintilla/lexers/LexEiffel.cxx
|
||||
src/stc/scintilla/lexers/LexErlang.cxx
|
||||
|
@@ -230,6 +230,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexCSS.obj \
|
||||
$(OBJS)\wxscintilla_LexD.obj \
|
||||
$(OBJS)\wxscintilla_LexDMAP.obj \
|
||||
$(OBJS)\wxscintilla_LexDMIS.obj \
|
||||
$(OBJS)\wxscintilla_LexECL.obj \
|
||||
$(OBJS)\wxscintilla_LexEiffel.obj \
|
||||
$(OBJS)\wxscintilla_LexErlang.obj \
|
||||
@@ -5980,6 +5981,9 @@ $(OBJS)\wxscintilla_LexD.obj: ..\..\src\stc\scintilla\lexers\LexD.cxx
|
||||
$(OBJS)\wxscintilla_LexDMAP.obj: ..\..\src\stc\scintilla\lexers\LexDMAP.cxx
|
||||
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMAP.cxx
|
||||
|
||||
$(OBJS)\wxscintilla_LexDMIS.obj: ..\..\src\stc\scintilla\lexers\LexDMIS.cxx
|
||||
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMIS.cxx
|
||||
|
||||
$(OBJS)\wxscintilla_LexECL.obj: ..\..\src\stc\scintilla\lexers\LexECL.cxx
|
||||
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexECL.cxx
|
||||
|
||||
|
@@ -218,6 +218,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexCSS.o \
|
||||
$(OBJS)\wxscintilla_LexD.o \
|
||||
$(OBJS)\wxscintilla_LexDMAP.o \
|
||||
$(OBJS)\wxscintilla_LexDMIS.o \
|
||||
$(OBJS)\wxscintilla_LexECL.o \
|
||||
$(OBJS)\wxscintilla_LexEiffel.o \
|
||||
$(OBJS)\wxscintilla_LexErlang.o \
|
||||
@@ -6155,6 +6156,9 @@ $(OBJS)\wxscintilla_LexD.o: ../../src/stc/scintilla/lexers/LexD.cxx
|
||||
$(OBJS)\wxscintilla_LexDMAP.o: ../../src/stc/scintilla/lexers/LexDMAP.cxx
|
||||
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\wxscintilla_LexDMIS.o: ../../src/stc/scintilla/lexers/LexDMIS.cxx
|
||||
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\wxscintilla_LexECL.o: ../../src/stc/scintilla/lexers/LexECL.cxx
|
||||
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
@@ -241,6 +241,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexCSS.obj \
|
||||
$(OBJS)\wxscintilla_LexD.obj \
|
||||
$(OBJS)\wxscintilla_LexDMAP.obj \
|
||||
$(OBJS)\wxscintilla_LexDMIS.obj \
|
||||
$(OBJS)\wxscintilla_LexECL.obj \
|
||||
$(OBJS)\wxscintilla_LexEiffel.obj \
|
||||
$(OBJS)\wxscintilla_LexErlang.obj \
|
||||
@@ -6672,6 +6673,9 @@ $(OBJS)\wxscintilla_LexD.obj: ..\..\src\stc\scintilla\lexers\LexD.cxx
|
||||
$(OBJS)\wxscintilla_LexDMAP.obj: ..\..\src\stc\scintilla\lexers\LexDMAP.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMAP.cxx
|
||||
|
||||
$(OBJS)\wxscintilla_LexDMIS.obj: ..\..\src\stc\scintilla\lexers\LexDMIS.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMIS.cxx
|
||||
|
||||
$(OBJS)\wxscintilla_LexECL.obj: ..\..\src\stc\scintilla\lexers\LexECL.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexECL.cxx
|
||||
|
||||
|
@@ -376,6 +376,9 @@
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx">
|
||||
</File>
|
||||
|
@@ -850,6 +850,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx"
|
||||
>
|
||||
|
@@ -846,6 +846,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx"
|
||||
>
|
||||
|
@@ -235,6 +235,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
|
||||
#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
|
||||
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||
#define wxSTC_FOLDFLAG_LINESTATE 0x0080
|
||||
#define wxSTC_TIME_FOREVER 10000000
|
||||
#define wxSTC_WRAP_NONE 0
|
||||
#define wxSTC_WRAP_WORD 1
|
||||
@@ -369,7 +370,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_MOD_CHANGEANNOTATION 0x20000
|
||||
#define wxSTC_MOD_CONTAINER 0x40000
|
||||
#define wxSTC_MOD_LEXERSTATE 0x80000
|
||||
#define wxSTC_MODEVENTMASKALL 0xFFFFF
|
||||
#define wxSTC_MOD_INSERTCHECK 0x100000
|
||||
#define wxSTC_MODEVENTMASKALL 0x1FFFFF
|
||||
#define wxSTC_UPDATE_CONTENT 0x1
|
||||
#define wxSTC_UPDATE_SELECTION 0x2
|
||||
#define wxSTC_UPDATE_V_SCROLL 0x4
|
||||
@@ -518,6 +520,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_LEX_RUST 111
|
||||
#define wxSTC_LEX_DMAP 112
|
||||
#define wxSTC_LEX_AS 113
|
||||
#define wxSTC_LEX_DMIS 114
|
||||
|
||||
/// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
/// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -568,6 +571,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_C_PREPROCESSORCOMMENT 23
|
||||
#define wxSTC_C_PREPROCESSORCOMMENTDOC 24
|
||||
#define wxSTC_C_USERLITERAL 25
|
||||
#define wxSTC_C_TASKMARKER 26
|
||||
#define wxSTC_C_ESCAPESEQUENCE 27
|
||||
|
||||
/// Lexical states for SCLEX_D
|
||||
#define wxSTC_D_DEFAULT 0
|
||||
@@ -2301,6 +2306,18 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_DMAP_WORD2 9
|
||||
#define wxSTC_DMAP_WORD3 10
|
||||
|
||||
/// Lexical states for SCLEX_DMIS
|
||||
#define wxSTC_DMIS_DEFAULT 0
|
||||
#define wxSTC_DMIS_COMMENT 1
|
||||
#define wxSTC_DMIS_STRING 2
|
||||
#define wxSTC_DMIS_NUMBER 3
|
||||
#define wxSTC_DMIS_KEYWORD 4
|
||||
#define wxSTC_DMIS_MAJORWORD 5
|
||||
#define wxSTC_DMIS_MINORWORD 6
|
||||
#define wxSTC_DMIS_UNSUPPORTED_MAJOR 7
|
||||
#define wxSTC_DMIS_UNSUPPORTED_MINOR 8
|
||||
#define wxSTC_DMIS_LABEL 9
|
||||
|
||||
//}}}
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
@@ -2666,6 +2683,9 @@ public:
|
||||
// Insert string at a position.
|
||||
void InsertText(int pos, const wxString& text);
|
||||
|
||||
// Change the text that is being inserted in response to SC_MOD_INSERTCHECK
|
||||
void ChangeInsertion(int length, const wxString& text);
|
||||
|
||||
// Delete all text in the document.
|
||||
void ClearAll();
|
||||
|
||||
|
@@ -191,6 +191,7 @@
|
||||
#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
|
||||
#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
|
||||
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||
#define wxSTC_FOLDFLAG_LINESTATE 0x0080
|
||||
#define wxSTC_TIME_FOREVER 10000000
|
||||
#define wxSTC_WRAP_NONE 0
|
||||
#define wxSTC_WRAP_WORD 1
|
||||
@@ -325,7 +326,8 @@
|
||||
#define wxSTC_MOD_CHANGEANNOTATION 0x20000
|
||||
#define wxSTC_MOD_CONTAINER 0x40000
|
||||
#define wxSTC_MOD_LEXERSTATE 0x80000
|
||||
#define wxSTC_MODEVENTMASKALL 0xFFFFF
|
||||
#define wxSTC_MOD_INSERTCHECK 0x100000
|
||||
#define wxSTC_MODEVENTMASKALL 0x1FFFFF
|
||||
#define wxSTC_UPDATE_CONTENT 0x1
|
||||
#define wxSTC_UPDATE_SELECTION 0x2
|
||||
#define wxSTC_UPDATE_V_SCROLL 0x4
|
||||
@@ -474,6 +476,7 @@
|
||||
#define wxSTC_LEX_RUST 111
|
||||
#define wxSTC_LEX_DMAP 112
|
||||
#define wxSTC_LEX_AS 113
|
||||
#define wxSTC_LEX_DMIS 114
|
||||
|
||||
/// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
/// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -524,6 +527,8 @@
|
||||
#define wxSTC_C_PREPROCESSORCOMMENT 23
|
||||
#define wxSTC_C_PREPROCESSORCOMMENTDOC 24
|
||||
#define wxSTC_C_USERLITERAL 25
|
||||
#define wxSTC_C_TASKMARKER 26
|
||||
#define wxSTC_C_ESCAPESEQUENCE 27
|
||||
|
||||
/// Lexical states for SCLEX_D
|
||||
#define wxSTC_D_DEFAULT 0
|
||||
@@ -2257,6 +2262,18 @@
|
||||
#define wxSTC_DMAP_WORD2 9
|
||||
#define wxSTC_DMAP_WORD3 10
|
||||
|
||||
/// Lexical states for SCLEX_DMIS
|
||||
#define wxSTC_DMIS_DEFAULT 0
|
||||
#define wxSTC_DMIS_COMMENT 1
|
||||
#define wxSTC_DMIS_STRING 2
|
||||
#define wxSTC_DMIS_NUMBER 3
|
||||
#define wxSTC_DMIS_KEYWORD 4
|
||||
#define wxSTC_DMIS_MAJORWORD 5
|
||||
#define wxSTC_DMIS_MINORWORD 6
|
||||
#define wxSTC_DMIS_UNSUPPORTED_MAJOR 7
|
||||
#define wxSTC_DMIS_UNSUPPORTED_MINOR 8
|
||||
#define wxSTC_DMIS_LABEL 9
|
||||
|
||||
//}}}
|
||||
|
||||
// Commands that can be bound to keystrokes {{{
|
||||
@@ -2708,6 +2725,11 @@ public:
|
||||
*/
|
||||
void InsertText(int pos, const wxString& text);
|
||||
|
||||
/**
|
||||
Change the text that is being inserted in response to SC_MOD_INSERTCHECK
|
||||
*/
|
||||
void ChangeInsertion(int length, const wxString& text);
|
||||
|
||||
/**
|
||||
Delete all text in the document.
|
||||
*/
|
||||
|
@@ -545,7 +545,7 @@ void ScintillaWX::Paste() {
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertPaste(selStart, buf, len);
|
||||
InsertPaste(buf, len);
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_DATAOBJ
|
||||
|
@@ -3,7 +3,7 @@ directories from the Scintilla source distribution. All other code
|
||||
needed to implement Scintilla on top of wxWidgets is located in the
|
||||
directory above this one.
|
||||
|
||||
The current version of the Scintilla code is 3.4.1
|
||||
The current version of the Scintilla code is 3.4.2
|
||||
|
||||
These are the basic steps needed to update the version of Scintilla used by wxSTC.
|
||||
|
||||
|
@@ -77,7 +77,9 @@ namespace Scintilla {
|
||||
|
||||
typedef float XYPOSITION;
|
||||
typedef double XYACCUMULATOR;
|
||||
//#define XYPOSITION int
|
||||
inline int RoundXYPosition(XYPOSITION xyPos) {
|
||||
return int(xyPos + 0.5);
|
||||
}
|
||||
|
||||
// Underlying the implementation of the platform classes are platform specific types.
|
||||
// Sometimes these need to be passed around by client code so they are defined here
|
||||
@@ -92,7 +94,7 @@ typedef void *IdlerID;
|
||||
|
||||
/**
|
||||
* A geometric point class.
|
||||
* Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably.
|
||||
* Point is similar to the Win32 POINT and GTK+ GdkPoint types.
|
||||
*/
|
||||
class Point {
|
||||
public:
|
||||
@@ -102,6 +104,10 @@ public:
|
||||
explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {
|
||||
}
|
||||
|
||||
static Point FromInts(int x_, int y_) {
|
||||
return Point(static_cast<XYPOSITION>(x_), static_cast<XYPOSITION>(y_));
|
||||
}
|
||||
|
||||
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
|
||||
|
||||
static Point FromLong(long lpoint);
|
||||
@@ -109,7 +115,7 @@ public:
|
||||
|
||||
/**
|
||||
* A geometric rectangle class.
|
||||
* PRectangle is exactly the same as the Win32 RECT so can be used interchangeably.
|
||||
* PRectangle is similar to the Win32 RECT.
|
||||
* PRectangles contain their top and left sides, but not their right and bottom sides.
|
||||
*/
|
||||
class PRectangle {
|
||||
@@ -119,10 +125,15 @@ public:
|
||||
XYPOSITION right;
|
||||
XYPOSITION bottom;
|
||||
|
||||
PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :
|
||||
explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :
|
||||
left(left_), top(top_), right(right_), bottom(bottom_) {
|
||||
}
|
||||
|
||||
static PRectangle FromInts(int left_, int top_, int right_, int bottom_) {
|
||||
return PRectangle(static_cast<XYPOSITION>(left_), static_cast<XYPOSITION>(top_),
|
||||
static_cast<XYPOSITION>(right_), static_cast<XYPOSITION>(bottom_));
|
||||
}
|
||||
|
||||
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
|
||||
|
||||
bool operator==(PRectangle &rc) const {
|
||||
@@ -512,11 +523,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
// Shut up annoying Visual C++ warnings:
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4244 4309 4514 4710)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(SCINTILLA_QT)
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
@@ -126,6 +126,7 @@
|
||||
#define SCLEX_RUST 111
|
||||
#define SCLEX_DMAP 112
|
||||
#define SCLEX_AS 113
|
||||
#define SCLEX_DMIS 114
|
||||
#define SCLEX_AUTOMATIC 1000
|
||||
#define SCE_P_DEFAULT 0
|
||||
#define SCE_P_COMMENTLINE 1
|
||||
@@ -169,6 +170,8 @@
|
||||
#define SCE_C_PREPROCESSORCOMMENT 23
|
||||
#define SCE_C_PREPROCESSORCOMMENTDOC 24
|
||||
#define SCE_C_USERLITERAL 25
|
||||
#define SCE_C_TASKMARKER 26
|
||||
#define SCE_C_ESCAPESEQUENCE 27
|
||||
#define SCE_D_DEFAULT 0
|
||||
#define SCE_D_COMMENT 1
|
||||
#define SCE_D_COMMENTLINE 2
|
||||
@@ -1700,6 +1703,16 @@
|
||||
#define SCE_DMAP_WORD 8
|
||||
#define SCE_DMAP_WORD2 9
|
||||
#define SCE_DMAP_WORD3 10
|
||||
#define SCE_DMIS_DEFAULT 0
|
||||
#define SCE_DMIS_COMMENT 1
|
||||
#define SCE_DMIS_STRING 2
|
||||
#define SCE_DMIS_NUMBER 3
|
||||
#define SCE_DMIS_KEYWORD 4
|
||||
#define SCE_DMIS_MAJORWORD 5
|
||||
#define SCE_DMIS_MINORWORD 6
|
||||
#define SCE_DMIS_UNSUPPORTED_MAJOR 7
|
||||
#define SCE_DMIS_UNSUPPORTED_MINOR 8
|
||||
#define SCE_DMIS_LABEL 9
|
||||
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
|
||||
|
||||
#endif
|
||||
|
@@ -61,6 +61,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCI_ADDTEXT 2001
|
||||
#define SCI_ADDSTYLEDTEXT 2002
|
||||
#define SCI_INSERTTEXT 2003
|
||||
#define SCI_CHANGEINSERTION 2672
|
||||
#define SCI_CLEARALL 2004
|
||||
#define SCI_DELETERANGE 2645
|
||||
#define SCI_CLEARDOCUMENTSTYLE 2005
|
||||
@@ -472,6 +473,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
|
||||
#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
|
||||
#define SC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||
#define SC_FOLDFLAG_LINESTATE 0x0080
|
||||
#define SCI_SETFOLDFLAGS 2233
|
||||
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
|
||||
#define SCI_SETTABINDENTS 2260
|
||||
@@ -956,7 +958,8 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SC_MOD_CHANGEANNOTATION 0x20000
|
||||
#define SC_MOD_CONTAINER 0x40000
|
||||
#define SC_MOD_LEXERSTATE 0x80000
|
||||
#define SC_MODEVENTMASKALL 0xFFFFF
|
||||
#define SC_MOD_INSERTCHECK 0x100000
|
||||
#define SC_MODEVENTMASKALL 0x1FFFFF
|
||||
#define SC_UPDATE_CONTENT 0x1
|
||||
#define SC_UPDATE_SELECTION 0x2
|
||||
#define SC_UPDATE_V_SCROLL 0x4
|
||||
|
@@ -98,6 +98,9 @@ fun void AddStyledText=2002(int length, cells c)
|
||||
# Insert string at a position.
|
||||
fun void InsertText=2003(position pos, string text)
|
||||
|
||||
# Change the text that is being inserted in response to SC_MOD_INSERTCHECK
|
||||
fun void ChangeInsertion=2672(int length, string text)
|
||||
|
||||
# Delete all text in the document.
|
||||
fun void ClearAll=2004(,)
|
||||
|
||||
@@ -1151,6 +1154,7 @@ 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_LINESTATE=0x0080
|
||||
|
||||
# Set some style options for folding.
|
||||
set void SetFoldFlags=2233(int flags,)
|
||||
@@ -2494,7 +2498,8 @@ val SC_MOD_CHANGEMARGIN=0x10000
|
||||
val SC_MOD_CHANGEANNOTATION=0x20000
|
||||
val SC_MOD_CONTAINER=0x40000
|
||||
val SC_MOD_LEXERSTATE=0x80000
|
||||
val SC_MODEVENTMASKALL=0xFFFFF
|
||||
val SC_MOD_INSERTCHECK=0x100000
|
||||
val SC_MODEVENTMASKALL=0x1FFFFF
|
||||
|
||||
enu Update=SC_UPDATE_
|
||||
val SC_UPDATE_CONTENT=0x1
|
||||
@@ -2659,6 +2664,7 @@ val SCLEX_KVIRC=110
|
||||
val SCLEX_RUST=111
|
||||
val SCLEX_DMAP=112
|
||||
val SCLEX_AS=113
|
||||
val SCLEX_DMIS=114
|
||||
|
||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -2711,6 +2717,8 @@ val SCE_C_HASHQUOTEDSTRING=22
|
||||
val SCE_C_PREPROCESSORCOMMENT=23
|
||||
val SCE_C_PREPROCESSORCOMMENTDOC=24
|
||||
val SCE_C_USERLITERAL=25
|
||||
val SCE_C_TASKMARKER=26
|
||||
val SCE_C_ESCAPESEQUENCE=27
|
||||
# Lexical states for SCLEX_D
|
||||
lex D=SCLEX_D SCE_D_
|
||||
val SCE_D_DEFAULT=0
|
||||
@@ -4438,6 +4446,18 @@ val SCE_DMAP_IDENTIFIER=7
|
||||
val SCE_DMAP_WORD=8
|
||||
val SCE_DMAP_WORD2=9
|
||||
val SCE_DMAP_WORD3=10
|
||||
# Lexical states for SCLEX_DMIS
|
||||
lex DMIS=SCLEX_DMIS SCE_DMIS_
|
||||
val SCE_DMIS_DEFAULT=0
|
||||
val SCE_DMIS_COMMENT=1
|
||||
val SCE_DMIS_STRING=2
|
||||
val SCE_DMIS_NUMBER=3
|
||||
val SCE_DMIS_KEYWORD=4
|
||||
val SCE_DMIS_MAJORWORD=5
|
||||
val SCE_DMIS_MINORWORD=6
|
||||
val SCE_DMIS_UNSUPPORTED_MAJOR=7
|
||||
val SCE_DMIS_UNSUPPORTED_MINOR=8
|
||||
val SCE_DMIS_LABEL=9
|
||||
|
||||
# Events
|
||||
|
||||
|
@@ -117,20 +117,20 @@ static inline bool IsDoxygenChar (const int ch)
|
||||
|
||||
static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
// Used to buffer a string, to be able to compare it using built-in functions
|
||||
char Buffer[100];
|
||||
|
||||
|
||||
// Used to know the length of an operator
|
||||
int OpType;
|
||||
|
||||
// Used to buffer a string, to be able to compare it using built-in functions
|
||||
char Buffer[100];
|
||||
|
||||
|
||||
// Used to know the length of an operator
|
||||
int OpType;
|
||||
|
||||
|
||||
// Get references to keywords lists
|
||||
WordList &cpuInstruction = *keywordlists[0];
|
||||
WordList ®isters = *keywordlists[1];
|
||||
WordList &directive = *keywordlists[2];
|
||||
WordList &extInstruction = *keywordlists[3];
|
||||
WordList &alert = *keywordlists[4];
|
||||
WordList &alert = *keywordlists[4];
|
||||
WordList &doxygenKeyword = *keywordlists[5];
|
||||
|
||||
|
||||
@@ -140,109 +140,109 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* Parse the source
|
||||
* Parse the source
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
for ( ; sc.More(); sc.Forward())
|
||||
{
|
||||
/************************************************************
|
||||
*
|
||||
* A style always terminates at the end of a line, even for
|
||||
* comments (no multi-lines comments)
|
||||
*
|
||||
************************************************************/
|
||||
if (sc.atLineStart) {
|
||||
/************************************************************
|
||||
*
|
||||
* A style always terminates at the end of a line, even for
|
||||
* comments (no multi-lines comments)
|
||||
*
|
||||
************************************************************/
|
||||
if (sc.atLineStart) {
|
||||
sc.SetState(SCE_A68K_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* If we are not in "default style", check if the style continues
|
||||
* In this case, we just have to loop
|
||||
* If we are not in "default style", check if the style continues
|
||||
* In this case, we just have to loop
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
if (sc.state != SCE_A68K_DEFAULT)
|
||||
{
|
||||
if ( ((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number
|
||||
if ( ((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number
|
||||
|| ((sc.state == SCE_A68K_NUMBER_BIN) && IsBin(sc.ch)) // Binary number
|
||||
|| ((sc.state == SCE_A68K_NUMBER_HEX) && isxdigit(sc.ch)) // Hexa number
|
||||
|| ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument
|
||||
|| ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument
|
||||
|| ((sc.state == SCE_A68K_STRING1) && (sc.ch != '\'')) // String single-quoted
|
||||
|| ((sc.state == SCE_A68K_STRING2) && (sc.ch != '\"')) // String double-quoted
|
||||
|| ((sc.state == SCE_A68K_MACRO_DECLARATION) && IsIdentifierChar(sc.ch)) // Macro declaration (or global label, we don't know at this point)
|
||||
|| ((sc.state == SCE_A68K_IDENTIFIER) && IsIdentifierChar(sc.ch)) // Identifier
|
||||
|| ((sc.state == SCE_A68K_LABEL) && IsIdentifierChar(sc.ch)) // Label (local)
|
||||
|| ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && IsDoxygenChar(sc.ch)) // Doxygen keyword
|
||||
|| ((sc.state == SCE_A68K_COMMENT_SPECIAL) && isalpha(sc.ch)) // Alert
|
||||
|| ((sc.state == SCE_A68K_COMMENT) && !isalpha(sc.ch) && (sc.ch != '\\'))) // Normal comment
|
||||
|| ((sc.state == SCE_A68K_MACRO_DECLARATION) && IsIdentifierChar(sc.ch)) // Macro declaration (or global label, we don't know at this point)
|
||||
|| ((sc.state == SCE_A68K_IDENTIFIER) && IsIdentifierChar(sc.ch)) // Identifier
|
||||
|| ((sc.state == SCE_A68K_LABEL) && IsIdentifierChar(sc.ch)) // Label (local)
|
||||
|| ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && IsDoxygenChar(sc.ch)) // Doxygen keyword
|
||||
|| ((sc.state == SCE_A68K_COMMENT_SPECIAL) && isalpha(sc.ch)) // Alert
|
||||
|| ((sc.state == SCE_A68K_COMMENT) && !isalpha(sc.ch) && (sc.ch != '\\'))) // Normal comment
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* Check if current state terminates
|
||||
*
|
||||
************************************************************/
|
||||
/************************************************************
|
||||
*
|
||||
* Check if current state terminates
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
// Strings: include terminal ' or " in the current string by skipping it
|
||||
if ((sc.state == SCE_A68K_STRING1) || (sc.state == SCE_A68K_STRING2)) {
|
||||
sc.Forward();
|
||||
// Strings: include terminal ' or " in the current string by skipping it
|
||||
if ((sc.state == SCE_A68K_STRING1) || (sc.state == SCE_A68K_STRING2)) {
|
||||
sc.Forward();
|
||||
}
|
||||
|
||||
|
||||
// If a macro declaration was terminated with ':', it was a label
|
||||
else if ((sc.state == SCE_A68K_MACRO_DECLARATION) && (sc.chPrev == ':')) {
|
||||
sc.ChangeState(SCE_A68K_LABEL);
|
||||
|
||||
|
||||
// If a macro declaration was terminated with ':', it was a label
|
||||
else if ((sc.state == SCE_A68K_MACRO_DECLARATION) && (sc.chPrev == ':')) {
|
||||
sc.ChangeState(SCE_A68K_LABEL);
|
||||
}
|
||||
|
||||
|
||||
// If it wasn't a Doxygen keyword, change it to normal comment
|
||||
else if (sc.state == SCE_A68K_COMMENT_DOXYGEN) {
|
||||
|
||||
// If it wasn't a Doxygen keyword, change it to normal comment
|
||||
else if (sc.state == SCE_A68K_COMMENT_DOXYGEN) {
|
||||
sc.GetCurrent(Buffer, sizeof(Buffer));
|
||||
if (!doxygenKeyword.InList(Buffer)) {
|
||||
if (!doxygenKeyword.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_COMMENT);
|
||||
}
|
||||
sc.SetState(SCE_A68K_COMMENT);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// If it wasn't an Alert, change it to normal comment
|
||||
else if (sc.state == SCE_A68K_COMMENT_SPECIAL) {
|
||||
sc.GetCurrent(Buffer, sizeof(Buffer));
|
||||
if (!alert.InList(Buffer)) {
|
||||
|
||||
// If it wasn't an Alert, change it to normal comment
|
||||
else if (sc.state == SCE_A68K_COMMENT_SPECIAL) {
|
||||
sc.GetCurrent(Buffer, sizeof(Buffer));
|
||||
if (!alert.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_COMMENT);
|
||||
}
|
||||
// Reset style to normal comment, or to Doxygen keyword if it begins with '\'
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else {
|
||||
// Reset style to normal comment, or to Doxygen keyword if it begins with '\'
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else {
|
||||
sc.SetState(SCE_A68K_COMMENT);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// If we are in a comment, it's a Doxygen keyword or an Alert
|
||||
else if (sc.state == SCE_A68K_COMMENT) {
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else {
|
||||
sc.SetState(SCE_A68K_COMMENT_SPECIAL);
|
||||
}
|
||||
continue;
|
||||
|
||||
// If we are in a comment, it's a Doxygen keyword or an Alert
|
||||
else if (sc.state == SCE_A68K_COMMENT) {
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else {
|
||||
sc.SetState(SCE_A68K_COMMENT_SPECIAL);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check if we are at the end of an identifier
|
||||
// In this case, colourise it if was a keyword.
|
||||
else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) {
|
||||
else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) {
|
||||
sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context
|
||||
if (cpuInstruction.InList(Buffer)) { // And check if it belongs to a keyword list
|
||||
sc.ChangeState(SCE_A68K_CPUINSTRUCTION);
|
||||
@@ -269,30 +269,30 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
// Something which begins at the beginning of a line, and with
|
||||
// - '\' + an identifier start char, or
|
||||
// - '\\@' + an identifier start char
|
||||
// is a local label (second case is used for macro local labels). We set it already as a label, it can't be a macro/equ declaration
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.chNext) && (sc.ch == '\\')) {
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && (sc.ch == '\\') && (sc.chNext == '\\')) {
|
||||
sc.Forward(2);
|
||||
if ((sc.ch == '@') && IsIdentifierStart(sc.chNext)) {
|
||||
sc.ChangeState(SCE_A68K_LABEL);
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
}
|
||||
|
||||
// Something which begins at the beginning of a line, and with
|
||||
// - '\' + an identifier start char, or
|
||||
// - '\\@' + an identifier start char
|
||||
// is a local label (second case is used for macro local labels). We set it already as a label, it can't be a macro/equ declaration
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.chNext) && (sc.ch == '\\')) {
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && (sc.ch == '\\') && (sc.chNext == '\\')) {
|
||||
sc.Forward(2);
|
||||
if ((sc.ch == '@') && IsIdentifierStart(sc.chNext)) {
|
||||
sc.ChangeState(SCE_A68K_LABEL);
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
}
|
||||
|
||||
// Label and macro identifiers start at the beginning of a line
|
||||
// We set both as a macro id, but if it wasn't one (':' at the end),
|
||||
// it will be changed as a label.
|
||||
// We set both as a macro id, but if it wasn't one (':' at the end),
|
||||
// it will be changed as a label.
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) {
|
||||
sc.SetState(SCE_A68K_MACRO_DECLARATION);
|
||||
sc.SetState(SCE_A68K_MACRO_DECLARATION);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Default: alert in a comment. If it doesn't match
|
||||
sc.SetState(SCE_A68K_COMMENT); // with an alert, it will be toggle to a normal comment
|
||||
else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Default: alert in a comment. If it doesn't match
|
||||
sc.SetState(SCE_A68K_COMMENT); // with an alert, it will be toggle to a normal comment
|
||||
}
|
||||
else if ((sc.ch < 0x80) && isdigit(sc.ch)) { // Decimal numbers haven't prefix
|
||||
sc.SetState(SCE_A68K_NUMBER_DEC);
|
||||
@@ -309,7 +309,7 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\"')) { // String (double-quoted)
|
||||
sc.SetState(SCE_A68K_STRING2);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro are prefixed with '\'
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro are prefixed with '\'
|
||||
sc.SetState(SCE_A68K_MACRO_ARG);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { // An identifier: constant, label, etc...
|
||||
|
@@ -36,7 +36,10 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static bool IsSpaceEquiv(int state) {
|
||||
namespace {
|
||||
// Use an unnamed namespace to protect the functions and classes from name conflicts
|
||||
|
||||
bool IsSpaceEquiv(int state) {
|
||||
return (state <= SCE_C_COMMENTDOC) ||
|
||||
// including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
|
||||
(state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) ||
|
||||
@@ -50,7 +53,7 @@ static bool IsSpaceEquiv(int state) {
|
||||
// a = b+++/ptn/...
|
||||
// Putting a space between the '++' post-inc operator and the '+' binary op
|
||||
// fixes this, and is highly recommended for readability anyway.
|
||||
static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
|
||||
bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
|
||||
int pos = (int) sc.currentPos;
|
||||
while (--pos > 0) {
|
||||
char ch = styler[pos];
|
||||
@@ -61,7 +64,7 @@ static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
|
||||
bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
|
||||
// Don't look at styles, so no need to flush.
|
||||
int pos = (int) sc.currentPos;
|
||||
int currentLine = styler.GetLine(pos);
|
||||
@@ -83,7 +86,120 @@ static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
|
||||
return !*s;
|
||||
}
|
||||
|
||||
static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
|
||||
bool IsSpaceOrTab(int ch) {
|
||||
return ch == ' ' || ch == '\t';
|
||||
}
|
||||
|
||||
bool OnlySpaceOrTab(const std::string &s) {
|
||||
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
|
||||
if (!IsSpaceOrTab(*it))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> StringSplit(const std::string &text, int separator) {
|
||||
std::vector<std::string> vs(text.empty() ? 0 : 1);
|
||||
for (std::string::const_iterator it = text.begin(); it != text.end(); ++it) {
|
||||
if (*it == separator) {
|
||||
vs.push_back(std::string());
|
||||
} else {
|
||||
vs.back() += *it;
|
||||
}
|
||||
}
|
||||
return vs;
|
||||
}
|
||||
|
||||
struct BracketPair {
|
||||
std::vector<std::string>::iterator itBracket;
|
||||
std::vector<std::string>::iterator itEndBracket;
|
||||
};
|
||||
|
||||
BracketPair FindBracketPair(std::vector<std::string> &tokens) {
|
||||
BracketPair bp;
|
||||
std::vector<std::string>::iterator itTok = std::find(tokens.begin(), tokens.end(), "(");
|
||||
bp.itBracket = tokens.end();
|
||||
bp.itEndBracket = tokens.end();
|
||||
if (itTok != tokens.end()) {
|
||||
bp.itBracket = itTok;
|
||||
size_t nest = 0;
|
||||
while (itTok != tokens.end()) {
|
||||
if (*itTok == "(") {
|
||||
nest++;
|
||||
} else if (*itTok == ")") {
|
||||
nest--;
|
||||
if (nest == 0) {
|
||||
bp.itEndBracket = itTok;
|
||||
return bp;
|
||||
}
|
||||
}
|
||||
++itTok;
|
||||
}
|
||||
}
|
||||
bp.itBracket = tokens.end();
|
||||
return bp;
|
||||
}
|
||||
|
||||
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
|
||||
int activity, WordList &markerList, bool caseSensitive){
|
||||
if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) {
|
||||
const int lengthMarker = 50;
|
||||
char marker[lengthMarker+1];
|
||||
int currPos = (int) sc.currentPos;
|
||||
int i = 0;
|
||||
while (i < lengthMarker) {
|
||||
char ch = styler.SafeGetCharAt(currPos + i);
|
||||
if (IsASpace(ch) || isoperator(ch)) {
|
||||
break;
|
||||
}
|
||||
if (caseSensitive)
|
||||
marker[i] = ch;
|
||||
else
|
||||
marker[i] = static_cast<char>(tolower(ch));
|
||||
i++;
|
||||
}
|
||||
marker[i] = '\0';
|
||||
if (markerList.InList(marker)) {
|
||||
sc.SetState(SCE_C_TASKMARKER|activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct EscapeSequence {
|
||||
int digitsLeft;
|
||||
CharacterSet setHexDigits;
|
||||
CharacterSet setOctDigits;
|
||||
CharacterSet setNoneNumeric;
|
||||
CharacterSet *escapeSetValid;
|
||||
EscapeSequence() {
|
||||
digitsLeft = 0;
|
||||
escapeSetValid = 0;
|
||||
setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef");
|
||||
setOctDigits = CharacterSet(CharacterSet::setNone, "01234567");
|
||||
}
|
||||
void resetEscapeState(int nextChar) {
|
||||
digitsLeft = 0;
|
||||
escapeSetValid = &setNoneNumeric;
|
||||
if (nextChar == 'U') {
|
||||
digitsLeft = 9;
|
||||
escapeSetValid = &setHexDigits;
|
||||
} else if (nextChar == 'u') {
|
||||
digitsLeft = 5;
|
||||
escapeSetValid = &setHexDigits;
|
||||
} else if (nextChar == 'x') {
|
||||
digitsLeft = 5;
|
||||
escapeSetValid = &setHexDigits;
|
||||
} else if (setOctDigits.Contains(nextChar)) {
|
||||
digitsLeft = 3;
|
||||
escapeSetValid = &setOctDigits;
|
||||
}
|
||||
}
|
||||
bool atEscapeEnd(int currChar) const {
|
||||
return (digitsLeft <= 0) || !escapeSetValid->Contains(currChar);
|
||||
}
|
||||
};
|
||||
|
||||
std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
|
||||
std::string restOfLine;
|
||||
int i =0;
|
||||
char ch = styler.SafeGetCharAt(start, '\n');
|
||||
@@ -100,40 +216,21 @@ static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace
|
||||
return restOfLine;
|
||||
}
|
||||
|
||||
static bool IsStreamCommentStyle(int style) {
|
||||
bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_C_COMMENT ||
|
||||
style == SCE_C_COMMENTDOC ||
|
||||
style == SCE_C_COMMENTDOCKEYWORD ||
|
||||
style == SCE_C_COMMENTDOCKEYWORDERROR;
|
||||
}
|
||||
|
||||
static std::vector<std::string> Tokenize(const std::string &s) {
|
||||
// Break into space separated tokens
|
||||
std::string word;
|
||||
std::vector<std::string> tokens;
|
||||
for (const char *cp = s.c_str(); *cp; cp++) {
|
||||
if ((*cp == ' ') || (*cp == '\t')) {
|
||||
if (!word.empty()) {
|
||||
tokens.push_back(word);
|
||||
word = "";
|
||||
}
|
||||
} else {
|
||||
word += *cp;
|
||||
}
|
||||
}
|
||||
if (!word.empty()) {
|
||||
tokens.push_back(word);
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
struct PPDefinition {
|
||||
int line;
|
||||
std::string key;
|
||||
std::string value;
|
||||
bool isUndef;
|
||||
PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false) :
|
||||
line(line_), key(key_), value(value_), isUndef(isUndef_) {
|
||||
std::string arguments;
|
||||
PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
|
||||
line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {
|
||||
}
|
||||
};
|
||||
|
||||
@@ -211,6 +308,8 @@ struct OptionsCPP {
|
||||
bool updatePreprocessor;
|
||||
bool triplequotedStrings;
|
||||
bool hashquotedStrings;
|
||||
bool backQuotedStrings;
|
||||
bool escapeSequence;
|
||||
bool fold;
|
||||
bool foldSyntaxBased;
|
||||
bool foldComment;
|
||||
@@ -229,6 +328,8 @@ struct OptionsCPP {
|
||||
updatePreprocessor = true;
|
||||
triplequotedStrings = false;
|
||||
hashquotedStrings = false;
|
||||
backQuotedStrings = false;
|
||||
escapeSequence = false;
|
||||
fold = false;
|
||||
foldSyntaxBased = true;
|
||||
foldComment = false;
|
||||
@@ -243,12 +344,13 @@ struct OptionsCPP {
|
||||
}
|
||||
};
|
||||
|
||||
static const char *const cppWordLists[] = {
|
||||
const char *const cppWordLists[] = {
|
||||
"Primary keywords and identifiers",
|
||||
"Secondary keywords and identifiers",
|
||||
"Documentation comment keywords",
|
||||
"Global classes and typedefs",
|
||||
"Preprocessor definitions",
|
||||
"Task marker and error marker keywords",
|
||||
0,
|
||||
};
|
||||
|
||||
@@ -274,6 +376,12 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
|
||||
DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings,
|
||||
"Set to 1 to enable highlighting of hash-quoted strings.");
|
||||
|
||||
DefineProperty("lexer.cpp.backquoted.strings", &OptionsCPP::backQuotedStrings,
|
||||
"Set to 1 to enable highlighting of back-quoted raw strings .");
|
||||
|
||||
DefineProperty("lexer.cpp.escape.sequence", &OptionsCPP::escapeSequence,
|
||||
"Set to 1 to enable highlighting of escape sequences in strings");
|
||||
|
||||
DefineProperty("fold", &OptionsCPP::fold);
|
||||
|
||||
DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased,
|
||||
@@ -312,7 +420,9 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
|
||||
}
|
||||
};
|
||||
|
||||
static const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0};
|
||||
const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0};
|
||||
|
||||
}
|
||||
|
||||
class LexerCPP : public ILexerWithSubStyles {
|
||||
bool caseSensitive;
|
||||
@@ -321,6 +431,7 @@ class LexerCPP : public ILexerWithSubStyles {
|
||||
CharacterSet setArithmethicOp;
|
||||
CharacterSet setRelOp;
|
||||
CharacterSet setLogicalOp;
|
||||
CharacterSet setWordStart;
|
||||
PPStates vlls;
|
||||
std::vector<PPDefinition> ppDefineHistory;
|
||||
WordList keywords;
|
||||
@@ -328,9 +439,26 @@ class LexerCPP : public ILexerWithSubStyles {
|
||||
WordList keywords3;
|
||||
WordList keywords4;
|
||||
WordList ppDefinitions;
|
||||
std::map<std::string, std::string> preprocessorDefinitionsStart;
|
||||
WordList markerList;
|
||||
struct SymbolValue {
|
||||
std::string value;
|
||||
std::string arguments;
|
||||
SymbolValue(const std::string &value_="", const std::string &arguments_="") : value(value_), arguments(arguments_) {
|
||||
}
|
||||
SymbolValue &operator = (const std::string &value_) {
|
||||
value = value_;
|
||||
arguments.clear();
|
||||
return *this;
|
||||
}
|
||||
bool IsMacro() const {
|
||||
return !arguments.empty();
|
||||
}
|
||||
};
|
||||
typedef std::map<std::string, SymbolValue> SymbolTable;
|
||||
SymbolTable preprocessorDefinitionsStart;
|
||||
OptionsCPP options;
|
||||
OptionSetCPP osCPP;
|
||||
EscapeSequence escapeSeq;
|
||||
SparseState<std::string> rawStringTerminators;
|
||||
enum { activeFlag = 0x40 };
|
||||
enum { ssIdentifier, ssDocKeyword };
|
||||
@@ -394,7 +522,7 @@ public:
|
||||
}
|
||||
int SCI_METHOD PrimaryStyleFromStyle(int style) {
|
||||
return MaskActive(style);
|
||||
}
|
||||
}
|
||||
void SCI_METHOD FreeSubStyles() {
|
||||
subStyles.Free();
|
||||
}
|
||||
@@ -417,8 +545,9 @@ public:
|
||||
static int MaskActive(int style) {
|
||||
return style & ~activeFlag;
|
||||
}
|
||||
void EvaluateTokens(std::vector<std::string> &tokens);
|
||||
bool EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions);
|
||||
void EvaluateTokens(std::vector<std::string> &tokens, const SymbolTable &preprocessorDefinitions);
|
||||
std::vector<std::string> Tokenize(const std::string &expr) const;
|
||||
bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions);
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
|
||||
@@ -452,6 +581,9 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
|
||||
case 4:
|
||||
wordListN = &ppDefinitions;
|
||||
break;
|
||||
case 5:
|
||||
wordListN = &markerList;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
if (wordListN) {
|
||||
@@ -469,7 +601,16 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
|
||||
if (cpEquals) {
|
||||
std::string name(cpDefinition, cpEquals - cpDefinition);
|
||||
std::string val(cpEquals+1);
|
||||
preprocessorDefinitionsStart[name] = val;
|
||||
size_t bracket = name.find('(');
|
||||
size_t bracketEnd = name.find(')');
|
||||
if ((bracket != std::string::npos) && (bracketEnd != std::string::npos)) {
|
||||
// Macro
|
||||
std::string args = name.substr(bracket + 1, bracketEnd - bracket - 1);
|
||||
name = name.substr(0, bracket);
|
||||
preprocessorDefinitionsStart[name] = SymbolValue(val, args);
|
||||
} else {
|
||||
preprocessorDefinitionsStart[name] = val;
|
||||
}
|
||||
} else {
|
||||
std::string name(cpDefinition);
|
||||
std::string val("1");
|
||||
@@ -499,7 +640,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
|
||||
|
||||
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
|
||||
setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true);
|
||||
|
||||
CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\t\v\f\n");
|
||||
|
||||
@@ -511,6 +652,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
int visibleChars = 0;
|
||||
bool lastWordWasUUID = false;
|
||||
int styleBeforeDCKeyword = SCE_C_DEFAULT;
|
||||
int styleBeforeTaskMarker = SCE_C_DEFAULT;
|
||||
bool continuationLine = false;
|
||||
bool isIncludePreprocessor = false;
|
||||
bool isStringInPreprocessor = false;
|
||||
@@ -540,7 +682,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler, static_cast<char>(0xff));
|
||||
StyleContext sc(startPos, length, initStyle, styler, static_cast<unsigned char>(0xff));
|
||||
LinePPState preproc = vlls.ForLine(lineCurrent);
|
||||
|
||||
bool definitionsChanged = false;
|
||||
@@ -556,12 +698,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
definitionsChanged = true;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> preprocessorDefinitions = preprocessorDefinitionsStart;
|
||||
SymbolTable preprocessorDefinitions = preprocessorDefinitionsStart;
|
||||
for (std::vector<PPDefinition>::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) {
|
||||
if (itDef->isUndef)
|
||||
preprocessorDefinitions.erase(itDef->key);
|
||||
else
|
||||
preprocessorDefinitions[itDef->key] = itDef->value;
|
||||
preprocessorDefinitions[itDef->key] = SymbolValue(itDef->value, itDef->arguments);
|
||||
}
|
||||
|
||||
std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1);
|
||||
@@ -581,13 +723,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
// Inside inactive preprocessor declaration, state will be reset anyway at the end of this block.
|
||||
if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) {
|
||||
// Prevent SCE_C_STRINGEOL from leaking back to previous line which
|
||||
// ends with a line continuation by locking in the state upto this position.
|
||||
// ends with a line continuation by locking in the state up to this position.
|
||||
sc.SetState(sc.state);
|
||||
}
|
||||
if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) {
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
}
|
||||
// Reset states to begining of colourise so no surprises
|
||||
// Reset states to beginning of colourise so no surprises
|
||||
// if different sets of lines lexed.
|
||||
visibleChars = 0;
|
||||
lastWordWasUUID = false;
|
||||
@@ -725,6 +867,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
if (sc.Match('*', '/')) {
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
|
||||
} else {
|
||||
styleBeforeTaskMarker = SCE_C_COMMENT;
|
||||
highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive);
|
||||
}
|
||||
break;
|
||||
case SCE_C_COMMENTDOC:
|
||||
@@ -742,6 +887,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
case SCE_C_COMMENTLINE:
|
||||
if (sc.atLineStart && !continuationLine) {
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
} else {
|
||||
styleBeforeTaskMarker = SCE_C_COMMENTLINE;
|
||||
highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive);
|
||||
}
|
||||
break;
|
||||
case SCE_C_COMMENTLINEDOC:
|
||||
@@ -794,9 +942,11 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
isIncludePreprocessor = false;
|
||||
}
|
||||
} else if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||
sc.Forward();
|
||||
if (options.escapeSequence) {
|
||||
sc.SetState(SCE_C_ESCAPESEQUENCE|activitySet);
|
||||
escapeSeq.resetEscapeState(sc.chNext);
|
||||
}
|
||||
sc.Forward(); // Skip all characters after the backslash
|
||||
} else if (sc.ch == '\"') {
|
||||
if (sc.chNext == '_') {
|
||||
sc.ChangeState(SCE_C_USERLITERAL|activitySet);
|
||||
@@ -805,6 +955,24 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SCE_C_ESCAPESEQUENCE:
|
||||
escapeSeq.digitsLeft--;
|
||||
if (!escapeSeq.atEscapeEnd(sc.ch)) {
|
||||
break;
|
||||
}
|
||||
if (sc.ch == '"') {
|
||||
sc.SetState(SCE_C_STRING|activitySet);
|
||||
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
|
||||
} else if (sc.ch == '\\') {
|
||||
escapeSeq.resetEscapeState(sc.chNext);
|
||||
sc.Forward();
|
||||
} else {
|
||||
sc.SetState(SCE_C_STRING|activitySet);
|
||||
if (sc.atLineEnd) {
|
||||
sc.ChangeState(SCE_C_STRINGEOL|activitySet);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SCE_C_HASHQUOTEDSTRING:
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||
@@ -880,6 +1048,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
if (sc.atLineEnd || sc.ch == ')') {
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
}
|
||||
break;
|
||||
case SCE_C_TASKMARKER:
|
||||
if (isoperator(sc.ch) || IsASpace(sc.ch)) {
|
||||
sc.SetState(styleBeforeTaskMarker|activitySet);
|
||||
styleBeforeTaskMarker = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
if (sc.atLineEnd && !atLineEndBeforeSwitch) {
|
||||
@@ -900,6 +1074,10 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
} else if (options.hashquotedStrings && sc.Match('#', '\"')) {
|
||||
sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet);
|
||||
sc.Forward();
|
||||
} else if (options.backQuotedStrings && sc.Match('`')) {
|
||||
sc.SetState(SCE_C_STRINGRAW|activitySet);
|
||||
rawStringTerminator = "`";
|
||||
sc.Forward();
|
||||
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
if (lastWordWasUUID) {
|
||||
sc.SetState(SCE_C_UUID|activitySet);
|
||||
@@ -1018,19 +1196,35 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
} else if (sc.Match("define")) {
|
||||
if (options.updatePreprocessor && !preproc.IsInactive()) {
|
||||
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true);
|
||||
if (restOfLine.find(")") == std::string::npos) { // Don't handle macros with arguments
|
||||
std::vector<std::string> tokens = Tokenize(restOfLine);
|
||||
std::string key;
|
||||
std::string value("1");
|
||||
if (tokens.size() >= 1) {
|
||||
key = tokens[0];
|
||||
if (tokens.size() >= 2) {
|
||||
value = tokens[1];
|
||||
}
|
||||
preprocessorDefinitions[key] = value;
|
||||
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
|
||||
definitionsChanged = true;
|
||||
}
|
||||
size_t startName = 0;
|
||||
while ((startName < restOfLine.length()) && IsSpaceOrTab(restOfLine[startName]))
|
||||
startName++;
|
||||
size_t endName = startName;
|
||||
while ((endName < restOfLine.length()) && setWord.Contains(static_cast<unsigned char>(restOfLine[endName])))
|
||||
endName++;
|
||||
std::string key = restOfLine.substr(startName, endName-startName);
|
||||
if (restOfLine[endName] == '(') {
|
||||
// Macro
|
||||
size_t endArgs = endName;
|
||||
while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')'))
|
||||
endArgs++;
|
||||
std::string args = restOfLine.substr(endName + 1, endArgs - endName - 1);
|
||||
size_t startValue = endArgs+1;
|
||||
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
|
||||
startValue++;
|
||||
std::string value = restOfLine.substr(startValue);
|
||||
preprocessorDefinitions[key] = SymbolValue(value, args);
|
||||
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
|
||||
definitionsChanged = true;
|
||||
} else {
|
||||
// Value
|
||||
size_t startValue = endName;
|
||||
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
|
||||
startValue++;
|
||||
std::string value = restOfLine.substr(startValue);
|
||||
preprocessorDefinitions[key] = value;
|
||||
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
|
||||
definitionsChanged = true;
|
||||
}
|
||||
}
|
||||
} else if (sc.Match("undef")) {
|
||||
@@ -1180,19 +1374,36 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
|
||||
void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
|
||||
void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTable &preprocessorDefinitions) {
|
||||
|
||||
// Evaluate defined() statements to either 0 or 1
|
||||
for (size_t i=0; (i+2)<tokens.size();) {
|
||||
if ((tokens[i] == "defined") && (tokens[i+1] == "(")) {
|
||||
// Remove whitespace tokens
|
||||
tokens.erase(std::remove_if(tokens.begin(), tokens.end(), OnlySpaceOrTab), tokens.end());
|
||||
|
||||
// Evaluate defined statements to either 0 or 1
|
||||
for (size_t i=0; (i+1)<tokens.size();) {
|
||||
if (tokens[i] == "defined") {
|
||||
const char *val = "0";
|
||||
if (tokens[i+2] == ")") {
|
||||
// defined()
|
||||
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3);
|
||||
} else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) {
|
||||
// defined(<int>)
|
||||
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4);
|
||||
val = "1";
|
||||
if (tokens[i+1] == "(") {
|
||||
if (((i + 2)<tokens.size()) && (tokens[i + 2] == ")")) {
|
||||
// defined()
|
||||
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3);
|
||||
} else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) {
|
||||
// defined(<identifier>)
|
||||
SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+2]);
|
||||
if (it != preprocessorDefinitions.end()) {
|
||||
val = "1";
|
||||
}
|
||||
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4);
|
||||
} else {
|
||||
// Spurious '(' so erase as more likely to result in false
|
||||
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 2);
|
||||
}
|
||||
} else {
|
||||
// defined <identifier>
|
||||
SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+1]);
|
||||
if (it != preprocessorDefinitions.end()) {
|
||||
val = "1";
|
||||
}
|
||||
}
|
||||
tokens[i] = val;
|
||||
} else {
|
||||
@@ -1200,21 +1411,82 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate identifiers
|
||||
const size_t maxIterations = 100;
|
||||
size_t iterations = 0; // Limit number of iterations in case there is a recursive macro.
|
||||
for (size_t i = 0; (i<tokens.size()) && (iterations < maxIterations);) {
|
||||
iterations++;
|
||||
if (setWordStart.Contains(static_cast<unsigned char>(tokens[i][0]))) {
|
||||
SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i]);
|
||||
if (it != preprocessorDefinitions.end()) {
|
||||
// Tokenize value
|
||||
std::vector<std::string> macroTokens = Tokenize(it->second.value);
|
||||
if (it->second.IsMacro()) {
|
||||
if ((i + 1 < tokens.size()) && (tokens.at(i + 1) == "(")) {
|
||||
// Create map of argument name to value
|
||||
std::vector<std::string> argumentNames = StringSplit(it->second.arguments, ',');
|
||||
std::map<std::string, std::string> arguments;
|
||||
size_t arg = 0;
|
||||
size_t tok = i+2;
|
||||
while ((tok < tokens.size()) && (arg < argumentNames.size()) && (tokens.at(tok) != ")")) {
|
||||
if (tokens.at(tok) != ",") {
|
||||
arguments[argumentNames.at(arg)] = tokens.at(tok);
|
||||
arg++;
|
||||
}
|
||||
tok++;
|
||||
}
|
||||
|
||||
// Remove invocation
|
||||
tokens.erase(tokens.begin() + i, tokens.begin() + tok + 1);
|
||||
|
||||
// Substitute values into macro
|
||||
macroTokens.erase(std::remove_if(macroTokens.begin(), macroTokens.end(), OnlySpaceOrTab), macroTokens.end());
|
||||
|
||||
for (size_t iMacro = 0; iMacro < macroTokens.size();) {
|
||||
if (setWordStart.Contains(static_cast<unsigned char>(macroTokens[iMacro][0]))) {
|
||||
std::map<std::string, std::string>::const_iterator itFind = arguments.find(macroTokens[iMacro]);
|
||||
if (itFind != arguments.end()) {
|
||||
// TODO: Possible that value will be expression so should insert tokenized form
|
||||
macroTokens[iMacro] = itFind->second;
|
||||
}
|
||||
}
|
||||
iMacro++;
|
||||
}
|
||||
|
||||
// Insert results back into tokens
|
||||
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
|
||||
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
// Remove invocation
|
||||
tokens.erase(tokens.begin() + i);
|
||||
// Insert results back into tokens
|
||||
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
|
||||
}
|
||||
} else {
|
||||
// Identifier not found
|
||||
tokens.erase(tokens.begin() + i);
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Find bracketed subexpressions and recurse on them
|
||||
std::vector<std::string>::iterator itBracket = std::find(tokens.begin(), tokens.end(), "(");
|
||||
std::vector<std::string>::iterator itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
|
||||
while ((itBracket != tokens.end()) && (itEndBracket != tokens.end()) && (itEndBracket > itBracket)) {
|
||||
std::vector<std::string> inBracket(itBracket + 1, itEndBracket);
|
||||
EvaluateTokens(inBracket);
|
||||
BracketPair bracketPair = FindBracketPair(tokens);
|
||||
while (bracketPair.itBracket != tokens.end()) {
|
||||
std::vector<std::string> inBracket(bracketPair.itBracket + 1, bracketPair.itEndBracket);
|
||||
EvaluateTokens(inBracket, preprocessorDefinitions);
|
||||
|
||||
// The insertion is done before the removal because there were failures with the opposite approach
|
||||
tokens.insert(itBracket, inBracket.begin(), inBracket.end());
|
||||
itBracket = std::find(tokens.begin(), tokens.end(), "(");
|
||||
itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
|
||||
tokens.erase(itBracket, itEndBracket + 1);
|
||||
tokens.insert(bracketPair.itBracket, inBracket.begin(), inBracket.end());
|
||||
|
||||
itBracket = std::find(tokens.begin(), tokens.end(), "(");
|
||||
itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
|
||||
bracketPair = FindBracketPair(tokens);
|
||||
tokens.erase(bracketPair.itBracket, bracketPair.itEndBracket + 1);
|
||||
|
||||
bracketPair = FindBracketPair(tokens);
|
||||
}
|
||||
|
||||
// Evaluate logical negations
|
||||
@@ -1283,45 +1555,51 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
|
||||
}
|
||||
}
|
||||
|
||||
bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions) {
|
||||
// Break into tokens, replacing with definitions
|
||||
std::string word;
|
||||
std::vector<std::string> LexerCPP::Tokenize(const std::string &expr) const {
|
||||
// Break into tokens
|
||||
std::vector<std::string> tokens;
|
||||
const char *cp = expr.c_str();
|
||||
for (;;) {
|
||||
while (*cp) {
|
||||
std::string word;
|
||||
if (setWord.Contains(static_cast<unsigned char>(*cp))) {
|
||||
// Identifiers and numbers
|
||||
while (setWord.Contains(static_cast<unsigned char>(*cp))) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
}
|
||||
} else if (IsSpaceOrTab(*cp)) {
|
||||
while (IsSpaceOrTab(*cp)) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
}
|
||||
} else if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
}
|
||||
} else if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
}
|
||||
} else {
|
||||
std::map<std::string, std::string>::const_iterator it = preprocessorDefinitions.find(word);
|
||||
if (it != preprocessorDefinitions.end()) {
|
||||
tokens.push_back(it->second);
|
||||
} else if (!word.empty() && ((word[0] >= '0' && word[0] <= '9') || (word == "defined"))) {
|
||||
tokens.push_back(word);
|
||||
}
|
||||
word = "";
|
||||
if (!*cp) {
|
||||
break;
|
||||
}
|
||||
if ((*cp != ' ') && (*cp != '\t')) {
|
||||
std::string op(cp, 1);
|
||||
if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
if (setRelOp.Contains(static_cast<unsigned char>(cp[1]))) {
|
||||
op += cp[1];
|
||||
cp++;
|
||||
}
|
||||
} else if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
if (setLogicalOp.Contains(static_cast<unsigned char>(cp[1]))) {
|
||||
op += cp[1];
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
tokens.push_back(op);
|
||||
}
|
||||
// Should handle strings, characters, and comments here
|
||||
word += *cp;
|
||||
cp++;
|
||||
}
|
||||
cp++;
|
||||
tokens.push_back(word);
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
EvaluateTokens(tokens);
|
||||
bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions) {
|
||||
std::vector<std::string> tokens = Tokenize(expr);
|
||||
|
||||
EvaluateTokens(tokens, preprocessorDefinitions);
|
||||
|
||||
// "0" or "" -> false else true
|
||||
bool isFalse = tokens.empty() ||
|
||||
|
@@ -158,7 +158,7 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
|
||||
if (sc.atLineStart) {
|
||||
// Reset states to begining of colourise so no surprises
|
||||
// Reset states to beginning of colourise so no surprises
|
||||
// if different sets of lines lexed.
|
||||
visibleChars = 0;
|
||||
lastWordWasUUID = false;
|
||||
|
355
src/stc/scintilla/lexers/LexDMIS.cxx
Normal file
355
src/stc/scintilla/lexers/LexDMIS.cxx
Normal file
@@ -0,0 +1,355 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexDMIS.cxx
|
||||
** Lexer for DMIS.
|
||||
**/
|
||||
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
|
||||
// Copyright 2013-2014 by Andreas Tscharner <andy@vis.ethz.ch>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "SciLexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
#include "LexerModule.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "WordList.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
|
||||
static const char *const DMISWordListDesc[] = {
|
||||
"DMIS Major Words",
|
||||
"DMIS Minor Words",
|
||||
"Unsupported DMIS Major Words",
|
||||
"Unsupported DMIS Minor Words",
|
||||
"Keywords for code folding start",
|
||||
"Corresponding keywords for code folding end",
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
class LexerDMIS : public ILexer
|
||||
{
|
||||
private:
|
||||
char *m_wordListSets;
|
||||
WordList m_majorWords;
|
||||
WordList m_minorWords;
|
||||
WordList m_unsupportedMajor;
|
||||
WordList m_unsupportedMinor;
|
||||
WordList m_codeFoldingStart;
|
||||
WordList m_codeFoldingEnd;
|
||||
|
||||
char * SCI_METHOD UpperCase(char *item);
|
||||
void SCI_METHOD InitWordListSets(void);
|
||||
|
||||
public:
|
||||
LexerDMIS(void);
|
||||
virtual ~LexerDMIS(void);
|
||||
|
||||
int SCI_METHOD Version() const {
|
||||
return lvOriginal;
|
||||
}
|
||||
|
||||
void SCI_METHOD Release() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
const char * SCI_METHOD PropertyNames() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int SCI_METHOD PropertyType(const char *) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char * SCI_METHOD DescribeProperty(const char *) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int SCI_METHOD PropertySet(const char *, const char *) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ILexer *LexerFactoryDMIS() {
|
||||
return new LexerDMIS;
|
||||
}
|
||||
|
||||
const char * SCI_METHOD DescribeWordListSets();
|
||||
void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
|
||||
};
|
||||
|
||||
|
||||
char * SCI_METHOD LexerDMIS::UpperCase(char *item)
|
||||
{
|
||||
char *itemStart;
|
||||
|
||||
|
||||
itemStart = item;
|
||||
while (item && *item) {
|
||||
*item = toupper(*item);
|
||||
item++;
|
||||
};
|
||||
return itemStart;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerDMIS::InitWordListSets(void)
|
||||
{
|
||||
size_t totalLen = 0;
|
||||
|
||||
|
||||
for (int i=0; DMISWordListDesc[i]; i++) {
|
||||
totalLen += strlen(DMISWordListDesc[i]);
|
||||
totalLen++;
|
||||
};
|
||||
|
||||
totalLen++;
|
||||
this->m_wordListSets = new char[totalLen];
|
||||
memset(this->m_wordListSets, 0, totalLen);
|
||||
|
||||
for (int i=0; DMISWordListDesc[i]; i++) {
|
||||
strcat(this->m_wordListSets, DMISWordListDesc[i]);
|
||||
strcat(this->m_wordListSets, "\n");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
LexerDMIS::LexerDMIS(void) {
|
||||
this->InitWordListSets();
|
||||
|
||||
this->m_majorWords.Clear();
|
||||
this->m_minorWords.Clear();
|
||||
this->m_unsupportedMajor.Clear();
|
||||
this->m_unsupportedMinor.Clear();
|
||||
this->m_codeFoldingStart.Clear();
|
||||
this->m_codeFoldingEnd.Clear();
|
||||
}
|
||||
|
||||
LexerDMIS::~LexerDMIS(void) {
|
||||
delete[] this->m_wordListSets;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerDMIS::WordListSet(int n, const char *wl)
|
||||
{
|
||||
switch (n) {
|
||||
case 0:
|
||||
this->m_majorWords.Clear();
|
||||
this->m_majorWords.Set(wl);
|
||||
break;
|
||||
case 1:
|
||||
this->m_minorWords.Clear();
|
||||
this->m_minorWords.Set(wl);
|
||||
break;
|
||||
case 2:
|
||||
this->m_unsupportedMajor.Clear();
|
||||
this->m_unsupportedMajor.Set(wl);
|
||||
break;
|
||||
case 3:
|
||||
this->m_unsupportedMinor.Clear();
|
||||
this->m_unsupportedMinor.Set(wl);
|
||||
break;
|
||||
case 4:
|
||||
this->m_codeFoldingStart.Clear();
|
||||
this->m_codeFoldingStart.Set(wl);
|
||||
break;
|
||||
case 5:
|
||||
this->m_codeFoldingEnd.Clear();
|
||||
this->m_codeFoldingEnd.Set(wl);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * SCI_METHOD LexerDMIS::DescribeWordListSets()
|
||||
{
|
||||
return this->m_wordListSets;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerDMIS::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess)
|
||||
{
|
||||
const unsigned int MAX_STR_LEN = 100;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
StyleContext scCTX(startPos, lengthDoc, initStyle, styler);
|
||||
CharacterSet setDMISNumber(CharacterSet::setDigits, ".-+eE");
|
||||
CharacterSet setDMISWordStart(CharacterSet::setAlpha, "-234", 0x80, true);
|
||||
CharacterSet setDMISWord(CharacterSet::setAlpha);
|
||||
|
||||
|
||||
bool isIFLine = false;
|
||||
|
||||
for (; scCTX.More(); scCTX.Forward()) {
|
||||
if (scCTX.atLineEnd) {
|
||||
isIFLine = false;
|
||||
};
|
||||
|
||||
switch (scCTX.state) {
|
||||
case SCE_DMIS_DEFAULT:
|
||||
if (scCTX.Match('$', '$')) {
|
||||
scCTX.SetState(SCE_DMIS_COMMENT);
|
||||
scCTX.Forward();
|
||||
};
|
||||
if (scCTX.Match('\'')) {
|
||||
scCTX.SetState(SCE_DMIS_STRING);
|
||||
};
|
||||
if (IsADigit(scCTX.ch) || ((scCTX.Match('-') || scCTX.Match('+')) && IsADigit(scCTX.chNext))) {
|
||||
scCTX.SetState(SCE_DMIS_NUMBER);
|
||||
break;
|
||||
};
|
||||
if (setDMISWordStart.Contains(scCTX.ch)) {
|
||||
scCTX.SetState(SCE_DMIS_KEYWORD);
|
||||
};
|
||||
if (scCTX.Match('(') && (!isIFLine)) {
|
||||
scCTX.SetState(SCE_DMIS_LABEL);
|
||||
};
|
||||
break;
|
||||
|
||||
case SCE_DMIS_COMMENT:
|
||||
if (scCTX.atLineEnd) {
|
||||
scCTX.SetState(SCE_DMIS_DEFAULT);
|
||||
};
|
||||
break;
|
||||
|
||||
case SCE_DMIS_STRING:
|
||||
if (scCTX.Match('\'')) {
|
||||
scCTX.SetState(SCE_DMIS_DEFAULT);
|
||||
};
|
||||
break;
|
||||
|
||||
case SCE_DMIS_NUMBER:
|
||||
if (!setDMISNumber.Contains(scCTX.ch)) {
|
||||
scCTX.SetState(SCE_DMIS_DEFAULT);
|
||||
};
|
||||
break;
|
||||
|
||||
case SCE_DMIS_KEYWORD:
|
||||
if (!setDMISWord.Contains(scCTX.ch)) {
|
||||
char tmpStr[MAX_STR_LEN];
|
||||
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
|
||||
scCTX.GetCurrent(tmpStr, (MAX_STR_LEN-1));
|
||||
strncpy(tmpStr, this->UpperCase(tmpStr), (MAX_STR_LEN-1));
|
||||
|
||||
if (this->m_minorWords.InList(tmpStr)) {
|
||||
scCTX.ChangeState(SCE_DMIS_MINORWORD);
|
||||
};
|
||||
if (this->m_majorWords.InList(tmpStr)) {
|
||||
isIFLine = (strcmp(tmpStr, "IF") == 0);
|
||||
scCTX.ChangeState(SCE_DMIS_MAJORWORD);
|
||||
};
|
||||
if (this->m_unsupportedMajor.InList(tmpStr)) {
|
||||
scCTX.ChangeState(SCE_DMIS_UNSUPPORTED_MAJOR);
|
||||
};
|
||||
if (this->m_unsupportedMinor.InList(tmpStr)) {
|
||||
scCTX.ChangeState(SCE_DMIS_UNSUPPORTED_MINOR);
|
||||
};
|
||||
|
||||
if (scCTX.Match('(') && (!isIFLine)) {
|
||||
scCTX.SetState(SCE_DMIS_LABEL);
|
||||
} else {
|
||||
scCTX.SetState(SCE_DMIS_DEFAULT);
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case SCE_DMIS_LABEL:
|
||||
if (scCTX.Match(')')) {
|
||||
scCTX.SetState(SCE_DMIS_DEFAULT);
|
||||
};
|
||||
break;
|
||||
};
|
||||
};
|
||||
scCTX.Complete();
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerDMIS::Fold(unsigned int startPos, int lengthDoc, int, IDocument *pAccess)
|
||||
{
|
||||
const int MAX_STR_LEN = 100;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
unsigned int endPos = startPos + lengthDoc;
|
||||
char chNext = styler[startPos];
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
int strPos = 0;
|
||||
bool foldWordPossible = false;
|
||||
CharacterSet setDMISFoldWord(CharacterSet::setAlpha);
|
||||
char *tmpStr;
|
||||
|
||||
|
||||
tmpStr = new char[MAX_STR_LEN];
|
||||
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
|
||||
|
||||
for (unsigned int i=startPos; i<endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i+1);
|
||||
|
||||
bool atEOL = ((ch == '\r' && chNext != '\n') || (ch == '\n'));
|
||||
|
||||
if (strPos >= (MAX_STR_LEN-1)) {
|
||||
strPos = MAX_STR_LEN-1;
|
||||
};
|
||||
|
||||
int style = styler.StyleAt(i);
|
||||
bool noFoldPos = ((style == SCE_DMIS_COMMENT) || (style == SCE_DMIS_STRING));
|
||||
|
||||
if (foldWordPossible) {
|
||||
if (setDMISFoldWord.Contains(ch)) {
|
||||
tmpStr[strPos++] = ch;
|
||||
} else {
|
||||
tmpStr = this->UpperCase(tmpStr);
|
||||
if (this->m_codeFoldingStart.InList(tmpStr) && (!noFoldPos)) {
|
||||
levelCurrent++;
|
||||
};
|
||||
if (this->m_codeFoldingEnd.InList(tmpStr) && (!noFoldPos)) {
|
||||
levelCurrent--;
|
||||
};
|
||||
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
|
||||
strPos = 0;
|
||||
foldWordPossible = false;
|
||||
};
|
||||
} else {
|
||||
if (setDMISFoldWord.Contains(ch)) {
|
||||
tmpStr[strPos++] = ch;
|
||||
foldWordPossible = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (atEOL || (i == (endPos-1))) {
|
||||
int lev = levelPrev;
|
||||
|
||||
if (levelCurrent > levelPrev) {
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
};
|
||||
if (lev != styler.LevelAt(lineCurrent)) {
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
};
|
||||
lineCurrent++;
|
||||
levelPrev = levelCurrent;
|
||||
};
|
||||
};
|
||||
delete[] tmpStr;
|
||||
}
|
||||
|
||||
|
||||
LexerModule lmDMIS(SCLEX_DMIS, LexerDMIS::LexerFactoryDMIS, "DMIS", DMISWordListDesc);
|
@@ -1,7 +1,7 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexFortran.cxx
|
||||
** Lexer for Fortran.
|
||||
** Writen by Chuan-jian Shen, Last changed Sep. 2003
|
||||
** Written by Chuan-jian Shen, Last changed Sep. 2003
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@@ -455,11 +455,11 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) {
|
||||
// Remove delta for do-label
|
||||
levelDeltaNext -= wordLevelDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
strcpy(prevWord, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (atEOL) {
|
||||
int lev = levelCurrent;
|
||||
if (visibleChars == 0 && foldCompact)
|
||||
|
@@ -577,7 +577,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
|
||||
|
||||
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers
|
||||
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
|
||||
styler.StartAt(startPos, static_cast<unsigned char>(STYLE_MAX));
|
||||
char prevWord[200];
|
||||
prevWord[0] = '\0';
|
||||
char phpStringDelimiter[200]; // PHP is not limited in length, we are
|
||||
@@ -609,7 +609,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
if (startPos == 0)
|
||||
state = SCE_H_DEFAULT;
|
||||
}
|
||||
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
|
||||
styler.StartAt(startPos, static_cast<unsigned char>(STYLE_MAX));
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int lineState;
|
||||
@@ -811,8 +811,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
}
|
||||
styler.SetLineState(lineCurrent,
|
||||
((inScriptType & 0x03) << 0) |
|
||||
((tagOpened & 0x01) << 2) |
|
||||
((tagClosing & 0x01) << 3) |
|
||||
((tagOpened ? 1 : 0) << 2) |
|
||||
((tagClosing ? 1 : 0) << 3) |
|
||||
((aspScript & 0x0F) << 4) |
|
||||
((clientScript & 0x0F) << 8) |
|
||||
((beforePreProc & 0xFF) << 12));
|
||||
|
@@ -359,7 +359,7 @@ static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - un
|
||||
WordList *[], Accessor &styler)
|
||||
{
|
||||
/* Based on CMake's folder */
|
||||
|
||||
|
||||
/* Exiting if folding isnt enabled */
|
||||
if ( styler.GetPropertyInt("fold") == 0 )
|
||||
return;
|
||||
|
@@ -60,7 +60,7 @@ private:
|
||||
if (static_cast<int>(modes.size()) > numLines * 2 + 256)
|
||||
modes.resize(numLines + 128);
|
||||
}
|
||||
|
||||
|
||||
vector<latexFoldSave> saves;
|
||||
void setSave(int line, const latexFoldSave &save) {
|
||||
if (line >= static_cast<int>(saves.size())) saves.resize(line + 1);
|
||||
@@ -192,7 +192,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
int state = initStyle;
|
||||
if (state == SCE_L_ERROR || state == SCE_L_SHORTCMD || state == SCE_L_SPECIAL) // should not happen
|
||||
latexStateReset(mode, state);
|
||||
|
||||
|
||||
char chNext = styler.SafeGetCharAt(startPos);
|
||||
char chVerbatimDelim = '\0';
|
||||
styler.StartSegment(startPos);
|
||||
@@ -207,7 +207,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (ch == '\r' || ch == '\n')
|
||||
setMode(styler.GetLine(i), mode);
|
||||
|
||||
@@ -256,7 +256,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
state = SCE_L_COMMENT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
// These 3 will never be reached.
|
||||
case SCE_L_ERROR:
|
||||
case SCE_L_SPECIAL:
|
||||
@@ -400,7 +400,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
mode = 0;
|
||||
state = SCE_L_DEFAULT;
|
||||
} else { // This may not be an error, e.g. \begin{equation}\text{$a$}\end{equation}
|
||||
} else { // This may not be an error, e.g. \begin{equation}\text{$a$}\end{equation}
|
||||
styler.ColourTo(i, SCE_L_SHORTCMD);
|
||||
}
|
||||
break;
|
||||
|
@@ -141,7 +141,7 @@ static void ColouriseLuaDoc(
|
||||
char s[100];
|
||||
while (setWord.Contains(c = sc.GetRelative(ln))) { // get potential label
|
||||
if (i < 90)
|
||||
s[i++] = c;
|
||||
s[i++] = static_cast<char>(c);
|
||||
ln++;
|
||||
}
|
||||
s[i] = '\0'; int lbl = ln;
|
||||
|
@@ -64,7 +64,7 @@ static void ColouriseMatlabOctaveDoc(
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
// boolean for when the ' is allowed to be transpose vs the start/end
|
||||
// boolean for when the ' is allowed to be transpose vs the start/end
|
||||
// of a string
|
||||
bool transpose = false;
|
||||
|
||||
@@ -82,14 +82,14 @@ static void ColouriseMatlabOctaveDoc(
|
||||
|
||||
for (; sc.More(); sc.Forward(), column++) {
|
||||
|
||||
if(sc.atLineStart) {
|
||||
// set the line state to the current commentDepth
|
||||
if(sc.atLineStart) {
|
||||
// set the line state to the current commentDepth
|
||||
curLine = styler.GetLine(sc.currentPos);
|
||||
styler.SetLineState(curLine, commentDepth);
|
||||
|
||||
// reset the column to 0, nonSpace to -1 (not set)
|
||||
column = 0;
|
||||
nonSpaceColumn = -1;
|
||||
nonSpaceColumn = -1;
|
||||
}
|
||||
|
||||
// save the column position of first non space character in a line
|
||||
@@ -108,7 +108,7 @@ static void ColouriseMatlabOctaveDoc(
|
||||
sc.ForwardSetState(SCE_MATLAB_DEFAULT);
|
||||
transpose = true;
|
||||
} else if(sc.ch == '.' && sc.chNext == '.') {
|
||||
// we werent an operator, but a '...'
|
||||
// we werent an operator, but a '...'
|
||||
sc.ChangeState(SCE_MATLAB_COMMENT);
|
||||
transpose = false;
|
||||
} else {
|
||||
@@ -161,8 +161,8 @@ static void ColouriseMatlabOctaveDoc(
|
||||
} else if (sc.state == SCE_MATLAB_COMMENT) {
|
||||
// end or start of a nested a block comment?
|
||||
if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column) {
|
||||
if(commentDepth > 0) commentDepth --;
|
||||
|
||||
if(commentDepth > 0) commentDepth --;
|
||||
|
||||
curLine = styler.GetLine(sc.currentPos);
|
||||
styler.SetLineState(curLine, commentDepth);
|
||||
sc.Forward();
|
||||
@@ -174,7 +174,7 @@ static void ColouriseMatlabOctaveDoc(
|
||||
}
|
||||
else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column)
|
||||
{
|
||||
commentDepth ++;
|
||||
commentDepth ++;
|
||||
|
||||
curLine = styler.GetLine(sc.currentPos);
|
||||
styler.SetLineState(curLine, commentDepth);
|
||||
|
@@ -41,7 +41,7 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
int curLine = styler.GetLine(startPos);
|
||||
// the line state holds the last state on or before the line that isn't the default style
|
||||
int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : SCE_PO_DEFAULT;
|
||||
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
// whether we should leave a state
|
||||
switch (sc.state) {
|
||||
@@ -57,19 +57,19 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
// on its own like a keyword rather than changing the whole flags style
|
||||
sc.ChangeState(SCE_PO_FUZZY);
|
||||
break;
|
||||
|
||||
|
||||
case SCE_PO_MSGCTXT:
|
||||
case SCE_PO_MSGID:
|
||||
case SCE_PO_MSGSTR:
|
||||
if (isspacechar(sc.ch))
|
||||
sc.SetState(SCE_PO_DEFAULT);
|
||||
break;
|
||||
|
||||
|
||||
case SCE_PO_ERROR:
|
||||
if (sc.atLineEnd)
|
||||
sc.SetState(SCE_PO_DEFAULT);
|
||||
break;
|
||||
|
||||
|
||||
case SCE_PO_MSGCTXT_TEXT:
|
||||
case SCE_PO_MSGID_TEXT:
|
||||
case SCE_PO_MSGSTR_TEXT:
|
||||
@@ -92,7 +92,7 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// whether we should enter a new state
|
||||
if (sc.state == SCE_PO_DEFAULT) {
|
||||
// forward to the first non-white character on the line
|
||||
@@ -103,11 +103,11 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
// and anyway the styling don't use line state for comments
|
||||
if (curLineState == SCE_PO_COMMENT)
|
||||
curLineState = SCE_PO_DEFAULT;
|
||||
|
||||
|
||||
while (sc.More() && ! sc.atLineEnd && isspacechar(sc.ch))
|
||||
sc.Forward();
|
||||
}
|
||||
|
||||
|
||||
if (atLineStart && sc.ch == '#') {
|
||||
if (sc.chNext == '.')
|
||||
sc.SetState(SCE_PO_PROGRAMMER_COMMENT);
|
||||
@@ -134,11 +134,11 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
sc.SetState(SCE_PO_ERROR);
|
||||
} else if (! isspacechar(sc.ch))
|
||||
sc.SetState(SCE_PO_ERROR);
|
||||
|
||||
|
||||
if (sc.state != SCE_PO_DEFAULT)
|
||||
curLineState = sc.state;
|
||||
}
|
||||
|
||||
|
||||
if (sc.atLineEnd) {
|
||||
// Update the line state, so it can be seen by next line
|
||||
curLine = styler.GetLine(sc.currentPos);
|
||||
@@ -163,7 +163,7 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce
|
||||
return;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact") != 0;
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
int curLine = styler.GetLine(startPos);
|
||||
int lineState = styler.GetLineState(curLine);
|
||||
@@ -172,17 +172,17 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce
|
||||
int nextLevel;
|
||||
int visible = 0;
|
||||
int chNext = styler[startPos];
|
||||
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
int ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i+1);
|
||||
|
||||
|
||||
if (! isspacechar(ch)) {
|
||||
visible++;
|
||||
} else if ((ch == '\r' && chNext != '\n') || ch == '\n' || i+1 >= endPos) {
|
||||
int lvl = level;
|
||||
int nextLine = curLine + 1;
|
||||
|
||||
|
||||
nextLineState = styler.GetLineState(nextLine);
|
||||
if ((lineState != SCE_PO_COMMENT || foldComment) &&
|
||||
nextLineState == lineState &&
|
||||
@@ -190,14 +190,14 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce
|
||||
nextLevel = SC_FOLDLEVELBASE + 1;
|
||||
else
|
||||
nextLevel = SC_FOLDLEVELBASE;
|
||||
|
||||
|
||||
if (nextLevel > level)
|
||||
lvl |= SC_FOLDLEVELHEADERFLAG;
|
||||
if (visible == 0 && foldCompact)
|
||||
lvl |= SC_FOLDLEVELWHITEFLAG;
|
||||
|
||||
|
||||
styler.SetLevel(curLine, lvl);
|
||||
|
||||
|
||||
lineState = nextLineState;
|
||||
curLine = nextLine;
|
||||
level = nextLevel;
|
||||
|
@@ -662,7 +662,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
} else if (initStyle == SCE_PL_POD
|
||||
|| initStyle == SCE_PL_POD_VERB
|
||||
) {
|
||||
// POD backtracking finds preceeding blank lines and goes back past them
|
||||
// POD backtracking finds preceding blank lines and goes back past them
|
||||
int ln = styler.GetLine(startPos);
|
||||
if (ln > 0) {
|
||||
initStyle = styler.StyleAt(styler.LineStart(--ln));
|
||||
@@ -1159,12 +1159,12 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
sc.ForwardSetState(SCE_PL_DEFAULT);
|
||||
HereDoc.State = 3;
|
||||
} else {
|
||||
// invalid indentifier; inexact fallback, but hey
|
||||
// invalid identifier; inexact fallback, but hey
|
||||
sc.ChangeState(SCE_PL_IDENTIFIER);
|
||||
sc.SetState(SCE_PL_DEFAULT);
|
||||
}
|
||||
} else {
|
||||
sc.ChangeState(SCE_PL_DEFAULT); // invalid indentifier
|
||||
sc.ChangeState(SCE_PL_DEFAULT); // invalid identifier
|
||||
}
|
||||
backFlag = BACK_NONE;
|
||||
break;
|
||||
|
@@ -731,7 +731,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
// If anyone runs into this problem, I recommend raising this
|
||||
// value slightly higher to replacing the fixed array with a linked
|
||||
// list. Keep in mind this code will be called everytime the lexer
|
||||
// list. Keep in mind this code will be called every time the lexer
|
||||
// is invoked.
|
||||
|
||||
#define INNER_STRINGS_MAX_COUNT 5
|
||||
|
@@ -292,7 +292,7 @@ static void ScanNumber(Accessor& styler, int& pos) {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (c == 'f') {
|
||||
error |= base != 10;
|
||||
@@ -600,7 +600,7 @@ static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes)
|
||||
} else if (pos >= max) {
|
||||
styler.ColourTo(pos - 1, SCE_RUST_STRINGR);
|
||||
break;
|
||||
} else {
|
||||
} else {
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
@@ -33,9 +33,9 @@ static void ClassifySTTXTWord(WordList *keywordlists[], StyleContext &sc)
|
||||
char s[256] = { 0 };
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
|
||||
if ((*keywordlists[0]).InList(s)) {
|
||||
sc.ChangeState(SCE_STTXT_KEYWORD);
|
||||
}
|
||||
if ((*keywordlists[0]).InList(s)) {
|
||||
sc.ChangeState(SCE_STTXT_KEYWORD);
|
||||
}
|
||||
|
||||
else if ((*keywordlists[1]).InList(s)) {
|
||||
sc.ChangeState(SCE_STTXT_TYPE);
|
||||
@@ -72,8 +72,8 @@ static void ColouriseSTTXTDoc (unsigned int startPos, int length, int initStyle,
|
||||
CharacterSet setOperator(CharacterSet::setNone,",.+-*/:;<=>[]()%&");
|
||||
CharacterSet setDataTime(CharacterSet::setDigits,"_.-:dmshDMSH");
|
||||
|
||||
for ( ; sc.More() ; sc.Forward())
|
||||
{
|
||||
for ( ; sc.More() ; sc.Forward())
|
||||
{
|
||||
if(sc.atLineStart && sc.state != SCE_STTXT_COMMENT)
|
||||
sc.SetState(SCE_STTXT_DEFAULT);
|
||||
|
||||
@@ -181,7 +181,7 @@ static void ColouriseSTTXTDoc (unsigned int startPos, int length, int initStyle,
|
||||
else if (setOperator.Contains(sc.ch))
|
||||
sc.SetState(SCE_STTXT_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sc.state == SCE_STTXT_IDENTIFIER && setWord.Contains(sc.chPrev))
|
||||
ClassifySTTXTWord(keywordlists, sc);
|
||||
@@ -355,7 +355,7 @@ static void FoldSTTXTDoc(unsigned int startPos, int length, int initStyle, WordL
|
||||
}
|
||||
if ( foldComment && atEOL && ( IsCommentLine(lineCurrent, styler,false)
|
||||
|| IsCommentLine(lineCurrent,styler,true))) {
|
||||
if(!IsCommentLine(lineCurrent-1, styler,true) && IsCommentLine(lineCurrent+1, styler,true))
|
||||
if(!IsCommentLine(lineCurrent-1, styler,true) && IsCommentLine(lineCurrent+1, styler,true))
|
||||
levelCurrent++;
|
||||
if (IsCommentLine(lineCurrent-1, styler,true) && !IsCommentLine(lineCurrent+1, styler,true))
|
||||
levelCurrent--;
|
||||
|
@@ -396,7 +396,7 @@ void SCI_METHOD LexerVisualProlog::Lex(unsigned int startPos, int length, int in
|
||||
if (sc.atLineEnd) {
|
||||
// Update the line state, so it can be seen by next line
|
||||
int lineState = 0;
|
||||
if (SCE_VISUALPROLOG_STRING_VERBATIM_EOL == sc.state) {
|
||||
if (SCE_VISUALPROLOG_STRING_VERBATIM_EOL == sc.state) {
|
||||
lineState = closingQuote;
|
||||
} else if (SCE_VISUALPROLOG_COMMENT_BLOCK == sc.state) {
|
||||
lineState = nestLevel;
|
||||
|
@@ -72,7 +72,7 @@ inline int Maximum(int a, int b) {
|
||||
|
||||
// Shut up annoying Visual C++ warnings:
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4244 4309 4514 4710)
|
||||
#pragma warning(disable: 4244 4309)
|
||||
#endif
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
|
@@ -11,11 +11,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Visual C++ doesn't like unreachable code in its own headers.
|
||||
#pragma warning(disable: 4018 4100 4245 4511 4512 4663 4702)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
|
@@ -65,7 +65,7 @@ public:
|
||||
void SetSeparator(char separator_);
|
||||
char GetSeparator() const;
|
||||
|
||||
/// The typesep character is used for seperating the word from the type
|
||||
/// The typesep character is used for separating the word from the type
|
||||
void SetTypesep(char separator_);
|
||||
char GetTypesep() const;
|
||||
|
||||
|
@@ -109,13 +109,15 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
int endSeg = ends[seg];
|
||||
if (endSeg > startSeg) {
|
||||
if (IsArrowCharacter(s[startSeg])) {
|
||||
xEnd = x + widthArrow;
|
||||
bool upArrow = s[startSeg] == '\001';
|
||||
rcClient.left = x;
|
||||
rcClient.right = rcClient.left + widthArrow;
|
||||
rcClient.left = static_cast<XYPOSITION>(x);
|
||||
rcClient.right = static_cast<XYPOSITION>(xEnd);
|
||||
if (draw) {
|
||||
const int halfWidth = widthArrow / 2 - 3;
|
||||
const int centreX = rcClient.left + widthArrow / 2 - 1;
|
||||
const int centreY = (rcClient.top + rcClient.bottom) / 2;
|
||||
const int quarterWidth = halfWidth / 2;
|
||||
const int centreX = x + widthArrow / 2 - 1;
|
||||
const int centreY = static_cast<int>(rcClient.top + rcClient.bottom) / 2;
|
||||
surface->FillRectangle(rcClient, colourBG);
|
||||
PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1,
|
||||
rcClient.right - 2, rcClient.bottom - 1);
|
||||
@@ -123,21 +125,20 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
|
||||
if (upArrow) { // Up arrow
|
||||
Point pts[] = {
|
||||
Point(centreX - halfWidth, centreY + halfWidth / 2),
|
||||
Point(centreX + halfWidth, centreY + halfWidth / 2),
|
||||
Point(centreX, centreY - halfWidth + halfWidth / 2),
|
||||
Point::FromInts(centreX - halfWidth, centreY + quarterWidth),
|
||||
Point::FromInts(centreX + halfWidth, centreY + quarterWidth),
|
||||
Point::FromInts(centreX, centreY - halfWidth + quarterWidth),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
|
||||
} else { // Down arrow
|
||||
Point pts[] = {
|
||||
Point(centreX - halfWidth, centreY - halfWidth / 2),
|
||||
Point(centreX + halfWidth, centreY - halfWidth / 2),
|
||||
Point(centreX, centreY + halfWidth - halfWidth / 2),
|
||||
Point::FromInts(centreX - halfWidth, centreY - quarterWidth),
|
||||
Point::FromInts(centreX + halfWidth, centreY - quarterWidth),
|
||||
Point::FromInts(centreX, centreY + halfWidth - quarterWidth),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
|
||||
}
|
||||
}
|
||||
xEnd = rcClient.right;
|
||||
offsetMain = xEnd;
|
||||
if (upArrow) {
|
||||
rectUp = rcClient;
|
||||
@@ -147,11 +148,11 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
} else if (IsTabCharacter(s[startSeg])) {
|
||||
xEnd = NextTabPos(x);
|
||||
} else {
|
||||
xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg);
|
||||
xEnd = x + RoundXYPosition(surface->WidthText(font, s + startSeg, endSeg - startSeg));
|
||||
if (draw) {
|
||||
rcClient.left = x;
|
||||
rcClient.right = xEnd;
|
||||
surface->DrawTextTransparent(rcClient, font, ytext,
|
||||
rcClient.left = static_cast<XYPOSITION>(x);
|
||||
rcClient.right = static_cast<XYPOSITION>(xEnd);
|
||||
surface->DrawTextTransparent(rcClient, font, static_cast<XYPOSITION>(ytext),
|
||||
s+startSeg, endSeg - startSeg,
|
||||
highlight ? colourSel : colourUnSel);
|
||||
}
|
||||
@@ -164,16 +165,16 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
|
||||
int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
|
||||
PRectangle rcClientPos = wCallTip.GetClientPosition();
|
||||
PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left,
|
||||
PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left,
|
||||
rcClientPos.bottom - rcClientPos.top);
|
||||
PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1);
|
||||
PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);
|
||||
|
||||
// To make a nice small call tip window, it is only sized to fit most normal characters without accents
|
||||
int ascent = surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font);
|
||||
int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font));
|
||||
|
||||
// For each line...
|
||||
// Draw the definition in three parts: before highlight, highlighted, after highlight
|
||||
int ytext = rcClient.top + ascent + 1;
|
||||
int ytext = static_cast<int>(rcClient.top) + ascent + 1;
|
||||
rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1;
|
||||
const char *chunkVal = val.c_str();
|
||||
bool moreChunks = true;
|
||||
@@ -185,8 +186,8 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
|
||||
chunkEnd = chunkVal + strlen(chunkVal);
|
||||
moreChunks = false;
|
||||
}
|
||||
int chunkOffset = chunkVal - val.c_str();
|
||||
int chunkLength = chunkEnd - chunkVal;
|
||||
int chunkOffset = static_cast<int>(chunkVal - val.c_str());
|
||||
int chunkLength = static_cast<int>(chunkEnd - chunkVal);
|
||||
int chunkEndOffset = chunkOffset + chunkLength;
|
||||
int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset);
|
||||
thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset);
|
||||
@@ -194,7 +195,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
|
||||
int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset);
|
||||
thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset);
|
||||
thisEndHighlight -= chunkOffset;
|
||||
rcClient.top = ytext - ascent - 1;
|
||||
rcClient.top = static_cast<XYPOSITION>(ytext - ascent - 1);
|
||||
|
||||
int x = insetX; // start each line at this inset
|
||||
|
||||
@@ -217,9 +218,9 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
|
||||
if (val.empty())
|
||||
return;
|
||||
PRectangle rcClientPos = wCallTip.GetClientPosition();
|
||||
PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left,
|
||||
PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left,
|
||||
rcClientPos.bottom - rcClientPos.top);
|
||||
PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1);
|
||||
PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);
|
||||
|
||||
surfaceWindow->FillRectangle(rcClient, colourBG);
|
||||
|
||||
@@ -229,13 +230,13 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
|
||||
#ifndef __APPLE__
|
||||
// OSX doesn't put borders on "help tags"
|
||||
// Draw a raised border around the edges of the window
|
||||
surfaceWindow->MoveTo(0, rcClientSize.bottom - 1);
|
||||
surfaceWindow->MoveTo(0, static_cast<int>(rcClientSize.bottom) - 1);
|
||||
surfaceWindow->PenColour(colourShade);
|
||||
surfaceWindow->LineTo(rcClientSize.right - 1, rcClientSize.bottom - 1);
|
||||
surfaceWindow->LineTo(rcClientSize.right - 1, 0);
|
||||
surfaceWindow->LineTo(static_cast<int>(rcClientSize.right) - 1, static_cast<int>(rcClientSize.bottom) - 1);
|
||||
surfaceWindow->LineTo(static_cast<int>(rcClientSize.right) - 1, 0);
|
||||
surfaceWindow->PenColour(colourLight);
|
||||
surfaceWindow->LineTo(0, 0);
|
||||
surfaceWindow->LineTo(0, rcClientSize.bottom - 1);
|
||||
surfaceWindow->LineTo(0, static_cast<int>(rcClientSize.bottom) - 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -264,7 +265,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *
|
||||
endHighlight = 0;
|
||||
inCallTipMode = true;
|
||||
posStartCallTip = pos;
|
||||
int deviceHeight = surfaceMeasure->DeviceHeightFont(size);
|
||||
XYPOSITION deviceHeight = static_cast<XYPOSITION>(surfaceMeasure->DeviceHeightFont(size));
|
||||
FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet);
|
||||
font.Create(fp);
|
||||
// Look for multiple lines in the text
|
||||
@@ -280,12 +281,12 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *
|
||||
look = newline + 1;
|
||||
numLines++;
|
||||
}
|
||||
lineHeight = surfaceMeasure->Height(font);
|
||||
lineHeight = RoundXYPosition(surfaceMeasure->Height(font));
|
||||
|
||||
// The returned
|
||||
// rectangle is aligned to the right edge of the last arrow encountered in
|
||||
// the tip text, else to the tip text left edge.
|
||||
int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + borderHeight * 2;
|
||||
int height = lineHeight * numLines - static_cast<int>(surfaceMeasure->InternalLeading(font)) + borderHeight * 2;
|
||||
delete surfaceMeasure;
|
||||
if (above) {
|
||||
return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset);
|
||||
|
@@ -35,48 +35,48 @@ int symmetricCaseConversionRanges[] = {
|
||||
//lower, upper, range length, range pitch
|
||||
//++Autogenerated -- start of section automatically generated
|
||||
//**\(\*\n\)
|
||||
97,65,26,1,
|
||||
224,192,23,1,
|
||||
248,216,7,1,
|
||||
257,256,24,2,
|
||||
314,313,8,2,
|
||||
331,330,23,2,
|
||||
462,461,8,2,
|
||||
479,478,9,2,
|
||||
505,504,20,2,
|
||||
547,546,9,2,
|
||||
583,582,5,2,
|
||||
945,913,17,1,
|
||||
963,931,9,1,
|
||||
985,984,12,2,
|
||||
1072,1040,32,1,
|
||||
1104,1024,16,1,
|
||||
1121,1120,17,2,
|
||||
1163,1162,27,2,
|
||||
1218,1217,7,2,
|
||||
1233,1232,44,2,
|
||||
1377,1329,38,1,
|
||||
7681,7680,75,2,
|
||||
7841,7840,48,2,
|
||||
7936,7944,8,1,
|
||||
7952,7960,6,1,
|
||||
7968,7976,8,1,
|
||||
7984,7992,8,1,
|
||||
8000,8008,6,1,
|
||||
8032,8040,8,1,
|
||||
8560,8544,16,1,
|
||||
9424,9398,26,1,
|
||||
11312,11264,47,1,
|
||||
11393,11392,50,2,
|
||||
11520,4256,38,1,
|
||||
42561,42560,23,2,
|
||||
42625,42624,12,2,
|
||||
42787,42786,7,2,
|
||||
42803,42802,31,2,
|
||||
42879,42878,5,2,
|
||||
42913,42912,5,2,
|
||||
65345,65313,26,1,
|
||||
66600,66560,40,1,
|
||||
97,65,26,1,
|
||||
224,192,23,1,
|
||||
248,216,7,1,
|
||||
257,256,24,2,
|
||||
314,313,8,2,
|
||||
331,330,23,2,
|
||||
462,461,8,2,
|
||||
479,478,9,2,
|
||||
505,504,20,2,
|
||||
547,546,9,2,
|
||||
583,582,5,2,
|
||||
945,913,17,1,
|
||||
963,931,9,1,
|
||||
985,984,12,2,
|
||||
1072,1040,32,1,
|
||||
1104,1024,16,1,
|
||||
1121,1120,17,2,
|
||||
1163,1162,27,2,
|
||||
1218,1217,7,2,
|
||||
1233,1232,44,2,
|
||||
1377,1329,38,1,
|
||||
7681,7680,75,2,
|
||||
7841,7840,48,2,
|
||||
7936,7944,8,1,
|
||||
7952,7960,6,1,
|
||||
7968,7976,8,1,
|
||||
7984,7992,8,1,
|
||||
8000,8008,6,1,
|
||||
8032,8040,8,1,
|
||||
8560,8544,16,1,
|
||||
9424,9398,26,1,
|
||||
11312,11264,47,1,
|
||||
11393,11392,50,2,
|
||||
11520,4256,38,1,
|
||||
42561,42560,23,2,
|
||||
42625,42624,12,2,
|
||||
42787,42786,7,2,
|
||||
42803,42802,31,2,
|
||||
42879,42878,5,2,
|
||||
42913,42912,5,2,
|
||||
65345,65313,26,1,
|
||||
66600,66560,40,1,
|
||||
|
||||
//--Autogenerated -- end of section automatically generated
|
||||
};
|
||||
@@ -88,138 +88,138 @@ int symmetricCaseConversions[] = {
|
||||
//lower, upper
|
||||
//++Autogenerated -- start of section automatically generated
|
||||
//**1 \(\*\n\)
|
||||
255,376,
|
||||
307,306,
|
||||
309,308,
|
||||
311,310,
|
||||
378,377,
|
||||
380,379,
|
||||
382,381,
|
||||
384,579,
|
||||
387,386,
|
||||
389,388,
|
||||
392,391,
|
||||
396,395,
|
||||
402,401,
|
||||
405,502,
|
||||
409,408,
|
||||
410,573,
|
||||
414,544,
|
||||
417,416,
|
||||
419,418,
|
||||
421,420,
|
||||
424,423,
|
||||
429,428,
|
||||
432,431,
|
||||
436,435,
|
||||
438,437,
|
||||
441,440,
|
||||
445,444,
|
||||
447,503,
|
||||
454,452,
|
||||
457,455,
|
||||
460,458,
|
||||
477,398,
|
||||
499,497,
|
||||
501,500,
|
||||
572,571,
|
||||
575,11390,
|
||||
576,11391,
|
||||
578,577,
|
||||
592,11375,
|
||||
593,11373,
|
||||
594,11376,
|
||||
595,385,
|
||||
596,390,
|
||||
598,393,
|
||||
599,394,
|
||||
601,399,
|
||||
603,400,
|
||||
608,403,
|
||||
611,404,
|
||||
613,42893,
|
||||
614,42922,
|
||||
616,407,
|
||||
617,406,
|
||||
619,11362,
|
||||
623,412,
|
||||
625,11374,
|
||||
626,413,
|
||||
629,415,
|
||||
637,11364,
|
||||
640,422,
|
||||
643,425,
|
||||
648,430,
|
||||
649,580,
|
||||
650,433,
|
||||
651,434,
|
||||
652,581,
|
||||
658,439,
|
||||
881,880,
|
||||
883,882,
|
||||
887,886,
|
||||
891,1021,
|
||||
892,1022,
|
||||
893,1023,
|
||||
940,902,
|
||||
941,904,
|
||||
942,905,
|
||||
943,906,
|
||||
972,908,
|
||||
973,910,
|
||||
974,911,
|
||||
983,975,
|
||||
1010,1017,
|
||||
1016,1015,
|
||||
1019,1018,
|
||||
1231,1216,
|
||||
7545,42877,
|
||||
7549,11363,
|
||||
8017,8025,
|
||||
8019,8027,
|
||||
8021,8029,
|
||||
8023,8031,
|
||||
8048,8122,
|
||||
8049,8123,
|
||||
8050,8136,
|
||||
8051,8137,
|
||||
8052,8138,
|
||||
8053,8139,
|
||||
8054,8154,
|
||||
8055,8155,
|
||||
8056,8184,
|
||||
8057,8185,
|
||||
8058,8170,
|
||||
8059,8171,
|
||||
8060,8186,
|
||||
8061,8187,
|
||||
8112,8120,
|
||||
8113,8121,
|
||||
8144,8152,
|
||||
8145,8153,
|
||||
8160,8168,
|
||||
8161,8169,
|
||||
8165,8172,
|
||||
8526,8498,
|
||||
8580,8579,
|
||||
11361,11360,
|
||||
11365,570,
|
||||
11366,574,
|
||||
11368,11367,
|
||||
11370,11369,
|
||||
11372,11371,
|
||||
11379,11378,
|
||||
11382,11381,
|
||||
11500,11499,
|
||||
11502,11501,
|
||||
11507,11506,
|
||||
11559,4295,
|
||||
11565,4301,
|
||||
42874,42873,
|
||||
42876,42875,
|
||||
42892,42891,
|
||||
42897,42896,
|
||||
42899,42898,
|
||||
255,376,
|
||||
307,306,
|
||||
309,308,
|
||||
311,310,
|
||||
378,377,
|
||||
380,379,
|
||||
382,381,
|
||||
384,579,
|
||||
387,386,
|
||||
389,388,
|
||||
392,391,
|
||||
396,395,
|
||||
402,401,
|
||||
405,502,
|
||||
409,408,
|
||||
410,573,
|
||||
414,544,
|
||||
417,416,
|
||||
419,418,
|
||||
421,420,
|
||||
424,423,
|
||||
429,428,
|
||||
432,431,
|
||||
436,435,
|
||||
438,437,
|
||||
441,440,
|
||||
445,444,
|
||||
447,503,
|
||||
454,452,
|
||||
457,455,
|
||||
460,458,
|
||||
477,398,
|
||||
499,497,
|
||||
501,500,
|
||||
572,571,
|
||||
575,11390,
|
||||
576,11391,
|
||||
578,577,
|
||||
592,11375,
|
||||
593,11373,
|
||||
594,11376,
|
||||
595,385,
|
||||
596,390,
|
||||
598,393,
|
||||
599,394,
|
||||
601,399,
|
||||
603,400,
|
||||
608,403,
|
||||
611,404,
|
||||
613,42893,
|
||||
614,42922,
|
||||
616,407,
|
||||
617,406,
|
||||
619,11362,
|
||||
623,412,
|
||||
625,11374,
|
||||
626,413,
|
||||
629,415,
|
||||
637,11364,
|
||||
640,422,
|
||||
643,425,
|
||||
648,430,
|
||||
649,580,
|
||||
650,433,
|
||||
651,434,
|
||||
652,581,
|
||||
658,439,
|
||||
881,880,
|
||||
883,882,
|
||||
887,886,
|
||||
891,1021,
|
||||
892,1022,
|
||||
893,1023,
|
||||
940,902,
|
||||
941,904,
|
||||
942,905,
|
||||
943,906,
|
||||
972,908,
|
||||
973,910,
|
||||
974,911,
|
||||
983,975,
|
||||
1010,1017,
|
||||
1016,1015,
|
||||
1019,1018,
|
||||
1231,1216,
|
||||
7545,42877,
|
||||
7549,11363,
|
||||
8017,8025,
|
||||
8019,8027,
|
||||
8021,8029,
|
||||
8023,8031,
|
||||
8048,8122,
|
||||
8049,8123,
|
||||
8050,8136,
|
||||
8051,8137,
|
||||
8052,8138,
|
||||
8053,8139,
|
||||
8054,8154,
|
||||
8055,8155,
|
||||
8056,8184,
|
||||
8057,8185,
|
||||
8058,8170,
|
||||
8059,8171,
|
||||
8060,8186,
|
||||
8061,8187,
|
||||
8112,8120,
|
||||
8113,8121,
|
||||
8144,8152,
|
||||
8145,8153,
|
||||
8160,8168,
|
||||
8161,8169,
|
||||
8165,8172,
|
||||
8526,8498,
|
||||
8580,8579,
|
||||
11361,11360,
|
||||
11365,570,
|
||||
11366,574,
|
||||
11368,11367,
|
||||
11370,11369,
|
||||
11372,11371,
|
||||
11379,11378,
|
||||
11382,11381,
|
||||
11500,11499,
|
||||
11502,11501,
|
||||
11507,11506,
|
||||
11559,4295,
|
||||
11565,4301,
|
||||
42874,42873,
|
||||
42876,42875,
|
||||
42892,42891,
|
||||
42897,42896,
|
||||
42899,42898,
|
||||
|
||||
//--Autogenerated -- end of section automatically generated
|
||||
};
|
||||
|
@@ -106,6 +106,7 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmD);
|
||||
LINK_LEXER(lmDiff);
|
||||
LINK_LEXER(lmDMAP);
|
||||
LINK_LEXER(lmDMIS);
|
||||
LINK_LEXER(lmECL);
|
||||
LINK_LEXER(lmEiffel);
|
||||
LINK_LEXER(lmEiffelkw);
|
||||
|
@@ -14,11 +14,6 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
// Shut up annoying Visual C++ warnings:
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4514)
|
||||
#endif
|
||||
|
||||
CharClassify::CharClassify() {
|
||||
SetDefaultCharClasses(true);
|
||||
}
|
||||
|
@@ -76,6 +76,10 @@ int ContractionState::DisplayFromDoc(int lineDoc) const {
|
||||
}
|
||||
}
|
||||
|
||||
int ContractionState::DisplayLastFromDoc(int lineDoc) const {
|
||||
return DisplayFromDoc(lineDoc) + GetHeight(lineDoc) - 1;
|
||||
}
|
||||
|
||||
int ContractionState::DocFromDisplay(int lineDisplay) const {
|
||||
if (OneToOne()) {
|
||||
return lineDisplay;
|
||||
|
@@ -39,6 +39,7 @@ public:
|
||||
int LinesInDoc() const;
|
||||
int LinesDisplayed() const;
|
||||
int DisplayFromDoc(int lineDoc) const;
|
||||
int DisplayLastFromDoc(int lineDoc) const;
|
||||
int DocFromDisplay(int lineDisplay) const;
|
||||
|
||||
void InsertLine(int lineDoc);
|
||||
|
@@ -98,6 +98,7 @@ Document::Document() {
|
||||
enteredModification = 0;
|
||||
enteredStyling = 0;
|
||||
enteredReadOnlyCount = 0;
|
||||
insertionSet = false;
|
||||
tabInChars = 8;
|
||||
indentInChars = 0;
|
||||
actualIndentInChars = 8;
|
||||
@@ -919,37 +920,56 @@ bool Document::DeleteChars(int pos, int len) {
|
||||
/**
|
||||
* Insert a string with a length.
|
||||
*/
|
||||
bool Document::InsertString(int position, const char *s, int insertLength) {
|
||||
int Document::InsertString(int position, const char *s, int insertLength) {
|
||||
if (insertLength <= 0) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
CheckReadOnly(); // Application may change read only state here
|
||||
if (cb.IsReadOnly()) {
|
||||
return 0;
|
||||
}
|
||||
CheckReadOnly();
|
||||
if (enteredModification != 0) {
|
||||
return false;
|
||||
} else {
|
||||
enteredModification++;
|
||||
if (!cb.IsReadOnly()) {
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
|
||||
position, insertLength,
|
||||
0, s));
|
||||
int prevLinesTotal = LinesTotal();
|
||||
bool startSavePoint = cb.IsSavePoint();
|
||||
bool startSequence = false;
|
||||
const char *text = cb.InsertString(position, s, insertLength, startSequence);
|
||||
if (startSavePoint && cb.IsCollectingUndo())
|
||||
NotifySavePoint(!startSavePoint);
|
||||
ModifiedAt(position);
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0),
|
||||
position, insertLength,
|
||||
LinesTotal() - prevLinesTotal, text));
|
||||
}
|
||||
enteredModification--;
|
||||
return 0;
|
||||
}
|
||||
return !cb.IsReadOnly();
|
||||
enteredModification++;
|
||||
insertionSet = false;
|
||||
insertion.clear();
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_INSERTCHECK,
|
||||
position, insertLength,
|
||||
0, s));
|
||||
if (insertionSet) {
|
||||
s = insertion.c_str();
|
||||
insertLength = static_cast<int>(insertion.length());
|
||||
}
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
|
||||
position, insertLength,
|
||||
0, s));
|
||||
int prevLinesTotal = LinesTotal();
|
||||
bool startSavePoint = cb.IsSavePoint();
|
||||
bool startSequence = false;
|
||||
const char *text = cb.InsertString(position, s, insertLength, startSequence);
|
||||
if (startSavePoint && cb.IsCollectingUndo())
|
||||
NotifySavePoint(!startSavePoint);
|
||||
ModifiedAt(position);
|
||||
NotifyModified(
|
||||
DocModification(
|
||||
SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0),
|
||||
position, insertLength,
|
||||
LinesTotal() - prevLinesTotal, text));
|
||||
if (insertionSet) { // Free memory as could be large
|
||||
std::string().swap(insertion);
|
||||
}
|
||||
enteredModification--;
|
||||
return insertLength;
|
||||
}
|
||||
|
||||
void Document::ChangeInsertion(const char *s, int length) {
|
||||
insertionSet = true;
|
||||
insertion.assign(s, length);
|
||||
}
|
||||
|
||||
int SCI_METHOD Document::AddData(char *data, int length) {
|
||||
@@ -1113,22 +1133,6 @@ int Document::Redo() {
|
||||
return newPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a single character.
|
||||
*/
|
||||
bool Document::InsertChar(int pos, char ch) {
|
||||
char chs[1];
|
||||
chs[0] = ch;
|
||||
return InsertString(pos, chs, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a null terminated string.
|
||||
*/
|
||||
bool Document::InsertCString(int position, const char *s) {
|
||||
return InsertString(position, s, static_cast<int>(s ? strlen(s) : 0));
|
||||
}
|
||||
|
||||
void Document::DelChar(int pos) {
|
||||
DeleteChars(pos, LenChar(pos));
|
||||
}
|
||||
@@ -1183,7 +1187,7 @@ int SCI_METHOD Document::GetLineIndentation(int line) {
|
||||
return indent;
|
||||
}
|
||||
|
||||
void Document::SetLineIndentation(int line, int indent) {
|
||||
int Document::SetLineIndentation(int line, int indent) {
|
||||
int indentOfLine = GetLineIndentation(line);
|
||||
if (indent < 0)
|
||||
indent = 0;
|
||||
@@ -1193,7 +1197,10 @@ void Document::SetLineIndentation(int line, int indent) {
|
||||
int indentPos = GetLineIndentPosition(line);
|
||||
UndoGroup ug(this);
|
||||
DeleteChars(thisLineStart, indentPos - thisLineStart);
|
||||
InsertCString(thisLineStart, linebuf.c_str());
|
||||
return thisLineStart + InsertString(thisLineStart, linebuf.c_str(),
|
||||
static_cast<int>(linebuf.length()));
|
||||
} else {
|
||||
return GetLineIndentPosition(line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1325,21 +1332,21 @@ void Document::ConvertLineEnds(int eolModeSet) {
|
||||
} else {
|
||||
// CR
|
||||
if (eolModeSet == SC_EOL_CRLF) {
|
||||
InsertString(pos + 1, "\n", 1); // Insert LF
|
||||
pos++;
|
||||
pos += InsertString(pos + 1, "\n", 1); // Insert LF
|
||||
} else if (eolModeSet == SC_EOL_LF) {
|
||||
InsertString(pos, "\n", 1); // Insert LF
|
||||
DeleteChars(pos + 1, 1); // Delete CR
|
||||
pos += InsertString(pos, "\n", 1); // Insert LF
|
||||
DeleteChars(pos, 1); // Delete CR
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
} else if (cb.CharAt(pos) == '\n') {
|
||||
// LF
|
||||
if (eolModeSet == SC_EOL_CRLF) {
|
||||
InsertString(pos, "\r", 1); // Insert CR
|
||||
pos++;
|
||||
pos += InsertString(pos, "\r", 1); // Insert CR
|
||||
} else if (eolModeSet == SC_EOL_CR) {
|
||||
InsertString(pos, "\r", 1); // Insert CR
|
||||
DeleteChars(pos + 1, 1); // Delete LF
|
||||
pos += InsertString(pos, "\r", 1); // Insert CR
|
||||
DeleteChars(pos, 1); // Delete LF
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -43,6 +43,14 @@ public:
|
||||
return (start != invalidPosition) && (end != invalidPosition);
|
||||
}
|
||||
|
||||
Position First() const {
|
||||
return (start <= end) ? start : end;
|
||||
}
|
||||
|
||||
Position Last() const {
|
||||
return (start > end) ? start : end;
|
||||
}
|
||||
|
||||
// Is the position within the range?
|
||||
bool Contains(Position pos) const {
|
||||
if (start < end) {
|
||||
@@ -191,9 +199,6 @@ public:
|
||||
bool operator==(const WatcherWithUserData &other) const {
|
||||
return (watcher == other.watcher) && (userData == other.userData);
|
||||
}
|
||||
bool operator!=(const WatcherWithUserData &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -208,6 +213,9 @@ private:
|
||||
int enteredStyling;
|
||||
int enteredReadOnlyCount;
|
||||
|
||||
bool insertionSet;
|
||||
std::string insertion;
|
||||
|
||||
std::vector<WatcherWithUserData> watchers;
|
||||
|
||||
// ldSize is not real data - it is for dimensions and loops
|
||||
@@ -277,7 +285,8 @@ public:
|
||||
void ModifiedAt(int pos);
|
||||
void CheckReadOnly();
|
||||
bool DeleteChars(int pos, int len);
|
||||
bool InsertString(int position, const char *s, int insertLength);
|
||||
int InsertString(int position, const char *s, int insertLength);
|
||||
void ChangeInsertion(const char *s, int length);
|
||||
int SCI_METHOD AddData(char *data, int length);
|
||||
void * SCI_METHOD ConvertToDocument();
|
||||
int Undo();
|
||||
@@ -299,7 +308,7 @@ public:
|
||||
int GapPosition() const { return cb.GapPosition(); }
|
||||
|
||||
int SCI_METHOD GetLineIndentation(int line);
|
||||
void SetLineIndentation(int line, int indent);
|
||||
int SetLineIndentation(int line, int indent);
|
||||
int GetLineIndentPosition(int line) const;
|
||||
int GetColumn(int position);
|
||||
int CountCharacters(int startPos, int endPos);
|
||||
@@ -310,8 +319,6 @@ public:
|
||||
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
|
||||
bool IsReadOnly() const { return cb.IsReadOnly(); }
|
||||
|
||||
bool InsertChar(int pos, char ch);
|
||||
bool InsertCString(int position, const char *s);
|
||||
void DelChar(int pos);
|
||||
void DelCharBack(int pos);
|
||||
|
||||
@@ -393,7 +400,7 @@ public:
|
||||
void AnnotationSetStyles(int line, const unsigned char *styles);
|
||||
int AnnotationLines(int line) const;
|
||||
void AnnotationClearAll();
|
||||
|
||||
|
||||
bool AddWatcher(DocWatcher *watcher, void *userData);
|
||||
bool RemoveWatcher(DocWatcher *watcher, void *userData);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -47,7 +47,7 @@ public:
|
||||
|
||||
/**
|
||||
* When platform has a way to generate an event before painting,
|
||||
* accumulate needed styling range and other work items in
|
||||
* accumulate needed styling range and other work items in
|
||||
* WorkNeeded to avoid unnecessary work inside paint handler
|
||||
*/
|
||||
class WorkNeeded {
|
||||
@@ -356,12 +356,12 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
int LineFromLocation(Point pt) const;
|
||||
void SetTopLine(int topLineNew);
|
||||
|
||||
bool AbandonPaint();
|
||||
virtual bool AbandonPaint();
|
||||
virtual void RedrawRect(PRectangle rc);
|
||||
virtual void DiscardOverdraw();
|
||||
virtual void Redraw();
|
||||
void RedrawSelMargin(int line=-1, bool allAfter=false);
|
||||
PRectangle RectangleFromRange(int start, int end);
|
||||
PRectangle RectangleFromRange(Range r);
|
||||
void InvalidateRange(int start, int end);
|
||||
|
||||
bool UserVirtualSpace() const {
|
||||
@@ -420,6 +420,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void ScrollRange(SelectionRange range);
|
||||
void ShowCaretAtCurrentPosition();
|
||||
void DropCaret();
|
||||
void CaretSetPeriod(int period);
|
||||
void InvalidateCaret();
|
||||
virtual void UpdateSystemCaret();
|
||||
|
||||
@@ -472,8 +473,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
int InsertSpace(int position, unsigned int spaces);
|
||||
void AddChar(char ch);
|
||||
virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);
|
||||
void InsertPaste(SelectionPosition selStart, const char *text, int len);
|
||||
void ClearSelection(bool retainMultipleSelections=false);
|
||||
void InsertPaste(const char *text, int len);
|
||||
enum PasteShape { pasteStream=0, pasteRectangular = 1, pasteLine = 2 };
|
||||
void InsertPasteShape(const char *text, int len, PasteShape shape);
|
||||
void ClearSelection(bool retainMultipleSelections = false);
|
||||
void ClearAll();
|
||||
void ClearDocumentStyle();
|
||||
void Cut();
|
||||
|
@@ -20,17 +20,17 @@ using namespace Scintilla;
|
||||
|
||||
static PRectangle PixelGridAlign(const PRectangle &rc) {
|
||||
// Move left and right side to nearest pixel to avoid blurry visuals
|
||||
return PRectangle(int(rc.left + 0.5), rc.top, int(rc.right + 0.5), rc.bottom);
|
||||
return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom));
|
||||
}
|
||||
|
||||
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
|
||||
surface->PenColour(fore);
|
||||
int ymid = (rc.bottom + rc.top) / 2;
|
||||
int ymid = static_cast<int>(rc.bottom + rc.top) / 2;
|
||||
if (style == INDIC_SQUIGGLE) {
|
||||
int x = int(rc.left+0.5);
|
||||
int xLast = int(rc.right+0.5);
|
||||
int y = 0;
|
||||
surface->MoveTo(x, rc.top + y);
|
||||
surface->MoveTo(x, static_cast<int>(rc.top) + y);
|
||||
while (x < xLast) {
|
||||
if ((x + 2) > xLast) {
|
||||
if (xLast > x)
|
||||
@@ -40,12 +40,12 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
|
||||
x += 2;
|
||||
y = 2 - y;
|
||||
}
|
||||
surface->LineTo(x, rc.top + y);
|
||||
surface->LineTo(x, static_cast<int>(rc.top) + y);
|
||||
}
|
||||
} else if (style == INDIC_SQUIGGLEPIXMAP) {
|
||||
PRectangle rcSquiggle = PixelGridAlign(rc);
|
||||
|
||||
int width = Platform::Minimum(4000, rcSquiggle.Width());
|
||||
int width = Platform::Minimum(4000, static_cast<int>(rcSquiggle.Width()));
|
||||
RGBAImage image(width, 3, 1.0, 0);
|
||||
enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f };
|
||||
for (int x = 0; x < width; x++) {
|
||||
@@ -62,19 +62,19 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
|
||||
}
|
||||
surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels());
|
||||
} else if (style == INDIC_SQUIGGLELOW) {
|
||||
surface->MoveTo(rc.left, rc.top);
|
||||
int x = rc.left + 3;
|
||||
surface->MoveTo(static_cast<int>(rc.left), static_cast<int>(rc.top));
|
||||
int x = static_cast<int>(rc.left) + 3;
|
||||
int y = 0;
|
||||
while (x < rc.right) {
|
||||
surface->LineTo(x-1, rc.top + y);
|
||||
surface->LineTo(x - 1, static_cast<int>(rc.top) + y);
|
||||
y = 1 - y;
|
||||
surface->LineTo(x, rc.top + y);
|
||||
surface->LineTo(x, static_cast<int>(rc.top) + y);
|
||||
x += 3;
|
||||
}
|
||||
surface->LineTo(rc.right, rc.top + y); // Finish the line
|
||||
surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rc.top) + y); // Finish the line
|
||||
} else if (style == INDIC_TT) {
|
||||
surface->MoveTo(rc.left, ymid);
|
||||
int x = rc.left + 5;
|
||||
surface->MoveTo(static_cast<int>(rc.left), ymid);
|
||||
int x = static_cast<int>(rc.left) + 5;
|
||||
while (x < rc.right) {
|
||||
surface->LineTo(x, ymid);
|
||||
surface->MoveTo(x-3, ymid);
|
||||
@@ -83,35 +83,35 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
|
||||
surface->MoveTo(x, ymid);
|
||||
x += 5;
|
||||
}
|
||||
surface->LineTo(rc.right, ymid); // Finish the line
|
||||
surface->LineTo(static_cast<int>(rc.right), ymid); // Finish the line
|
||||
if (x - 3 <= rc.right) {
|
||||
surface->MoveTo(x-3, ymid);
|
||||
surface->LineTo(x-3, ymid+2);
|
||||
}
|
||||
} else if (style == INDIC_DIAGONAL) {
|
||||
int x = rc.left;
|
||||
int x = static_cast<int>(rc.left);
|
||||
while (x < rc.right) {
|
||||
surface->MoveTo(x, rc.top+2);
|
||||
surface->MoveTo(x, static_cast<int>(rc.top) + 2);
|
||||
int endX = x+3;
|
||||
int endY = rc.top - 1;
|
||||
int endY = static_cast<int>(rc.top) - 1;
|
||||
if (endX > rc.right) {
|
||||
endY += endX - rc.right;
|
||||
endX = rc.right;
|
||||
endY += endX - static_cast<int>(rc.right);
|
||||
endX = static_cast<int>(rc.right);
|
||||
}
|
||||
surface->LineTo(endX, endY);
|
||||
x += 4;
|
||||
}
|
||||
} else if (style == INDIC_STRIKE) {
|
||||
surface->MoveTo(rc.left, rc.top - 4);
|
||||
surface->LineTo(rc.right, rc.top - 4);
|
||||
surface->MoveTo(static_cast<int>(rc.left), static_cast<int>(rc.top) - 4);
|
||||
surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rc.top) - 4);
|
||||
} else if (style == INDIC_HIDDEN) {
|
||||
// Draw nothing
|
||||
} else if (style == INDIC_BOX) {
|
||||
surface->MoveTo(rc.left, ymid+1);
|
||||
surface->LineTo(rc.right, ymid+1);
|
||||
surface->LineTo(rc.right, rcLine.top+1);
|
||||
surface->LineTo(rc.left, rcLine.top+1);
|
||||
surface->LineTo(rc.left, ymid+1);
|
||||
surface->MoveTo(static_cast<int>(rc.left), ymid + 1);
|
||||
surface->LineTo(static_cast<int>(rc.right), ymid + 1);
|
||||
surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rcLine.top) + 1);
|
||||
surface->LineTo(static_cast<int>(rc.left), static_cast<int>(rcLine.top) + 1);
|
||||
surface->LineTo(static_cast<int>(rc.left), ymid + 1);
|
||||
} else if (style == INDIC_ROUNDBOX || style == INDIC_STRAIGHTBOX) {
|
||||
PRectangle rcBox = rcLine;
|
||||
rcBox.top = rcLine.top + 1;
|
||||
@@ -123,32 +123,32 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
|
||||
rcBox.top = rcLine.top + 1;
|
||||
rcBox.bottom = rcLine.bottom;
|
||||
// Cap width at 4000 to avoid large allocations when mistakes made
|
||||
int width = Platform::Minimum(rcBox.Width(), 4000);
|
||||
RGBAImage image(width, rcBox.Height(), 1.0, 0);
|
||||
int width = Platform::Minimum(static_cast<int>(rcBox.Width()), 4000);
|
||||
RGBAImage image(width, static_cast<int>(rcBox.Height()), 1.0, 0);
|
||||
// Draw horizontal lines top and bottom
|
||||
for (int x=0; x<width; x++) {
|
||||
for (int y=0; y<rcBox.Height(); y += rcBox.Height()-1) {
|
||||
for (int y = 0; y<static_cast<int>(rcBox.Height()); y += static_cast<int>(rcBox.Height()) - 1) {
|
||||
image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
|
||||
}
|
||||
}
|
||||
// Draw vertical lines left and right
|
||||
for (int y=1; y<rcBox.Height(); y++) {
|
||||
for (int y = 1; y<static_cast<int>(rcBox.Height()); y++) {
|
||||
for (int x=0; x<width; x += width-1) {
|
||||
image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
|
||||
}
|
||||
}
|
||||
surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels());
|
||||
} else if (style == INDIC_DASH) {
|
||||
int x = rc.left;
|
||||
int x = static_cast<int>(rc.left);
|
||||
while (x < rc.right) {
|
||||
surface->MoveTo(x, ymid);
|
||||
surface->LineTo(Platform::Minimum(x + 4, rc.right), ymid);
|
||||
surface->LineTo(Platform::Minimum(x + 4, static_cast<int>(rc.right)), ymid);
|
||||
x += 7;
|
||||
}
|
||||
} else if (style == INDIC_DOTS) {
|
||||
int x = rc.left;
|
||||
while (x < rc.right) {
|
||||
PRectangle rcDot(x, ymid, x+1, ymid+1);
|
||||
int x = static_cast<int>(rc.left);
|
||||
while (x < static_cast<int>(rc.right)) {
|
||||
PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1);
|
||||
surface->FillRectangle(rcDot, fore);
|
||||
x += 2;
|
||||
}
|
||||
@@ -156,8 +156,8 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
|
||||
PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom);
|
||||
surface->FillRectangle(rcComposition, fore);
|
||||
} else { // Either INDIC_PLAIN or unknown
|
||||
surface->MoveTo(rc.left, ymid);
|
||||
surface->LineTo(rc.right, ymid);
|
||||
surface->MoveTo(static_cast<int>(rc.left), ymid);
|
||||
surface->LineTo(static_cast<int>(rc.right), ymid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -37,37 +37,37 @@ void LineMarker::SetXPM(const char *const *linesForm) {
|
||||
|
||||
void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage) {
|
||||
delete image;
|
||||
image = new RGBAImage(sizeRGBAImage.x, sizeRGBAImage.y, scale, pixelsRGBAImage);
|
||||
image = new RGBAImage(static_cast<int>(sizeRGBAImage.x), static_cast<int>(sizeRGBAImage.y), scale, pixelsRGBAImage);
|
||||
markType = SC_MARK_RGBAIMAGE;
|
||||
}
|
||||
|
||||
static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) {
|
||||
PRectangle rc;
|
||||
rc.left = centreX - armSize;
|
||||
rc.top = centreY - armSize;
|
||||
rc.right = centreX + armSize + 1;
|
||||
rc.bottom = centreY + armSize + 1;
|
||||
PRectangle rc = PRectangle::FromInts(
|
||||
centreX - armSize,
|
||||
centreY - armSize,
|
||||
centreX + armSize + 1,
|
||||
centreY + armSize + 1);
|
||||
surface->RectangleDraw(rc, back, fore);
|
||||
}
|
||||
|
||||
static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) {
|
||||
PRectangle rcCircle;
|
||||
rcCircle.left = centreX - armSize;
|
||||
rcCircle.top = centreY - armSize;
|
||||
rcCircle.right = centreX + armSize + 1;
|
||||
rcCircle.bottom = centreY + armSize + 1;
|
||||
PRectangle rcCircle = PRectangle::FromInts(
|
||||
centreX - armSize,
|
||||
centreY - armSize,
|
||||
centreX + armSize + 1,
|
||||
centreY + armSize + 1);
|
||||
surface->Ellipse(rcCircle, back, fore);
|
||||
}
|
||||
|
||||
static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) {
|
||||
PRectangle rcV(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1);
|
||||
PRectangle rcV = PRectangle::FromInts(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1);
|
||||
surface->FillRectangle(rcV, fore);
|
||||
PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
|
||||
PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1);
|
||||
surface->FillRectangle(rcH, fore);
|
||||
}
|
||||
|
||||
static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) {
|
||||
PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
|
||||
PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1);
|
||||
surface->FillRectangle(rcH, fore);
|
||||
}
|
||||
|
||||
@@ -102,9 +102,9 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
if ((markType == SC_MARK_RGBAIMAGE) && (image)) {
|
||||
// Make rectangle just large enough to fit image centred on centre of rcWhole
|
||||
PRectangle rcImage;
|
||||
rcImage.top = static_cast<int>(((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2);
|
||||
rcImage.top = ((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2;
|
||||
rcImage.bottom = rcImage.top + image->GetScaledHeight();
|
||||
rcImage.left = static_cast<int>(((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2);
|
||||
rcImage.left = ((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2;
|
||||
rcImage.right = rcImage.left + image->GetScaledWidth();
|
||||
surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels());
|
||||
return;
|
||||
@@ -113,17 +113,17 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
PRectangle rc = rcWhole;
|
||||
rc.top++;
|
||||
rc.bottom--;
|
||||
int minDim = Platform::Minimum(rc.Width(), rc.Height());
|
||||
int minDim = Platform::Minimum(static_cast<int>(rc.Width()), static_cast<int>(rc.Height()));
|
||||
minDim--; // Ensure does not go beyond edge
|
||||
int centreX = floor((rc.right + rc.left) / 2.0);
|
||||
int centreY = floor((rc.bottom + rc.top) / 2.0);
|
||||
int centreX = static_cast<int>(floor((rc.right + rc.left) / 2.0));
|
||||
int centreY = static_cast<int>(floor((rc.bottom + rc.top) / 2.0));
|
||||
int dimOn2 = minDim / 2;
|
||||
int dimOn4 = minDim / 4;
|
||||
int blobSize = dimOn2-1;
|
||||
int armSize = dimOn2-2;
|
||||
if (marginStyle == SC_MARGIN_NUMBER || marginStyle == SC_MARGIN_TEXT || marginStyle == SC_MARGIN_RTEXT) {
|
||||
// On textual margins move marker to the left to try to avoid overlapping the text
|
||||
centreX = rc.left + dimOn2 + 1;
|
||||
centreX = static_cast<int>(rc.left) + dimOn2 + 1;
|
||||
}
|
||||
if (markType == SC_MARK_ROUNDRECT) {
|
||||
PRectangle rcRounded = rc;
|
||||
@@ -131,51 +131,51 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
rcRounded.right = rc.right - 1;
|
||||
surface->RoundedRectangle(rcRounded, fore, back);
|
||||
} else if (markType == SC_MARK_CIRCLE) {
|
||||
PRectangle rcCircle;
|
||||
rcCircle.left = centreX - dimOn2;
|
||||
rcCircle.top = centreY - dimOn2;
|
||||
rcCircle.right = centreX + dimOn2;
|
||||
rcCircle.bottom = centreY + dimOn2;
|
||||
PRectangle rcCircle = PRectangle::FromInts(
|
||||
centreX - dimOn2,
|
||||
centreY - dimOn2,
|
||||
centreX + dimOn2,
|
||||
centreY + dimOn2);
|
||||
surface->Ellipse(rcCircle, fore, back);
|
||||
} else if (markType == SC_MARK_ARROW) {
|
||||
Point pts[] = {
|
||||
Point(centreX - dimOn4, centreY - dimOn2),
|
||||
Point(centreX - dimOn4, centreY + dimOn2),
|
||||
Point(centreX + dimOn2 - dimOn4, centreY),
|
||||
Point::FromInts(centreX - dimOn4, centreY - dimOn2),
|
||||
Point::FromInts(centreX - dimOn4, centreY + dimOn2),
|
||||
Point::FromInts(centreX + dimOn2 - dimOn4, centreY),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
|
||||
} else if (markType == SC_MARK_ARROWDOWN) {
|
||||
Point pts[] = {
|
||||
Point(centreX - dimOn2, centreY - dimOn4),
|
||||
Point(centreX + dimOn2, centreY - dimOn4),
|
||||
Point(centreX, centreY + dimOn2 - dimOn4),
|
||||
Point::FromInts(centreX - dimOn2, centreY - dimOn4),
|
||||
Point::FromInts(centreX + dimOn2, centreY - dimOn4),
|
||||
Point::FromInts(centreX, centreY + dimOn2 - dimOn4),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
|
||||
} else if (markType == SC_MARK_PLUS) {
|
||||
Point pts[] = {
|
||||
Point(centreX - armSize, centreY - 1),
|
||||
Point(centreX - 1, centreY - 1),
|
||||
Point(centreX - 1, centreY - armSize),
|
||||
Point(centreX + 1, centreY - armSize),
|
||||
Point(centreX + 1, centreY - 1),
|
||||
Point(centreX + armSize, centreY -1),
|
||||
Point(centreX + armSize, centreY +1),
|
||||
Point(centreX + 1, centreY + 1),
|
||||
Point(centreX + 1, centreY + armSize),
|
||||
Point(centreX - 1, centreY + armSize),
|
||||
Point(centreX - 1, centreY + 1),
|
||||
Point(centreX - armSize, centreY + 1),
|
||||
Point::FromInts(centreX - armSize, centreY - 1),
|
||||
Point::FromInts(centreX - 1, centreY - 1),
|
||||
Point::FromInts(centreX - 1, centreY - armSize),
|
||||
Point::FromInts(centreX + 1, centreY - armSize),
|
||||
Point::FromInts(centreX + 1, centreY - 1),
|
||||
Point::FromInts(centreX + armSize, centreY -1),
|
||||
Point::FromInts(centreX + armSize, centreY +1),
|
||||
Point::FromInts(centreX + 1, centreY + 1),
|
||||
Point::FromInts(centreX + 1, centreY + armSize),
|
||||
Point::FromInts(centreX - 1, centreY + armSize),
|
||||
Point::FromInts(centreX - 1, centreY + 1),
|
||||
Point::FromInts(centreX - armSize, centreY + 1),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
|
||||
} else if (markType == SC_MARK_MINUS) {
|
||||
Point pts[] = {
|
||||
Point(centreX - armSize, centreY - 1),
|
||||
Point(centreX + armSize, centreY -1),
|
||||
Point(centreX + armSize, centreY +1),
|
||||
Point(centreX - armSize, centreY + 1),
|
||||
Point::FromInts(centreX - armSize, centreY - 1),
|
||||
Point::FromInts(centreX + armSize, centreY -1),
|
||||
Point::FromInts(centreX + armSize, centreY +1),
|
||||
Point::FromInts(centreX - armSize, centreY + 1),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
|
||||
@@ -193,46 +193,46 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
|
||||
} else if (markType == SC_MARK_VLINE) {
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
} else if (markType == SC_MARK_LCORNER) {
|
||||
surface->PenColour(tail);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY);
|
||||
surface->LineTo(rc.right - 1, centreY);
|
||||
surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
|
||||
|
||||
} else if (markType == SC_MARK_TCORNER) {
|
||||
surface->PenColour(tail);
|
||||
surface->MoveTo(centreX, centreY);
|
||||
surface->LineTo(rc.right - 1, centreY);
|
||||
surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY + 1);
|
||||
|
||||
surface->PenColour(head);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
} else if (markType == SC_MARK_LCORNERCURVE) {
|
||||
surface->PenColour(tail);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY-3);
|
||||
surface->LineTo(centreX+3, centreY);
|
||||
surface->LineTo(rc.right - 1, centreY);
|
||||
surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
|
||||
|
||||
} else if (markType == SC_MARK_TCORNERCURVE) {
|
||||
surface->PenColour(tail);
|
||||
surface->MoveTo(centreX, centreY-3);
|
||||
surface->LineTo(centreX+3, centreY);
|
||||
surface->LineTo(rc.right - 1, centreY);
|
||||
surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY-2);
|
||||
|
||||
surface->PenColour(head);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
} else if (markType == SC_MARK_BOXPLUS) {
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, head);
|
||||
@@ -244,10 +244,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
else
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY - blobSize);
|
||||
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, head);
|
||||
@@ -270,7 +270,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
|
||||
surface->PenColour(head);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
} else if (markType == SC_MARK_BOXMINUSCONNECTED) {
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, head);
|
||||
@@ -278,10 +278,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
|
||||
surface->PenColour(head);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY - blobSize);
|
||||
|
||||
if (tFold == LineMarker::body) {
|
||||
@@ -305,10 +305,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
else
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY - blobSize);
|
||||
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
|
||||
@@ -317,7 +317,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
} else if (markType == SC_MARK_CIRCLEMINUS) {
|
||||
surface->PenColour(head);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, tail);
|
||||
@@ -325,10 +325,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
} else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) {
|
||||
surface->PenColour(head);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY - blobSize);
|
||||
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
|
||||
@@ -344,11 +344,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
character, 1, fore, back);
|
||||
|
||||
} else if (markType == SC_MARK_DOTDOTDOT) {
|
||||
int right = centreX - 6;
|
||||
XYPOSITION right = static_cast<XYPOSITION>(centreX - 6);
|
||||
for (int b=0; b<3; b++) {
|
||||
PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2);
|
||||
surface->FillRectangle(rcBlob, fore);
|
||||
right += 5;
|
||||
right += 5.0f;
|
||||
}
|
||||
} else if (markType == SC_MARK_ARROWS) {
|
||||
surface->PenColour(fore);
|
||||
@@ -363,14 +363,14 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
}
|
||||
} else if (markType == SC_MARK_SHORTARROW) {
|
||||
Point pts[] = {
|
||||
Point(centreX, centreY + dimOn2),
|
||||
Point(centreX + dimOn2, centreY),
|
||||
Point(centreX, centreY - dimOn2),
|
||||
Point(centreX, centreY - dimOn4),
|
||||
Point(centreX - dimOn4, centreY - dimOn4),
|
||||
Point(centreX - dimOn4, centreY + dimOn4),
|
||||
Point(centreX, centreY + dimOn4),
|
||||
Point(centreX, centreY + dimOn2),
|
||||
Point::FromInts(centreX, centreY + dimOn2),
|
||||
Point::FromInts(centreX + dimOn2, centreY),
|
||||
Point::FromInts(centreX, centreY - dimOn2),
|
||||
Point::FromInts(centreX, centreY - dimOn4),
|
||||
Point::FromInts(centreX - dimOn4, centreY - dimOn4),
|
||||
Point::FromInts(centreX - dimOn4, centreY + dimOn4),
|
||||
Point::FromInts(centreX, centreY + dimOn4),
|
||||
Point::FromInts(centreX, centreY + dimOn2),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
} else if (markType == SC_MARK_LEFTRECT) {
|
||||
@@ -380,11 +380,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
} else if (markType == SC_MARK_BOOKMARK) {
|
||||
int halfHeight = minDim / 3;
|
||||
Point pts[] = {
|
||||
Point(rc.left, centreY-halfHeight),
|
||||
Point(rc.right-3, centreY-halfHeight),
|
||||
Point(rc.right-3-halfHeight, centreY),
|
||||
Point(rc.right-3, centreY+halfHeight),
|
||||
Point(rc.left, centreY+halfHeight),
|
||||
Point::FromInts(static_cast<int>(rc.left), centreY-halfHeight),
|
||||
Point::FromInts(static_cast<int>(rc.right) - 3, centreY - halfHeight),
|
||||
Point::FromInts(static_cast<int>(rc.right) - 3 - halfHeight, centreY),
|
||||
Point::FromInts(static_cast<int>(rc.right) - 3, centreY + halfHeight),
|
||||
Point::FromInts(static_cast<int>(rc.left), centreY + halfHeight),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
} else { // SC_MARK_FULLRECT
|
||||
|
@@ -232,7 +232,7 @@ Point LineLayout::PointFromPosition(int posInLine, int lineHeight) const {
|
||||
for (int subLine = 0; subLine < lines; subLine++) {
|
||||
const Range rangeSubLine = SubLineRange(subLine);
|
||||
if (posInLine >= rangeSubLine.start) {
|
||||
pt.y = subLine*lineHeight;
|
||||
pt.y = static_cast<XYPOSITION>(subLine*lineHeight);
|
||||
if (posInLine <= rangeSubLine.end) {
|
||||
pt.x = positions[posInLine] - positions[rangeSubLine.start];
|
||||
if (rangeSubLine.start != 0) // Wrapped lines may be indented
|
||||
@@ -462,7 +462,7 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
|
||||
// Search for first visible break
|
||||
// First find the first visible character
|
||||
if (xStart > 0.0f)
|
||||
nextBreak = ll->FindBefore(xStart, lineStart, lineEnd);
|
||||
nextBreak = ll->FindBefore(static_cast<XYPOSITION>(xStart), lineStart, lineEnd);
|
||||
// Now back to a style break
|
||||
while ((nextBreak > lineStart) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) {
|
||||
nextBreak--;
|
||||
@@ -563,7 +563,7 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
|
||||
if (s_ && positions_) {
|
||||
positions = new XYPOSITION[len + (len / 4) + 1];
|
||||
for (unsigned int i=0; i<len; i++) {
|
||||
positions[i] = static_cast<XYPOSITION>(positions_[i]);
|
||||
positions[i] = positions_[i];
|
||||
}
|
||||
memcpy(reinterpret_cast<char *>(positions + len), s_, len);
|
||||
}
|
||||
@@ -594,7 +594,7 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
|
||||
}
|
||||
}
|
||||
|
||||
int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) {
|
||||
unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) {
|
||||
unsigned int ret = s[0] << 7;
|
||||
for (unsigned int i=0; i<len_; i++) {
|
||||
ret *= 1000003;
|
||||
@@ -646,18 +646,18 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
|
||||
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) {
|
||||
|
||||
allClear = false;
|
||||
int probe = -1;
|
||||
size_t probe = pces.size(); // Out of bounds
|
||||
if ((!pces.empty()) && (len < 30)) {
|
||||
// Only store short strings in the cache so it doesn't churn with
|
||||
// long comments with only a single comment.
|
||||
|
||||
// Two way associative: try two probe positions.
|
||||
int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
|
||||
probe = static_cast<int>(hashValue % pces.size());
|
||||
unsigned int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
|
||||
probe = hashValue % pces.size();
|
||||
if (pces[probe].Retrieve(styleNumber, s, len, positions)) {
|
||||
return;
|
||||
}
|
||||
int probe2 = static_cast<int>((hashValue * 37) % pces.size());
|
||||
unsigned int probe2 = (hashValue * 37) % pces.size();
|
||||
if (pces[probe2].Retrieve(styleNumber, s, len, positions)) {
|
||||
return;
|
||||
}
|
||||
@@ -682,7 +682,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
|
||||
} else {
|
||||
surface->MeasureWidths(vstyle.styles[styleNumber].font, s, len, positions);
|
||||
}
|
||||
if (probe >= 0) {
|
||||
if (probe < pces.size()) {
|
||||
// Store into cache
|
||||
clock++;
|
||||
if (clock > 60000) {
|
||||
// Since there are only 16 bits for the clock, wrap it round and
|
||||
|
@@ -111,7 +111,7 @@ public:
|
||||
void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock);
|
||||
void Clear();
|
||||
bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const;
|
||||
static int Hash(unsigned int styleNumber_, const char *s, unsigned int len);
|
||||
static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len);
|
||||
bool NewerThan(const PositionCacheEntry &other) const;
|
||||
void ResetClock();
|
||||
};
|
||||
|
@@ -207,11 +207,6 @@
|
||||
#include "CharClassify.h"
|
||||
#include "RESearch.h"
|
||||
|
||||
// Shut up annoying Visual C++ warnings:
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4514)
|
||||
#endif
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
@@ -789,7 +784,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
|
||||
c = *(ap+1);
|
||||
while ((lp < endp) && (static_cast<unsigned char>(ci.CharAt(lp)) != c))
|
||||
lp++;
|
||||
if (lp >= endp) /* if EOS, fail, else fall thru. */
|
||||
if (lp >= endp) /* if EOS, fail, else fall through. */
|
||||
return 0;
|
||||
default: /* regular matching all the way. */
|
||||
while (lp < endp) {
|
||||
@@ -819,7 +814,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
|
||||
*
|
||||
* special case optimizations: (nfa[n], nfa[n+1])
|
||||
* CLO ANY
|
||||
* We KNOW .* will match everything upto the
|
||||
* We KNOW .* will match everything up to the
|
||||
* end of line. Thus, directly go to the end of
|
||||
* line, without recursive PMatch calls. As in
|
||||
* the other closure cases, the remaining pattern
|
||||
|
@@ -198,8 +198,8 @@ void ScintillaBase::AutoCompleteDoubleClick(void *p) {
|
||||
void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) {
|
||||
UndoGroup ug(pdoc);
|
||||
pdoc->DeleteChars(startPos, removeLen);
|
||||
pdoc->InsertString(startPos, text, textLen);
|
||||
SetEmptySelection(startPos + textLen);
|
||||
const int lengthInserted = pdoc->InsertString(startPos, text, textLen);
|
||||
SetEmptySelection(startPos + lengthInserted);
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
@@ -233,7 +233,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
int heightLB = ac.heightLBDefault;
|
||||
int widthLB = ac.widthLBDefault;
|
||||
if (pt.x >= rcClient.right - widthLB) {
|
||||
HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB);
|
||||
HorizontalScrollTo(static_cast<int>(xOffset + pt.x - rcClient.right + widthLB));
|
||||
Redraw();
|
||||
pt = PointMainCaret();
|
||||
}
|
||||
@@ -248,17 +248,17 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above.
|
||||
rcac.top = pt.y - heightLB;
|
||||
if (rcac.top < rcPopupBounds.top) {
|
||||
heightLB -= (rcPopupBounds.top - rcac.top);
|
||||
heightLB -= static_cast<int>(rcPopupBounds.top - rcac.top);
|
||||
rcac.top = rcPopupBounds.top;
|
||||
}
|
||||
} else {
|
||||
rcac.top = pt.y + vs.lineHeight;
|
||||
}
|
||||
rcac.right = rcac.left + widthLB;
|
||||
rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom);
|
||||
rcac.bottom = static_cast<XYPOSITION>(Platform::Minimum(static_cast<int>(rcac.top) + heightLB, static_cast<int>(rcPopupBounds.bottom)));
|
||||
ac.lb->SetPositionRelative(rcac, wMain);
|
||||
ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
|
||||
unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
|
||||
unsigned int aveCharWidth = static_cast<unsigned int>(vs.styles[STYLE_DEFAULT].aveCharWidth);
|
||||
ac.lb->SetAverageCharWidth(aveCharWidth);
|
||||
ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
|
||||
|
||||
@@ -266,8 +266,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
|
||||
// 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();
|
||||
int heightAlloced = rcList.bottom - rcList.top;
|
||||
widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
|
||||
int heightAlloced = static_cast<int>(rcList.bottom - rcList.top);
|
||||
widthLB = Platform::Maximum(widthLB, static_cast<int>(rcList.right - rcList.left));
|
||||
if (maxListWidth != 0)
|
||||
widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth);
|
||||
// Make an allowance for large strings in list
|
||||
@@ -416,7 +416,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {
|
||||
// If the call-tip window would be out of the client
|
||||
// space
|
||||
PRectangle rcClient = GetClientRectangle();
|
||||
int offset = vs.lineHeight + rc.Height();
|
||||
int offset = vs.lineHeight + static_cast<int>(rc.Height());
|
||||
// adjust so it displays above the text.
|
||||
if (rc.bottom > rcClient.bottom) {
|
||||
rc.top -= offset;
|
||||
@@ -749,7 +749,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
switch (iMessage) {
|
||||
case SCI_AUTOCSHOW:
|
||||
listType = 0;
|
||||
AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
|
||||
AutoCompleteStart(static_cast<int>(wParam), reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCCANCEL:
|
||||
@@ -813,21 +813,21 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ac.ignoreCase;
|
||||
|
||||
case SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR:
|
||||
ac.ignoreCaseBehaviour = wParam;
|
||||
ac.ignoreCaseBehaviour = static_cast<unsigned int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR:
|
||||
return ac.ignoreCaseBehaviour;
|
||||
|
||||
case SCI_AUTOCSETORDER:
|
||||
ac.autoSort = wParam;
|
||||
ac.autoSort = static_cast<int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETORDER:
|
||||
return ac.autoSort;
|
||||
|
||||
case SCI_USERLISTSHOW:
|
||||
listType = wParam;
|
||||
listType = static_cast<int>(wParam);
|
||||
AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
@@ -846,25 +846,26 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ac.dropRestOfWord;
|
||||
|
||||
case SCI_AUTOCSETMAXHEIGHT:
|
||||
ac.lb->SetVisibleRows(wParam);
|
||||
ac.lb->SetVisibleRows(static_cast<int>(wParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETMAXHEIGHT:
|
||||
return ac.lb->GetVisibleRows();
|
||||
|
||||
case SCI_AUTOCSETMAXWIDTH:
|
||||
maxListWidth = wParam;
|
||||
maxListWidth = static_cast<int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETMAXWIDTH:
|
||||
return maxListWidth;
|
||||
|
||||
case SCI_REGISTERIMAGE:
|
||||
ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
|
||||
ac.lb->RegisterImage(static_cast<int>(wParam), reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_REGISTERRGBAIMAGE:
|
||||
ac.lb->RegisterRGBAImage(wParam, sizeRGBAImage.x, sizeRGBAImage.y, reinterpret_cast<unsigned char *>(lParam));
|
||||
ac.lb->RegisterRGBAImage(static_cast<int>(wParam), static_cast<int>(sizeRGBAImage.x), static_cast<int>(sizeRGBAImage.y),
|
||||
reinterpret_cast<unsigned char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_CLEARREGISTEREDIMAGES:
|
||||
@@ -879,7 +880,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ac.GetTypesep();
|
||||
|
||||
case SCI_CALLTIPSHOW:
|
||||
CallTipShow(LocationFromPosition(wParam),
|
||||
CallTipShow(LocationFromPosition(static_cast<int>(wParam)),
|
||||
reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
@@ -894,32 +895,32 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ct.posStartCallTip;
|
||||
|
||||
case SCI_CALLTIPSETPOSSTART:
|
||||
ct.posStartCallTip = wParam;
|
||||
ct.posStartCallTip = static_cast<int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETHLT:
|
||||
ct.SetHighlight(wParam, lParam);
|
||||
ct.SetHighlight(static_cast<int>(wParam), static_cast<int>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETBACK:
|
||||
ct.colourBG = ColourDesired(wParam);
|
||||
ct.colourBG = ColourDesired(static_cast<long>(wParam));
|
||||
vs.styles[STYLE_CALLTIP].back = ct.colourBG;
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETFORE:
|
||||
ct.colourUnSel = ColourDesired(wParam);
|
||||
ct.colourUnSel = ColourDesired(static_cast<long>(wParam));
|
||||
vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETFOREHLT:
|
||||
ct.colourSel = ColourDesired(wParam);
|
||||
ct.colourSel = ColourDesired(static_cast<long>(wParam));
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPUSESTYLE:
|
||||
ct.SetTabSize((int)wParam);
|
||||
ct.SetTabSize(static_cast<int>(wParam));
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
@@ -934,7 +935,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
|
||||
#ifdef SCI_LEXER
|
||||
case SCI_SETLEXER:
|
||||
DocumentLexState()->SetLexer(wParam);
|
||||
DocumentLexState()->SetLexer(static_cast<int>(wParam));
|
||||
break;
|
||||
|
||||
case SCI_GETLEXER:
|
||||
@@ -942,10 +943,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
|
||||
case SCI_COLOURISE:
|
||||
if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) {
|
||||
pdoc->ModifiedAt(wParam);
|
||||
NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam);
|
||||
pdoc->ModifiedAt(static_cast<int>(wParam));
|
||||
NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : static_cast<int>(lParam));
|
||||
} else {
|
||||
DocumentLexState()->Colourise(wParam, lParam);
|
||||
DocumentLexState()->Colourise(static_cast<int>(wParam), static_cast<int>(lParam));
|
||||
}
|
||||
Redraw();
|
||||
break;
|
||||
@@ -963,7 +964,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
reinterpret_cast<char *>(lParam));
|
||||
|
||||
case SCI_GETPROPERTYINT:
|
||||
return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), lParam);
|
||||
return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), static_cast<int>(lParam));
|
||||
|
||||
case SCI_SETKEYWORDS:
|
||||
DocumentLexState()->SetWordList(wParam, reinterpret_cast<const char *>(lParam));
|
||||
|
@@ -230,6 +230,14 @@ SelectionRange &Selection::RangeMain() {
|
||||
return ranges[mainRange];
|
||||
}
|
||||
|
||||
SelectionPosition Selection::Start() const {
|
||||
if (IsRectangular()) {
|
||||
return rangeRectangular.Start();
|
||||
} else {
|
||||
return ranges[mainRange].Start();
|
||||
}
|
||||
}
|
||||
|
||||
bool Selection::MoveExtends() const {
|
||||
return moveExtends;
|
||||
}
|
||||
|
@@ -157,6 +157,7 @@ public:
|
||||
void SetMain(size_t r);
|
||||
SelectionRange &Range(size_t r);
|
||||
SelectionRange &RangeMain();
|
||||
SelectionPosition Start() const;
|
||||
bool MoveExtends() const;
|
||||
void SetMoveExtends(bool moveExtends_);
|
||||
bool Empty() const;
|
||||
|
@@ -75,12 +75,12 @@ void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, cons
|
||||
if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1
|
||||
sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER;
|
||||
|
||||
float deviceHeight = surface.DeviceHeightFont(sizeZoomed);
|
||||
float deviceHeight = static_cast<float>(surface.DeviceHeightFont(sizeZoomed));
|
||||
FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, fs.italic, fs.extraFontFlag, technology, fs.characterSet);
|
||||
font.Create(fp);
|
||||
|
||||
ascent = surface.Ascent(font);
|
||||
descent = surface.Descent(font);
|
||||
ascent = static_cast<unsigned int>(surface.Ascent(font));
|
||||
descent = static_cast<unsigned int>(surface.Descent(font));
|
||||
aveCharWidth = surface.AverageCharWidth(font);
|
||||
spaceWidth = surface.WidthChar(font, ' ');
|
||||
}
|
||||
@@ -347,7 +347,7 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) {
|
||||
|
||||
controlCharWidth = 0.0;
|
||||
if (controlCharSymbol >= 32) {
|
||||
controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, controlCharSymbol);
|
||||
controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, static_cast<char>(controlCharSymbol));
|
||||
}
|
||||
|
||||
fixedColumnWidth = marginInside ? leftMarginWidth : 0;
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
bool isSet;
|
||||
ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) {
|
||||
}
|
||||
ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(lParam), isSet(wParam != 0) {
|
||||
ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(static_cast<long>(lParam)), isSet(wParam != 0) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -47,7 +47,7 @@ ColourDesired XPM::ColourFromCode(int ch) const {
|
||||
|
||||
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);
|
||||
PRectangle rc = PRectangle::FromInts(startX, y, x, y + 1);
|
||||
surface->FillRectangle(rc, ColourFromCode(code));
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ void XPM::Init(const char *const *linesForm) {
|
||||
if (*colourDef == '#') {
|
||||
colour.Set(colourDef);
|
||||
} else {
|
||||
codeTransparent = code;
|
||||
codeTransparent = static_cast<char>(code);
|
||||
}
|
||||
colourCodeTable[code] = colour;
|
||||
}
|
||||
@@ -127,8 +127,8 @@ void XPM::Draw(Surface *surface, PRectangle &rc) {
|
||||
return;
|
||||
}
|
||||
// Centre the pixmap
|
||||
int startY = rc.top + (rc.Height() - height) / 2;
|
||||
int startX = rc.left + (rc.Width() - width) / 2;
|
||||
int startY = static_cast<int>(rc.top + (rc.Height() - height) / 2);
|
||||
int startX = static_cast<int>(rc.left + (rc.Width() - width) / 2);
|
||||
for (int y=0; y<height; y++) {
|
||||
int prevCode = 0;
|
||||
int xStartRun = 0;
|
||||
|
@@ -282,6 +282,12 @@ void wxStyledTextCtrl::InsertText(int pos, const wxString& text)
|
||||
SendMsg(SCI_INSERTTEXT, pos, (sptr_t)(const char*)wx2stc(text));
|
||||
}
|
||||
|
||||
// Change the text that is being inserted in response to SC_MOD_INSERTCHECK
|
||||
void wxStyledTextCtrl::ChangeInsertion(int length, const wxString& text)
|
||||
{
|
||||
SendMsg(SCI_CHANGEINSERTION, length, (sptr_t)(const char*)wx2stc(text));
|
||||
}
|
||||
|
||||
// Delete all text in the document.
|
||||
void wxStyledTextCtrl::ClearAll()
|
||||
{
|
||||
@@ -5317,7 +5323,7 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
|
||||
|
||||
/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
|
||||
{
|
||||
return wxVersionInfo("Scintilla", 3, 4, 1, "Scintilla 3.4.1");
|
||||
return wxVersionInfo("Scintilla", 3, 4, 2, "Scintilla 3.4.2");
|
||||
}
|
||||
|
||||
#endif // wxUSE_STC
|
||||
|
@@ -1205,7 +1205,7 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
|
||||
|
||||
/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
|
||||
{
|
||||
return wxVersionInfo("Scintilla", 3, 4, 1, "Scintilla 3.4.1");
|
||||
return wxVersionInfo("Scintilla", 3, 4, 2, "Scintilla 3.4.2");
|
||||
}
|
||||
|
||||
#endif // wxUSE_STC
|
||||
|
Reference in New Issue
Block a user