Updated Scintilla to version 1.70

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40086 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-07-14 01:20:18 +00:00
parent dc8a1aa53d
commit b8193d807f
98 changed files with 5324 additions and 1112 deletions

View File

@@ -43,6 +43,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_AutoComplete.obj \
$(OBJS)\stcdll_CallTip.obj \
$(OBJS)\stcdll_CellBuffer.obj \
$(OBJS)\stcdll_CharClassify.obj \
$(OBJS)\stcdll_ContractionState.obj \
$(OBJS)\stcdll_Document.obj \
$(OBJS)\stcdll_DocumentAccessor.obj \
@@ -77,6 +78,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexGui4Cli.obj \
$(OBJS)\stcdll_LexHTML.obj \
$(OBJS)\stcdll_LexHaskell.obj \
$(OBJS)\stcdll_LexInno.obj \
$(OBJS)\stcdll_LexKix.obj \
$(OBJS)\stcdll_LexLisp.obj \
$(OBJS)\stcdll_LexLout.obj \
@@ -87,6 +89,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexMatlab.obj \
$(OBJS)\stcdll_LexMetapost.obj \
$(OBJS)\stcdll_LexNsis.obj \
$(OBJS)\stcdll_LexOpal.obj \
$(OBJS)\stcdll_LexOthers.obj \
$(OBJS)\stcdll_LexPB.obj \
$(OBJS)\stcdll_LexPOV.obj \
@@ -101,6 +104,8 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexTADS3.obj \
$(OBJS)\stcdll_LexScriptol.obj \
$(OBJS)\stcdll_LexSpecman.obj \
$(OBJS)\stcdll_LexSpice.obj \
$(OBJS)\stcdll_LexTCL.obj \
$(OBJS)\stcdll_LexTeX.obj \
$(OBJS)\stcdll_LexVB.obj \
$(OBJS)\stcdll_LexVHDL.obj \
@@ -131,6 +136,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_AutoComplete.obj \
$(OBJS)\stclib_CallTip.obj \
$(OBJS)\stclib_CellBuffer.obj \
$(OBJS)\stclib_CharClassify.obj \
$(OBJS)\stclib_ContractionState.obj \
$(OBJS)\stclib_Document.obj \
$(OBJS)\stclib_DocumentAccessor.obj \
@@ -165,6 +171,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexGui4Cli.obj \
$(OBJS)\stclib_LexHTML.obj \
$(OBJS)\stclib_LexHaskell.obj \
$(OBJS)\stclib_LexInno.obj \
$(OBJS)\stclib_LexKix.obj \
$(OBJS)\stclib_LexLisp.obj \
$(OBJS)\stclib_LexLout.obj \
@@ -175,6 +182,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexMatlab.obj \
$(OBJS)\stclib_LexMetapost.obj \
$(OBJS)\stclib_LexNsis.obj \
$(OBJS)\stclib_LexOpal.obj \
$(OBJS)\stclib_LexOthers.obj \
$(OBJS)\stclib_LexPB.obj \
$(OBJS)\stclib_LexPOV.obj \
@@ -189,6 +197,8 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexTADS3.obj \
$(OBJS)\stclib_LexScriptol.obj \
$(OBJS)\stclib_LexSpecman.obj \
$(OBJS)\stclib_LexSpice.obj \
$(OBJS)\stclib_LexTCL.obj \
$(OBJS)\stclib_LexTeX.obj \
$(OBJS)\stclib_LexVB.obj \
$(OBJS)\stclib_LexVHDL.obj \
@@ -428,6 +438,9 @@ $(OBJS)\stcdll_CallTip.obj: ../../src/stc\scintilla\src\CallTip.cxx
$(OBJS)\stcdll_CellBuffer.obj: ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_CharClassify.obj: ../../src/stc\scintilla\src\CharClassify.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_ContractionState.obj: ../../src/stc\scintilla\src\ContractionState.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@@ -530,6 +543,9 @@ $(OBJS)\stcdll_LexHTML.obj: ../../src/stc\scintilla\src\LexHTML.cxx
$(OBJS)\stcdll_LexHaskell.obj: ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexInno.obj: ../../src/stc\scintilla\src\LexInno.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexKix.obj: ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@@ -560,6 +576,9 @@ $(OBJS)\stcdll_LexMetapost.obj: ../../src/stc\scintilla\src\LexMetapost.cxx
$(OBJS)\stcdll_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexOpal.obj: ../../src/stc\scintilla\src\LexOpal.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexOthers.obj: ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@@ -602,6 +621,12 @@ $(OBJS)\stcdll_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
$(OBJS)\stcdll_LexSpecman.obj: ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexSpice.obj: ../../src/stc\scintilla\src\LexSpice.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexTCL.obj: ../../src/stc\scintilla\src\LexTCL.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexTeX.obj: ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@@ -665,6 +690,9 @@ $(OBJS)\stclib_CallTip.obj: ../../src/stc\scintilla\src\CallTip.cxx
$(OBJS)\stclib_CellBuffer.obj: ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_CharClassify.obj: ../../src/stc\scintilla\src\CharClassify.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_ContractionState.obj: ../../src/stc\scintilla\src\ContractionState.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
@@ -767,6 +795,9 @@ $(OBJS)\stclib_LexHTML.obj: ../../src/stc\scintilla\src\LexHTML.cxx
$(OBJS)\stclib_LexHaskell.obj: ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexInno.obj: ../../src/stc\scintilla\src\LexInno.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexKix.obj: ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
@@ -797,6 +828,9 @@ $(OBJS)\stclib_LexMetapost.obj: ../../src/stc\scintilla\src\LexMetapost.cxx
$(OBJS)\stclib_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexOpal.obj: ../../src/stc\scintilla\src\LexOpal.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexOthers.obj: ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
@@ -839,6 +873,12 @@ $(OBJS)\stclib_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
$(OBJS)\stclib_LexSpecman.obj: ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexSpice.obj: ../../src/stc\scintilla\src\LexSpice.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexTCL.obj: ../../src/stc\scintilla\src\LexTCL.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexTeX.obj: ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**

View File

@@ -36,6 +36,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_AutoComplete.o \
$(OBJS)\stcdll_CallTip.o \
$(OBJS)\stcdll_CellBuffer.o \
$(OBJS)\stcdll_CharClassify.o \
$(OBJS)\stcdll_ContractionState.o \
$(OBJS)\stcdll_Document.o \
$(OBJS)\stcdll_DocumentAccessor.o \
@@ -70,6 +71,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexGui4Cli.o \
$(OBJS)\stcdll_LexHTML.o \
$(OBJS)\stcdll_LexHaskell.o \
$(OBJS)\stcdll_LexInno.o \
$(OBJS)\stcdll_LexKix.o \
$(OBJS)\stcdll_LexLisp.o \
$(OBJS)\stcdll_LexLout.o \
@@ -80,6 +82,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexMatlab.o \
$(OBJS)\stcdll_LexMetapost.o \
$(OBJS)\stcdll_LexNsis.o \
$(OBJS)\stcdll_LexOpal.o \
$(OBJS)\stcdll_LexOthers.o \
$(OBJS)\stcdll_LexPB.o \
$(OBJS)\stcdll_LexPOV.o \
@@ -94,6 +97,8 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexTADS3.o \
$(OBJS)\stcdll_LexScriptol.o \
$(OBJS)\stcdll_LexSpecman.o \
$(OBJS)\stcdll_LexSpice.o \
$(OBJS)\stcdll_LexTCL.o \
$(OBJS)\stcdll_LexTeX.o \
$(OBJS)\stcdll_LexVB.o \
$(OBJS)\stcdll_LexVHDL.o \
@@ -124,6 +129,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_AutoComplete.o \
$(OBJS)\stclib_CallTip.o \
$(OBJS)\stclib_CellBuffer.o \
$(OBJS)\stclib_CharClassify.o \
$(OBJS)\stclib_ContractionState.o \
$(OBJS)\stclib_Document.o \
$(OBJS)\stclib_DocumentAccessor.o \
@@ -158,6 +164,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexGui4Cli.o \
$(OBJS)\stclib_LexHTML.o \
$(OBJS)\stclib_LexHaskell.o \
$(OBJS)\stclib_LexInno.o \
$(OBJS)\stclib_LexKix.o \
$(OBJS)\stclib_LexLisp.o \
$(OBJS)\stclib_LexLout.o \
@@ -168,6 +175,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexMatlab.o \
$(OBJS)\stclib_LexMetapost.o \
$(OBJS)\stclib_LexNsis.o \
$(OBJS)\stclib_LexOpal.o \
$(OBJS)\stclib_LexOthers.o \
$(OBJS)\stclib_LexPB.o \
$(OBJS)\stclib_LexPOV.o \
@@ -182,6 +190,8 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexTADS3.o \
$(OBJS)\stclib_LexScriptol.o \
$(OBJS)\stclib_LexSpecman.o \
$(OBJS)\stclib_LexSpice.o \
$(OBJS)\stclib_LexTCL.o \
$(OBJS)\stclib_LexTeX.o \
$(OBJS)\stclib_LexVB.o \
$(OBJS)\stclib_LexVHDL.o \
@@ -418,6 +428,9 @@ $(OBJS)\stcdll_CallTip.o: ../../src/stc/scintilla/src/CallTip.cxx
$(OBJS)\stcdll_CellBuffer.o: ../../src/stc/scintilla/src/CellBuffer.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_CharClassify.o: ../../src/stc/scintilla/src/CharClassify.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_ContractionState.o: ../../src/stc/scintilla/src/ContractionState.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -520,6 +533,9 @@ $(OBJS)\stcdll_LexHTML.o: ../../src/stc/scintilla/src/LexHTML.cxx
$(OBJS)\stcdll_LexHaskell.o: ../../src/stc/scintilla/src/LexHaskell.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexInno.o: ../../src/stc/scintilla/src/LexInno.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexKix.o: ../../src/stc/scintilla/src/LexKix.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -550,6 +566,9 @@ $(OBJS)\stcdll_LexMetapost.o: ../../src/stc/scintilla/src/LexMetapost.cxx
$(OBJS)\stcdll_LexNsis.o: ../../src/stc/scintilla/src/LexNsis.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexOpal.o: ../../src/stc/scintilla/src/LexOpal.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexOthers.o: ../../src/stc/scintilla/src/LexOthers.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -592,6 +611,12 @@ $(OBJS)\stcdll_LexScriptol.o: ../../src/stc/scintilla/src/LexScriptol.cxx
$(OBJS)\stcdll_LexSpecman.o: ../../src/stc/scintilla/src/LexSpecman.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexSpice.o: ../../src/stc/scintilla/src/LexSpice.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexTCL.o: ../../src/stc/scintilla/src/LexTCL.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexTeX.o: ../../src/stc/scintilla/src/LexTeX.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -655,6 +680,9 @@ $(OBJS)\stclib_CallTip.o: ../../src/stc/scintilla/src/CallTip.cxx
$(OBJS)\stclib_CellBuffer.o: ../../src/stc/scintilla/src/CellBuffer.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_CharClassify.o: ../../src/stc/scintilla/src/CharClassify.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_ContractionState.o: ../../src/stc/scintilla/src/ContractionState.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -757,6 +785,9 @@ $(OBJS)\stclib_LexHTML.o: ../../src/stc/scintilla/src/LexHTML.cxx
$(OBJS)\stclib_LexHaskell.o: ../../src/stc/scintilla/src/LexHaskell.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexInno.o: ../../src/stc/scintilla/src/LexInno.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexKix.o: ../../src/stc/scintilla/src/LexKix.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -787,6 +818,9 @@ $(OBJS)\stclib_LexMetapost.o: ../../src/stc/scintilla/src/LexMetapost.cxx
$(OBJS)\stclib_LexNsis.o: ../../src/stc/scintilla/src/LexNsis.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexOpal.o: ../../src/stc/scintilla/src/LexOpal.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexOthers.o: ../../src/stc/scintilla/src/LexOthers.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -829,6 +863,12 @@ $(OBJS)\stclib_LexScriptol.o: ../../src/stc/scintilla/src/LexScriptol.cxx
$(OBJS)\stclib_LexSpecman.o: ../../src/stc/scintilla/src/LexSpecman.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexSpice.o: ../../src/stc/scintilla/src/LexSpice.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexTCL.o: ../../src/stc/scintilla/src/LexTCL.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexTeX.o: ../../src/stc/scintilla/src/LexTeX.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -39,6 +39,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_AutoComplete.obj \
$(OBJS)\stcdll_CallTip.obj \
$(OBJS)\stcdll_CellBuffer.obj \
$(OBJS)\stcdll_CharClassify.obj \
$(OBJS)\stcdll_ContractionState.obj \
$(OBJS)\stcdll_Document.obj \
$(OBJS)\stcdll_DocumentAccessor.obj \
@@ -73,6 +74,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexGui4Cli.obj \
$(OBJS)\stcdll_LexHTML.obj \
$(OBJS)\stcdll_LexHaskell.obj \
$(OBJS)\stcdll_LexInno.obj \
$(OBJS)\stcdll_LexKix.obj \
$(OBJS)\stcdll_LexLisp.obj \
$(OBJS)\stcdll_LexLout.obj \
@@ -83,6 +85,7 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexMatlab.obj \
$(OBJS)\stcdll_LexMetapost.obj \
$(OBJS)\stcdll_LexNsis.obj \
$(OBJS)\stcdll_LexOpal.obj \
$(OBJS)\stcdll_LexOthers.obj \
$(OBJS)\stcdll_LexPB.obj \
$(OBJS)\stcdll_LexPOV.obj \
@@ -97,6 +100,8 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexTADS3.obj \
$(OBJS)\stcdll_LexScriptol.obj \
$(OBJS)\stcdll_LexSpecman.obj \
$(OBJS)\stcdll_LexSpice.obj \
$(OBJS)\stcdll_LexTCL.obj \
$(OBJS)\stcdll_LexTeX.obj \
$(OBJS)\stcdll_LexVB.obj \
$(OBJS)\stcdll_LexVHDL.obj \
@@ -129,6 +134,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_AutoComplete.obj \
$(OBJS)\stclib_CallTip.obj \
$(OBJS)\stclib_CellBuffer.obj \
$(OBJS)\stclib_CharClassify.obj \
$(OBJS)\stclib_ContractionState.obj \
$(OBJS)\stclib_Document.obj \
$(OBJS)\stclib_DocumentAccessor.obj \
@@ -163,6 +169,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexGui4Cli.obj \
$(OBJS)\stclib_LexHTML.obj \
$(OBJS)\stclib_LexHaskell.obj \
$(OBJS)\stclib_LexInno.obj \
$(OBJS)\stclib_LexKix.obj \
$(OBJS)\stclib_LexLisp.obj \
$(OBJS)\stclib_LexLout.obj \
@@ -173,6 +180,7 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexMatlab.obj \
$(OBJS)\stclib_LexMetapost.obj \
$(OBJS)\stclib_LexNsis.obj \
$(OBJS)\stclib_LexOpal.obj \
$(OBJS)\stclib_LexOthers.obj \
$(OBJS)\stclib_LexPB.obj \
$(OBJS)\stclib_LexPOV.obj \
@@ -187,6 +195,8 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexTADS3.obj \
$(OBJS)\stclib_LexScriptol.obj \
$(OBJS)\stclib_LexSpecman.obj \
$(OBJS)\stclib_LexSpice.obj \
$(OBJS)\stclib_LexTCL.obj \
$(OBJS)\stclib_LexTeX.obj \
$(OBJS)\stclib_LexVB.obj \
$(OBJS)\stclib_LexVHDL.obj \
@@ -512,6 +522,9 @@ $(OBJS)\stcdll_CallTip.obj: ../../src/stc\scintilla\src\CallTip.cxx
$(OBJS)\stcdll_CellBuffer.obj: ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_CharClassify.obj: ../../src/stc\scintilla\src\CharClassify.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_ContractionState.obj: ../../src/stc\scintilla\src\ContractionState.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@@ -614,6 +627,9 @@ $(OBJS)\stcdll_LexHTML.obj: ../../src/stc\scintilla\src\LexHTML.cxx
$(OBJS)\stcdll_LexHaskell.obj: ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexInno.obj: ../../src/stc\scintilla\src\LexInno.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexKix.obj: ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@@ -644,6 +660,9 @@ $(OBJS)\stcdll_LexMetapost.obj: ../../src/stc\scintilla\src\LexMetapost.cxx
$(OBJS)\stcdll_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexOpal.obj: ../../src/stc\scintilla\src\LexOpal.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexOthers.obj: ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@@ -686,6 +705,12 @@ $(OBJS)\stcdll_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
$(OBJS)\stcdll_LexSpecman.obj: ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexSpice.obj: ../../src/stc\scintilla\src\LexSpice.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexTCL.obj: ../../src/stc\scintilla\src\LexTCL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexTeX.obj: ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@@ -749,6 +774,9 @@ $(OBJS)\stclib_CallTip.obj: ../../src/stc\scintilla\src\CallTip.cxx
$(OBJS)\stclib_CellBuffer.obj: ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_CharClassify.obj: ../../src/stc\scintilla\src\CharClassify.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_ContractionState.obj: ../../src/stc\scintilla\src\ContractionState.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
@@ -851,6 +879,9 @@ $(OBJS)\stclib_LexHTML.obj: ../../src/stc\scintilla\src\LexHTML.cxx
$(OBJS)\stclib_LexHaskell.obj: ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexInno.obj: ../../src/stc\scintilla\src\LexInno.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexKix.obj: ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
@@ -881,6 +912,9 @@ $(OBJS)\stclib_LexMetapost.obj: ../../src/stc\scintilla\src\LexMetapost.cxx
$(OBJS)\stclib_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexOpal.obj: ../../src/stc\scintilla\src\LexOpal.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexOthers.obj: ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
@@ -923,6 +957,12 @@ $(OBJS)\stclib_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
$(OBJS)\stclib_LexSpecman.obj: ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexSpice.obj: ../../src/stc\scintilla\src\LexSpice.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexTCL.obj: ../../src/stc\scintilla\src\LexTCL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexTeX.obj: ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**

View File

@@ -236,6 +236,7 @@ STCDLL_OBJECTS = &
$(OBJS)\stcdll_AutoComplete.obj &
$(OBJS)\stcdll_CallTip.obj &
$(OBJS)\stcdll_CellBuffer.obj &
$(OBJS)\stcdll_CharClassify.obj &
$(OBJS)\stcdll_ContractionState.obj &
$(OBJS)\stcdll_Document.obj &
$(OBJS)\stcdll_DocumentAccessor.obj &
@@ -270,6 +271,7 @@ STCDLL_OBJECTS = &
$(OBJS)\stcdll_LexGui4Cli.obj &
$(OBJS)\stcdll_LexHTML.obj &
$(OBJS)\stcdll_LexHaskell.obj &
$(OBJS)\stcdll_LexInno.obj &
$(OBJS)\stcdll_LexKix.obj &
$(OBJS)\stcdll_LexLisp.obj &
$(OBJS)\stcdll_LexLout.obj &
@@ -280,6 +282,7 @@ STCDLL_OBJECTS = &
$(OBJS)\stcdll_LexMatlab.obj &
$(OBJS)\stcdll_LexMetapost.obj &
$(OBJS)\stcdll_LexNsis.obj &
$(OBJS)\stcdll_LexOpal.obj &
$(OBJS)\stcdll_LexOthers.obj &
$(OBJS)\stcdll_LexPB.obj &
$(OBJS)\stcdll_LexPOV.obj &
@@ -294,6 +297,8 @@ STCDLL_OBJECTS = &
$(OBJS)\stcdll_LexTADS3.obj &
$(OBJS)\stcdll_LexScriptol.obj &
$(OBJS)\stcdll_LexSpecman.obj &
$(OBJS)\stcdll_LexSpice.obj &
$(OBJS)\stcdll_LexTCL.obj &
$(OBJS)\stcdll_LexTeX.obj &
$(OBJS)\stcdll_LexVB.obj &
$(OBJS)\stcdll_LexVHDL.obj &
@@ -324,6 +329,7 @@ STCLIB_OBJECTS = &
$(OBJS)\stclib_AutoComplete.obj &
$(OBJS)\stclib_CallTip.obj &
$(OBJS)\stclib_CellBuffer.obj &
$(OBJS)\stclib_CharClassify.obj &
$(OBJS)\stclib_ContractionState.obj &
$(OBJS)\stclib_Document.obj &
$(OBJS)\stclib_DocumentAccessor.obj &
@@ -358,6 +364,7 @@ STCLIB_OBJECTS = &
$(OBJS)\stclib_LexGui4Cli.obj &
$(OBJS)\stclib_LexHTML.obj &
$(OBJS)\stclib_LexHaskell.obj &
$(OBJS)\stclib_LexInno.obj &
$(OBJS)\stclib_LexKix.obj &
$(OBJS)\stclib_LexLisp.obj &
$(OBJS)\stclib_LexLout.obj &
@@ -368,6 +375,7 @@ STCLIB_OBJECTS = &
$(OBJS)\stclib_LexMatlab.obj &
$(OBJS)\stclib_LexMetapost.obj &
$(OBJS)\stclib_LexNsis.obj &
$(OBJS)\stclib_LexOpal.obj &
$(OBJS)\stclib_LexOthers.obj &
$(OBJS)\stclib_LexPB.obj &
$(OBJS)\stclib_LexPOV.obj &
@@ -382,6 +390,8 @@ STCLIB_OBJECTS = &
$(OBJS)\stclib_LexTADS3.obj &
$(OBJS)\stclib_LexScriptol.obj &
$(OBJS)\stclib_LexSpecman.obj &
$(OBJS)\stclib_LexSpice.obj &
$(OBJS)\stclib_LexTCL.obj &
$(OBJS)\stclib_LexTeX.obj &
$(OBJS)\stclib_LexVB.obj &
$(OBJS)\stclib_LexVHDL.obj &
@@ -460,6 +470,9 @@ $(OBJS)\stcdll_CallTip.obj : .AUTODEPEND ../../src/stc\scintilla\src\CallTip.cx
$(OBJS)\stcdll_CellBuffer.obj : .AUTODEPEND ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_CharClassify.obj : .AUTODEPEND ../../src/stc\scintilla\src\CharClassify.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_ContractionState.obj : .AUTODEPEND ../../src/stc\scintilla\src\ContractionState.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@@ -562,6 +575,9 @@ $(OBJS)\stcdll_LexHTML.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexHTML.cx
$(OBJS)\stcdll_LexHaskell.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexInno.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexInno.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexKix.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@@ -592,6 +608,9 @@ $(OBJS)\stcdll_LexMetapost.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexMet
$(OBJS)\stcdll_LexNsis.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexOpal.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOpal.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexOthers.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@@ -634,6 +653,12 @@ $(OBJS)\stcdll_LexScriptol.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexScr
$(OBJS)\stcdll_LexSpecman.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexSpice.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSpice.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexTCL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTCL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexTeX.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@@ -697,6 +722,9 @@ $(OBJS)\stclib_CallTip.obj : .AUTODEPEND ../../src/stc\scintilla\src\CallTip.cx
$(OBJS)\stclib_CellBuffer.obj : .AUTODEPEND ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_CharClassify.obj : .AUTODEPEND ../../src/stc\scintilla\src\CharClassify.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_ContractionState.obj : .AUTODEPEND ../../src/stc\scintilla\src\ContractionState.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
@@ -799,6 +827,9 @@ $(OBJS)\stclib_LexHTML.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexHTML.cx
$(OBJS)\stclib_LexHaskell.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexInno.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexInno.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexKix.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
@@ -829,6 +860,9 @@ $(OBJS)\stclib_LexMetapost.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexMet
$(OBJS)\stclib_LexNsis.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexOpal.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOpal.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexOthers.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
@@ -871,6 +905,12 @@ $(OBJS)\stclib_LexScriptol.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexScr
$(OBJS)\stclib_LexSpecman.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexSpice.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSpice.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexTCL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTCL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexTeX.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<

View File

@@ -15,6 +15,7 @@
scintilla/src/AutoComplete.cxx
scintilla/src/CallTip.cxx
scintilla/src/CellBuffer.cxx
scintilla/src/CharClassify.cxx
scintilla/src/ContractionState.cxx
scintilla/src/Document.cxx
scintilla/src/DocumentAccessor.cxx
@@ -49,6 +50,7 @@
scintilla/src/LexGui4Cli.cxx
scintilla/src/LexHTML.cxx
scintilla/src/LexHaskell.cxx
scintilla/src/LexInno.cxx
scintilla/src/LexKix.cxx
scintilla/src/LexLisp.cxx
scintilla/src/LexLout.cxx
@@ -59,6 +61,7 @@
scintilla/src/LexMatlab.cxx
scintilla/src/LexMetapost.cxx
scintilla/src/LexNsis.cxx
scintilla/src/LexOpal.cxx
scintilla/src/LexOthers.cxx
scintilla/src/LexPB.cxx
scintilla/src/LexPOV.cxx
@@ -73,6 +76,8 @@
scintilla/src/LexTADS3.cxx
scintilla/src/LexScriptol.cxx
scintilla/src/LexSpecman.cxx
scintilla/src/LexSpice.cxx
scintilla/src/LexTCL.cxx
scintilla/src/LexTeX.cxx
scintilla/src/LexVB.cxx
scintilla/src/LexVHDL.cxx

View File

@@ -464,6 +464,10 @@ SOURCE=../../src/stc\scintilla\src\CellBuffer.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\CharClassify.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\ContractionState.cxx
# End Source File
# Begin Source File
@@ -600,6 +604,10 @@ SOURCE=../../src/stc\scintilla\src\LexHaskell.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexInno.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexKix.cxx
# End Source File
# Begin Source File
@@ -640,6 +648,10 @@ SOURCE=../../src/stc\scintilla\src\LexNsis.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexOpal.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexOthers.cxx
# End Source File
# Begin Source File
@@ -692,10 +704,18 @@ SOURCE=../../src/stc\scintilla\src\LexSpecman.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexSpice.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexTADS3.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexTCL.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexTeX.cxx
# End Source File
# Begin Source File

View File

@@ -120,15 +120,18 @@
#define wxSTC_MASK_FOLDERS 0xFE000000
#define wxSTC_MARGIN_SYMBOL 0
#define wxSTC_MARGIN_NUMBER 1
#define wxSTC_MARGIN_BACK 2
#define wxSTC_MARGIN_FORE 3
// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
// Styles 38 and 39 are for future use.
// Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
// Style 39 is for future use.
#define wxSTC_STYLE_DEFAULT 32
#define wxSTC_STYLE_LINENUMBER 33
#define wxSTC_STYLE_BRACELIGHT 34
#define wxSTC_STYLE_BRACEBAD 35
#define wxSTC_STYLE_CONTROLCHAR 36
#define wxSTC_STYLE_INDENTGUIDE 37
#define wxSTC_STYLE_CALLTIP 38
#define wxSTC_STYLE_LASTPREDEFINED 39
#define wxSTC_STYLE_MAX 127
@@ -166,6 +169,7 @@
#define wxSTC_INDIC_STRIKE 4
#define wxSTC_INDIC_HIDDEN 5
#define wxSTC_INDIC_BOX 6
#define wxSTC_INDIC_ROUNDBOX 7
#define wxSTC_INDIC0_MASK 0x20
#define wxSTC_INDIC1_MASK 0x40
#define wxSTC_INDIC2_MASK 0x80
@@ -258,6 +262,9 @@
#define wxSTC_SEL_STREAM 0
#define wxSTC_SEL_RECTANGLE 1
#define wxSTC_SEL_LINES 2
#define wxSTC_ALPHA_TRANSPARENT 0
#define wxSTC_ALPHA_OPAQUE 255
#define wxSTC_ALPHA_NOALPHA 256
// Maximum value of keywordSet parameter of SetKeyWords.
#define wxSTC_KEYWORDSET_MAX 8
@@ -381,10 +388,9 @@
#define wxSTC_LEX_FLAGSHIP 73
#define wxSTC_LEX_CSOUND 74
#define wxSTC_LEX_FREEBASIC 75
// These are deprecated, STC_LEX_HTML should be used instead.
#define wxSTC_LEX_ASP 29
#define wxSTC_LEX_PHP 30
#define wxSTC_LEX_INNOSETUP 76
#define wxSTC_LEX_OPAL 77
#define wxSTC_LEX_SPICE 78
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -430,6 +436,30 @@
#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
#define wxSTC_C_GLOBALCLASS 19
// Lexical states for SCLEX_TCL
#define wxSTC_TCL_DEFAULT 0
#define wxSTC_TCL_COMMENT 1
#define wxSTC_TCL_COMMENTLINE 2
#define wxSTC_TCL_NUMBER 3
#define wxSTC_TCL_WORD_IN_QUOTE 4
#define wxSTC_TCL_IN_QUOTE 5
#define wxSTC_TCL_OPERATOR 6
#define wxSTC_TCL_IDENTIFIER 7
#define wxSTC_TCL_SUBSTITUTION 8
#define wxSTC_TCL_SUB_BRACE 9
#define wxSTC_TCL_MODIFIER 10
#define wxSTC_TCL_EXPAND 11
#define wxSTC_TCL_WORD 12
#define wxSTC_TCL_WORD2 13
#define wxSTC_TCL_WORD3 14
#define wxSTC_TCL_WORD4 15
#define wxSTC_TCL_WORD5 16
#define wxSTC_TCL_WORD6 17
#define wxSTC_TCL_WORD7 18
#define wxSTC_TCL_WORD8 19
#define wxSTC_TCL_COMMENT_BOX 20
#define wxSTC_TCL_BLOCK_COMMENT 21
// Lexical states for SCLEX_HTML, SCLEX_XML
#define wxSTC_H_DEFAULT 0
#define wxSTC_H_TAG 1
@@ -664,6 +694,7 @@
#define wxSTC_PROPS_SECTION 2
#define wxSTC_PROPS_ASSIGNMENT 3
#define wxSTC_PROPS_DEFVAL 4
#define wxSTC_PROPS_KEY 5
// Lexical states for SCLEX_LATEX
#define wxSTC_L_DEFAULT 0
@@ -1208,6 +1239,7 @@
#define wxSTC_AU3_SPECIAL 12
#define wxSTC_AU3_EXPAND 13
#define wxSTC_AU3_COMOBJ 14
#define wxSTC_AU3_UDF 15
// Lexical states for SCLEX_APDL
#define wxSTC_APDL_DEFAULT 0
@@ -1446,6 +1478,44 @@
#define wxSTC_CSOUND_GLOBAL_VAR 14
#define wxSTC_CSOUND_STRINGEOL 15
// Lexical states for SCLEX_INNOSETUP
#define wxSTC_INNO_DEFAULT 0
#define wxSTC_INNO_COMMENT 1
#define wxSTC_INNO_KEYWORD 2
#define wxSTC_INNO_PARAMETER 3
#define wxSTC_INNO_SECTION 4
#define wxSTC_INNO_PREPROC 5
#define wxSTC_INNO_PREPROC_INLINE 6
#define wxSTC_INNO_COMMENT_PASCAL 7
#define wxSTC_INNO_KEYWORD_PASCAL 8
#define wxSTC_INNO_KEYWORD_USER 9
#define wxSTC_INNO_STRING_DOUBLE 10
#define wxSTC_INNO_STRING_SINGLE 11
#define wxSTC_INNO_IDENTIFIER 12
// Lexical states for SCLEX_OPAL
#define wxSTC_OPAL_SPACE 0
#define wxSTC_OPAL_COMMENT_BLOCK 1
#define wxSTC_OPAL_COMMENT_LINE 2
#define wxSTC_OPAL_INTEGER 3
#define wxSTC_OPAL_KEYWORD 4
#define wxSTC_OPAL_SORT 5
#define wxSTC_OPAL_STRING 6
#define wxSTC_OPAL_PAR 7
#define wxSTC_OPAL_BOOL_CONST 8
#define wxSTC_OPAL_DEFAULT 32
// Lexical states for SCLEX_SPICE
#define wxSTC_SPICE_DEFAULT 0
#define wxSTC_SPICE_IDENTIFIER 1
#define wxSTC_SPICE_KEYWORD 2
#define wxSTC_SPICE_KEYWORD2 3
#define wxSTC_SPICE_KEYWORD3 4
#define wxSTC_SPICE_NUMBER 5
#define wxSTC_SPICE_DELIMITER 6
#define wxSTC_SPICE_VALUE 7
#define wxSTC_SPICE_COMMENTLINE 8
//-----------------------------------------
// Commands that can be bound to keystrokes
@@ -1935,6 +2005,9 @@ public:
// Add a set of markers to a line.
void MarkerAddSet(int line, int set);
// Set the alpha used for a marker that is drawn in the text area, not the margin.
void MarkerSetAlpha(int markerNumber, int alpha);
// Set a margin to be either numeric or symbolic.
void SetMarginType(int margin, int marginType);
@@ -2001,6 +2074,12 @@ public:
// Set the background colour of the selection and whether to use this setting.
void SetSelBackground(bool useSetting, const wxColour& back);
// Get the alpha of the selection.
int GetSelAlpha();
// Set the alpha of the selection.
void SetSelAlpha(int alpha);
// Set the foreground colour of the caret.
void SetCaretForeground(const wxColour& fore);
@@ -2440,6 +2519,9 @@ public:
// Set the foreground colour for the highlighted part of the call tip.
void CallTipSetForegroundHighlight(const wxColour& fore);
// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
void CallTipUseStyle(int tabSize);
// Find the display line of a document line taking hidden lines into account.
int VisibleFromDocLine(int line);
@@ -3068,6 +3150,12 @@ public:
// Duplicate the selection. If selection empty duplicate the line containing the caret.
void SelectionDuplicate();
// Set background alpha of the caret line.
void SetCaretLineBackAlpha(int alpha);
// Get the background alpha of the caret line.
int GetCaretLineBackAlpha();
// Start notifying the container of all key presses and commands.
void StartRecord();

View File

@@ -66,6 +66,7 @@ STCDLL_OBJECTS = \
stcdll_AutoComplete.o \
stcdll_CallTip.o \
stcdll_CellBuffer.o \
stcdll_CharClassify.o \
stcdll_ContractionState.o \
stcdll_Document.o \
stcdll_DocumentAccessor.o \
@@ -100,6 +101,7 @@ STCDLL_OBJECTS = \
stcdll_LexGui4Cli.o \
stcdll_LexHTML.o \
stcdll_LexHaskell.o \
stcdll_LexInno.o \
stcdll_LexKix.o \
stcdll_LexLisp.o \
stcdll_LexLout.o \
@@ -110,6 +112,7 @@ STCDLL_OBJECTS = \
stcdll_LexMatlab.o \
stcdll_LexMetapost.o \
stcdll_LexNsis.o \
stcdll_LexOpal.o \
stcdll_LexOthers.o \
stcdll_LexPB.o \
stcdll_LexPOV.o \
@@ -124,6 +127,8 @@ STCDLL_OBJECTS = \
stcdll_LexTADS3.o \
stcdll_LexScriptol.o \
stcdll_LexSpecman.o \
stcdll_LexSpice.o \
stcdll_LexTCL.o \
stcdll_LexTeX.o \
stcdll_LexVB.o \
stcdll_LexVHDL.o \
@@ -151,6 +156,7 @@ STCLIB_OBJECTS = \
stclib_AutoComplete.o \
stclib_CallTip.o \
stclib_CellBuffer.o \
stclib_CharClassify.o \
stclib_ContractionState.o \
stclib_Document.o \
stclib_DocumentAccessor.o \
@@ -185,6 +191,7 @@ STCLIB_OBJECTS = \
stclib_LexGui4Cli.o \
stclib_LexHTML.o \
stclib_LexHaskell.o \
stclib_LexInno.o \
stclib_LexKix.o \
stclib_LexLisp.o \
stclib_LexLout.o \
@@ -195,6 +202,7 @@ STCLIB_OBJECTS = \
stclib_LexMatlab.o \
stclib_LexMetapost.o \
stclib_LexNsis.o \
stclib_LexOpal.o \
stclib_LexOthers.o \
stclib_LexPB.o \
stclib_LexPOV.o \
@@ -209,6 +217,8 @@ STCLIB_OBJECTS = \
stclib_LexTADS3.o \
stclib_LexScriptol.o \
stclib_LexSpecman.o \
stclib_LexSpice.o \
stclib_LexTCL.o \
stclib_LexTeX.o \
stclib_LexVB.o \
stclib_LexVHDL.o \
@@ -415,6 +425,9 @@ stcdll_CallTip.o: $(srcdir)/scintilla/src/CallTip.cxx
stcdll_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/CellBuffer.cxx
stcdll_CharClassify.o: $(srcdir)/scintilla/src/CharClassify.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/CharClassify.cxx
stcdll_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/ContractionState.cxx
@@ -517,6 +530,9 @@ stcdll_LexHTML.o: $(srcdir)/scintilla/src/LexHTML.cxx
stcdll_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
stcdll_LexInno.o: $(srcdir)/scintilla/src/LexInno.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexInno.cxx
stcdll_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
@@ -547,6 +563,9 @@ stcdll_LexMetapost.o: $(srcdir)/scintilla/src/LexMetapost.cxx
stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexNsis.cxx
stcdll_LexOpal.o: $(srcdir)/scintilla/src/LexOpal.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexOpal.cxx
stcdll_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexOthers.cxx
@@ -589,6 +608,12 @@ stcdll_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
stcdll_LexSpecman.o: $(srcdir)/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSpecman.cxx
stcdll_LexSpice.o: $(srcdir)/scintilla/src/LexSpice.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSpice.cxx
stcdll_LexTCL.o: $(srcdir)/scintilla/src/LexTCL.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTCL.cxx
stcdll_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTeX.cxx
@@ -652,6 +677,9 @@ stclib_CallTip.o: $(srcdir)/scintilla/src/CallTip.cxx
stclib_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/CellBuffer.cxx
stclib_CharClassify.o: $(srcdir)/scintilla/src/CharClassify.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/CharClassify.cxx
stclib_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/ContractionState.cxx
@@ -754,6 +782,9 @@ stclib_LexHTML.o: $(srcdir)/scintilla/src/LexHTML.cxx
stclib_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
stclib_LexInno.o: $(srcdir)/scintilla/src/LexInno.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexInno.cxx
stclib_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
@@ -784,6 +815,9 @@ stclib_LexMetapost.o: $(srcdir)/scintilla/src/LexMetapost.cxx
stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexNsis.cxx
stclib_LexOpal.o: $(srcdir)/scintilla/src/LexOpal.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexOpal.cxx
stclib_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexOthers.cxx
@@ -826,6 +860,12 @@ stclib_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
stclib_LexSpecman.o: $(srcdir)/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSpecman.cxx
stclib_LexSpice.o: $(srcdir)/scintilla/src/LexSpice.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSpice.cxx
stclib_LexTCL.o: $(srcdir)/scintilla/src/LexTCL.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTCL.cxx
stclib_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTeX.cxx

View File

@@ -47,14 +47,21 @@ wxColour wxColourFromCA(const ColourAllocated& ca) {
Palette::Palette() {
used = 0;
allowRealization = false;
size = 100;
entries = new ColourPair[size];
}
Palette::~Palette() {
Release();
delete [] entries;
entries = 0;
}
void Palette::Release() {
used = 0;
delete [] entries;
size = 100;
entries = new ColourPair[size];
}
// This method either adds a colour to the list of wanted colours (want==true)
@@ -67,11 +74,20 @@ void Palette::WantFind(ColourPair &cp, bool want) {
return;
}
if (used < numEntries) {
if (used >= size) {
int sizeNew = size * 2;
ColourPair *entriesNew = new ColourPair[sizeNew];
for (int j=0; j<size; j++) {
entriesNew[j] = entries[j];
}
delete []entries;
entries = entriesNew;
size = sizeNew;
}
entries[used].desired = cp.desired;
entries[used].allocated.Set(cp.desired.AsLong());
used++;
}
} else {
for (int i=0; i < used; i++) {
if (entries[i].desired == cp.desired) {
@@ -162,6 +178,8 @@ public:
virtual void FillRectangle(PRectangle rc, ColourAllocated back);
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern);
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags);
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource);
@@ -316,6 +334,14 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
}
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags) {
// ** TODO
RectangleDraw(rc, outline, fill);
}
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
PenColour(fore);
BrushColour(back);

View File

@@ -27,6 +27,7 @@
#include "Platform.h"
#include "Scintilla.h"
#include "CharClassify.h"
#include "XPM.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
@@ -48,7 +49,6 @@
#include "Editor.h"
#include "ScintillaBase.h"
//----------------------------------------------------------------------
#ifdef WXMAKINGDLL_STC

View File

@@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
The current version of the Scintilla code is 1.67
The current version of the Scintilla code is 1.70

View File

@@ -236,12 +236,15 @@ class Window; // Forward declaration for Palette
*/
class Palette {
int used;
enum {numEntries = 100};
ColourPair entries[numEntries];
int size;
ColourPair *entries;
#if PLAT_GTK
void *allocatedPalette; // GdkColor *
int allocatedLen;
#endif
// Private so Palette objects can not be copied
Palette(const Palette &) {}
Palette &operator=(const Palette &) { return *this; }
public:
#if PLAT_WIN
void *hpal;
@@ -319,6 +322,8 @@ public:
virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0;
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags)=0;
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;

View File

@@ -88,6 +88,9 @@
#define SCLEX_FLAGSHIP 73
#define SCLEX_CSOUND 74
#define SCLEX_FREEBASIC 75
#define SCLEX_INNOSETUP 76
#define SCLEX_OPAL 77
#define SCLEX_SPICE 78
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@@ -125,6 +128,28 @@
#define SCE_C_COMMENTDOCKEYWORD 17
#define SCE_C_COMMENTDOCKEYWORDERROR 18
#define SCE_C_GLOBALCLASS 19
#define SCE_TCL_DEFAULT 0
#define SCE_TCL_COMMENT 1
#define SCE_TCL_COMMENTLINE 2
#define SCE_TCL_NUMBER 3
#define SCE_TCL_WORD_IN_QUOTE 4
#define SCE_TCL_IN_QUOTE 5
#define SCE_TCL_OPERATOR 6
#define SCE_TCL_IDENTIFIER 7
#define SCE_TCL_SUBSTITUTION 8
#define SCE_TCL_SUB_BRACE 9
#define SCE_TCL_MODIFIER 10
#define SCE_TCL_EXPAND 11
#define SCE_TCL_WORD 12
#define SCE_TCL_WORD2 13
#define SCE_TCL_WORD3 14
#define SCE_TCL_WORD4 15
#define SCE_TCL_WORD5 16
#define SCE_TCL_WORD6 17
#define SCE_TCL_WORD7 18
#define SCE_TCL_WORD8 19
#define SCE_TCL_COMMENT_BOX 20
#define SCE_TCL_BLOCK_COMMENT 21
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
@@ -326,6 +351,7 @@
#define SCE_PROPS_SECTION 2
#define SCE_PROPS_ASSIGNMENT 3
#define SCE_PROPS_DEFVAL 4
#define SCE_PROPS_KEY 5
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
@@ -795,6 +821,7 @@
#define SCE_AU3_SPECIAL 12
#define SCE_AU3_EXPAND 13
#define SCE_AU3_COMOBJ 14
#define SCE_AU3_UDF 15
#define SCE_APDL_DEFAULT 0
#define SCE_APDL_COMMENT 1
#define SCE_APDL_COMMENTBLOCK 2
@@ -1008,6 +1035,38 @@
#define SCE_CSOUND_IRATE_VAR 13
#define SCE_CSOUND_GLOBAL_VAR 14
#define SCE_CSOUND_STRINGEOL 15
#define SCE_INNO_DEFAULT 0
#define SCE_INNO_COMMENT 1
#define SCE_INNO_KEYWORD 2
#define SCE_INNO_PARAMETER 3
#define SCE_INNO_SECTION 4
#define SCE_INNO_PREPROC 5
#define SCE_INNO_PREPROC_INLINE 6
#define SCE_INNO_COMMENT_PASCAL 7
#define SCE_INNO_KEYWORD_PASCAL 8
#define SCE_INNO_KEYWORD_USER 9
#define SCE_INNO_STRING_DOUBLE 10
#define SCE_INNO_STRING_SINGLE 11
#define SCE_INNO_IDENTIFIER 12
#define SCE_OPAL_SPACE 0
#define SCE_OPAL_COMMENT_BLOCK 1
#define SCE_OPAL_COMMENT_LINE 2
#define SCE_OPAL_INTEGER 3
#define SCE_OPAL_KEYWORD 4
#define SCE_OPAL_SORT 5
#define SCE_OPAL_STRING 6
#define SCE_OPAL_PAR 7
#define SCE_OPAL_BOOL_CONST 8
#define SCE_OPAL_DEFAULT 32
#define SCE_SPICE_DEFAULT 0
#define SCE_SPICE_IDENTIFIER 1
#define SCE_SPICE_KEYWORD 2
#define SCE_SPICE_KEYWORD2 3
#define SCE_SPICE_KEYWORD3 4
#define SCE_SPICE_NUMBER 5
#define SCE_SPICE_DELIMITER 6
#define SCE_SPICE_VALUE 7
#define SCE_SPICE_COMMENTLINE 8
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface

View File

@@ -138,8 +138,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_MARKERPREVIOUS 2048
#define SCI_MARKERDEFINEPIXMAP 2049
#define SCI_MARKERADDSET 2466
#define SCI_MARKERSETALPHA 2476
#define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1
#define SC_MARGIN_BACK 2
#define SC_MARGIN_FORE 3
#define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242
@@ -154,6 +157,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define STYLE_BRACEBAD 35
#define STYLE_CONTROLCHAR 36
#define STYLE_INDENTGUIDE 37
#define STYLE_CALLTIP 38
#define STYLE_LASTPREDEFINED 39
#define STYLE_MAX 127
#define SC_CHARSET_ANSI 0
@@ -195,6 +199,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_STYLESETHOTSPOT 2409
#define SCI_SETSELFORE 2067
#define SCI_SETSELBACK 2068
#define SCI_GETSELALPHA 2477
#define SCI_SETSELALPHA 2478
#define SCI_SETCARETFORE 2069
#define SCI_ASSIGNCMDKEY 2070
#define SCI_CLEARCMDKEY 2071
@@ -214,6 +220,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define INDIC_STRIKE 4
#define INDIC_HIDDEN 5
#define INDIC_BOX 6
#define INDIC_ROUNDBOX 7
#define INDIC0_MASK 0x20
#define INDIC1_MASK 0x40
#define INDIC2_MASK 0x80
@@ -358,6 +365,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CALLTIPSETBACK 2205
#define SCI_CALLTIPSETFORE 2206
#define SCI_CALLTIPSETFOREHLT 2207
#define SCI_CALLTIPUSESTYLE 2212
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SCI_WRAPCOUNT 2235
@@ -607,6 +615,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETPASTECONVERTENDINGS 2467
#define SCI_GETPASTECONVERTENDINGS 2468
#define SCI_SELECTIONDUPLICATE 2469
#define SC_ALPHA_TRANSPARENT 0
#define SC_ALPHA_OPAQUE 255
#define SC_ALPHA_NOALPHA 256
#define SCI_SETCARETLINEBACKALPHA 2470
#define SCI_GETCARETLINEBACKALPHA 2471
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001

View File

@@ -316,9 +316,14 @@ fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap)
# Add a set of markers to a line.
fun void MarkerAddSet=2466(int line, int set)
# Set the alpha used for a marker that is drawn in the text area, not the margin.
fun void MarkerSetAlpha=2476(int markerNumber, int alpha)
enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
val SC_MARGIN_BACK=2
val SC_MARGIN_FORE=3
# Set a margin to be either numeric or symbolic.
set void SetMarginTypeN=2240(int margin, int marginType)
@@ -344,8 +349,8 @@ set void SetMarginSensitiveN=2246(int margin, bool sensitive)
# Retrieve the mouse click sensitivity of a margin.
get bool GetMarginSensitiveN=2247(int margin,)
# Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
# Styles 38 and 39 are for future use.
# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
# Style 39 is for future use.
enu StylesCommon=STYLE_
val STYLE_DEFAULT=32
val STYLE_LINENUMBER=33
@@ -353,6 +358,7 @@ val STYLE_BRACELIGHT=34
val STYLE_BRACEBAD=35
val STYLE_CONTROLCHAR=36
val STYLE_INDENTGUIDE=37
val STYLE_CALLTIP=38
val STYLE_LASTPREDEFINED=39
val STYLE_MAX=127
@@ -430,6 +436,12 @@ fun void SetSelFore=2067(bool useSetting, colour fore)
# Set the background colour of the selection and whether to use this setting.
fun void SetSelBack=2068(bool useSetting, colour back)
# Get the alpha of the selection.
get int GetSelAlpha=2477(,)
# Set the alpha of the selection.
set void SetSelAlpha=2478(int alpha,)
# Set the foreground colour of the caret.
set void SetCaretFore=2069(colour fore,)
@@ -474,6 +486,7 @@ val INDIC_DIAGONAL=3
val INDIC_STRIKE=4
val INDIC_HIDDEN=5
val INDIC_BOX=6
val INDIC_ROUNDBOX=7
val INDIC0_MASK=0x20
val INDIC1_MASK=0x40
val INDIC2_MASK=0x80
@@ -919,6 +932,9 @@ set void CallTipSetFore=2206(colour fore,)
# Set the foreground colour for the highlighted part of the call tip.
set void CallTipSetForeHlt=2207(colour fore,)
# Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
set void CallTipUseStyle=2212(int tabSize,)
# Find the display line of a document line taking hidden lines into account.
fun int VisibleFromDocLine=2220(int line,)
@@ -1446,7 +1462,6 @@ get int GetXOffset=2398(,)
fun void ChooseCaretX=2399(,)
# Set the focus to this Scintilla widget.
# GTK+ Specific.
fun void GrabFocus=2400(,)
enu CaretPolicy = CARET_
@@ -1642,6 +1657,16 @@ get bool GetPasteConvertEndings=2468(,)
# Duplicate the selection. If selection empty duplicate the line containing the caret.
fun void SelectionDuplicate=2469(,)
val SC_ALPHA_TRANSPARENT=0
val SC_ALPHA_OPAQUE=255
val SC_ALPHA_NOALPHA=256
# Set background alpha of the caret line.
set void SetCaretLineBackAlpha=2470(int alpha,)
# Get the background alpha of the caret line.
get int GetCaretLineBackAlpha=2471(,)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@@ -1820,11 +1845,9 @@ val SCLEX_SMALLTALK=72
val SCLEX_FLAGSHIP=73
val SCLEX_CSOUND=74
val SCLEX_FREEBASIC=75
# These are deprecated, STC_LEX_HTML should be used instead.
val SCLEX_ASP=29
val SCLEX_PHP=30
val SCLEX_INNOSETUP=76
val SCLEX_OPAL=77
val SCLEX_SPICE=78
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -1850,7 +1873,6 @@ val SCE_P_DECORATOR=15
# Lexical states for SCLEX_CPP
lex Cpp=SCLEX_CPP SCE_C_
lex Pascal=SCLEX_PASCAL SCE_C_
lex TCL=SCLEX_TCL SCE_C_
lex BullAnt=SCLEX_BULLANT SCE_C_
val SCE_C_DEFAULT=0
val SCE_C_COMMENT=1
@@ -1872,6 +1894,30 @@ val SCE_C_WORD2=16
val SCE_C_COMMENTDOCKEYWORD=17
val SCE_C_COMMENTDOCKEYWORDERROR=18
val SCE_C_GLOBALCLASS=19
# Lexical states for SCLEX_TCL
lex TCL=SCLEX_TCL SCE_TCL_
val SCE_TCL_DEFAULT=0
val SCE_TCL_COMMENT=1
val SCE_TCL_COMMENTLINE=2
val SCE_TCL_NUMBER=3
val SCE_TCL_WORD_IN_QUOTE=4
val SCE_TCL_IN_QUOTE=5
val SCE_TCL_OPERATOR=6
val SCE_TCL_IDENTIFIER=7
val SCE_TCL_SUBSTITUTION=8
val SCE_TCL_SUB_BRACE=9
val SCE_TCL_MODIFIER=10
val SCE_TCL_EXPAND=11
val SCE_TCL_WORD=12
val SCE_TCL_WORD2=13
val SCE_TCL_WORD3=14
val SCE_TCL_WORD4=15
val SCE_TCL_WORD5=16
val SCE_TCL_WORD6=17
val SCE_TCL_WORD7=18
val SCE_TCL_WORD8=19
val SCE_TCL_COMMENT_BOX=20
val SCE_TCL_BLOCK_COMMENT=21
# Lexical states for SCLEX_HTML, SCLEX_XML
lex HTML=SCLEX_HTML SCE_H
lex XML=SCLEX_XML SCE_H
@@ -2100,6 +2146,7 @@ val SCE_PROPS_COMMENT=1
val SCE_PROPS_SECTION=2
val SCE_PROPS_ASSIGNMENT=3
val SCE_PROPS_DEFVAL=4
val SCE_PROPS_KEY=5
# Lexical states for SCLEX_LATEX
lex LaTeX=SCLEX_LATEX SCE_L_
val SCE_L_DEFAULT=0
@@ -2646,6 +2693,7 @@ val SCE_AU3_PREPROCESSOR=11
val SCE_AU3_SPECIAL=12
val SCE_AU3_EXPAND=13
val SCE_AU3_COMOBJ=14
val SCE_AU3_UDF=15
# Lexical states for SCLEX_APDL
lex APDL=SCLEX_APDL SCE_APDL_
val SCE_APDL_DEFAULT=0
@@ -2883,6 +2931,44 @@ val SCE_CSOUND_KRATE_VAR=12
val SCE_CSOUND_IRATE_VAR=13
val SCE_CSOUND_GLOBAL_VAR=14
val SCE_CSOUND_STRINGEOL=15
# Lexical states for SCLEX_INNOSETUP
lex Inno=SCLEX_INNOSETUP SCE_INNO_
val SCE_INNO_DEFAULT=0
val SCE_INNO_COMMENT=1
val SCE_INNO_KEYWORD=2
val SCE_INNO_PARAMETER=3
val SCE_INNO_SECTION=4
val SCE_INNO_PREPROC=5
val SCE_INNO_PREPROC_INLINE=6
val SCE_INNO_COMMENT_PASCAL=7
val SCE_INNO_KEYWORD_PASCAL=8
val SCE_INNO_KEYWORD_USER=9
val SCE_INNO_STRING_DOUBLE=10
val SCE_INNO_STRING_SINGLE=11
val SCE_INNO_IDENTIFIER=12
# Lexical states for SCLEX_OPAL
lex Opal=SCLEX_OPAL SCE_OPAL_
val SCE_OPAL_SPACE=0
val SCE_OPAL_COMMENT_BLOCK=1
val SCE_OPAL_COMMENT_LINE=2
val SCE_OPAL_INTEGER=3
val SCE_OPAL_KEYWORD=4
val SCE_OPAL_SORT=5
val SCE_OPAL_STRING=6
val SCE_OPAL_PAR=7
val SCE_OPAL_BOOL_CONST=8
val SCE_OPAL_DEFAULT=32
# Lexical states for SCLEX_SPICE
lex Spice=SCLEX_SPICE SCE_SPICE_
val SCE_SPICE_DEFAULT=0
val SCE_SPICE_IDENTIFIER=1
val SCE_SPICE_KEYWORD=2
val SCE_SPICE_KEYWORD2=3
val SCE_SPICE_KEYWORD3=4
val SCE_SPICE_NUMBER=5
val SCE_SPICE_DELIMITER=6
val SCE_SPICE_VALUE=7
val SCE_SPICE_COMMENTLINE=8
# Events

View File

@@ -34,7 +34,11 @@ struct _ScintillaClass {
void (* notify) (ScintillaObject *ttt);
};
#if GLIB_MAJOR_VERSION < 2
GtkType scintilla_get_type (void);
#else
GType scintilla_get_type (void);
#endif
GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci, uptr_t id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);

View File

@@ -13,6 +13,9 @@
#include "Scintilla.h"
#include "CallTip.h"
static const int insetX = 5; // text inset in x from calltip border
static const int widthArrow = 14;
CallTip::CallTip() {
wCallTip = 0;
inCallTipMode = false;
@@ -23,6 +26,8 @@ CallTip::CallTip() {
lineHeight = 1;
startHighlight = 0;
endHighlight = 0;
tabSize = 0;
useStyleCallTip = false; // for backwards compatibility
colourBG.desired = ColourDesired(0xff, 0xff, 0xff);
colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80);
@@ -38,8 +43,6 @@ CallTip::~CallTip() {
val = 0;
}
const int widthArrow = 14;
void CallTip::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(colourBG, want);
pal.WantFind(colourUnSel, want);
@@ -48,19 +51,42 @@ void CallTip::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(colourLight, want);
}
// Although this test includes 0, we should never see a \0 character.
static bool IsArrowCharacter(char ch) {
return (ch == 0) || (ch == '\001') || (ch == '\002');
}
// We ignore tabs unless a tab width has been set.
bool CallTip::IsTabCharacter(char ch) {
return (tabSize > 0) && (ch == '\t');
}
int CallTip::NextTabPos(int x) {
if (tabSize > 0) { // paranoia... not called unless this is true
x -= insetX; // position relative to text
x = (x + tabSize) / tabSize; // tab "number"
return tabSize*x + insetX; // position of next tab
} else {
return x + 1; // arbitrary
}
}
// Draw a section of the call tip that does not include \n in one colour.
// The text may include up to numEnds tabs or arrow characters.
void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw) {
s += posStart;
int len = posEnd - posStart;
// Divide the text into sections that are all text, or that are
// single arrows or single tab characters (if tabSize > 0).
int maxEnd = 0;
int ends[10];
const int numEnds = 10;
int ends[numEnds + 2];
for (int i=0;i<len;i++) {
if (IsArrowCharacter(s[i])) {
if ((maxEnd < numEnds) &&
(IsArrowCharacter(s[i]) || IsTabCharacter(s[i])) ) {
if (i > 0)
ends[maxEnd++] = i;
ends[maxEnd++] = i+1;
@@ -73,20 +99,19 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int endSeg = ends[seg];
if (endSeg > startSeg) {
if (IsArrowCharacter(s[startSeg])) {
xEnd = x + widthArrow;
offsetMain = xEnd;
bool upArrow = s[startSeg] == '\001';
rcClient.left = x;
rcClient.right = xEnd;
rcClient.right = rcClient.left + widthArrow;
if (draw) {
const int halfWidth = widthArrow / 2 - 3;
const int centreX = x + widthArrow / 2 - 1;
const int centreX = rcClient.left + widthArrow / 2 - 1;
const int centreY = (rcClient.top + rcClient.bottom) / 2;
surface->FillRectangle(rcClient, colourBG.allocated);
PRectangle rcClientInner(rcClient.left+1, rcClient.top+1, rcClient.right-2, rcClient.bottom-1);
PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1,
rcClient.right - 2, rcClient.bottom - 1);
surface->FillRectangle(rcClientInner, colourUnSel.allocated);
if (s[startSeg] == '\001') {
// Up arrow
if (upArrow) { // Up arrow
Point pts[] = {
Point(centreX - halfWidth, centreY + halfWidth / 2),
Point(centreX + halfWidth, centreY + halfWidth / 2),
@@ -94,8 +119,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
colourBG.allocated, colourBG.allocated);
} else {
// Down arrow
} else { // Down arrow
Point pts[] = {
Point(centreX - halfWidth, centreY - halfWidth / 2),
Point(centreX + halfWidth, centreY - halfWidth / 2),
@@ -105,20 +129,23 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
colourBG.allocated, colourBG.allocated);
}
}
if (s[startSeg] == '\001') {
xEnd = rcClient.right;
offsetMain = xEnd;
if (upArrow) {
rectUp = rcClient;
} else if (s[startSeg] == '\002') {
} else {
rectDown = rcClient;
}
} else if (IsTabCharacter(s[startSeg])) {
xEnd = NextTabPos(x);
} else {
xEnd = x + surface->WidthText(font, s+startSeg, endSeg - startSeg);
xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg);
if (draw) {
rcClient.left = x;
rcClient.right = xEnd;
surface->DrawTextNoClip(rcClient, font, ytext,
surface->DrawTextTransparent(rcClient, font, ytext,
s+startSeg, endSeg - startSeg,
highlight ? colourSel.allocated : colourUnSel.allocated,
colourBG.allocated);
highlight ? colourSel.allocated : colourUnSel.allocated);
}
}
x = xEnd;
@@ -160,7 +187,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
thisEndHighlight -= chunkOffset;
rcClient.top = ytext - ascent - 1;
int x = 5;
int x = insetX; // start each line at this inset
DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight,
ytext, rcClient, false, draw);
@@ -187,7 +214,7 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
surfaceWindow->FillRectangle(rcClient, colourBG.allocated);
offsetMain = 5;
offsetMain = insetX; // initial alignment assuming no arrows
PaintContents(surfaceWindow, true);
// Draw a raised border around the edges of the window
@@ -238,14 +265,17 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
const char *look = val;
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
offsetMain = 5;
int width = PaintContents(surfaceMeasure, false) + 5;
offsetMain = insetX; // changed to right edge of any arrows
int width = PaintContents(surfaceMeasure, false) + insetX;
while ((newline = strchr(look, '\n')) != NULL) {
look = newline + 1;
numLines++;
}
lineHeight = surfaceMeasure->Height(font);
// Extra line for border and an empty line at top and bottom
// Extra line for border and an empty line at top and bottom. 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) + 2 + 2;
delete surfaceMeasure;
return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height);
@@ -268,3 +298,17 @@ void CallTip::SetHighlight(int start, int end) {
}
}
}
// Set the tab size (sizes > 0 enable the use of tabs). This also enables the
// use of the STYLE_CALLTIP.
void CallTip::SetTabSize(int tabSz) {
tabSize = tabSz;
useStyleCallTip = true;
}
// It might be better to have two access functions for this and to use
// them for all settings of colours.
void CallTip::SetForeBack(const ColourPair &fore, const ColourPair &back) {
colourBG = back;
colourUnSel = fore;
}

View File

@@ -11,14 +11,17 @@
/**
*/
class CallTip {
int startHighlight;
int endHighlight;
int startHighlight; // character offset to start and...
int endHighlight; // ...end of highlighted text
char *val;
Font font;
PRectangle rectUp;
PRectangle rectDown;
int lineHeight;
int offsetMain;
PRectangle rectUp; // rectangle of last up angle in the tip
PRectangle rectDown; // rectangle of last down arrow in the tip
int lineHeight; // vertical line spacing
int offsetMain; // The alignment point of the call tip
int tabSize; // Tab size in pixels, <=0 no TAB expand
bool useStyleCallTip; // if true, STYLE_CALLTIP should be used
// Private so CallTip objects can not be copied
CallTip(const CallTip &) {}
CallTip &operator=(const CallTip &) { return *this; }
@@ -26,6 +29,8 @@ class CallTip {
int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw);
int PaintContents(Surface *surfaceWindow, bool draw);
bool IsTabCharacter(char c);
int NextTabPos(int x);
public:
Window wCallTip;
@@ -60,6 +65,15 @@ public:
/// Set a range of characters to be displayed in a highlight style.
/// Commonly used to highlight the current parameter.
void SetHighlight(int start, int end);
/// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand.
void SetTabSize(int tabSz);
/// Used to determine which STYLE_xxxx to use for call tip information
bool UseStyleCallTip() const { return useStyleCallTip;}
// Modify foreground and background colours
void SetForeBack(const ColourPair &fore, const ColourPair &back);
};
#endif

View File

@@ -0,0 +1,43 @@
// Scintilla source code edit control
/** @file CharClassify.cxx
** Character classifications used by Document and RESearch.
**/
// Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <ctype.h>
#include "CharClassify.h"
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4514)
#endif
CharClassify::CharClassify() {
SetDefaultCharClasses(true);
}
void CharClassify::SetDefaultCharClasses(bool includeWordClass) {
// Initialize all char classes to default values
for (int ch = 0; ch < 256; ch++) {
if (ch == '\r' || ch == '\n')
charClass[ch] = ccNewLine;
else if (ch < 0x20 || ch == ' ')
charClass[ch] = ccSpace;
else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_'))
charClass[ch] = ccWord;
else
charClass[ch] = ccPunctuation;
}
}
void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) {
// Apply the newCharClass to the specifed chars
if (chars) {
while (*chars) {
charClass[*chars] = static_cast<unsigned char>(newCharClass);
chars++;
}
}
}

View File

@@ -0,0 +1,25 @@
// Scintilla source code edit control
/** @file CharClassify.h
** Character classifications used by Document and RESearch.
**/
// Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CHARCLASSIFY_H
#define CHARCLASSIFY_H
class CharClassify {
public:
CharClassify();
enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation };
void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, cc newCharClass);
cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);}
bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;}
private:
enum { maxChar=256 };
unsigned char charClass[maxChar]; // not type cc to save space
};
#endif

View File

@@ -280,4 +280,10 @@ void ContractionState::ShowAll() {
delete []lines;
lines = 0;
size = 0;
delete []docLines;
docLines = 0;
sizeDocLines = 0;
linesInDisplay = linesInDoc;
}

View File

@@ -15,6 +15,7 @@
#include "Scintilla.h"
#include "SVector.h"
#include "CellBuffer.h"
#include "CharClassify.h"
#include "Document.h"
#include "RESearch.h"
@@ -50,7 +51,6 @@ Document::Document() {
stylingBits = 5;
stylingBitsMask = 0x1F;
stylingMask = 0;
SetDefaultCharClasses(true);
endStyled = 0;
styleClock = 0;
enteredCount = 0;
@@ -836,10 +836,10 @@ int Document::ParaDown(int pos) {
return LineEnd(line-1);
}
Document::charClassification Document::WordCharClass(unsigned char ch) {
CharClassify::cc Document::WordCharClass(unsigned char ch) {
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80))
return ccWord;
return charClass[ch];
return CharClassify::ccWord;
return charClass.GetClass(ch);
}
/**
@@ -847,7 +847,7 @@ Document::charClassification Document::WordCharClass(unsigned char ch) {
* Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0.
*/
int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
charClassification ccStart = ccWord;
CharClassify::cc ccStart = CharClassify::ccWord;
if (delta < 0) {
if (!onlyWordCharacters)
ccStart = WordCharClass(cb.CharAt(pos-1));
@@ -871,19 +871,19 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
*/
int Document::NextWordStart(int pos, int delta) {
if (delta < 0) {
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccSpace))
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace))
pos--;
if (pos > 0) {
charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1));
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) {
pos--;
}
}
} else {
charClassification ccStart = WordCharClass(cb.CharAt(pos));
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos));
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart))
pos++;
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccSpace))
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace))
pos++;
}
return pos;
@@ -899,22 +899,22 @@ int Document::NextWordStart(int pos, int delta) {
int Document::NextWordEnd(int pos, int delta) {
if (delta < 0) {
if (pos > 0) {
charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
if (ccStart != ccSpace) {
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1));
if (ccStart != CharClassify::ccSpace) {
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) {
pos--;
}
}
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccSpace) {
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) {
pos--;
}
}
} else {
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccSpace) {
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) {
pos++;
}
if (pos < Length()) {
charClassification ccStart = WordCharClass(cb.CharAt(pos));
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos));
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) {
pos++;
}
@@ -929,8 +929,8 @@ int Document::NextWordEnd(int pos, int delta) {
*/
bool Document::IsWordStartAt(int pos) {
if (pos > 0) {
charClassification ccPos = WordCharClass(CharAt(pos));
return (ccPos == ccWord || ccPos == ccPunctuation) &&
CharClassify::cc ccPos = WordCharClass(CharAt(pos));
return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) &&
(ccPos != WordCharClass(CharAt(pos - 1)));
}
return true;
@@ -942,8 +942,8 @@ bool Document::IsWordStartAt(int pos) {
*/
bool Document::IsWordEndAt(int pos) {
if (pos < Length()) {
charClassification ccPrev = WordCharClass(CharAt(pos-1));
return (ccPrev == ccWord || ccPrev == ccPunctuation) &&
CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1));
return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) &&
(ccPrev != WordCharClass(CharAt(pos)));
}
return true;
@@ -1004,7 +1004,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
int *length) {
if (regExp) {
if (!pre)
pre = new RESearch();
pre = new RESearch(&charClass);
if (!pre)
return -1;
@@ -1266,27 +1266,11 @@ void Document::ChangeCase(Range r, bool makeUpperCase) {
}
void Document::SetDefaultCharClasses(bool includeWordClass) {
// Initialize all char classes to default values
for (int ch = 0; ch < 256; ch++) {
if (ch == '\r' || ch == '\n')
charClass[ch] = ccNewLine;
else if (ch < 0x20 || ch == ' ')
charClass[ch] = ccSpace;
else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_'))
charClass[ch] = ccWord;
else
charClass[ch] = ccPunctuation;
}
charClass.SetDefaultCharClasses(includeWordClass);
}
void Document::SetCharClasses(const unsigned char *chars, charClassification newCharClass) {
// Apply the newCharClass to the specifed chars
if (chars) {
while (*chars) {
charClass[*chars] = newCharClass;
chars++;
}
}
void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) {
charClass.SetCharClasses(chars, newCharClass);
}
void Document::SetStylingBits(int bits) {
@@ -1430,7 +1414,7 @@ void Document::NotifyModified(DocModification mh) {
}
bool Document::IsWordPartSeparator(char ch) {
return (WordCharClass(ch) == ccWord) && IsPunctuation(ch);
return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch);
}
int Document::WordPartLeft(int pos) {

View File

@@ -93,7 +93,7 @@ public:
private:
int refCount;
CellBuffer cb;
charClassification charClass[256];
CharClassify charClass;
char stylingMask;
int endStyled;
int styleClock;
@@ -207,7 +207,7 @@ public:
void ChangeCase(Range r, bool makeUpperCase);
void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, charClassification newCharClass);
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
bool SetStyleFor(int length, char style);
@@ -239,7 +239,7 @@ public:
private:
void CheckReadOnly();
charClassification WordCharClass(unsigned char ch);
CharClassify::cc WordCharClass(unsigned char ch);
bool IsWordStartAt(int pos);
bool IsWordEndAt(int pos);
bool IsWordAt(int start, int end);

View File

@@ -18,6 +18,7 @@
#include "DocumentAccessor.h"
#include "CellBuffer.h"
#include "Scintilla.h"
#include "CharClassify.h"
#include "Document.h"
DocumentAccessor::~DocumentAccessor() {

View File

@@ -26,6 +26,7 @@
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Document.h"
#include "Editor.h"
@@ -213,7 +214,7 @@ void LineLayoutCache::Allocate(int length_) {
}
void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
// PLATFORM_ASSERT(useCount == 0);
PLATFORM_ASSERT(useCount == 0);
int lengthForLevel = 0;
if (level == llcCaret) {
lengthForLevel = 1;
@@ -239,7 +240,7 @@ void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
}
void LineLayoutCache::Deallocate() {
// PLATFORM_ASSERT(useCount == 0);
PLATFORM_ASSERT(useCount == 0);
for (int i = 0; i < length; i++)
delete cache[i];
delete []cache;
@@ -284,7 +285,7 @@ LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChar
} else if (level == llcPage) {
if (lineNumber == lineCaret) {
pos = 0;
} else {
} else if (length > 1) {
pos = 1 + (lineNumber % (length - 1));
}
} else if (level == llcDocument) {
@@ -428,9 +429,8 @@ Editor::Editor() {
wrapState = eWrapNone;
wrapWidth = LineLayout::wrapWidthInfinite;
docLineLastWrapped = -1;
docLastLineToWrap = -1;
backgroundWrapEnabled = true;
wrapStart = wrapLineLarge;
wrapEnd = wrapLineLarge;
wrapVisualFlags = 0;
wrapVisualFlagsLocation = 0;
wrapVisualStartIndent = 0;
@@ -810,6 +810,9 @@ int Editor::PositionFromLocationClose(Point pt) {
return pdoc->MovePositionOutsideChar(i + posLineStart, 1);
}
}
if (pt.x < (ll->positions[lineEnd] - subLineStart)) {
return pdoc->MovePositionOutsideChar(lineEnd + posLineStart, 1);
}
}
}
@@ -1483,29 +1486,18 @@ void Editor::InvalidateCaret() {
void Editor::UpdateSystemCaret() {
}
void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) {
docLineStartWrapping = Platform::Minimum(docLineStartWrapping, pdoc->LinesTotal()-1);
docLineEndWrapping = Platform::Minimum(docLineEndWrapping, pdoc->LinesTotal()-1);
bool noWrap = (docLastLineToWrap == docLineLastWrapped);
if (docLineLastWrapped > (docLineStartWrapping - 1)) {
docLineLastWrapped = docLineStartWrapping - 1;
if (docLineLastWrapped < -1)
docLineLastWrapped = -1;
void Editor::NeedWrapping(int docLineStart, int docLineEnd) {
docLineStart = Platform::Clamp(docLineStart, 0, pdoc->LinesTotal());
if (wrapStart > docLineStart) {
wrapStart = docLineStart;
llc.Invalidate(LineLayout::llPositions);
}
if (noWrap) {
docLastLineToWrap = docLineEndWrapping;
} else if (docLastLineToWrap < docLineEndWrapping) {
docLastLineToWrap = docLineEndWrapping + 1;
if (wrapEnd < docLineEnd) {
wrapEnd = docLineEnd;
}
if (docLastLineToWrap < -1)
docLastLineToWrap = -1;
if (docLastLineToWrap >= pdoc->LinesTotal())
docLastLineToWrap = pdoc->LinesTotal()-1;
wrapEnd = Platform::Clamp(wrapEnd, 0, pdoc->LinesTotal());
// Wrap lines during idle.
if ((wrapState != eWrapNone) &&
backgroundWrapEnabled &&
(docLastLineToWrap != docLineLastWrapped)) {
if ((wrapState != eWrapNone) && (wrapEnd != wrapStart)) {
SetIdle(true);
}
}
@@ -1514,33 +1506,33 @@ void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) {
// fullwrap: if true, all lines which need wrapping will be done,
// in this single call.
// priorityWrapLineStart: If greater than zero, all lines starting from
// here to 100 lines past will be wrapped (even if there are
// here to 1 page + 100 lines past will be wrapped (even if there are
// more lines under wrapping process in idle).
// If it is neither fullwrap, nor priorityWrap, then 100 lines will be
// If it is neither fullwrap, nor priorityWrap, then 1 page + 100 lines will be
// wrapped, if there are any wrapping going on in idle. (Generally this
// condition is called only from idler).
// Return true if wrapping occurred.
bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
// If there are any pending wraps, do them during idle if possible.
int linesInOneCall = LinesOnScreen() + 100;
if (wrapState != eWrapNone) {
if (docLineLastWrapped < docLastLineToWrap) {
if (!(backgroundWrapEnabled && SetIdle(true))) {
// Background wrapping is disabled, or idle processing
// not supported. A full wrap is required.
if (wrapStart < wrapEnd) {
if (!SetIdle(true)) {
// Idle processing not supported so full wrap required.
fullWrap = true;
}
}
if (!fullWrap && priorityWrapLineStart >= 0 &&
// .. and if the paint window is outside pending wraps
(((priorityWrapLineStart + 100) < docLineLastWrapped) ||
(priorityWrapLineStart > docLastLineToWrap))) {
(((priorityWrapLineStart + linesInOneCall) < wrapStart) ||
(priorityWrapLineStart > wrapEnd))) {
// No priority wrap pending
return false;
}
}
int goodTopLine = topLine;
bool wrapOccurred = false;
if (docLineLastWrapped < pdoc->LinesTotal()) {
if (wrapStart <= pdoc->LinesTotal()) {
if (wrapState == eWrapNone) {
if (wrapWidth != LineLayout::wrapWidthInfinite) {
wrapWidth = LineLayout::wrapWidthInfinite;
@@ -1549,8 +1541,11 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
}
wrapOccurred = true;
}
docLineLastWrapped = 0x7ffffff;
wrapStart = wrapLineLarge;
wrapEnd = wrapLineLarge;
} else {
if (wrapEnd >= pdoc->LinesTotal())
wrapEnd = pdoc->LinesTotal();
//ElapsedTime et;
int lineDocTop = cs.DocFromDisplay(topLine);
int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
@@ -1564,44 +1559,42 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
AutoSurface surface(this);
if (surface) {
bool priorityWrap = false;
int lastLineToWrap = docLastLineToWrap;
int firstLineToWrap = docLineLastWrapped;
int lastLineToWrap = wrapEnd;
int lineToWrap = wrapStart;
if (!fullWrap) {
if (priorityWrapLineStart >= 0) {
// This is a priority wrap.
firstLineToWrap = priorityWrapLineStart;
lastLineToWrap = firstLineToWrap + 100;
lineToWrap = priorityWrapLineStart;
lastLineToWrap = priorityWrapLineStart + linesInOneCall;
priorityWrap = true;
} else {
// This is idle wrap.
lastLineToWrap = docLineLastWrapped + 100;
lastLineToWrap = wrapStart + linesInOneCall;
}
if (lastLineToWrap >= docLastLineToWrap)
lastLineToWrap = docLastLineToWrap;
if (lastLineToWrap >= wrapEnd)
lastLineToWrap = wrapEnd;
} // else do a fullWrap.
// printf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, firstLineToWrap, lastLineToWrap);
// printf("Pending wraps: %d to %d\n", docLineLastWrapped, docLastLineToWrap);
while (firstLineToWrap < lastLineToWrap) {
firstLineToWrap++;
if (!priorityWrap)
docLineLastWrapped++;
if (firstLineToWrap < pdoc->LinesTotal()) {
AutoLineLayout ll(llc, RetrieveLineLayout(firstLineToWrap));
// Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap);
// Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd);
while (lineToWrap < lastLineToWrap) {
AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap));
int linesWrapped = 1;
if (ll) {
LayoutLine(firstLineToWrap, surface, vs, ll, wrapWidth);
LayoutLine(lineToWrap, surface, vs, ll, wrapWidth);
linesWrapped = ll->lines;
}
if (cs.SetHeight(firstLineToWrap, linesWrapped)) {
if (cs.SetHeight(lineToWrap, linesWrapped)) {
wrapOccurred = true;
}
lineToWrap++;
}
}
if (!priorityWrap)
wrapStart = lineToWrap;
// If wrapping is done, bring it to resting position
if (docLineLastWrapped > docLastLineToWrap) {
docLineLastWrapped = -1;
docLastLineToWrap = -1;
if (wrapStart >= wrapEnd) {
wrapStart = wrapLineLarge;
wrapEnd = wrapLineLarge;
}
}
goodTopLine = cs.DisplayFromDoc(lineDocTop);
@@ -1673,6 +1666,7 @@ void Editor::LinesSplit(int pixelWidth) {
targetEnd += static_cast<int>(strlen(eol));
}
}
lineEnd = pdoc->LineFromPosition(targetEnd);
}
pdoc->EndUndoAction();
}
@@ -1716,7 +1710,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
rcSelMargin.left = rcSelMargin.right;
rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width;
if (vs.ms[margin].symbol) {
if (vs.ms[margin].style != SC_MARGIN_NUMBER) {
/* alternate scheme:
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
@@ -1727,8 +1721,21 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
// Required because of special way brush is created for selection margin
surface->FillRectangle(rcSelMargin, *pixmapSelPattern);
else
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);
else {
ColourAllocated colour;
switch (vs.ms[margin].style) {
case SC_MARGIN_BACK:
colour = vs.styles[STYLE_DEFAULT].back.allocated;
break;
case SC_MARGIN_FORE:
colour = vs.styles[STYLE_DEFAULT].fore.allocated;
break;
default:
colour = vs.styles[STYLE_LINENUMBER].back.allocated;
break;
}
surface->FillRectangle(rcSelMargin, colour);
}
} else {
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);
}
@@ -1835,7 +1842,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
PRectangle rcMarker = rcSelMargin;
rcMarker.top = yposScreen;
rcMarker.bottom = yposScreen + vs.lineHeight;
if (!vs.ms[margin].symbol) {
if (vs.ms[margin].style == SC_MARGIN_NUMBER) {
char number[100];
number[0] = '\0';
if (firstSubLine)
@@ -2126,7 +2133,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
continue;
}
if (p > 0) {
if (wrapState == eWrapChar){
if (wrapState == eWrapChar) {
lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1)
- posLineStart;
p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart;
@@ -2145,14 +2152,15 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
}
}
ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw) {
return primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated;
}
ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) {
if (inSelection) {
if (vsDraw.selbackset) {
if (primarySelection)
return vsDraw.selbackground.allocated;
else
return vsDraw.selbackground2.allocated;
if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
return SelectionBackground(vsDraw);
}
} else {
if ((vsDraw.edgeState == EDGE_BACKGROUND) &&
@@ -2204,7 +2212,7 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace,
surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative);
}
};
Relative rel = {surface, x0, xStraight?1:-1, y0, yStraight?1:-1};
Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1};
// arrow head
rel.MoveTo(xa, y);
@@ -2220,6 +2228,12 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace,
y - 2 * dy);
}
static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) {
if (alpha != SC_ALPHA_NOALPHA) {
surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0);
}
}
void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
int line, int lineEnd, int xStart, int subLine, int subLineStart,
bool overrideBackground, ColourAllocated background,
@@ -2236,16 +2250,18 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
bool eolInSelection = (subLine == (ll->lines - 1)) &&
(posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd);
if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1)) {
if (primarySelection)
surface->FillRectangle(rcSegment, vsDraw.selbackground.allocated);
else
surface->FillRectangle(rcSegment, vsDraw.selbackground2.allocated);
} else if (overrideBackground) {
if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw));
} else {
if (overrideBackground) {
surface->FillRectangle(rcSegment, background);
} else {
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated);
}
if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) {
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha);
}
}
rcSegment.left = xEol + vsDraw.aveCharWidth + xStart;
rcSegment.right = rcLine.right;
@@ -2290,14 +2306,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
// the color for the highest numbered one is used.
bool overrideBackground = false;
ColourAllocated background;
if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {
overrideBackground = true;
background = vsDraw.caretLineBackground.allocated;
}
if (!overrideBackground) {
int marks = pdoc->GetMark(line);
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if ((marks & 1) && vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) {
if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) &&
(vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
background = vsDraw.markers[markBit].back.allocated;
overrideBackground = true;
}
@@ -2306,14 +2323,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
if (!overrideBackground) {
if (vsDraw.maskInLine) {
int marks = pdoc->GetMark(line) & vsDraw.maskInLine;
if (marks) {
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if ((marks & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) {
int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
if (marksMasked) {
for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) &&
(vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
overrideBackground = true;
background = vsDraw.markers[markBit].back.allocated;
}
marks >>= 1;
marksMasked >>= 1;
}
}
}
@@ -2641,6 +2659,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
xStart, subLine, subLineStart, overrideBackground, background,
drawWrapMarkEnd, vsDraw.whitespaceForeground.allocated);
}
if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) && (ll->selStart >= 0) && (ll->selEnd >= 0)) {
int startPosSel = (ll->selStart < posLineStart) ? posLineStart : ll->selStart;
int endPosSel = (ll->selEnd < (lineEnd + posLineStart)) ? ll->selEnd : (lineEnd + posLineStart);
if (startPosSel < endPosSel) {
rcSegment.left = xStart + ll->positions[startPosSel - posLineStart] - subLineStart;
rcSegment.right = xStart + ll->positions[endPosSel - posLineStart] - subLineStart;
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha);
}
}
if (vsDraw.edgeState == EDGE_LINE) {
int edgeX = theEdge * vsDraw.spaceWidth;
@@ -2648,6 +2675,31 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
rcSegment.right = rcSegment.left + 1;
surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated);
}
// Draw any translucent whole line states
rcSegment.left = xStart;
rcSegment.right = rcLine.right - 1;
if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha);
}
int marks = pdoc->GetMark(line);
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
}
marks >>= 1;
}
if (vsDraw.maskInLine) {
int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
if (marksMasked) {
for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
}
marksMasked >>= 1;
}
}
}
}
void Editor::RefreshPixMaps(Surface *surfaceWindow) {
@@ -2721,7 +2773,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
// paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
RefreshStyleData();
RefreshPixMaps(surfaceWindow);
PRectangle rcClient = GetClientRectangle();
@@ -2752,6 +2803,8 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
if (needUpdateUI) {
NotifyUpdateUI();
needUpdateUI = false;
RefreshStyleData();
RefreshPixMaps(surfaceWindow);
}
// Call priority lines wrap on a window of lines which are likely
@@ -3063,7 +3116,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
// Printing supports only the line number margin.
int lineNumberIndex = -1;
for (int margin = 0; margin < ViewStyle::margins; margin++) {
if ((!vsPrint.ms[margin].symbol) && (vsPrint.ms[margin].width > 0)) {
if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) {
lineNumberIndex = margin;
} else {
vsPrint.ms[margin].width = 0;
@@ -3076,6 +3129,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
// Don't show the selection when printing
vsPrint.selbackset = false;
vsPrint.selforeset = false;
vsPrint.selAlpha = SC_ALPHA_NOALPHA;
vsPrint.whitespaceBackgroundSet = false;
vsPrint.whitespaceForegroundSet = false;
vsPrint.showCaretLineBackground = false;
@@ -3662,19 +3716,8 @@ void Editor::CheckModificationForWrap(DocModification mh) {
llc.Invalidate(LineLayout::llCheckTextAndStyle);
if (wrapState != eWrapNone) {
int lineDoc = pdoc->LineFromPosition(mh.position);
if (mh.linesAdded <= 0) {
AutoSurface surface(this);
AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
if (surface && ll) {
LayoutLine(lineDoc, surface, vs, ll, wrapWidth);
if (cs.GetHeight(lineDoc) != ll->lines) {
NeedWrapping(lineDoc - 1, lineDoc + 1);
Redraw();
}
}
} else {
NeedWrapping(lineDoc, lineDoc + 1 + mh.linesAdded);
}
int lines = Platform::Maximum(0, mh.linesAdded);
NeedWrapping(lineDoc, lineDoc + lines + 1);
}
}
}
@@ -3717,6 +3760,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
InvalidateRange(mh.position, mh.position + mh.length);
}
}
llc.Invalidate(LineLayout::llCheckTextAndStyle);
} else {
// Move selection and brace highlights
if (mh.modificationType & SC_MOD_INSERTTEXT) {
@@ -4849,7 +4893,7 @@ void Editor::CopyRangeToClipboard(int start, int end) {
void Editor::CopyText(int length, const char *text) {
SelectionText selectedText;
selectedText.Copy(text, length,
selectedText.Copy(text, length + 1,
pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false);
CopyToClipboard(selectedText);
}
@@ -5377,13 +5421,13 @@ bool Editor::Idle() {
bool idleDone;
bool wrappingDone = (wrapState == eWrapNone) || (!backgroundWrapEnabled);
bool wrappingDone = wrapState == eWrapNone;
if (!wrappingDone) {
// Wrap lines during idle.
WrapLines(false, -1);
// No more wrapping
if (docLineLastWrapped == docLastLineToWrap)
if (wrapStart == wrapEnd)
wrappingDone = true;
}
@@ -6038,14 +6082,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
pdoc->SetDefaultCharClasses(false);
if (lParam == 0)
return 0;
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), Document::ccWord);
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccWord);
}
break;
case SCI_SETWHITESPACECHARS: {
if (lParam == 0)
return 0;
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), Document::ccSpace);
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccSpace);
}
break;
@@ -6305,7 +6349,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return pdoc->ExtendWordSelect(wParam, 1, lParam != 0);
case SCI_SETWRAPMODE:
switch(wParam){
switch (wParam) {
case SC_WRAP_WORD:
wrapState = eWrapWord;
break;
@@ -6465,8 +6509,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return pdoc->LineEnd(wParam);
case SCI_SETCODEPAGE:
if (ValidCodePage(wParam)) {
pdoc->dbcsCodePage = wParam;
InvalidateStyleRedraw();
}
break;
case SCI_GETCODEPAGE:
@@ -6499,6 +6545,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleData();
RedrawSelMargin();
break;
case SCI_MARKERSETALPHA:
if (wParam <= MARKER_MAX)
vs.markers[wParam].alpha = lParam;
InvalidateStyleRedraw();
break;
case SCI_MARKERADD: {
int markerID = pdoc->AddMark(wParam, lParam);
return markerID;
@@ -6546,14 +6597,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_SETMARGINTYPEN:
if (ValidMargin(wParam)) {
vs.ms[wParam].symbol = (lParam == SC_MARGIN_SYMBOL);
vs.ms[wParam].style = lParam;
InvalidateStyleRedraw();
}
break;
case SCI_GETMARGINTYPEN:
if (ValidMargin(wParam))
return vs.ms[wParam].symbol ? SC_MARGIN_SYMBOL : SC_MARGIN_NUMBER;
return vs.ms[wParam].style;
else
return 0;
@@ -6717,6 +6768,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
vs.caretLineBackground.desired = wParam;
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEBACKALPHA:
return vs.caretLineAlpha;
case SCI_SETCARETLINEBACKALPHA:
vs.caretLineAlpha = wParam;
InvalidateStyleRedraw();
break;
// Folding messages
@@ -6831,6 +6888,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleRedraw();
break;
case SCI_SETSELALPHA:
vs.selAlpha = wParam;
InvalidateStyleRedraw();
break;
case SCI_GETSELALPHA:
return vs.selAlpha;
case SCI_SETWHITESPACEFORE:
vs.whitespaceForegroundSet = wParam != 0;
vs.whitespaceForeground.desired = ColourDesired(lParam);

View File

@@ -305,10 +305,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
// Wrapping support
enum { eWrapNone, eWrapWord, eWrapChar } wrapState;
bool backgroundWrapEnabled;
enum { wrapLineLarge = 0x7ffffff };
int wrapWidth;
int docLineLastWrapped;
int docLastLineToWrap;
int wrapStart;
int wrapEnd;
int wrapVisualFlags;
int wrapVisualFlagsLocation;
int wrapVisualStartIndent;
@@ -377,7 +377,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void InvalidateCaret();
virtual void UpdateSystemCaret();
void NeedWrapping(int docLineStartWrapping = 0, int docLineEndWrapping = 0x7ffffff);
void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge);
bool WrapLines(bool fullWrap, int priorityWrapLineStart);
void LinesJoin();
void LinesSplit(int pixelWidth);
@@ -387,6 +387,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
LineLayout *RetrieveLineLayout(int lineNumber);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite);
ColourAllocated SelectionBackground(ViewStyle &vsDraw);
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll);
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour);
@@ -524,6 +525,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void GetHotSpotRange(int& hsStart, int& hsEnd);
int CodePage() const;
virtual bool ValidCodePage(int /* codePage */) const { return true; }
int WrapCount(int line);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;

View File

@@ -12,6 +12,8 @@
#include "Platform.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "PropSet.h"
#include "Accessor.h"
@@ -116,16 +118,16 @@ LexerLibrary::LexerLibrary(const char* ModuleName) {
if (lib->IsValid()) {
m_sModuleName = ModuleName;
//Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects
GetLexerCountFn GetLexerCount = (GetLexerCountFn)lib->FindFunction("GetLexerCount");
GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount");
if (GetLexerCount) {
ExternalLexerModule *lex;
LexerMinder *lm;
// Find functions in the DLL
GetLexerNameFn GetLexerName = (GetLexerNameFn)lib->FindFunction("GetLexerName");
ExtLexerFunction Lexer = (ExtLexerFunction)lib->FindFunction("Lex");
ExtFoldFunction Folder = (ExtFoldFunction)lib->FindFunction("Fold");
GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName");
ExtLexerFunction Lexer = (ExtLexerFunction)(sptr_t)lib->FindFunction("Lex");
ExtFoldFunction Folder = (ExtFoldFunction)(sptr_t)lib->FindFunction("Fold");
// Assign a buffer for the lexer name.
char lexname[100];

View File

@@ -63,6 +63,12 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
surface->LineTo(rc.right, rcLine.top+1);
surface->LineTo(rc.left, rcLine.top+1);
surface->LineTo(rc.left, ymid+1);
} else if (style == INDIC_ROUNDBOX) {
PRectangle rcBox = rcLine;
rcBox.top = rcLine.top + 1;
rcBox.left = rc.left;
rcBox.right = rc.right;
surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0);
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);

View File

@@ -171,6 +171,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmGui4Cli);
LINK_LEXER(lmHaskell);
LINK_LEXER(lmHTML);
LINK_LEXER(lmInno);
LINK_LEXER(lmKix);
LINK_LEXER(lmLatex);
LINK_LEXER(lmLISP);
@@ -186,6 +187,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmNsis);
LINK_LEXER(lmNull);
LINK_LEXER(lmOctave);
LINK_LEXER(lmOpal);
LINK_LEXER(lmPascal);
LINK_LEXER(lmPB);
LINK_LEXER(lmPerl);
@@ -201,6 +203,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmScriptol);
LINK_LEXER(lmSmalltalk);
LINK_LEXER(lmSpecman);
LINK_LEXER(lmSpice);
LINK_LEXER(lmSQL);
LINK_LEXER(lmTADS3);
LINK_LEXER(lmTCL);

View File

@@ -39,6 +39,9 @@
// May 23, 2005 - Fixed the SentKey lexing in case of a missing }
// Aug 11, 2005 - Fixed possible bug with s_save length > 100.
// Aug 23, 2005 - Added Switch/endswitch support to the folding logic.
// Sep 27, 2005 - Fixed the SentKey lexing logic in case of multiple sentkeys.
// Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions.
// Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF)
//
// Copyright for Scintilla: 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@@ -92,6 +95,7 @@ static inline bool IsAOperator(char ch) {
static int GetSendKey(const char *szLine, char *szKey)
{
int nFlag = 0;
int nStartFound = 0;
int nKeyPos = 0;
int nSpecPos= 0;
int nSpecNum= 1;
@@ -102,11 +106,13 @@ static int GetSendKey(const char *szLine, char *szKey)
// split the portion of the sendkey in the part before and after the spaces
while ( ( (cTemp = szLine[nPos]) != '\0'))
{
// skip leading Ctrl/Shift/ALt state
if ((cTemp == '#' || cTemp == '!' || cTemp == '^') && (szLine[nPos+1] == '{') )
{
// skip leading Ctrl/Shift/Alt state
if (cTemp == '{') {
nStartFound = 1;
}
else if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space
//
if (nStartFound == 1) {
if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space
{
nFlag = 1;
// Add } to the end of the first bit for table lookup later.
@@ -128,6 +134,7 @@ static int GetSendKey(const char *szLine, char *szKey)
// check if Second portion is all numbers for repeat fuction
if (isdigit(cTemp) == false) {nSpecNum = 0;}
}
}
nPos++; // skip to next char
} // End While
@@ -190,6 +197,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
// find the first previous line without continuation character at the end
int lineCurrent = styler.GetLine(startPos);
int s_startPos = startPos;
@@ -325,6 +333,10 @@ static void ColouriseAU3Doc(unsigned int startPos,
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_DEFAULT);
}
else if (keywords8.InList(s)) {
sc.ChangeState(SCE_AU3_UDF);
sc.SetState(SCE_AU3_DEFAULT);
}
else if (strcmp(s, "_") == 0) {
sc.ChangeState(SCE_AU3_OPERATOR);
sc.SetState(SCE_AU3_DEFAULT);
@@ -411,9 +423,11 @@ static void ColouriseAU3Doc(unsigned int startPos,
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>'))
{
sc.ForwardSetState(SCE_AU3_DEFAULT);
si=0;
}
if (sc.atLineEnd)
{
si=0;
// at line end and not found a continuation char then reset to default
int lineCurrent = styler.GetLine(sc.currentPos);
if (!IsContinuationLine(lineCurrent,styler))
@@ -422,11 +436,8 @@ static void ColouriseAU3Doc(unsigned int startPos,
}
}
// find Sendkeys in a STRING
if (sc.ch == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '+' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '!' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '^' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '#' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ) {
sc.SetState(SCE_AU3_SENT);}
break;
}
@@ -459,6 +470,35 @@ static void ColouriseAU3Doc(unsigned int startPos,
}
sc.SetState(SCE_AU3_STRING);
}
else
{
// check if the start is a valid SendKey start
int nPos = 0;
int nState = 1;
char cTemp;
while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
{
if (cTemp == '{' && nState == 1)
{
nState = 2;
}
if (nState == 1 && !(cTemp == '+' || cTemp == '!' || cTemp == '^' || cTemp == '#' ))
{
nState = 0;
}
nPos++;
}
//Verify characters infront of { ... if not assume regular string
if (nState == 1 && (!(sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ))) {
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_STRING);
}
// If invalid character found then assume its a regular string
if (nState == 0) {
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_STRING);
}
}
// check if next portion is again a sendkey
if (sc.atLineEnd)
{
@@ -466,13 +506,12 @@ static void ColouriseAU3Doc(unsigned int startPos,
sc.SetState(SCE_AU3_DEFAULT);
si = 0; // reset string indicator
}
//if (sc.ch == '{' && sc.chPrev != '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '+' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '!' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '^' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '#' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
//* check in next characters following a sentkey are again a sent key
// Need this test incase of 2 sentkeys like {F1}{ENTER} but not detect {{}
if (sc.state == SCE_AU3_STRING && (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' )) {
sc.SetState(SCE_AU3_SENT);}
// check to see if the string ended...
// Sentkey string isn't complete but the string ended....
// Sendkey string isn't complete but the string ended....
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\''))
{
sc.ChangeState(SCE_AU3_STRING);
@@ -491,6 +530,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
else if (sc.ch == '$') {sc.SetState(SCE_AU3_VARIABLE);}
else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);}
else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);}
//else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);}
else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include
else if (sc.ch == '\"') {
sc.SetState(SCE_AU3_STRING);
@@ -543,6 +583,10 @@ static void ColouriseAU3Doc(unsigned int startPos,
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_EXPAND);
}
else if (keywords8.InList(s_save)) {
sc.ChangeState(SCE_AU3_UDF);
sc.SetState(SCE_AU3_UDF);
}
else {
sc.ChangeState(SCE_AU3_DEFAULT);
sc.SetState(SCE_AU3_DEFAULT);
@@ -841,6 +885,7 @@ static const char * const AU3WordLists[] = {
"#autoit Pre-processors",
"#autoit Special",
"#autoit Expand",
"#autoit UDF",
0
};
LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists);

View File

@@ -258,6 +258,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
if (state == SCE_SH_DEFAULT) {
if (ch == '\\') { // escaped character
if (i < lengthDoc - 1)
i++;
ch = chNext;
chNext = chNext2;
@@ -626,7 +627,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
&& !IsCommentLine(lineCurrent+1, styler))
levelCurrent--;
}
if (style == SCE_C_OPERATOR) {
if (style == SCE_SH_OPERATOR) {
if (ch == '{') {
levelCurrent++;
} else if (ch == '}') {

View File

@@ -147,7 +147,7 @@ static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
sc.ChangeState(SCE_B_ERROR);
sc.SetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_COMMENT) {
} else if (sc.state == SCE_B_COMMENT || sc.state == SCE_B_PREPROCESSOR) {
if (sc.atLineEnd) {
sc.SetState(SCE_B_DEFAULT);
}
@@ -163,6 +163,11 @@ static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
wasfirst = isfirst;
sc.SetState(SCE_B_IDENTIFIER);
} else if (sc.Match(comment_char)) {
// Hack to make deprecated QBASIC '$Include show
// up in freebasic with SCE_B_PREPROCESSOR.
if (comment_char == '\'' && sc.Match(comment_char, '$'))
sc.SetState(SCE_B_PREPROCESSOR);
else
sc.SetState(SCE_B_COMMENT);
} else if (sc.Match('"')) {
sc.SetState(SCE_B_STRING);

View File

@@ -459,4 +459,3 @@ static void ColouriseCppDocInsensitive(unsigned int startPos, int length, int in
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDocSensitive, "cpp", FoldCppDoc, cppWordLists);
LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, ColouriseCppDocInsensitive, "cppnocase", FoldCppDoc, cppWordLists);
LexerModule lmTCL(SCLEX_TCL, ColouriseCppDocSensitive, "tcl", FoldCppDoc, cppWordLists);

View File

@@ -32,7 +32,7 @@ static inline bool isEiffelOperator(unsigned int ch) {
}
static inline bool IsAWordChar(unsigned int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static inline bool IsAWordStart(unsigned int ch) {

View File

@@ -149,7 +149,13 @@ static inline bool isStringState(int state) {
case SCE_HB_STRING:
case SCE_HBA_STRING:
case SCE_HP_STRING:
case SCE_HP_CHARACTER:
case SCE_HP_TRIPLE:
case SCE_HP_TRIPLEDOUBLE:
case SCE_HPA_STRING:
case SCE_HPA_CHARACTER:
case SCE_HPA_TRIPLE:
case SCE_HPA_TRIPLEDOUBLE:
case SCE_HPHP_HSTRING:
case SCE_HPHP_SIMPLESTRING:
case SCE_HPHP_HSTRING_VARIABLE:
@@ -163,6 +169,19 @@ static inline bool isStringState(int state) {
return bResult;
}
static inline bool stateAllowsTermination(int state) {
bool allowTermination = !isStringState(state);
if (allowTermination) {
switch (state) {
case SCE_HPHP_COMMENT:
case SCE_HP_COMMENTLINE:
case SCE_HPA_COMMENTLINE:
allowTermination = false;
}
}
return allowTermination;
}
// not really well done, since it's only comments that should lex the %> and <%
static inline bool isCommentASPState(int state) {
bool bResult;
@@ -668,7 +687,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
(ch == '<') &&
(chNext == '?') &&
!IsScriptCommentState(state) ) {
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 10, eScriptPHP);
if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
@@ -763,9 +782,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
else if ((
((inScriptType == eNonHtmlPreProc)
|| (inScriptType == eNonHtmlScriptPreProc)) && (
((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
((scriptLanguage != eScriptNone) && !isStringState(state) &&
((ch == '%') || (ch == '?')))
((scriptLanguage != eScriptNone) && stateAllowsTermination(state) && ((ch == '%') || (ch == '?')))
) && (chNext == '>')) ||
((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
if (state == SCE_H_ASPAT) {

View File

@@ -0,0 +1,290 @@
// Scintilla source code edit control
/** @file LexInno.cxx
** Lexer for Inno Setup scripts.
**/
// Written by Friedrich Vedder <fvedd@t-online.de>, using code from LexOthers.cxx.
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
int state = SCE_INNO_DEFAULT;
char chPrev;
char ch = 0;
char chNext = styler[startPos];
int lengthDoc = startPos + length;
char *buffer = new char[length];
int bufferCount = 0;
bool isBOL, isEOL, isWS, isBOLWS = 0;
WordList &sectionKeywords = *keywordLists[0];
WordList &standardKeywords = *keywordLists[1];
WordList &parameterKeywords = *keywordLists[2];
WordList &preprocessorKeywords = *keywordLists[3];
WordList &pascalKeywords = *keywordLists[4];
WordList &userKeywords = *keywordLists[5];
// Go through all provided text segment
// using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
for (int i = startPos; i < lengthDoc; i++) {
chPrev = ch;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
i++;
continue;
}
isBOL = (chPrev == 0) || (chPrev == '\n') || (chPrev == '\r' && ch != '\n');
isBOLWS = (isBOL) ? 1 : (isBOLWS && (chPrev == ' ' || chPrev == '\t'));
isEOL = (ch == '\n' || ch == '\r');
isWS = (ch == ' ' || ch == '\t');
switch(state) {
case SCE_INNO_DEFAULT:
if (ch == ';' && isBOLWS) {
// Start of a comment
state = SCE_INNO_COMMENT;
} else if (ch == '[' && isBOLWS) {
// Start of a section name
bufferCount = 0;
state = SCE_INNO_SECTION;
} else if (ch == '#' && isBOLWS) {
// Start of a preprocessor directive
state = SCE_INNO_PREPROC;
} else if (ch == '{' && chNext == '#') {
// Start of a preprocessor inline directive
state = SCE_INNO_PREPROC_INLINE;
} else if ((ch == '{' && (chNext == ' ' || chNext == '\t'))
|| (ch == '(' && chNext == '*')) {
// Start of a Pascal comment
state = SCE_INNO_COMMENT_PASCAL;
} else if (ch == '"') {
// Start of a double-quote string
state = SCE_INNO_STRING_DOUBLE;
} else if (ch == '\'') {
// Start of a single-quote string
state = SCE_INNO_STRING_SINGLE;
} else if (isascii(ch) && (isalpha(ch) || (ch == '_'))) {
// Start of an identifier
bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch));
state = SCE_INNO_IDENTIFIER;
} else {
// Style it the default style
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_COMMENT:
if (isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_COMMENT);
}
break;
case SCE_INNO_IDENTIFIER:
if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else {
state = SCE_INNO_DEFAULT;
buffer[bufferCount] = '\0';
// Check if the buffer contains a keyword
if (standardKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD);
} else if (parameterKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_PARAMETER);
} else if (pascalKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD_PASCAL);
} else if (userKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD_USER);
} else {
styler.ColourTo(i-1,SCE_INNO_DEFAULT);
}
// Push back the faulty character
chNext = styler[i--];
ch = chPrev;
}
break;
case SCE_INNO_SECTION:
if (ch == ']') {
state = SCE_INNO_DEFAULT;
buffer[bufferCount] = '\0';
// Check if the buffer contains a section name
if (sectionKeywords.InList(buffer)) {
styler.ColourTo(i,SCE_INNO_SECTION);
} else {
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
} else if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_PREPROC:
if (isWS || isEOL) {
if (isascii(chPrev) && isalpha(chPrev)) {
state = SCE_INNO_DEFAULT;
buffer[bufferCount] = '\0';
// Check if the buffer contains a preprocessor directive
if (preprocessorKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_PREPROC);
} else {
styler.ColourTo(i-1,SCE_INNO_DEFAULT);
}
// Push back the faulty character
chNext = styler[i--];
ch = chPrev;
}
} else if (isascii(ch) && isalpha(ch)) {
if (chPrev == '#' || chPrev == ' ' || chPrev == '\t')
bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch));
}
break;
case SCE_INNO_STRING_DOUBLE:
if (ch == '"' || isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_STRING_SINGLE:
if (ch == '\'' || isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_PREPROC_INLINE:
if (ch == '}') {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_PREPROC_INLINE);
} else if (isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_COMMENT_PASCAL:
if (ch == '}' || (ch == ')' && chPrev == '*')) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL);
} else if (isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
}
}
delete []buffer;
}
static const char * const innoWordListDesc[] = {
"Sections",
"Keywords",
"Parameters",
"Preprocessor directives",
"Pascal keywords",
"User defined keywords",
0
};
static void FoldInnoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
bool headerPoint = false;
int lev;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler[i+1];
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_INNO_SECTION)
headerPoint = true;
if (atEOL) {
lev = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
int levelPrevious = styler.LevelAt(lineCurrent - 1);
if (levelPrevious & SC_FOLDLEVELHEADERFLAG)
lev = SC_FOLDLEVELBASE + 1;
else
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
}
if (headerPoint)
lev = SC_FOLDLEVELBASE;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (headerPoint)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent))
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
visibleChars = 0;
headerPoint = false;
}
if (!isspacechar(ch))
visibleChars++;
}
if (lineCurrent > 0) {
int levelPrevious = styler.LevelAt(lineCurrent - 1);
if (levelPrevious & SC_FOLDLEVELHEADERFLAG)
lev = SC_FOLDLEVELBASE + 1;
else
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
} else {
lev = SC_FOLDLEVELBASE;
}
int flagsNext = styler.LevelAt(lineCurrent);
styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK);
}
LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc);

View File

@@ -38,7 +38,8 @@ static inline bool IsANumberChar(int ch) {
// but probably enough in most cases.
return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+');
ch == '.' || ch == '-' || ch == '+' ||
(ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'));
}
static inline bool IsLuaOperator(int ch) {
@@ -51,7 +52,8 @@ static inline bool IsLuaOperator(int ch) {
ch == '{' || ch == '}' || ch == '~' ||
ch == '[' || ch == ']' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' ||
ch == '.' || ch == '^' || ch == '%' || ch == ':') {
ch == '.' || ch == '^' || ch == '%' || ch == ':' ||
ch == '#') {
return true;
}
return false;
@@ -144,7 +146,7 @@ static void ColouriseLuaDoc(
if (sc.state == SCE_LUA_OPERATOR) {
sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_NUMBER) {
// We stop the number definition on non-numerical non-dot non-eE non-sign char
// We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char
if (!IsANumberChar(sc.ch)) {
sc.SetState(SCE_LUA_DEFAULT);
}
@@ -225,6 +227,9 @@ static void ColouriseLuaDoc(
if (sc.state == SCE_LUA_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_LUA_NUMBER);
if (sc.ch == '0' && toupper(sc.chNext) == 'X') {
sc.Forward(1);
}
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_LUA_IDENTIFIER);
} else if (sc.ch == '\"') {

View File

@@ -3,7 +3,7 @@
** Lexer for MSSQL.
**/
// By Filip Yaghob <fyaghob@gmail.com>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>

View File

@@ -0,0 +1,518 @@
// Scintilla source code edit control
/** @file LexOpal.cxx
** Lexer for OPAL (functional language similar to Haskell)
** Written by Sebastian Pipping <webmaster@hartwork.org>
**/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
{
unsigned int i = 0;
while( ( i < end - start + 1 ) && ( i < len - 1 ) )
{
s[i] = static_cast<char>( styler[ start + i ] );
i++;
}
s[ i ] = '\0';
}
inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
{
char ch;
// Wait for string to close
bool even_backslash_count = true; // Without gaps in between
cur++; // Skip initial quote
for( ; ; )
{
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_STRING );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( ( ch == '\015' ) || ( ch == '\012' ) ) // Deny multi-line strings
{
styler.ColourTo( cur - 1, SCE_OPAL_STRING );
styler.StartSegment( cur );
return true;
}
else
{
if( even_backslash_count )
{
if( ch == '"' )
{
styler.ColourTo( cur, SCE_OPAL_STRING );
cur++;
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else if( ch == '\\' )
{
even_backslash_count = false;
}
}
else
{
even_backslash_count = true;
}
}
cur++;
}
}
inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
{
char ch;
if( could_fail )
{
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( ch != '*' )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
styler.StartSegment( cur );
return true;
}
}
// Wait for comment close
cur++;
bool star_found = false;
for( ; ; )
{
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_BLOCK );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( star_found )
{
if( ch == '/' )
{
styler.ColourTo( cur, SCE_OPAL_COMMENT_BLOCK );
cur++;
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else if( ch != '*' )
{
star_found = false;
}
}
else if( ch == '*' )
{
star_found = true;
}
cur++;
}
}
inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
{
char ch;
if( could_fail )
{
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( ch != '-' )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
styler.StartSegment( cur );
return true;
}
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( ( ch != ' ' ) && ( ch != '\t' ) )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
styler.StartSegment( cur );
return true;
}
}
// Wait for end of line
bool fifteen_found = false;
for( ; ; )
{
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( fifteen_found )
{
/*
if( ch == '\012' )
{
// One newline on Windows (015, 012)
}
else
{
// One newline on MAC (015) and another char
}
*/
cur--;
styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
styler.StartSegment( cur );
return true;
}
else
{
if( ch == '\015' )
{
fifteen_found = true;
}
else if( ch == '\012' )
{
// One newline on Linux (012)
styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
styler.StartSegment( cur );
return true;
}
}
}
}
inline bool HandlePar( unsigned int & cur, Accessor & styler )
{
styler.ColourTo( cur, SCE_OPAL_PAR );
cur++;
styler.StartSegment( cur );
return true;
}
inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
{
char ch;
cur++;
for( ; ; )
{
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
return false;
}
ch = styler.SafeGetCharAt( cur );
switch( ch )
{
case ' ':
case '\t':
case '\015':
case '\012':
cur++;
break;
default:
styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
styler.StartSegment( cur );
return true;
}
}
}
inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
{
char ch;
for( ; ; )
{
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( !isdigit( ch ) )
{
styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
styler.StartSegment( cur );
return true;
}
}
}
inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor & styler, WordList * keywordlists[] )
{
char ch;
const unsigned int beg = cur;
cur++;
for( ; ; )
{
ch = styler.SafeGetCharAt( cur );
if( ( ch != '_' ) && ( ch != '-' ) &&
!islower( ch ) && !isupper( ch ) && !isdigit( ch ) ) break;
cur++;
if( cur >= one_too_much )
{
break;
}
}
const int ide_len = cur - beg + 1;
char * ide = new char[ ide_len ];
getRange( beg, cur, styler, ide, ide_len );
WordList & keywords = *keywordlists[ 0 ];
WordList & classwords = *keywordlists[ 1 ];
if( keywords.InList( ide ) ) // Keyword
{
delete [] ide;
styler.ColourTo( cur - 1, SCE_OPAL_KEYWORD );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else if( classwords.InList( ide ) ) // Sort
{
delete [] ide;
styler.ColourTo( cur - 1, SCE_OPAL_SORT );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else if( !strcmp( ide, "true" ) || !strcmp( ide, "false" ) ) // Bool const
{
delete [] ide;
styler.ColourTo( cur - 1, SCE_OPAL_BOOL_CONST );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else // Unknown keyword
{
delete [] ide;
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
}
inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
{
cur++;
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor & styler )
{
styler.StartAt( startPos );
styler.StartSegment( startPos );
unsigned int & cur = startPos;
const unsigned int one_too_much = startPos + length;
int state = initStyle;
for( ; ; )
{
switch( state )
{
case SCE_OPAL_KEYWORD:
case SCE_OPAL_SORT:
if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
state = SCE_OPAL_DEFAULT;
break;
case SCE_OPAL_INTEGER:
if( !HandleInteger( cur, one_too_much, styler ) ) return;
state = SCE_OPAL_DEFAULT;
break;
case SCE_OPAL_COMMENT_BLOCK:
if( !HandleCommentBlock( cur, one_too_much, styler, false ) ) return;
state = SCE_OPAL_DEFAULT;
break;
case SCE_OPAL_COMMENT_LINE:
if( !HandleCommentLine( cur, one_too_much, styler, false ) ) return;
state = SCE_OPAL_DEFAULT;
break;
case SCE_OPAL_STRING:
if( !HandleString( cur, one_too_much, styler ) ) return;
state = SCE_OPAL_DEFAULT;
break;
default: // SCE_OPAL_DEFAULT:
{
char ch = styler.SafeGetCharAt( cur );
switch( ch )
{
// String
case '"':
if( !HandleString( cur, one_too_much, styler ) ) return;
break;
// Comment block
case '/':
if( !HandleCommentBlock( cur, one_too_much, styler, true ) ) return;
break;
// Comment line
case '-':
if( !HandleCommentLine( cur, one_too_much, styler, true ) ) return;
break;
// Par
case '(':
case ')':
case '[':
case ']':
case '{':
case '}':
if( !HandlePar( cur, styler ) ) return;
break;
// Whitespace
case ' ':
case '\t':
case '\015':
case '\012':
if( !HandleSpace( cur, one_too_much, styler ) ) return;
break;
default:
{
// Integer
if( isdigit( ch ) )
{
if( !HandleInteger( cur, one_too_much, styler ) ) return;
}
// Keyword
else if( islower( ch ) || isupper( ch ) )
{
if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
}
// Skip
else
{
if( !HandleSkip( cur, one_too_much, styler ) ) return;
}
}
}
break;
}
}
}
}
static const char * const opalWordListDesc[] = {
"Keywords",
"Sorts",
0
};
LexerModule lmOpal(SCLEX_OPAL, ColouriseOpalDoc, "opal", NULL, opalWordListDesc);

View File

@@ -41,7 +41,7 @@ static bool IsBOperator(char ch) {
// Tests for BATCH Separators
static bool IsBSeparator(char ch) {
return (ch == ':') || (ch == '\\') || (ch == '.') || (ch == ';') ||
return (ch == '\\') || (ch == '.') || (ch == ';') ||
(ch == '\"') || (ch == '\'') || (ch == '/') || (ch == ')');
}
@@ -50,7 +50,7 @@ static void ColouriseBatchLine(
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
WordList &keywords,
WordList *keywordlists[],
Accessor &styler) {
unsigned int offset = 0; // Line Buffer Offset
@@ -59,7 +59,9 @@ static void ColouriseBatchLine(
char wordBuffer[81]; // Word Buffer - large to catch long paths
unsigned int wbl; // Word Buffer Length
unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length
bool forFound = false; // No Local Variable without FOR statement
WordList &keywords = *keywordlists[0]; // Internal Commands
WordList &keywords2 = *keywordlists[1]; // External Commands (optional)
// CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
// Toggling Regular Keyword Checking off improves readability
// Other Regular Keywords and External Commands / Programs might also benefit from toggling
@@ -174,7 +176,13 @@ static void ColouriseBatchLine(
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Colorize External Command / Program
if (!keywords2) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else if (keywords2.InList(wordBuffer)) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else {
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// Reset External Command / Program Location
cmdLoc = offset;
} else {
@@ -186,10 +194,6 @@ static void ColouriseBatchLine(
// Check for Regular Keyword in list
} else if ((keywords.InList(wordBuffer)) &&
(continueProcessing)) {
// Local Variables do not exist if no FOR statement
if (CompareCaseInsensitive(wordBuffer, "for") == 0) {
forFound = true;
}
// ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking
if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) ||
(CompareCaseInsensitive(wordBuffer, "goto") == 0) ||
@@ -306,8 +310,14 @@ static void ColouriseBatchLine(
}
}
}
// Colorize External command / program
// Colorize External Command / Program
if (!keywords2) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else if (keywords2.InList(wordBuffer)) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else {
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// No need to Reset Offset
// Check for Default Text
} else {
@@ -360,7 +370,7 @@ static void ColouriseBatchLine(
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
// Check for Local Variable (%%a)
} else if ((forFound) &&
} else if (
(wordBuffer[1] == '%') &&
(wordBuffer[2] != '%') &&
(!IsBOperator(wordBuffer[2])) &&
@@ -447,7 +457,6 @@ static void ColouriseBatchDoc(
Accessor &styler) {
char lineBuffer[1024];
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
styler.StartSegment(startPos);
@@ -458,14 +467,14 @@ static void ColouriseBatchDoc(
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0';
ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywords, styler);
ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
keywords, styler);
keywordlists, styler);
}
}
@@ -593,8 +602,8 @@ static void ColourisePropsLine(
while ((i < lengthLine) && (lineBuffer[i] != '='))
i++;
if ((i < lengthLine) && (lineBuffer[i] == '=')) {
styler.ColourTo(startLine + i - 1, SCE_PROPS_DEFAULT);
styler.ColourTo(startLine + i, 3);
styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
@@ -1103,7 +1112,8 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
}
static const char * const batchWordListDesc[] = {
"Keywords",
"Internal Commands",
"External Commands",
0
};

View File

@@ -212,6 +212,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
} else if (sc.state == SCE_P_DECORATOR) {
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_P_DEFAULT);
} else if (sc.ch == '#') {
sc.SetState((sc.chNext == '#') ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
}
} else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
if (sc.ch == '\\') {

View File

@@ -43,7 +43,6 @@ static inline bool IsANumberChar(int ch) {
ch == '.' || ch == '-' || ch == '+');
}
static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
@@ -60,28 +59,8 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0;
int styleBeforeDCKeyword = SCE_C_DEFAULT;
bool fold = styler.GetPropertyInt("fold") != 0;
int lineCurrent = styler.GetLine(startPos);
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
for (; sc.More(); sc.Forward()) {
// Fold based on indentation
if (sc.atLineStart) {
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
int level = indentCurrent;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags);
if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) {
level |= SC_FOLDLEVELHEADERFLAG;
}
}
if (fold) {
styler.SetLevel(lineCurrent, level);
}
}
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_SQL_OPERATOR:
@@ -243,12 +222,14 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
levelCurrent = styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK;
levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
}
int levelNext = levelCurrent;
char chNext = styler[startPos];
@@ -306,7 +287,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
} else {
s[j] = '\0';
}
if (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0) {
if ((!foldOnlyBegin) && (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0)) {
if (endFound) {
// ignore
endFound = false;
@@ -326,16 +307,14 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
}
}
if (atEOL) {
int level = levelCurrent;
if (visibleChars == 0 && foldCompact) {
// Empty line
level |= SC_FOLDLEVELWHITEFLAG;
}
if (visibleChars > 0 && levelNext > levelCurrent) {
level |= SC_FOLDLEVELHEADERFLAG;
}
if (level != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, level);
int levelUse = levelCurrent;
int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;

View File

@@ -0,0 +1,221 @@
// Scintilla source code edit control
/** @file LexSpice.cxx
** Lexer for Spice
**/
// Copyright 2006 by Fabien Proriol
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include "Platform.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "PropSet.h"
#include "KeyWords.h"
#include "SciLexer.h"
#include "SString.h"
/*
* Interface
*/
static void ColouriseDocument(
unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
static const char * const spiceWordListDesc[] = {
"Keywords", // SPICE command
"Keywords2", // SPICE functions
"Keywords3", // SPICE params
0
};
LexerModule lmSpice(SCLEX_SPICE, ColouriseDocument, "spice", NULL, spiceWordListDesc);
/*
* Implementation
*/
static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute);
static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute);
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute);
static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute);
static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute);
static inline bool IsDelimiterCharacter(int ch);
static inline bool IsNumberStartCharacter(int ch);
static inline bool IsNumberCharacter(int ch);
static inline bool IsSeparatorOrDelimiterCharacter(int ch);
static inline bool IsWordStartCharacter(int ch);
static inline bool IsWordCharacter(int ch);
static void ColouriseComment(StyleContext& sc, bool&) {
sc.SetState(SCE_SPICE_COMMENTLINE);
while (!sc.atLineEnd) {
sc.Forward();
}
}
static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = sc.Match (')');
sc.SetState(SCE_SPICE_DELIMITER);
sc.ForwardSetState(SCE_SPICE_DEFAULT);
}
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
SString number;
sc.SetState(SCE_SPICE_NUMBER);
// Get all characters up to a delimiter or a separator, including points, but excluding
// double points (ranges).
while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) {
number += static_cast<char>(sc.ch);
sc.Forward();
}
// Special case: exponent with sign
if ((sc.chPrev == 'e' || sc.chPrev == 'E') &&
(sc.ch == '+' || sc.ch == '-')) {
number += static_cast<char>(sc.ch);
sc.Forward ();
while (!IsSeparatorOrDelimiterCharacter(sc.ch)) {
number += static_cast<char>(sc.ch);
sc.Forward();
}
}
sc.SetState(SCE_SPICE_DEFAULT);
}
static void ColouriseWhiteSpace(StyleContext& sc, bool& ) {
sc.SetState(SCE_SPICE_DEFAULT);
sc.ForwardSetState(SCE_SPICE_DEFAULT);
}
static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
sc.SetState(SCE_SPICE_IDENTIFIER);
SString word;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
word += static_cast<char>(tolower(sc.ch));
sc.Forward();
}
if (keywords.InList(word.c_str())) {
sc.ChangeState(SCE_SPICE_KEYWORD);
if (word != "all") {
apostropheStartsAttribute = false;
}
}
else if (keywords2.InList(word.c_str())) {
sc.ChangeState(SCE_SPICE_KEYWORD2);
if (word != "all") {
apostropheStartsAttribute = false;
}
}
else if (keywords3.InList(word.c_str())) {
sc.ChangeState(SCE_SPICE_KEYWORD3);
if (word != "all") {
apostropheStartsAttribute = false;
}
}
sc.SetState(SCE_SPICE_DEFAULT);
}
//
// ColouriseDocument
//
static void ColouriseDocument(
unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
StyleContext sc(startPos, length, initStyle, styler);
int lineCurrent = styler.GetLine(startPos);
bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
while (sc.More()) {
if (sc.atLineEnd) {
// Go to the next line
sc.Forward();
lineCurrent++;
// Remember the line state for future incremental lexing
styler.SetLineState(lineCurrent, apostropheStartsAttribute);
// Don't continue any styles on the next line
sc.SetState(SCE_SPICE_DEFAULT);
}
// Comments
if ((sc.Match('*') && sc.atLineStart) || sc.Match('*','~')) {
ColouriseComment(sc, apostropheStartsAttribute);
// Whitespace
} else if (IsASpace(sc.ch)) {
ColouriseWhiteSpace(sc, apostropheStartsAttribute);
// Delimiters
} else if (IsDelimiterCharacter(sc.ch)) {
ColouriseDelimiter(sc, apostropheStartsAttribute);
// Numbers
} else if (IsADigit(sc.ch) || sc.ch == '#') {
ColouriseNumber(sc, apostropheStartsAttribute);
// Keywords or identifiers
} else {
ColouriseWord(sc, keywords, keywords2, keywords3, apostropheStartsAttribute);
}
}
sc.Complete();
}
static inline bool IsDelimiterCharacter(int ch) {
switch (ch) {
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
case '-':
case '.':
case '/':
case ':':
case ';':
case '<':
case '=':
case '>':
case '|':
return true;
default:
return false;
}
}
static inline bool IsNumberCharacter(int ch) {
return IsNumberStartCharacter(ch) ||
ch == '_' ||
ch == '.' ||
ch == '#' ||
(ch >= 'a' && ch <= 'f') ||
(ch >= 'A' && ch <= 'F');
}
static inline bool IsNumberStartCharacter(int ch) {
return IsADigit(ch);
}
static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
return IsASpace(ch) || IsDelimiterCharacter(ch);
}
static inline bool IsWordCharacter(int ch) {
return IsWordStartCharacter(ch) || IsADigit(ch);
}
static inline bool IsWordStartCharacter(int ch) {
return (isascii(ch) && isalpha(ch)) || ch == '_';
}

View File

@@ -0,0 +1,362 @@
// Scintilla source code edit control
/** @file LexTCL.cxx
** Lexer for TCL language.
**/
// Copyright 1998-2001 by Andre Arpin <arpin@kingston.net>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
return ch >= 0x80 ||
(isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator
}
static inline bool IsAWordStart(int ch) {
return ch >= 0x80 || (ch ==':' || isalpha(ch) || ch == '_');
}
static inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
(IsADigit(ch, 0x10) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+');
}
static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *keywordlists[], Accessor &styler) {
#define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT)
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool commentLevel = false;
bool subBrace = false; // substitution begin with a brace ${.....}
enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,
LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 } lineState = LS_DEFAULT;
bool prevSlash = false;
int currentLevel = 0;
bool expected = 0;
bool subParen = 0;
int currentLine = styler.GetLine(startPos);
if (currentLine > 0)
currentLine--;
length += startPos - styler.LineStart(currentLine);
// make sure lines overlap
startPos = styler.LineStart(currentLine);
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
WordList &keywords9 = *keywordlists[8];
if (currentLine > 0) {
int ls = styler.GetLineState(currentLine - 1);
lineState = tLineState(ls & LS_MASK_STATE);
expected = LS_COMMAND_EXPECTED == tLineState(ls & LS_COMMAND_EXPECTED);
subBrace = LS_BRACE_ONLY == tLineState(ls & LS_BRACE_ONLY);
currentLevel = styler.LevelAt(currentLine - 1) >> 17;
commentLevel = (styler.LevelAt(currentLine - 1) >> 16) & 1;
} else
styler.SetLevel(0, SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG);
bool visibleChars = false;
int previousLevel = currentLevel;
StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler);
for (; ; sc.Forward()) {
next:
if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac
continue;
bool atEnd = !sc.More(); // make sure we coloured the last word
if (lineState != LS_DEFAULT) {
sc.SetState(SCE_TCL_DEFAULT);
if (lineState == LS_OPEN_COMMENT)
sc.SetState(SCE_TCL_COMMENTLINE);
else if (lineState == LS_OPEN_DOUBLE_QUOTE)
sc.SetState(SCE_TCL_IN_QUOTE);
else if (lineState == LS_COMMENT_BOX && (sc.ch == '#' || (sc.ch == ' ' && sc.chNext=='#')))
sc.SetState(SCE_TCL_COMMENT_BOX);
lineState = LS_DEFAULT;
}
if (subBrace) { // ${ overrides every thing even \ except }
if (sc.ch == '}') {
subBrace = false;
sc.SetState(SCE_TCL_OPERATOR);
sc.ForwardSetState(SCE_TCL_DEFAULT);
goto next;
}
else
sc.SetState(SCE_TCL_SUB_BRACE);
if (!sc.atLineEnd)
continue;
} else if (sc.state == SCE_TCL_DEFAULT || sc.state ==SCE_TCL_OPERATOR) {
expected &= isspacechar(static_cast<unsigned char>(sc.ch)) || IsAWordStart(sc.ch) || sc.ch =='#';
} else if (sc.state == SCE_TCL_SUBSTITUTION) {
switch(sc.ch) {
case '(':
subParen=true;
sc.SetState(SCE_TCL_OPERATOR);
sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
continue;
case ')':
sc.SetState(SCE_TCL_OPERATOR);
subParen=false;
continue;
case '$':
continue;
case ',':
sc.SetState(SCE_TCL_OPERATOR);
if (subParen)
sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
continue;
default :
// maybe spaces should be allowed ???
if (!IsAWordChar(sc.ch)) { // probably the code is wrong
sc.SetState(SCE_TCL_DEFAULT);
subParen = 0;
}
break;
}
} else if (isComment(sc.state)) {
} else if (!IsAWordChar(sc.ch)) {
if ((sc.state == SCE_TCL_IDENTIFIER && expected) || sc.state == SCE_TCL_MODIFIER) {
char w[100];
char *s=w;
sc.GetCurrent(w, sizeof(w));
if (w[strlen(w)-1]=='\r')
w[strlen(w)-1]=0;
while(*s == ':') // ignore leading : like in ::set a 10
++s;
bool quote = sc.state == SCE_TCL_IN_QUOTE;
if (commentLevel || expected) {
if (keywords.InList(s)) {
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD4);
} else if (sc.GetRelative(-static_cast<int>(strlen(s))-1) == '{' &&
keywords5.InList(s) && sc.ch == '}') { // {keyword} exactly no spaces
sc.ChangeState(SCE_TCL_EXPAND);
}
if (keywords6.InList(s)) {
sc.ChangeState(SCE_TCL_WORD5);
} else if (keywords7.InList(s)) {
sc.ChangeState(SCE_TCL_WORD6);
} else if (keywords8.InList(s)) {
sc.ChangeState(SCE_TCL_WORD7);
} else if (keywords9.InList(s)) {
sc.ChangeState(SCE_TCL_WORD8);
}
}
expected = false;
sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT);
} else if (sc.state == SCE_TCL_MODIFIER || sc.state == SCE_TCL_IDENTIFIER) {
sc.SetState(SCE_TCL_DEFAULT);
}
}
if (atEnd)
break;
if (sc.atLineEnd) {
lineState = LS_DEFAULT;
currentLine = styler.GetLine(sc.currentPos);
if (foldComment && sc.state!=SCE_TCL_COMMENT && isComment(sc.state)) {
if (currentLevel == 0) {
++currentLevel;
commentLevel = true;
}
} else {
if (visibleChars && commentLevel) {
--currentLevel;
--previousLevel;
commentLevel = false;
}
}
int flag = 0;
if (!visibleChars)
flag = SC_FOLDLEVELWHITEFLAG;
if (currentLevel > previousLevel)
flag = SC_FOLDLEVELHEADERFLAG;
styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16));
// Update the line state, so it can be seen by next line
if (sc.state == SCE_TCL_IN_QUOTE)
lineState = LS_OPEN_DOUBLE_QUOTE;
else {
if (prevSlash) {
if (isComment(sc.state))
lineState = LS_OPEN_COMMENT;
} else if (sc.state == SCE_TCL_COMMENT_BOX)
lineState = LS_COMMENT_BOX;
}
styler.SetLineState(currentLine,
(subBrace ? LS_BRACE_ONLY : 0) |
(expected ? LS_COMMAND_EXPECTED : 0) | lineState);
if (lineState == LS_COMMENT_BOX)
sc.ForwardSetState(SCE_TCL_COMMENT_BOX);
else if (lineState == LS_OPEN_DOUBLE_QUOTE)
sc.ForwardSetState(SCE_TCL_IN_QUOTE);
else
sc.ForwardSetState(SCE_TCL_DEFAULT);
prevSlash = false;
previousLevel = currentLevel;
goto next;
}
if (prevSlash) {
prevSlash = false;
if (sc.ch == '#' && IsANumberChar(sc.chNext))
sc.ForwardSetState(SCE_TCL_NUMBER);
continue;
}
prevSlash = sc.ch == '\\';
if (isComment(sc.state))
continue;
if (sc.atLineStart) {
visibleChars = false;
if (sc.state!=SCE_TCL_IN_QUOTE && !isComment(sc.state))
{
sc.SetState(SCE_TCL_DEFAULT);
expected = IsAWordStart(sc.ch)|| isspacechar(static_cast<unsigned char>(sc.ch));
}
}
switch (sc.state) {
case SCE_TCL_NUMBER:
if (!IsANumberChar(sc.ch))
sc.SetState(SCE_TCL_DEFAULT);
break;
case SCE_TCL_IN_QUOTE:
if (sc.ch == '"') {
sc.ForwardSetState(SCE_TCL_DEFAULT);
visibleChars = true; // necessary if a " is the first and only character on a line
goto next;
} else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') {
sc.SetState(SCE_TCL_OPERATOR);
expected = sc.ch == '[';
sc.ForwardSetState(SCE_TCL_IN_QUOTE);
goto next;
}
continue;
case SCE_TCL_OPERATOR:
sc.SetState(SCE_TCL_DEFAULT);
break;
}
if (sc.ch == '#') {
if (visibleChars) {
if (sc.state != SCE_TCL_IN_QUOTE && expected)
sc.SetState(SCE_TCL_COMMENT);
} else {
sc.SetState(SCE_TCL_COMMENTLINE);
if (sc.chNext == '~')
sc.SetState(SCE_TCL_BLOCK_COMMENT);
if (sc.atLineStart && (sc.chNext == '#' || sc.chNext == '-'))
sc.SetState(SCE_TCL_COMMENT_BOX);
}
}
if (!isspacechar(static_cast<unsigned char>(sc.ch))) {
visibleChars = true;
}
if (sc.ch == '\\') {
prevSlash = true;
continue;
}
// Determine if a new state should be entered.
if (sc.state == SCE_TCL_DEFAULT) {
if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_TCL_IDENTIFIER);
} else if (IsADigit(sc.ch) && !IsAWordChar(sc.chPrev)) {
sc.SetState(SCE_TCL_NUMBER);
} else {
switch (sc.ch) {
case '\"':
sc.SetState(SCE_TCL_IN_QUOTE);
break;
case '{':
sc.SetState(SCE_TCL_OPERATOR);
expected = true;
++currentLevel;
break;
case '}':
sc.SetState(SCE_TCL_OPERATOR);
--currentLevel;
break;
case '[':
expected = true;
case ']':
case '(':
case ')':
sc.SetState(SCE_TCL_OPERATOR);
break;
case ';':
expected = true;
break;
case '$':
subParen = 0;
if (sc.chNext != '{') {
sc.SetState(SCE_TCL_SUBSTITUTION);
}
else {
sc.SetState(SCE_TCL_OPERATOR); // $
sc.Forward(); // {
sc.ForwardSetState(SCE_TCL_SUB_BRACE);
subBrace = true;
}
break;
case '#':
if ((isspacechar(static_cast<unsigned char>(sc.chPrev))||
isoperator(static_cast<char>(sc.chPrev))) && IsADigit(sc.chNext,0x10))
sc.SetState(SCE_TCL_NUMBER);
break;
case '-':
sc.SetState(IsADigit(sc.chNext)? SCE_TCL_NUMBER: SCE_TCL_MODIFIER);
break;
default:
if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_TCL_OPERATOR);
}
}
}
}
}
sc.Complete();
}
static const char * const tclWordListDesc[] = {
"TCL Keywords",
"TK Keywords",
"iTCL Keywords",
"tkCommands",
"expand"
"user1",
"user2",
"user3",
"user4",
0
};
// this code supports folding in the colourizer
LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc);

View File

@@ -15,11 +15,13 @@ public:
int markType;
ColourPair fore;
ColourPair back;
int alpha;
XPM *pxpm;
LineMarker() {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
}
LineMarker(const LineMarker &) {
@@ -27,6 +29,7 @@ public:
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
}
~LineMarker() {
@@ -37,6 +40,7 @@ public:
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
delete pxpm;
pxpm = NULL;
return *this;

View File

@@ -15,7 +15,7 @@
* Removed all use of register.
* Converted to modern function prototypes.
* Put all global/static variables into an object so this code can be
* used from multiple threads etc.
* used from multiple threads, etc.
*
* These routines are the PUBLIC DOMAIN equivalents of regex
* routines as found in 4.nBSD UN*X, with minor extensions.
@@ -32,62 +32,60 @@
* Interfaces:
* RESearch::Compile: compile a regular expression into a NFA.
*
* char *RESearch::Compile(s)
* char *s;
* const char *RESearch::Compile(const char *pat, int length,
* bool caseSensitive, bool posix)
*
* Returns a short error string if they fail.
*
* RESearch::Execute: execute the NFA to match a pattern.
*
* int RESearch::Execute(s)
* char *s;
*
* RESearch::ModifyWord change RESearch::Execute's understanding of what a "word"
* looks like (for \< and \>) by adding into the
* hidden word-syntax table.
*
* void RESearch::ModifyWord(s)
* char *s;
* int RESearch::Execute(characterIndexer &ci, int lp, int endp)
*
* RESearch::Substitute: substitute the matched portions in a new string.
*
* int RESearch::Substitute(src, dst)
* char *src;
* char *dst;
* int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst)
*
* re_fail: failure routine for RESearch::Execute.
* re_fail: failure routine for RESearch::Execute. (no longer used)
*
* void re_fail(msg, op)
* char *msg;
* char op;
* void re_fail(char *msg, char op)
*
* Regular Expressions:
*
* [1] char matches itself, unless it is a special
* character (metachar): . \ [ ] * + ^ $
* and ( ) if posix option.
*
* [2] . matches any character.
*
* [3] \ matches the character following it, except
* when followed by a left or right round bracket,
* a digit 1 to 9 or a left or right angle bracket.
* (see [7], [8] and [9])
* [3] \ matches the character following it, except:
* - \a, \b, \f, \n, \t, \v match the
* corresponding C escape char;
* - if not in posix mode, when followed by a
* left or right round bracket (see [7]);
* - when followed by a digit 1 to 9 (see [8]);
* - when followed by a left or right angle bracket
* (see [9]).
* It is used as an escape character for all
* other meta-characters, and itself. When used
* in a set ([4]), it is treated as an ordinary
* character.
* character (except for escape chars).
*
* [4] [set] matches one of the characters in the set.
* If the first character in the set is "^",
* it matches a character NOT in the set, i.e.
* complements the set. A shorthand S-E is
* used to specify a set of characters S upto
* complements the set. A shorthand S-E (start-end)
* is used to specify a set of characters S upto
* E, inclusive. The special characters "]" and
* "-" have no special meaning if they appear
* as the first chars in the set.
* as the first chars in the set. To include both,
* put - first: [-]A-Z]:
* [-]|] matches these 2 chars,
* []-|] matches from ] to | chars.
* examples: match:
*
* [a-z] any lowercase alpha
*
* [^]-] any char except ] and -
* [^-]] any char except - and ]
*
* [^A-Z] any char except uppercase
* alpha
@@ -101,10 +99,10 @@
* [6] + same as [5], except it matches one or more.
*
* [7] a regular expression in the form [1] to [10], enclosed
* as \(form\) matches what form matches. The enclosure
* creates a set of tags, used for [8] and for
* pattern substution. The tagged forms are numbered
* starting from 1.
* as \(form\) (or (form) with posix flag) matches what
* form matches. The enclosure creates a set of tags,
* used for [8] and for pattern substitution.
* The tagged forms are numbered starting from 1.
*
* [8] a \ followed by a digit 1 to 9 matches whatever a
* previously tagged regular expression ([7]) matched.
@@ -147,8 +145,8 @@
*
* This implementation uses a bit-set representation for character
* classes for speed and compactness. Each character is represented
* by one bit in a 128-bit block. Thus, CCL always takes a
* constant 16 bytes in the internal nfa, and RESearch::Execute does a single
* by one bit in a 256-bit block. Thus, CCL always takes a
* constant 32 bytes in the internal nfa, and RESearch::Execute does a single
* bit comparison to locate the character in the set.
*
* Examples:
@@ -174,8 +172,14 @@
* matches: foo-foo fo-fo fob-fob foobar-foobar ...
*/
#include "CharClassify.h"
#include "RESearch.h"
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4514)
#endif
#define OKP 1
#define NOP 0
@@ -200,13 +204,19 @@
#define BLKIND 0370
#define BITIND 07
#define ASCIIB 0177
const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
#define badpat(x) (*nfa = END, x)
RESearch::RESearch() {
/*
* Character classification table for word boundary operators BOW
* and EOW is passed in by the creator of this object (Scintilla
* Document). The Document default state is that word chars are:
* 0-9,a-z, A-Z and _
*/
RESearch::RESearch(CharClassify *charClassTable) {
charClass = charClassTable;
Init();
}
@@ -285,8 +295,8 @@ const char escapeValue(char ch) {
const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
char *mp=nfa; /* nfa pointer */
char *lp; /* saved pointer.. */
char *sp=nfa; /* another one.. */
char *lp; /* saved pointer */
char *sp=nfa; /* another one */
char *mpMax = mp + MAXNFA - BITBLK - 10;
int tagi = 0; /* tag stack index */
@@ -310,11 +320,11 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
lp = mp;
switch(*p) {
case '.': /* match any char.. */
case '.': /* match any char */
*mp++ = ANY;
break;
case '^': /* match beginning.. */
case '^': /* match beginning */
if (p == pat)
*mp++ = BOL;
else {
@@ -323,7 +333,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
}
break;
case '$': /* match endofline.. */
case '$': /* match endofline */
if (!*(p+1))
*mp++ = EOL;
else {
@@ -332,7 +342,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
}
break;
case '[': /* match char class..*/
case '[': /* match char class */
*mp++ = CCL;
i++;
@@ -384,12 +394,12 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
break;
case '*': /* match 0 or more.. */
case '+': /* match 1 or more.. */
case '*': /* match 0 or more... */
case '+': /* match 1 or more... */
if (p == pat)
return badpat("Empty closure");
lp = sp; /* previous opcode */
if (*lp == CLO) /* equivalence.. */
if (*lp == CLO) /* equivalence... */
break;
switch(*lp) {
@@ -417,7 +427,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
mp = sp;
break;
case '\\': /* tags, backrefs .. */
case '\\': /* tags, backrefs... */
i++;
switch(*++p) {
@@ -619,53 +629,25 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
* At the end of a successful match, bopat[n] and eopat[n]
* are set to the beginning and end of subpatterns matched
* by tagged expressions (n = 1 to 9).
*
*/
extern void re_fail(char *,char);
/*
* character classification table for word boundary operators BOW
* and EOW. the reason for not using ctype macros is that we can
* let the user add into our own table. see RESearch::ModifyWord. This table
* is not in the bitset form, since we may wish to extend it in the
* future for other character classifications.
*
* TRUE for 0-9 A-Z a-z _
*/
static char chrtyp[MAXCHR] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 0
};
#define inascii(x) (0177&(x))
#define iswordc(x) chrtyp[inascii(x)]
#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
/*
* skip values for CLO XXX to skip past the closure
*/
#define ANYSKIP 2 /* [CLO] ANY END ... */
#define CHRSKIP 3 /* [CLO] CHR chr END ... */
#define CCLSKIP 34 /* [CLO] CCL 32bytes END ... */
#define ANYSKIP 2 /* [CLO] ANY END */
#define CHRSKIP 3 /* [CLO] CHR chr END */
#define CCLSKIP 34 /* [CLO] CCL 32 bytes END */
int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
int op, c, n;
int e; /* extra pointer for CLO */
int bp; /* beginning of subpat.. */
int ep; /* ending of subpat.. */
int bp; /* beginning of subpat... */
int ep; /* ending of subpat... */
int are; /* to save the line ptr. */
while ((op = *ap++) != END)
@@ -756,35 +738,6 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
return lp;
}
/*
* RESearch::ModifyWord:
* add new characters into the word table to change RESearch::Execute's
* understanding of what a word should look like. Note that we
* only accept additions into the word definition.
*
* If the string parameter is 0 or null string, the table is
* reset back to the default containing A-Z a-z 0-9 _. [We use
* the compact bitset representation for the default table]
*/
static char deftab[16] = {
0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',
'\376', '\377', '\377', 007
};
void RESearch::ModifyWord(char *s) {
int i;
if (!s || !*s) {
for (i = 0; i < MAXCHR; i++)
if (!isinset(deftab,i))
iswordc(i) = 0;
}
else
while(*s)
iswordc(*s++) = 1;
}
/*
* RESearch::Substitute:
* substitute the matched portions of the src in dst.

View File

@@ -27,16 +27,11 @@ public:
class RESearch {
public:
RESearch();
RESearch(CharClassify *charClassTable);
~RESearch();
void Init();
void Clear();
bool GrabMatches(CharacterIndexer &ci);
void ChSet(char c);
void ChSetWithCase(char c, bool caseSensitive);
const char *Compile(const char *pat, int length, bool caseSensitive, bool posix);
int Execute(CharacterIndexer &ci, int lp, int endp);
void ModifyWord(char *s);
int Substitute(CharacterIndexer &ci, char *src, char *dst);
enum {MAXTAG=10};
@@ -48,15 +43,23 @@ public:
char *pat[MAXTAG];
private:
void Init();
void Clear();
void ChSet(char c);
void ChSetWithCase(char c, bool caseSensitive);
int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
int bol;
int tagstk[MAXTAG]; /* subpat tag stack..*/
char nfa[MAXNFA]; /* automaton.. */
int tagstk[MAXTAG]; /* subpat tag stack */
char nfa[MAXNFA]; /* automaton */
int sta;
char bittab[BITBLK]; /* bit table for CCL */
/* pre-set bits... */
char bittab[BITBLK]; /* bit table for CCL pre-set bits */
int failure;
CharClassify *charClass;
bool iswordc(unsigned char x) {
return charClass->IsWord(x);
}
};
#endif

View File

@@ -31,6 +31,7 @@
#include "Style.h"
#include "ViewStyle.h"
#include "AutoComplete.h"
#include "CharClassify.h"
#include "Document.h"
#include "Editor.h"
#include "ScintillaBase.h"
@@ -368,12 +369,19 @@ int ScintillaBase::AutoCompleteGetCurrent() {
void ScintillaBase::CallTipShow(Point pt, const char *defn) {
AutoCompleteCancel();
pt.y += vs.lineHeight;
// If container knows about STYLE_CALLTIP then use it in place of the
// STYLE_DEFAULT for the face name, size and character set. Also use it
// for the foreground and background colour.
int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
if (ct.UseStyleCallTip()) {
ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
}
PRectangle rc = ct.CallTipStart(currentPos, pt,
defn,
vs.styles[STYLE_DEFAULT].fontName,
vs.styles[STYLE_DEFAULT].sizeZoomed,
vs.styles[ctStyle].fontName,
vs.styles[ctStyle].sizeZoomed,
CodePage(),
vs.styles[STYLE_DEFAULT].characterSet,
vs.styles[ctStyle].characterSet,
wMain);
// If the call-tip window would be out of the client
// space, adjust so it displays above the text.
@@ -461,7 +469,7 @@ void ScintillaBase::Colourise(int start, int end) {
int styleStart = 0;
if (start > 0)
styleStart = styler.StyleAt(start - 1);
styleStart = styler.StyleAt(start - 1) & pdoc->stylingBitsMask;
styler.SetCodePage(pdoc->dbcsCodePage);
if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available
@@ -624,11 +632,13 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
case SCI_CALLTIPSETBACK:
ct.colourBG = ColourDesired(wParam);
vs.styles[STYLE_CALLTIP].fore = ct.colourBG;
InvalidateStyleRedraw();
break;
case SCI_CALLTIPSETFORE:
ct.colourUnSel = ColourDesired(wParam);
vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
InvalidateStyleRedraw();
break;
@@ -637,6 +647,11 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
InvalidateStyleRedraw();
break;
case SCI_CALLTIPUSESTYLE:
ct.SetTabSize((int)wParam);
InvalidateStyleRedraw();
break;
case SCI_USEPOPUP:
displayPopupMenu = wParam != 0;
break;

View File

@@ -17,7 +17,7 @@
#include "ViewStyle.h"
MarginStyle::MarginStyle() :
symbol(false), width(16), mask(0xffffffff), sensitive(false) {
style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) {
}
// A list of the fontnames - avoids wasting space in each style
@@ -73,6 +73,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
selbackground2.desired = source.selbackground2.desired;
selAlpha = source.selAlpha;
foldmarginColourSet = source.foldmarginColourSet;
foldmarginColour.desired = source.foldmarginColour.desired;
@@ -95,6 +96,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
caretcolour.desired = source.caretcolour.desired;
showCaretLineBackground = source.showCaretLineBackground;
caretLineBackground.desired = source.caretLineBackground.desired;
caretLineAlpha = source.caretLineAlpha;
edgecolour.desired = source.edgecolour.desired;
edgeState = source.edgeState;
caretWidth = source.caretWidth;
@@ -140,6 +142,7 @@ void ViewStyle::Init() {
selbackset = true;
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
selAlpha = SC_ALPHA_NOALPHA;
foldmarginColourSet = false;
foldmarginColour.desired = ColourDesired(0xff, 0, 0);
@@ -157,6 +160,7 @@ void ViewStyle::Init() {
caretcolour.desired = ColourDesired(0, 0, 0);
showCaretLineBackground = false;
caretLineBackground.desired = ColourDesired(0xff, 0xff, 0);
caretLineAlpha = SC_ALPHA_NOALPHA;
edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
edgeState = EDGE_NONE;
caretWidth = 1;
@@ -171,13 +175,13 @@ void ViewStyle::Init() {
leftMarginWidth = 1;
rightMarginWidth = 1;
ms[0].symbol = false;
ms[0].style = SC_MARGIN_NUMBER;
ms[0].width = 0;
ms[0].mask = 0;
ms[1].symbol = true;
ms[1].style = SC_MARGIN_SYMBOL;
ms[1].width = 16;
ms[1].mask = ~SC_MASK_FOLDERS;
ms[2].symbol = true;
ms[2].style = SC_MARGIN_SYMBOL;
ms[2].width = 0;
ms[2].mask = 0;
fixedColumnWidth = leftMarginWidth;
@@ -185,7 +189,7 @@ void ViewStyle::Init() {
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
symbolMargin = symbolMargin || ms[margin].symbol;
symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
@@ -256,7 +260,7 @@ void ViewStyle::Refresh(Surface &surface) {
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
symbolMargin = symbolMargin || ms[margin].symbol;
symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
@@ -278,6 +282,10 @@ void ViewStyle::ClearStyles() {
}
}
styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
// Set call tip fore/back to match the values previously set for call tips
styles[STYLE_CALLTIP].back.desired = ColourDesired(0xff, 0xff, 0xff);
styles[STYLE_CALLTIP].fore.desired = ColourDesired(0x80, 0x80, 0x80);
}
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {

View File

@@ -12,7 +12,7 @@
*/
class MarginStyle {
public:
bool symbol;
int style;
int width;
int mask;
bool sensitive;
@@ -53,6 +53,7 @@ public:
bool selbackset;
ColourPair selbackground;
ColourPair selbackground2;
int selAlpha;
bool whitespaceForegroundSet;
ColourPair whitespaceForeground;
bool whitespaceBackgroundSet;
@@ -70,7 +71,7 @@ public:
bool hotspotUnderline;
bool hotspotSingleLine;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
enum { margins=3 };
enum { margins=5 };
int leftMarginWidth; ///< Spacing margin on left of text
int rightMarginWidth; ///< Spacing margin on left of text
bool symbolMargin;
@@ -85,6 +86,7 @@ public:
ColourPair caretcolour;
bool showCaretLineBackground;
ColourPair caretLineBackground;
int caretLineAlpha;
ColourPair edgecolour;
int edgeState;
int caretWidth;

View File

@@ -535,6 +535,11 @@ void wxStyledTextCtrl::MarkerAddSet(int line, int set) {
SendMsg(2466, line, set);
}
// Set the alpha used for a marker that is drawn in the text area, not the margin.
void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber, int alpha) {
SendMsg(2476, markerNumber, alpha);
}
// Set a margin to be either numeric or symbolic.
void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
SendMsg(2240, margin, marginType);
@@ -645,6 +650,16 @@ void wxStyledTextCtrl::SetSelBackground(bool useSetting, const wxColour& back) {
SendMsg(2068, useSetting, wxColourAsLong(back));
}
// Get the alpha of the selection.
int wxStyledTextCtrl::GetSelAlpha() {
return SendMsg(2477, 0, 0);
}
// Set the alpha of the selection.
void wxStyledTextCtrl::SetSelAlpha(int alpha) {
SendMsg(2478, alpha, 0);
}
// Set the foreground colour of the caret.
void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
SendMsg(2069, wxColourAsLong(fore), 0);
@@ -1445,6 +1460,11 @@ void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour& fore) {
SendMsg(2207, wxColourAsLong(fore), 0);
}
// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
void wxStyledTextCtrl::CallTipUseStyle(int tabSize) {
SendMsg(2212, tabSize, 0);
}
// Find the display line of a document line taking hidden lines into account.
int wxStyledTextCtrl::VisibleFromDocLine(int line) {
return SendMsg(2220, line, 0);
@@ -2481,6 +2501,16 @@ void wxStyledTextCtrl::SelectionDuplicate() {
SendMsg(2469, 0, 0);
}
// Set background alpha of the caret line.
void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha) {
SendMsg(2470, alpha, 0);
}
// Get the background alpha of the caret line.
int wxStyledTextCtrl::GetCaretLineBackAlpha() {
return SendMsg(2471, 0, 0);
}
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord() {
SendMsg(3001, 0, 0);

View File

@@ -120,15 +120,18 @@
#define wxSTC_MASK_FOLDERS 0xFE000000
#define wxSTC_MARGIN_SYMBOL 0
#define wxSTC_MARGIN_NUMBER 1
#define wxSTC_MARGIN_BACK 2
#define wxSTC_MARGIN_FORE 3
// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
// Styles 38 and 39 are for future use.
// Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
// Style 39 is for future use.
#define wxSTC_STYLE_DEFAULT 32
#define wxSTC_STYLE_LINENUMBER 33
#define wxSTC_STYLE_BRACELIGHT 34
#define wxSTC_STYLE_BRACEBAD 35
#define wxSTC_STYLE_CONTROLCHAR 36
#define wxSTC_STYLE_INDENTGUIDE 37
#define wxSTC_STYLE_CALLTIP 38
#define wxSTC_STYLE_LASTPREDEFINED 39
#define wxSTC_STYLE_MAX 127
@@ -166,6 +169,7 @@
#define wxSTC_INDIC_STRIKE 4
#define wxSTC_INDIC_HIDDEN 5
#define wxSTC_INDIC_BOX 6
#define wxSTC_INDIC_ROUNDBOX 7
#define wxSTC_INDIC0_MASK 0x20
#define wxSTC_INDIC1_MASK 0x40
#define wxSTC_INDIC2_MASK 0x80
@@ -258,6 +262,9 @@
#define wxSTC_SEL_STREAM 0
#define wxSTC_SEL_RECTANGLE 1
#define wxSTC_SEL_LINES 2
#define wxSTC_ALPHA_TRANSPARENT 0
#define wxSTC_ALPHA_OPAQUE 255
#define wxSTC_ALPHA_NOALPHA 256
// Maximum value of keywordSet parameter of SetKeyWords.
#define wxSTC_KEYWORDSET_MAX 8
@@ -381,10 +388,9 @@
#define wxSTC_LEX_FLAGSHIP 73
#define wxSTC_LEX_CSOUND 74
#define wxSTC_LEX_FREEBASIC 75
// These are deprecated, STC_LEX_HTML should be used instead.
#define wxSTC_LEX_ASP 29
#define wxSTC_LEX_PHP 30
#define wxSTC_LEX_INNOSETUP 76
#define wxSTC_LEX_OPAL 77
#define wxSTC_LEX_SPICE 78
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -430,6 +436,30 @@
#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
#define wxSTC_C_GLOBALCLASS 19
// Lexical states for SCLEX_TCL
#define wxSTC_TCL_DEFAULT 0
#define wxSTC_TCL_COMMENT 1
#define wxSTC_TCL_COMMENTLINE 2
#define wxSTC_TCL_NUMBER 3
#define wxSTC_TCL_WORD_IN_QUOTE 4
#define wxSTC_TCL_IN_QUOTE 5
#define wxSTC_TCL_OPERATOR 6
#define wxSTC_TCL_IDENTIFIER 7
#define wxSTC_TCL_SUBSTITUTION 8
#define wxSTC_TCL_SUB_BRACE 9
#define wxSTC_TCL_MODIFIER 10
#define wxSTC_TCL_EXPAND 11
#define wxSTC_TCL_WORD 12
#define wxSTC_TCL_WORD2 13
#define wxSTC_TCL_WORD3 14
#define wxSTC_TCL_WORD4 15
#define wxSTC_TCL_WORD5 16
#define wxSTC_TCL_WORD6 17
#define wxSTC_TCL_WORD7 18
#define wxSTC_TCL_WORD8 19
#define wxSTC_TCL_COMMENT_BOX 20
#define wxSTC_TCL_BLOCK_COMMENT 21
// Lexical states for SCLEX_HTML, SCLEX_XML
#define wxSTC_H_DEFAULT 0
#define wxSTC_H_TAG 1
@@ -664,6 +694,7 @@
#define wxSTC_PROPS_SECTION 2
#define wxSTC_PROPS_ASSIGNMENT 3
#define wxSTC_PROPS_DEFVAL 4
#define wxSTC_PROPS_KEY 5
// Lexical states for SCLEX_LATEX
#define wxSTC_L_DEFAULT 0
@@ -1208,6 +1239,7 @@
#define wxSTC_AU3_SPECIAL 12
#define wxSTC_AU3_EXPAND 13
#define wxSTC_AU3_COMOBJ 14
#define wxSTC_AU3_UDF 15
// Lexical states for SCLEX_APDL
#define wxSTC_APDL_DEFAULT 0
@@ -1446,6 +1478,44 @@
#define wxSTC_CSOUND_GLOBAL_VAR 14
#define wxSTC_CSOUND_STRINGEOL 15
// Lexical states for SCLEX_INNOSETUP
#define wxSTC_INNO_DEFAULT 0
#define wxSTC_INNO_COMMENT 1
#define wxSTC_INNO_KEYWORD 2
#define wxSTC_INNO_PARAMETER 3
#define wxSTC_INNO_SECTION 4
#define wxSTC_INNO_PREPROC 5
#define wxSTC_INNO_PREPROC_INLINE 6
#define wxSTC_INNO_COMMENT_PASCAL 7
#define wxSTC_INNO_KEYWORD_PASCAL 8
#define wxSTC_INNO_KEYWORD_USER 9
#define wxSTC_INNO_STRING_DOUBLE 10
#define wxSTC_INNO_STRING_SINGLE 11
#define wxSTC_INNO_IDENTIFIER 12
// Lexical states for SCLEX_OPAL
#define wxSTC_OPAL_SPACE 0
#define wxSTC_OPAL_COMMENT_BLOCK 1
#define wxSTC_OPAL_COMMENT_LINE 2
#define wxSTC_OPAL_INTEGER 3
#define wxSTC_OPAL_KEYWORD 4
#define wxSTC_OPAL_SORT 5
#define wxSTC_OPAL_STRING 6
#define wxSTC_OPAL_PAR 7
#define wxSTC_OPAL_BOOL_CONST 8
#define wxSTC_OPAL_DEFAULT 32
// Lexical states for SCLEX_SPICE
#define wxSTC_SPICE_DEFAULT 0
#define wxSTC_SPICE_IDENTIFIER 1
#define wxSTC_SPICE_KEYWORD 2
#define wxSTC_SPICE_KEYWORD2 3
#define wxSTC_SPICE_KEYWORD3 4
#define wxSTC_SPICE_NUMBER 5
#define wxSTC_SPICE_DELIMITER 6
#define wxSTC_SPICE_VALUE 7
#define wxSTC_SPICE_COMMENTLINE 8
//-----------------------------------------
// Commands that can be bound to keystrokes
@@ -1935,6 +2005,9 @@ public:
// Add a set of markers to a line.
void MarkerAddSet(int line, int set);
// Set the alpha used for a marker that is drawn in the text area, not the margin.
void MarkerSetAlpha(int markerNumber, int alpha);
// Set a margin to be either numeric or symbolic.
void SetMarginType(int margin, int marginType);
@@ -2001,6 +2074,12 @@ public:
// Set the background colour of the selection and whether to use this setting.
void SetSelBackground(bool useSetting, const wxColour& back);
// Get the alpha of the selection.
int GetSelAlpha();
// Set the alpha of the selection.
void SetSelAlpha(int alpha);
// Set the foreground colour of the caret.
void SetCaretForeground(const wxColour& fore);
@@ -2440,6 +2519,9 @@ public:
// Set the foreground colour for the highlighted part of the call tip.
void CallTipSetForegroundHighlight(const wxColour& fore);
// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
void CallTipUseStyle(int tabSize);
// Find the display line of a document line taking hidden lines into account.
int VisibleFromDocLine(int line);
@@ -3068,6 +3150,12 @@ public:
// Duplicate the selection. If selection empty duplicate the line containing the caret.
void SelectionDuplicate();
// Set background alpha of the caret line.
void SetCaretLineBackAlpha(int alpha);
// Get the background alpha of the caret line.
int GetCaretLineBackAlpha();
// Start notifying the container of all key presses and commands.
void StartRecord();

View File

@@ -66,6 +66,7 @@ STCDLL_OBJECTS = \
stcdll_AutoComplete.o \
stcdll_CallTip.o \
stcdll_CellBuffer.o \
stcdll_CharClassify.o \
stcdll_ContractionState.o \
stcdll_Document.o \
stcdll_DocumentAccessor.o \
@@ -100,6 +101,7 @@ STCDLL_OBJECTS = \
stcdll_LexGui4Cli.o \
stcdll_LexHTML.o \
stcdll_LexHaskell.o \
stcdll_LexInno.o \
stcdll_LexKix.o \
stcdll_LexLisp.o \
stcdll_LexLout.o \
@@ -110,6 +112,7 @@ STCDLL_OBJECTS = \
stcdll_LexMatlab.o \
stcdll_LexMetapost.o \
stcdll_LexNsis.o \
stcdll_LexOpal.o \
stcdll_LexOthers.o \
stcdll_LexPB.o \
stcdll_LexPOV.o \
@@ -124,6 +127,8 @@ STCDLL_OBJECTS = \
stcdll_LexTADS3.o \
stcdll_LexScriptol.o \
stcdll_LexSpecman.o \
stcdll_LexSpice.o \
stcdll_LexTCL.o \
stcdll_LexTeX.o \
stcdll_LexVB.o \
stcdll_LexVHDL.o \
@@ -151,6 +156,7 @@ STCLIB_OBJECTS = \
stclib_AutoComplete.o \
stclib_CallTip.o \
stclib_CellBuffer.o \
stclib_CharClassify.o \
stclib_ContractionState.o \
stclib_Document.o \
stclib_DocumentAccessor.o \
@@ -185,6 +191,7 @@ STCLIB_OBJECTS = \
stclib_LexGui4Cli.o \
stclib_LexHTML.o \
stclib_LexHaskell.o \
stclib_LexInno.o \
stclib_LexKix.o \
stclib_LexLisp.o \
stclib_LexLout.o \
@@ -195,6 +202,7 @@ STCLIB_OBJECTS = \
stclib_LexMatlab.o \
stclib_LexMetapost.o \
stclib_LexNsis.o \
stclib_LexOpal.o \
stclib_LexOthers.o \
stclib_LexPB.o \
stclib_LexPOV.o \
@@ -209,6 +217,8 @@ STCLIB_OBJECTS = \
stclib_LexTADS3.o \
stclib_LexScriptol.o \
stclib_LexSpecman.o \
stclib_LexSpice.o \
stclib_LexTCL.o \
stclib_LexTeX.o \
stclib_LexVB.o \
stclib_LexVHDL.o \
@@ -415,6 +425,9 @@ stcdll_CallTip.o: $(srcdir)/scintilla/src/CallTip.cxx
stcdll_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/CellBuffer.cxx
stcdll_CharClassify.o: $(srcdir)/scintilla/src/CharClassify.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/CharClassify.cxx
stcdll_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/ContractionState.cxx
@@ -517,6 +530,9 @@ stcdll_LexHTML.o: $(srcdir)/scintilla/src/LexHTML.cxx
stcdll_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
stcdll_LexInno.o: $(srcdir)/scintilla/src/LexInno.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexInno.cxx
stcdll_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
@@ -547,6 +563,9 @@ stcdll_LexMetapost.o: $(srcdir)/scintilla/src/LexMetapost.cxx
stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexNsis.cxx
stcdll_LexOpal.o: $(srcdir)/scintilla/src/LexOpal.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexOpal.cxx
stcdll_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexOthers.cxx
@@ -589,6 +608,12 @@ stcdll_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
stcdll_LexSpecman.o: $(srcdir)/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSpecman.cxx
stcdll_LexSpice.o: $(srcdir)/scintilla/src/LexSpice.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSpice.cxx
stcdll_LexTCL.o: $(srcdir)/scintilla/src/LexTCL.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTCL.cxx
stcdll_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTeX.cxx
@@ -652,6 +677,9 @@ stclib_CallTip.o: $(srcdir)/scintilla/src/CallTip.cxx
stclib_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/CellBuffer.cxx
stclib_CharClassify.o: $(srcdir)/scintilla/src/CharClassify.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/CharClassify.cxx
stclib_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/ContractionState.cxx
@@ -754,6 +782,9 @@ stclib_LexHTML.o: $(srcdir)/scintilla/src/LexHTML.cxx
stclib_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
stclib_LexInno.o: $(srcdir)/scintilla/src/LexInno.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexInno.cxx
stclib_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
@@ -784,6 +815,9 @@ stclib_LexMetapost.o: $(srcdir)/scintilla/src/LexMetapost.cxx
stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexNsis.cxx
stclib_LexOpal.o: $(srcdir)/scintilla/src/LexOpal.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexOpal.cxx
stclib_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexOthers.cxx
@@ -826,6 +860,12 @@ stclib_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
stclib_LexSpecman.o: $(srcdir)/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSpecman.cxx
stclib_LexSpice.o: $(srcdir)/scintilla/src/LexSpice.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSpice.cxx
stclib_LexTCL.o: $(srcdir)/scintilla/src/LexTCL.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTCL.cxx
stclib_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTeX.cxx

View File

@@ -47,14 +47,21 @@ wxColour wxColourFromCA(const ColourAllocated& ca) {
Palette::Palette() {
used = 0;
allowRealization = false;
size = 100;
entries = new ColourPair[size];
}
Palette::~Palette() {
Release();
delete [] entries;
entries = 0;
}
void Palette::Release() {
used = 0;
delete [] entries;
size = 100;
entries = new ColourPair[size];
}
// This method either adds a colour to the list of wanted colours (want==true)
@@ -67,11 +74,20 @@ void Palette::WantFind(ColourPair &cp, bool want) {
return;
}
if (used < numEntries) {
if (used >= size) {
int sizeNew = size * 2;
ColourPair *entriesNew = new ColourPair[sizeNew];
for (int j=0; j<size; j++) {
entriesNew[j] = entries[j];
}
delete []entries;
entries = entriesNew;
size = sizeNew;
}
entries[used].desired = cp.desired;
entries[used].allocated.Set(cp.desired.AsLong());
used++;
}
} else {
for (int i=0; i < used; i++) {
if (entries[i].desired == cp.desired) {
@@ -162,6 +178,8 @@ public:
virtual void FillRectangle(PRectangle rc, ColourAllocated back);
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern);
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags);
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource);
@@ -316,6 +334,14 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
}
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags) {
// ** TODO
RectangleDraw(rc, outline, fill);
}
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
PenColour(fore);
BrushColour(back);

View File

@@ -27,6 +27,7 @@
#include "Platform.h"
#include "Scintilla.h"
#include "CharClassify.h"
#include "XPM.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
@@ -48,7 +49,6 @@
#include "Editor.h"
#include "ScintillaBase.h"
//----------------------------------------------------------------------
#ifdef WXMAKINGDLL_STC

View File

@@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
The current version of the Scintilla code is 1.67
The current version of the Scintilla code is 1.70

View File

@@ -236,12 +236,15 @@ class Window; // Forward declaration for Palette
*/
class Palette {
int used;
enum {numEntries = 100};
ColourPair entries[numEntries];
int size;
ColourPair *entries;
#if PLAT_GTK
void *allocatedPalette; // GdkColor *
int allocatedLen;
#endif
// Private so Palette objects can not be copied
Palette(const Palette &) {}
Palette &operator=(const Palette &) { return *this; }
public:
#if PLAT_WIN
void *hpal;
@@ -319,6 +322,8 @@ public:
virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0;
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags)=0;
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;

View File

@@ -88,6 +88,9 @@
#define SCLEX_FLAGSHIP 73
#define SCLEX_CSOUND 74
#define SCLEX_FREEBASIC 75
#define SCLEX_INNOSETUP 76
#define SCLEX_OPAL 77
#define SCLEX_SPICE 78
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@@ -125,6 +128,28 @@
#define SCE_C_COMMENTDOCKEYWORD 17
#define SCE_C_COMMENTDOCKEYWORDERROR 18
#define SCE_C_GLOBALCLASS 19
#define SCE_TCL_DEFAULT 0
#define SCE_TCL_COMMENT 1
#define SCE_TCL_COMMENTLINE 2
#define SCE_TCL_NUMBER 3
#define SCE_TCL_WORD_IN_QUOTE 4
#define SCE_TCL_IN_QUOTE 5
#define SCE_TCL_OPERATOR 6
#define SCE_TCL_IDENTIFIER 7
#define SCE_TCL_SUBSTITUTION 8
#define SCE_TCL_SUB_BRACE 9
#define SCE_TCL_MODIFIER 10
#define SCE_TCL_EXPAND 11
#define SCE_TCL_WORD 12
#define SCE_TCL_WORD2 13
#define SCE_TCL_WORD3 14
#define SCE_TCL_WORD4 15
#define SCE_TCL_WORD5 16
#define SCE_TCL_WORD6 17
#define SCE_TCL_WORD7 18
#define SCE_TCL_WORD8 19
#define SCE_TCL_COMMENT_BOX 20
#define SCE_TCL_BLOCK_COMMENT 21
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
@@ -326,6 +351,7 @@
#define SCE_PROPS_SECTION 2
#define SCE_PROPS_ASSIGNMENT 3
#define SCE_PROPS_DEFVAL 4
#define SCE_PROPS_KEY 5
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
@@ -795,6 +821,7 @@
#define SCE_AU3_SPECIAL 12
#define SCE_AU3_EXPAND 13
#define SCE_AU3_COMOBJ 14
#define SCE_AU3_UDF 15
#define SCE_APDL_DEFAULT 0
#define SCE_APDL_COMMENT 1
#define SCE_APDL_COMMENTBLOCK 2
@@ -1008,6 +1035,38 @@
#define SCE_CSOUND_IRATE_VAR 13
#define SCE_CSOUND_GLOBAL_VAR 14
#define SCE_CSOUND_STRINGEOL 15
#define SCE_INNO_DEFAULT 0
#define SCE_INNO_COMMENT 1
#define SCE_INNO_KEYWORD 2
#define SCE_INNO_PARAMETER 3
#define SCE_INNO_SECTION 4
#define SCE_INNO_PREPROC 5
#define SCE_INNO_PREPROC_INLINE 6
#define SCE_INNO_COMMENT_PASCAL 7
#define SCE_INNO_KEYWORD_PASCAL 8
#define SCE_INNO_KEYWORD_USER 9
#define SCE_INNO_STRING_DOUBLE 10
#define SCE_INNO_STRING_SINGLE 11
#define SCE_INNO_IDENTIFIER 12
#define SCE_OPAL_SPACE 0
#define SCE_OPAL_COMMENT_BLOCK 1
#define SCE_OPAL_COMMENT_LINE 2
#define SCE_OPAL_INTEGER 3
#define SCE_OPAL_KEYWORD 4
#define SCE_OPAL_SORT 5
#define SCE_OPAL_STRING 6
#define SCE_OPAL_PAR 7
#define SCE_OPAL_BOOL_CONST 8
#define SCE_OPAL_DEFAULT 32
#define SCE_SPICE_DEFAULT 0
#define SCE_SPICE_IDENTIFIER 1
#define SCE_SPICE_KEYWORD 2
#define SCE_SPICE_KEYWORD2 3
#define SCE_SPICE_KEYWORD3 4
#define SCE_SPICE_NUMBER 5
#define SCE_SPICE_DELIMITER 6
#define SCE_SPICE_VALUE 7
#define SCE_SPICE_COMMENTLINE 8
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface

View File

@@ -138,8 +138,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_MARKERPREVIOUS 2048
#define SCI_MARKERDEFINEPIXMAP 2049
#define SCI_MARKERADDSET 2466
#define SCI_MARKERSETALPHA 2476
#define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1
#define SC_MARGIN_BACK 2
#define SC_MARGIN_FORE 3
#define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242
@@ -154,6 +157,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define STYLE_BRACEBAD 35
#define STYLE_CONTROLCHAR 36
#define STYLE_INDENTGUIDE 37
#define STYLE_CALLTIP 38
#define STYLE_LASTPREDEFINED 39
#define STYLE_MAX 127
#define SC_CHARSET_ANSI 0
@@ -195,6 +199,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_STYLESETHOTSPOT 2409
#define SCI_SETSELFORE 2067
#define SCI_SETSELBACK 2068
#define SCI_GETSELALPHA 2477
#define SCI_SETSELALPHA 2478
#define SCI_SETCARETFORE 2069
#define SCI_ASSIGNCMDKEY 2070
#define SCI_CLEARCMDKEY 2071
@@ -214,6 +220,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define INDIC_STRIKE 4
#define INDIC_HIDDEN 5
#define INDIC_BOX 6
#define INDIC_ROUNDBOX 7
#define INDIC0_MASK 0x20
#define INDIC1_MASK 0x40
#define INDIC2_MASK 0x80
@@ -358,6 +365,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CALLTIPSETBACK 2205
#define SCI_CALLTIPSETFORE 2206
#define SCI_CALLTIPSETFOREHLT 2207
#define SCI_CALLTIPUSESTYLE 2212
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SCI_WRAPCOUNT 2235
@@ -607,6 +615,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETPASTECONVERTENDINGS 2467
#define SCI_GETPASTECONVERTENDINGS 2468
#define SCI_SELECTIONDUPLICATE 2469
#define SC_ALPHA_TRANSPARENT 0
#define SC_ALPHA_OPAQUE 255
#define SC_ALPHA_NOALPHA 256
#define SCI_SETCARETLINEBACKALPHA 2470
#define SCI_GETCARETLINEBACKALPHA 2471
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001

View File

@@ -316,9 +316,14 @@ fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap)
# Add a set of markers to a line.
fun void MarkerAddSet=2466(int line, int set)
# Set the alpha used for a marker that is drawn in the text area, not the margin.
fun void MarkerSetAlpha=2476(int markerNumber, int alpha)
enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
val SC_MARGIN_BACK=2
val SC_MARGIN_FORE=3
# Set a margin to be either numeric or symbolic.
set void SetMarginTypeN=2240(int margin, int marginType)
@@ -344,8 +349,8 @@ set void SetMarginSensitiveN=2246(int margin, bool sensitive)
# Retrieve the mouse click sensitivity of a margin.
get bool GetMarginSensitiveN=2247(int margin,)
# Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
# Styles 38 and 39 are for future use.
# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
# Style 39 is for future use.
enu StylesCommon=STYLE_
val STYLE_DEFAULT=32
val STYLE_LINENUMBER=33
@@ -353,6 +358,7 @@ val STYLE_BRACELIGHT=34
val STYLE_BRACEBAD=35
val STYLE_CONTROLCHAR=36
val STYLE_INDENTGUIDE=37
val STYLE_CALLTIP=38
val STYLE_LASTPREDEFINED=39
val STYLE_MAX=127
@@ -430,6 +436,12 @@ fun void SetSelFore=2067(bool useSetting, colour fore)
# Set the background colour of the selection and whether to use this setting.
fun void SetSelBack=2068(bool useSetting, colour back)
# Get the alpha of the selection.
get int GetSelAlpha=2477(,)
# Set the alpha of the selection.
set void SetSelAlpha=2478(int alpha,)
# Set the foreground colour of the caret.
set void SetCaretFore=2069(colour fore,)
@@ -474,6 +486,7 @@ val INDIC_DIAGONAL=3
val INDIC_STRIKE=4
val INDIC_HIDDEN=5
val INDIC_BOX=6
val INDIC_ROUNDBOX=7
val INDIC0_MASK=0x20
val INDIC1_MASK=0x40
val INDIC2_MASK=0x80
@@ -919,6 +932,9 @@ set void CallTipSetFore=2206(colour fore,)
# Set the foreground colour for the highlighted part of the call tip.
set void CallTipSetForeHlt=2207(colour fore,)
# Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
set void CallTipUseStyle=2212(int tabSize,)
# Find the display line of a document line taking hidden lines into account.
fun int VisibleFromDocLine=2220(int line,)
@@ -1446,7 +1462,6 @@ get int GetXOffset=2398(,)
fun void ChooseCaretX=2399(,)
# Set the focus to this Scintilla widget.
# GTK+ Specific.
fun void GrabFocus=2400(,)
enu CaretPolicy = CARET_
@@ -1642,6 +1657,16 @@ get bool GetPasteConvertEndings=2468(,)
# Duplicate the selection. If selection empty duplicate the line containing the caret.
fun void SelectionDuplicate=2469(,)
val SC_ALPHA_TRANSPARENT=0
val SC_ALPHA_OPAQUE=255
val SC_ALPHA_NOALPHA=256
# Set background alpha of the caret line.
set void SetCaretLineBackAlpha=2470(int alpha,)
# Get the background alpha of the caret line.
get int GetCaretLineBackAlpha=2471(,)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@@ -1820,11 +1845,9 @@ val SCLEX_SMALLTALK=72
val SCLEX_FLAGSHIP=73
val SCLEX_CSOUND=74
val SCLEX_FREEBASIC=75
# These are deprecated, STC_LEX_HTML should be used instead.
val SCLEX_ASP=29
val SCLEX_PHP=30
val SCLEX_INNOSETUP=76
val SCLEX_OPAL=77
val SCLEX_SPICE=78
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -1850,7 +1873,6 @@ val SCE_P_DECORATOR=15
# Lexical states for SCLEX_CPP
lex Cpp=SCLEX_CPP SCE_C_
lex Pascal=SCLEX_PASCAL SCE_C_
lex TCL=SCLEX_TCL SCE_C_
lex BullAnt=SCLEX_BULLANT SCE_C_
val SCE_C_DEFAULT=0
val SCE_C_COMMENT=1
@@ -1872,6 +1894,30 @@ val SCE_C_WORD2=16
val SCE_C_COMMENTDOCKEYWORD=17
val SCE_C_COMMENTDOCKEYWORDERROR=18
val SCE_C_GLOBALCLASS=19
# Lexical states for SCLEX_TCL
lex TCL=SCLEX_TCL SCE_TCL_
val SCE_TCL_DEFAULT=0
val SCE_TCL_COMMENT=1
val SCE_TCL_COMMENTLINE=2
val SCE_TCL_NUMBER=3
val SCE_TCL_WORD_IN_QUOTE=4
val SCE_TCL_IN_QUOTE=5
val SCE_TCL_OPERATOR=6
val SCE_TCL_IDENTIFIER=7
val SCE_TCL_SUBSTITUTION=8
val SCE_TCL_SUB_BRACE=9
val SCE_TCL_MODIFIER=10
val SCE_TCL_EXPAND=11
val SCE_TCL_WORD=12
val SCE_TCL_WORD2=13
val SCE_TCL_WORD3=14
val SCE_TCL_WORD4=15
val SCE_TCL_WORD5=16
val SCE_TCL_WORD6=17
val SCE_TCL_WORD7=18
val SCE_TCL_WORD8=19
val SCE_TCL_COMMENT_BOX=20
val SCE_TCL_BLOCK_COMMENT=21
# Lexical states for SCLEX_HTML, SCLEX_XML
lex HTML=SCLEX_HTML SCE_H
lex XML=SCLEX_XML SCE_H
@@ -2100,6 +2146,7 @@ val SCE_PROPS_COMMENT=1
val SCE_PROPS_SECTION=2
val SCE_PROPS_ASSIGNMENT=3
val SCE_PROPS_DEFVAL=4
val SCE_PROPS_KEY=5
# Lexical states for SCLEX_LATEX
lex LaTeX=SCLEX_LATEX SCE_L_
val SCE_L_DEFAULT=0
@@ -2646,6 +2693,7 @@ val SCE_AU3_PREPROCESSOR=11
val SCE_AU3_SPECIAL=12
val SCE_AU3_EXPAND=13
val SCE_AU3_COMOBJ=14
val SCE_AU3_UDF=15
# Lexical states for SCLEX_APDL
lex APDL=SCLEX_APDL SCE_APDL_
val SCE_APDL_DEFAULT=0
@@ -2883,6 +2931,44 @@ val SCE_CSOUND_KRATE_VAR=12
val SCE_CSOUND_IRATE_VAR=13
val SCE_CSOUND_GLOBAL_VAR=14
val SCE_CSOUND_STRINGEOL=15
# Lexical states for SCLEX_INNOSETUP
lex Inno=SCLEX_INNOSETUP SCE_INNO_
val SCE_INNO_DEFAULT=0
val SCE_INNO_COMMENT=1
val SCE_INNO_KEYWORD=2
val SCE_INNO_PARAMETER=3
val SCE_INNO_SECTION=4
val SCE_INNO_PREPROC=5
val SCE_INNO_PREPROC_INLINE=6
val SCE_INNO_COMMENT_PASCAL=7
val SCE_INNO_KEYWORD_PASCAL=8
val SCE_INNO_KEYWORD_USER=9
val SCE_INNO_STRING_DOUBLE=10
val SCE_INNO_STRING_SINGLE=11
val SCE_INNO_IDENTIFIER=12
# Lexical states for SCLEX_OPAL
lex Opal=SCLEX_OPAL SCE_OPAL_
val SCE_OPAL_SPACE=0
val SCE_OPAL_COMMENT_BLOCK=1
val SCE_OPAL_COMMENT_LINE=2
val SCE_OPAL_INTEGER=3
val SCE_OPAL_KEYWORD=4
val SCE_OPAL_SORT=5
val SCE_OPAL_STRING=6
val SCE_OPAL_PAR=7
val SCE_OPAL_BOOL_CONST=8
val SCE_OPAL_DEFAULT=32
# Lexical states for SCLEX_SPICE
lex Spice=SCLEX_SPICE SCE_SPICE_
val SCE_SPICE_DEFAULT=0
val SCE_SPICE_IDENTIFIER=1
val SCE_SPICE_KEYWORD=2
val SCE_SPICE_KEYWORD2=3
val SCE_SPICE_KEYWORD3=4
val SCE_SPICE_NUMBER=5
val SCE_SPICE_DELIMITER=6
val SCE_SPICE_VALUE=7
val SCE_SPICE_COMMENTLINE=8
# Events

View File

@@ -34,7 +34,11 @@ struct _ScintillaClass {
void (* notify) (ScintillaObject *ttt);
};
#if GLIB_MAJOR_VERSION < 2
GtkType scintilla_get_type (void);
#else
GType scintilla_get_type (void);
#endif
GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci, uptr_t id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);

View File

@@ -13,6 +13,9 @@
#include "Scintilla.h"
#include "CallTip.h"
static const int insetX = 5; // text inset in x from calltip border
static const int widthArrow = 14;
CallTip::CallTip() {
wCallTip = 0;
inCallTipMode = false;
@@ -23,6 +26,8 @@ CallTip::CallTip() {
lineHeight = 1;
startHighlight = 0;
endHighlight = 0;
tabSize = 0;
useStyleCallTip = false; // for backwards compatibility
colourBG.desired = ColourDesired(0xff, 0xff, 0xff);
colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80);
@@ -38,8 +43,6 @@ CallTip::~CallTip() {
val = 0;
}
const int widthArrow = 14;
void CallTip::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(colourBG, want);
pal.WantFind(colourUnSel, want);
@@ -48,19 +51,42 @@ void CallTip::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(colourLight, want);
}
// Although this test includes 0, we should never see a \0 character.
static bool IsArrowCharacter(char ch) {
return (ch == 0) || (ch == '\001') || (ch == '\002');
}
// We ignore tabs unless a tab width has been set.
bool CallTip::IsTabCharacter(char ch) {
return (tabSize > 0) && (ch == '\t');
}
int CallTip::NextTabPos(int x) {
if (tabSize > 0) { // paranoia... not called unless this is true
x -= insetX; // position relative to text
x = (x + tabSize) / tabSize; // tab "number"
return tabSize*x + insetX; // position of next tab
} else {
return x + 1; // arbitrary
}
}
// Draw a section of the call tip that does not include \n in one colour.
// The text may include up to numEnds tabs or arrow characters.
void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw) {
s += posStart;
int len = posEnd - posStart;
// Divide the text into sections that are all text, or that are
// single arrows or single tab characters (if tabSize > 0).
int maxEnd = 0;
int ends[10];
const int numEnds = 10;
int ends[numEnds + 2];
for (int i=0;i<len;i++) {
if (IsArrowCharacter(s[i])) {
if ((maxEnd < numEnds) &&
(IsArrowCharacter(s[i]) || IsTabCharacter(s[i])) ) {
if (i > 0)
ends[maxEnd++] = i;
ends[maxEnd++] = i+1;
@@ -73,20 +99,19 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int endSeg = ends[seg];
if (endSeg > startSeg) {
if (IsArrowCharacter(s[startSeg])) {
xEnd = x + widthArrow;
offsetMain = xEnd;
bool upArrow = s[startSeg] == '\001';
rcClient.left = x;
rcClient.right = xEnd;
rcClient.right = rcClient.left + widthArrow;
if (draw) {
const int halfWidth = widthArrow / 2 - 3;
const int centreX = x + widthArrow / 2 - 1;
const int centreX = rcClient.left + widthArrow / 2 - 1;
const int centreY = (rcClient.top + rcClient.bottom) / 2;
surface->FillRectangle(rcClient, colourBG.allocated);
PRectangle rcClientInner(rcClient.left+1, rcClient.top+1, rcClient.right-2, rcClient.bottom-1);
PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1,
rcClient.right - 2, rcClient.bottom - 1);
surface->FillRectangle(rcClientInner, colourUnSel.allocated);
if (s[startSeg] == '\001') {
// Up arrow
if (upArrow) { // Up arrow
Point pts[] = {
Point(centreX - halfWidth, centreY + halfWidth / 2),
Point(centreX + halfWidth, centreY + halfWidth / 2),
@@ -94,8 +119,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
colourBG.allocated, colourBG.allocated);
} else {
// Down arrow
} else { // Down arrow
Point pts[] = {
Point(centreX - halfWidth, centreY - halfWidth / 2),
Point(centreX + halfWidth, centreY - halfWidth / 2),
@@ -105,20 +129,23 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
colourBG.allocated, colourBG.allocated);
}
}
if (s[startSeg] == '\001') {
xEnd = rcClient.right;
offsetMain = xEnd;
if (upArrow) {
rectUp = rcClient;
} else if (s[startSeg] == '\002') {
} else {
rectDown = rcClient;
}
} else if (IsTabCharacter(s[startSeg])) {
xEnd = NextTabPos(x);
} else {
xEnd = x + surface->WidthText(font, s+startSeg, endSeg - startSeg);
xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg);
if (draw) {
rcClient.left = x;
rcClient.right = xEnd;
surface->DrawTextNoClip(rcClient, font, ytext,
surface->DrawTextTransparent(rcClient, font, ytext,
s+startSeg, endSeg - startSeg,
highlight ? colourSel.allocated : colourUnSel.allocated,
colourBG.allocated);
highlight ? colourSel.allocated : colourUnSel.allocated);
}
}
x = xEnd;
@@ -160,7 +187,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
thisEndHighlight -= chunkOffset;
rcClient.top = ytext - ascent - 1;
int x = 5;
int x = insetX; // start each line at this inset
DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight,
ytext, rcClient, false, draw);
@@ -187,7 +214,7 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
surfaceWindow->FillRectangle(rcClient, colourBG.allocated);
offsetMain = 5;
offsetMain = insetX; // initial alignment assuming no arrows
PaintContents(surfaceWindow, true);
// Draw a raised border around the edges of the window
@@ -238,14 +265,17 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
const char *look = val;
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
offsetMain = 5;
int width = PaintContents(surfaceMeasure, false) + 5;
offsetMain = insetX; // changed to right edge of any arrows
int width = PaintContents(surfaceMeasure, false) + insetX;
while ((newline = strchr(look, '\n')) != NULL) {
look = newline + 1;
numLines++;
}
lineHeight = surfaceMeasure->Height(font);
// Extra line for border and an empty line at top and bottom
// Extra line for border and an empty line at top and bottom. 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) + 2 + 2;
delete surfaceMeasure;
return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height);
@@ -268,3 +298,17 @@ void CallTip::SetHighlight(int start, int end) {
}
}
}
// Set the tab size (sizes > 0 enable the use of tabs). This also enables the
// use of the STYLE_CALLTIP.
void CallTip::SetTabSize(int tabSz) {
tabSize = tabSz;
useStyleCallTip = true;
}
// It might be better to have two access functions for this and to use
// them for all settings of colours.
void CallTip::SetForeBack(const ColourPair &fore, const ColourPair &back) {
colourBG = back;
colourUnSel = fore;
}

View File

@@ -11,14 +11,17 @@
/**
*/
class CallTip {
int startHighlight;
int endHighlight;
int startHighlight; // character offset to start and...
int endHighlight; // ...end of highlighted text
char *val;
Font font;
PRectangle rectUp;
PRectangle rectDown;
int lineHeight;
int offsetMain;
PRectangle rectUp; // rectangle of last up angle in the tip
PRectangle rectDown; // rectangle of last down arrow in the tip
int lineHeight; // vertical line spacing
int offsetMain; // The alignment point of the call tip
int tabSize; // Tab size in pixels, <=0 no TAB expand
bool useStyleCallTip; // if true, STYLE_CALLTIP should be used
// Private so CallTip objects can not be copied
CallTip(const CallTip &) {}
CallTip &operator=(const CallTip &) { return *this; }
@@ -26,6 +29,8 @@ class CallTip {
int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw);
int PaintContents(Surface *surfaceWindow, bool draw);
bool IsTabCharacter(char c);
int NextTabPos(int x);
public:
Window wCallTip;
@@ -60,6 +65,15 @@ public:
/// Set a range of characters to be displayed in a highlight style.
/// Commonly used to highlight the current parameter.
void SetHighlight(int start, int end);
/// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand.
void SetTabSize(int tabSz);
/// Used to determine which STYLE_xxxx to use for call tip information
bool UseStyleCallTip() const { return useStyleCallTip;}
// Modify foreground and background colours
void SetForeBack(const ColourPair &fore, const ColourPair &back);
};
#endif

View File

@@ -0,0 +1,43 @@
// Scintilla source code edit control
/** @file CharClassify.cxx
** Character classifications used by Document and RESearch.
**/
// Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <ctype.h>
#include "CharClassify.h"
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4514)
#endif
CharClassify::CharClassify() {
SetDefaultCharClasses(true);
}
void CharClassify::SetDefaultCharClasses(bool includeWordClass) {
// Initialize all char classes to default values
for (int ch = 0; ch < 256; ch++) {
if (ch == '\r' || ch == '\n')
charClass[ch] = ccNewLine;
else if (ch < 0x20 || ch == ' ')
charClass[ch] = ccSpace;
else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_'))
charClass[ch] = ccWord;
else
charClass[ch] = ccPunctuation;
}
}
void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) {
// Apply the newCharClass to the specifed chars
if (chars) {
while (*chars) {
charClass[*chars] = static_cast<unsigned char>(newCharClass);
chars++;
}
}
}

View File

@@ -0,0 +1,25 @@
// Scintilla source code edit control
/** @file CharClassify.h
** Character classifications used by Document and RESearch.
**/
// Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CHARCLASSIFY_H
#define CHARCLASSIFY_H
class CharClassify {
public:
CharClassify();
enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation };
void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, cc newCharClass);
cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);}
bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;}
private:
enum { maxChar=256 };
unsigned char charClass[maxChar]; // not type cc to save space
};
#endif

View File

@@ -280,4 +280,10 @@ void ContractionState::ShowAll() {
delete []lines;
lines = 0;
size = 0;
delete []docLines;
docLines = 0;
sizeDocLines = 0;
linesInDisplay = linesInDoc;
}

View File

@@ -15,6 +15,7 @@
#include "Scintilla.h"
#include "SVector.h"
#include "CellBuffer.h"
#include "CharClassify.h"
#include "Document.h"
#include "RESearch.h"
@@ -50,7 +51,6 @@ Document::Document() {
stylingBits = 5;
stylingBitsMask = 0x1F;
stylingMask = 0;
SetDefaultCharClasses(true);
endStyled = 0;
styleClock = 0;
enteredCount = 0;
@@ -836,10 +836,10 @@ int Document::ParaDown(int pos) {
return LineEnd(line-1);
}
Document::charClassification Document::WordCharClass(unsigned char ch) {
CharClassify::cc Document::WordCharClass(unsigned char ch) {
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80))
return ccWord;
return charClass[ch];
return CharClassify::ccWord;
return charClass.GetClass(ch);
}
/**
@@ -847,7 +847,7 @@ Document::charClassification Document::WordCharClass(unsigned char ch) {
* Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0.
*/
int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
charClassification ccStart = ccWord;
CharClassify::cc ccStart = CharClassify::ccWord;
if (delta < 0) {
if (!onlyWordCharacters)
ccStart = WordCharClass(cb.CharAt(pos-1));
@@ -871,19 +871,19 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
*/
int Document::NextWordStart(int pos, int delta) {
if (delta < 0) {
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccSpace))
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace))
pos--;
if (pos > 0) {
charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1));
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) {
pos--;
}
}
} else {
charClassification ccStart = WordCharClass(cb.CharAt(pos));
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos));
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart))
pos++;
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccSpace))
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace))
pos++;
}
return pos;
@@ -899,22 +899,22 @@ int Document::NextWordStart(int pos, int delta) {
int Document::NextWordEnd(int pos, int delta) {
if (delta < 0) {
if (pos > 0) {
charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
if (ccStart != ccSpace) {
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1));
if (ccStart != CharClassify::ccSpace) {
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) {
pos--;
}
}
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccSpace) {
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) {
pos--;
}
}
} else {
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccSpace) {
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) {
pos++;
}
if (pos < Length()) {
charClassification ccStart = WordCharClass(cb.CharAt(pos));
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos));
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) {
pos++;
}
@@ -929,8 +929,8 @@ int Document::NextWordEnd(int pos, int delta) {
*/
bool Document::IsWordStartAt(int pos) {
if (pos > 0) {
charClassification ccPos = WordCharClass(CharAt(pos));
return (ccPos == ccWord || ccPos == ccPunctuation) &&
CharClassify::cc ccPos = WordCharClass(CharAt(pos));
return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) &&
(ccPos != WordCharClass(CharAt(pos - 1)));
}
return true;
@@ -942,8 +942,8 @@ bool Document::IsWordStartAt(int pos) {
*/
bool Document::IsWordEndAt(int pos) {
if (pos < Length()) {
charClassification ccPrev = WordCharClass(CharAt(pos-1));
return (ccPrev == ccWord || ccPrev == ccPunctuation) &&
CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1));
return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) &&
(ccPrev != WordCharClass(CharAt(pos)));
}
return true;
@@ -1004,7 +1004,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
int *length) {
if (regExp) {
if (!pre)
pre = new RESearch();
pre = new RESearch(&charClass);
if (!pre)
return -1;
@@ -1266,27 +1266,11 @@ void Document::ChangeCase(Range r, bool makeUpperCase) {
}
void Document::SetDefaultCharClasses(bool includeWordClass) {
// Initialize all char classes to default values
for (int ch = 0; ch < 256; ch++) {
if (ch == '\r' || ch == '\n')
charClass[ch] = ccNewLine;
else if (ch < 0x20 || ch == ' ')
charClass[ch] = ccSpace;
else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_'))
charClass[ch] = ccWord;
else
charClass[ch] = ccPunctuation;
}
charClass.SetDefaultCharClasses(includeWordClass);
}
void Document::SetCharClasses(const unsigned char *chars, charClassification newCharClass) {
// Apply the newCharClass to the specifed chars
if (chars) {
while (*chars) {
charClass[*chars] = newCharClass;
chars++;
}
}
void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) {
charClass.SetCharClasses(chars, newCharClass);
}
void Document::SetStylingBits(int bits) {
@@ -1430,7 +1414,7 @@ void Document::NotifyModified(DocModification mh) {
}
bool Document::IsWordPartSeparator(char ch) {
return (WordCharClass(ch) == ccWord) && IsPunctuation(ch);
return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch);
}
int Document::WordPartLeft(int pos) {

View File

@@ -93,7 +93,7 @@ public:
private:
int refCount;
CellBuffer cb;
charClassification charClass[256];
CharClassify charClass;
char stylingMask;
int endStyled;
int styleClock;
@@ -207,7 +207,7 @@ public:
void ChangeCase(Range r, bool makeUpperCase);
void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, charClassification newCharClass);
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
bool SetStyleFor(int length, char style);
@@ -239,7 +239,7 @@ public:
private:
void CheckReadOnly();
charClassification WordCharClass(unsigned char ch);
CharClassify::cc WordCharClass(unsigned char ch);
bool IsWordStartAt(int pos);
bool IsWordEndAt(int pos);
bool IsWordAt(int start, int end);

View File

@@ -18,6 +18,7 @@
#include "DocumentAccessor.h"
#include "CellBuffer.h"
#include "Scintilla.h"
#include "CharClassify.h"
#include "Document.h"
DocumentAccessor::~DocumentAccessor() {

View File

@@ -26,6 +26,7 @@
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Document.h"
#include "Editor.h"
@@ -213,7 +214,7 @@ void LineLayoutCache::Allocate(int length_) {
}
void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
// PLATFORM_ASSERT(useCount == 0);
PLATFORM_ASSERT(useCount == 0);
int lengthForLevel = 0;
if (level == llcCaret) {
lengthForLevel = 1;
@@ -239,7 +240,7 @@ void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
}
void LineLayoutCache::Deallocate() {
// PLATFORM_ASSERT(useCount == 0);
PLATFORM_ASSERT(useCount == 0);
for (int i = 0; i < length; i++)
delete cache[i];
delete []cache;
@@ -284,7 +285,7 @@ LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChar
} else if (level == llcPage) {
if (lineNumber == lineCaret) {
pos = 0;
} else {
} else if (length > 1) {
pos = 1 + (lineNumber % (length - 1));
}
} else if (level == llcDocument) {
@@ -428,9 +429,8 @@ Editor::Editor() {
wrapState = eWrapNone;
wrapWidth = LineLayout::wrapWidthInfinite;
docLineLastWrapped = -1;
docLastLineToWrap = -1;
backgroundWrapEnabled = true;
wrapStart = wrapLineLarge;
wrapEnd = wrapLineLarge;
wrapVisualFlags = 0;
wrapVisualFlagsLocation = 0;
wrapVisualStartIndent = 0;
@@ -810,6 +810,9 @@ int Editor::PositionFromLocationClose(Point pt) {
return pdoc->MovePositionOutsideChar(i + posLineStart, 1);
}
}
if (pt.x < (ll->positions[lineEnd] - subLineStart)) {
return pdoc->MovePositionOutsideChar(lineEnd + posLineStart, 1);
}
}
}
@@ -1483,29 +1486,18 @@ void Editor::InvalidateCaret() {
void Editor::UpdateSystemCaret() {
}
void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) {
docLineStartWrapping = Platform::Minimum(docLineStartWrapping, pdoc->LinesTotal()-1);
docLineEndWrapping = Platform::Minimum(docLineEndWrapping, pdoc->LinesTotal()-1);
bool noWrap = (docLastLineToWrap == docLineLastWrapped);
if (docLineLastWrapped > (docLineStartWrapping - 1)) {
docLineLastWrapped = docLineStartWrapping - 1;
if (docLineLastWrapped < -1)
docLineLastWrapped = -1;
void Editor::NeedWrapping(int docLineStart, int docLineEnd) {
docLineStart = Platform::Clamp(docLineStart, 0, pdoc->LinesTotal());
if (wrapStart > docLineStart) {
wrapStart = docLineStart;
llc.Invalidate(LineLayout::llPositions);
}
if (noWrap) {
docLastLineToWrap = docLineEndWrapping;
} else if (docLastLineToWrap < docLineEndWrapping) {
docLastLineToWrap = docLineEndWrapping + 1;
if (wrapEnd < docLineEnd) {
wrapEnd = docLineEnd;
}
if (docLastLineToWrap < -1)
docLastLineToWrap = -1;
if (docLastLineToWrap >= pdoc->LinesTotal())
docLastLineToWrap = pdoc->LinesTotal()-1;
wrapEnd = Platform::Clamp(wrapEnd, 0, pdoc->LinesTotal());
// Wrap lines during idle.
if ((wrapState != eWrapNone) &&
backgroundWrapEnabled &&
(docLastLineToWrap != docLineLastWrapped)) {
if ((wrapState != eWrapNone) && (wrapEnd != wrapStart)) {
SetIdle(true);
}
}
@@ -1514,33 +1506,33 @@ void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) {
// fullwrap: if true, all lines which need wrapping will be done,
// in this single call.
// priorityWrapLineStart: If greater than zero, all lines starting from
// here to 100 lines past will be wrapped (even if there are
// here to 1 page + 100 lines past will be wrapped (even if there are
// more lines under wrapping process in idle).
// If it is neither fullwrap, nor priorityWrap, then 100 lines will be
// If it is neither fullwrap, nor priorityWrap, then 1 page + 100 lines will be
// wrapped, if there are any wrapping going on in idle. (Generally this
// condition is called only from idler).
// Return true if wrapping occurred.
bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
// If there are any pending wraps, do them during idle if possible.
int linesInOneCall = LinesOnScreen() + 100;
if (wrapState != eWrapNone) {
if (docLineLastWrapped < docLastLineToWrap) {
if (!(backgroundWrapEnabled && SetIdle(true))) {
// Background wrapping is disabled, or idle processing
// not supported. A full wrap is required.
if (wrapStart < wrapEnd) {
if (!SetIdle(true)) {
// Idle processing not supported so full wrap required.
fullWrap = true;
}
}
if (!fullWrap && priorityWrapLineStart >= 0 &&
// .. and if the paint window is outside pending wraps
(((priorityWrapLineStart + 100) < docLineLastWrapped) ||
(priorityWrapLineStart > docLastLineToWrap))) {
(((priorityWrapLineStart + linesInOneCall) < wrapStart) ||
(priorityWrapLineStart > wrapEnd))) {
// No priority wrap pending
return false;
}
}
int goodTopLine = topLine;
bool wrapOccurred = false;
if (docLineLastWrapped < pdoc->LinesTotal()) {
if (wrapStart <= pdoc->LinesTotal()) {
if (wrapState == eWrapNone) {
if (wrapWidth != LineLayout::wrapWidthInfinite) {
wrapWidth = LineLayout::wrapWidthInfinite;
@@ -1549,8 +1541,11 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
}
wrapOccurred = true;
}
docLineLastWrapped = 0x7ffffff;
wrapStart = wrapLineLarge;
wrapEnd = wrapLineLarge;
} else {
if (wrapEnd >= pdoc->LinesTotal())
wrapEnd = pdoc->LinesTotal();
//ElapsedTime et;
int lineDocTop = cs.DocFromDisplay(topLine);
int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
@@ -1564,44 +1559,42 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
AutoSurface surface(this);
if (surface) {
bool priorityWrap = false;
int lastLineToWrap = docLastLineToWrap;
int firstLineToWrap = docLineLastWrapped;
int lastLineToWrap = wrapEnd;
int lineToWrap = wrapStart;
if (!fullWrap) {
if (priorityWrapLineStart >= 0) {
// This is a priority wrap.
firstLineToWrap = priorityWrapLineStart;
lastLineToWrap = firstLineToWrap + 100;
lineToWrap = priorityWrapLineStart;
lastLineToWrap = priorityWrapLineStart + linesInOneCall;
priorityWrap = true;
} else {
// This is idle wrap.
lastLineToWrap = docLineLastWrapped + 100;
lastLineToWrap = wrapStart + linesInOneCall;
}
if (lastLineToWrap >= docLastLineToWrap)
lastLineToWrap = docLastLineToWrap;
if (lastLineToWrap >= wrapEnd)
lastLineToWrap = wrapEnd;
} // else do a fullWrap.
// printf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, firstLineToWrap, lastLineToWrap);
// printf("Pending wraps: %d to %d\n", docLineLastWrapped, docLastLineToWrap);
while (firstLineToWrap < lastLineToWrap) {
firstLineToWrap++;
if (!priorityWrap)
docLineLastWrapped++;
if (firstLineToWrap < pdoc->LinesTotal()) {
AutoLineLayout ll(llc, RetrieveLineLayout(firstLineToWrap));
// Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap);
// Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd);
while (lineToWrap < lastLineToWrap) {
AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap));
int linesWrapped = 1;
if (ll) {
LayoutLine(firstLineToWrap, surface, vs, ll, wrapWidth);
LayoutLine(lineToWrap, surface, vs, ll, wrapWidth);
linesWrapped = ll->lines;
}
if (cs.SetHeight(firstLineToWrap, linesWrapped)) {
if (cs.SetHeight(lineToWrap, linesWrapped)) {
wrapOccurred = true;
}
lineToWrap++;
}
}
if (!priorityWrap)
wrapStart = lineToWrap;
// If wrapping is done, bring it to resting position
if (docLineLastWrapped > docLastLineToWrap) {
docLineLastWrapped = -1;
docLastLineToWrap = -1;
if (wrapStart >= wrapEnd) {
wrapStart = wrapLineLarge;
wrapEnd = wrapLineLarge;
}
}
goodTopLine = cs.DisplayFromDoc(lineDocTop);
@@ -1673,6 +1666,7 @@ void Editor::LinesSplit(int pixelWidth) {
targetEnd += static_cast<int>(strlen(eol));
}
}
lineEnd = pdoc->LineFromPosition(targetEnd);
}
pdoc->EndUndoAction();
}
@@ -1716,7 +1710,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
rcSelMargin.left = rcSelMargin.right;
rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width;
if (vs.ms[margin].symbol) {
if (vs.ms[margin].style != SC_MARGIN_NUMBER) {
/* alternate scheme:
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
@@ -1727,8 +1721,21 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
// Required because of special way brush is created for selection margin
surface->FillRectangle(rcSelMargin, *pixmapSelPattern);
else
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);
else {
ColourAllocated colour;
switch (vs.ms[margin].style) {
case SC_MARGIN_BACK:
colour = vs.styles[STYLE_DEFAULT].back.allocated;
break;
case SC_MARGIN_FORE:
colour = vs.styles[STYLE_DEFAULT].fore.allocated;
break;
default:
colour = vs.styles[STYLE_LINENUMBER].back.allocated;
break;
}
surface->FillRectangle(rcSelMargin, colour);
}
} else {
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);
}
@@ -1835,7 +1842,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
PRectangle rcMarker = rcSelMargin;
rcMarker.top = yposScreen;
rcMarker.bottom = yposScreen + vs.lineHeight;
if (!vs.ms[margin].symbol) {
if (vs.ms[margin].style == SC_MARGIN_NUMBER) {
char number[100];
number[0] = '\0';
if (firstSubLine)
@@ -2126,7 +2133,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
continue;
}
if (p > 0) {
if (wrapState == eWrapChar){
if (wrapState == eWrapChar) {
lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1)
- posLineStart;
p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart;
@@ -2145,14 +2152,15 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
}
}
ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw) {
return primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated;
}
ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) {
if (inSelection) {
if (vsDraw.selbackset) {
if (primarySelection)
return vsDraw.selbackground.allocated;
else
return vsDraw.selbackground2.allocated;
if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
return SelectionBackground(vsDraw);
}
} else {
if ((vsDraw.edgeState == EDGE_BACKGROUND) &&
@@ -2204,7 +2212,7 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace,
surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative);
}
};
Relative rel = {surface, x0, xStraight?1:-1, y0, yStraight?1:-1};
Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1};
// arrow head
rel.MoveTo(xa, y);
@@ -2220,6 +2228,12 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace,
y - 2 * dy);
}
static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) {
if (alpha != SC_ALPHA_NOALPHA) {
surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0);
}
}
void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
int line, int lineEnd, int xStart, int subLine, int subLineStart,
bool overrideBackground, ColourAllocated background,
@@ -2236,16 +2250,18 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
bool eolInSelection = (subLine == (ll->lines - 1)) &&
(posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd);
if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1)) {
if (primarySelection)
surface->FillRectangle(rcSegment, vsDraw.selbackground.allocated);
else
surface->FillRectangle(rcSegment, vsDraw.selbackground2.allocated);
} else if (overrideBackground) {
if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw));
} else {
if (overrideBackground) {
surface->FillRectangle(rcSegment, background);
} else {
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated);
}
if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) {
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha);
}
}
rcSegment.left = xEol + vsDraw.aveCharWidth + xStart;
rcSegment.right = rcLine.right;
@@ -2290,14 +2306,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
// the color for the highest numbered one is used.
bool overrideBackground = false;
ColourAllocated background;
if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {
overrideBackground = true;
background = vsDraw.caretLineBackground.allocated;
}
if (!overrideBackground) {
int marks = pdoc->GetMark(line);
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if ((marks & 1) && vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) {
if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) &&
(vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
background = vsDraw.markers[markBit].back.allocated;
overrideBackground = true;
}
@@ -2306,14 +2323,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
if (!overrideBackground) {
if (vsDraw.maskInLine) {
int marks = pdoc->GetMark(line) & vsDraw.maskInLine;
if (marks) {
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if ((marks & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) {
int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
if (marksMasked) {
for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) &&
(vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
overrideBackground = true;
background = vsDraw.markers[markBit].back.allocated;
}
marks >>= 1;
marksMasked >>= 1;
}
}
}
@@ -2641,6 +2659,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
xStart, subLine, subLineStart, overrideBackground, background,
drawWrapMarkEnd, vsDraw.whitespaceForeground.allocated);
}
if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) && (ll->selStart >= 0) && (ll->selEnd >= 0)) {
int startPosSel = (ll->selStart < posLineStart) ? posLineStart : ll->selStart;
int endPosSel = (ll->selEnd < (lineEnd + posLineStart)) ? ll->selEnd : (lineEnd + posLineStart);
if (startPosSel < endPosSel) {
rcSegment.left = xStart + ll->positions[startPosSel - posLineStart] - subLineStart;
rcSegment.right = xStart + ll->positions[endPosSel - posLineStart] - subLineStart;
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha);
}
}
if (vsDraw.edgeState == EDGE_LINE) {
int edgeX = theEdge * vsDraw.spaceWidth;
@@ -2648,6 +2675,31 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
rcSegment.right = rcSegment.left + 1;
surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated);
}
// Draw any translucent whole line states
rcSegment.left = xStart;
rcSegment.right = rcLine.right - 1;
if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha);
}
int marks = pdoc->GetMark(line);
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
}
marks >>= 1;
}
if (vsDraw.maskInLine) {
int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
if (marksMasked) {
for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
}
marksMasked >>= 1;
}
}
}
}
void Editor::RefreshPixMaps(Surface *surfaceWindow) {
@@ -2721,7 +2773,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
// paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
RefreshStyleData();
RefreshPixMaps(surfaceWindow);
PRectangle rcClient = GetClientRectangle();
@@ -2752,6 +2803,8 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
if (needUpdateUI) {
NotifyUpdateUI();
needUpdateUI = false;
RefreshStyleData();
RefreshPixMaps(surfaceWindow);
}
// Call priority lines wrap on a window of lines which are likely
@@ -3063,7 +3116,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
// Printing supports only the line number margin.
int lineNumberIndex = -1;
for (int margin = 0; margin < ViewStyle::margins; margin++) {
if ((!vsPrint.ms[margin].symbol) && (vsPrint.ms[margin].width > 0)) {
if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) {
lineNumberIndex = margin;
} else {
vsPrint.ms[margin].width = 0;
@@ -3076,6 +3129,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
// Don't show the selection when printing
vsPrint.selbackset = false;
vsPrint.selforeset = false;
vsPrint.selAlpha = SC_ALPHA_NOALPHA;
vsPrint.whitespaceBackgroundSet = false;
vsPrint.whitespaceForegroundSet = false;
vsPrint.showCaretLineBackground = false;
@@ -3662,19 +3716,8 @@ void Editor::CheckModificationForWrap(DocModification mh) {
llc.Invalidate(LineLayout::llCheckTextAndStyle);
if (wrapState != eWrapNone) {
int lineDoc = pdoc->LineFromPosition(mh.position);
if (mh.linesAdded <= 0) {
AutoSurface surface(this);
AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
if (surface && ll) {
LayoutLine(lineDoc, surface, vs, ll, wrapWidth);
if (cs.GetHeight(lineDoc) != ll->lines) {
NeedWrapping(lineDoc - 1, lineDoc + 1);
Redraw();
}
}
} else {
NeedWrapping(lineDoc, lineDoc + 1 + mh.linesAdded);
}
int lines = Platform::Maximum(0, mh.linesAdded);
NeedWrapping(lineDoc, lineDoc + lines + 1);
}
}
}
@@ -3717,6 +3760,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
InvalidateRange(mh.position, mh.position + mh.length);
}
}
llc.Invalidate(LineLayout::llCheckTextAndStyle);
} else {
// Move selection and brace highlights
if (mh.modificationType & SC_MOD_INSERTTEXT) {
@@ -4849,7 +4893,7 @@ void Editor::CopyRangeToClipboard(int start, int end) {
void Editor::CopyText(int length, const char *text) {
SelectionText selectedText;
selectedText.Copy(text, length,
selectedText.Copy(text, length + 1,
pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false);
CopyToClipboard(selectedText);
}
@@ -5377,13 +5421,13 @@ bool Editor::Idle() {
bool idleDone;
bool wrappingDone = (wrapState == eWrapNone) || (!backgroundWrapEnabled);
bool wrappingDone = wrapState == eWrapNone;
if (!wrappingDone) {
// Wrap lines during idle.
WrapLines(false, -1);
// No more wrapping
if (docLineLastWrapped == docLastLineToWrap)
if (wrapStart == wrapEnd)
wrappingDone = true;
}
@@ -6038,14 +6082,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
pdoc->SetDefaultCharClasses(false);
if (lParam == 0)
return 0;
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), Document::ccWord);
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccWord);
}
break;
case SCI_SETWHITESPACECHARS: {
if (lParam == 0)
return 0;
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), Document::ccSpace);
pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccSpace);
}
break;
@@ -6305,7 +6349,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return pdoc->ExtendWordSelect(wParam, 1, lParam != 0);
case SCI_SETWRAPMODE:
switch(wParam){
switch (wParam) {
case SC_WRAP_WORD:
wrapState = eWrapWord;
break;
@@ -6465,8 +6509,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return pdoc->LineEnd(wParam);
case SCI_SETCODEPAGE:
if (ValidCodePage(wParam)) {
pdoc->dbcsCodePage = wParam;
InvalidateStyleRedraw();
}
break;
case SCI_GETCODEPAGE:
@@ -6499,6 +6545,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleData();
RedrawSelMargin();
break;
case SCI_MARKERSETALPHA:
if (wParam <= MARKER_MAX)
vs.markers[wParam].alpha = lParam;
InvalidateStyleRedraw();
break;
case SCI_MARKERADD: {
int markerID = pdoc->AddMark(wParam, lParam);
return markerID;
@@ -6546,14 +6597,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_SETMARGINTYPEN:
if (ValidMargin(wParam)) {
vs.ms[wParam].symbol = (lParam == SC_MARGIN_SYMBOL);
vs.ms[wParam].style = lParam;
InvalidateStyleRedraw();
}
break;
case SCI_GETMARGINTYPEN:
if (ValidMargin(wParam))
return vs.ms[wParam].symbol ? SC_MARGIN_SYMBOL : SC_MARGIN_NUMBER;
return vs.ms[wParam].style;
else
return 0;
@@ -6717,6 +6768,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
vs.caretLineBackground.desired = wParam;
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEBACKALPHA:
return vs.caretLineAlpha;
case SCI_SETCARETLINEBACKALPHA:
vs.caretLineAlpha = wParam;
InvalidateStyleRedraw();
break;
// Folding messages
@@ -6831,6 +6888,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleRedraw();
break;
case SCI_SETSELALPHA:
vs.selAlpha = wParam;
InvalidateStyleRedraw();
break;
case SCI_GETSELALPHA:
return vs.selAlpha;
case SCI_SETWHITESPACEFORE:
vs.whitespaceForegroundSet = wParam != 0;
vs.whitespaceForeground.desired = ColourDesired(lParam);

View File

@@ -305,10 +305,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
// Wrapping support
enum { eWrapNone, eWrapWord, eWrapChar } wrapState;
bool backgroundWrapEnabled;
enum { wrapLineLarge = 0x7ffffff };
int wrapWidth;
int docLineLastWrapped;
int docLastLineToWrap;
int wrapStart;
int wrapEnd;
int wrapVisualFlags;
int wrapVisualFlagsLocation;
int wrapVisualStartIndent;
@@ -377,7 +377,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void InvalidateCaret();
virtual void UpdateSystemCaret();
void NeedWrapping(int docLineStartWrapping = 0, int docLineEndWrapping = 0x7ffffff);
void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge);
bool WrapLines(bool fullWrap, int priorityWrapLineStart);
void LinesJoin();
void LinesSplit(int pixelWidth);
@@ -387,6 +387,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
LineLayout *RetrieveLineLayout(int lineNumber);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite);
ColourAllocated SelectionBackground(ViewStyle &vsDraw);
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll);
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour);
@@ -524,6 +525,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void GetHotSpotRange(int& hsStart, int& hsEnd);
int CodePage() const;
virtual bool ValidCodePage(int /* codePage */) const { return true; }
int WrapCount(int line);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;

View File

@@ -12,6 +12,8 @@
#include "Platform.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "PropSet.h"
#include "Accessor.h"
@@ -116,16 +118,16 @@ LexerLibrary::LexerLibrary(const char* ModuleName) {
if (lib->IsValid()) {
m_sModuleName = ModuleName;
//Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects
GetLexerCountFn GetLexerCount = (GetLexerCountFn)lib->FindFunction("GetLexerCount");
GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount");
if (GetLexerCount) {
ExternalLexerModule *lex;
LexerMinder *lm;
// Find functions in the DLL
GetLexerNameFn GetLexerName = (GetLexerNameFn)lib->FindFunction("GetLexerName");
ExtLexerFunction Lexer = (ExtLexerFunction)lib->FindFunction("Lex");
ExtFoldFunction Folder = (ExtFoldFunction)lib->FindFunction("Fold");
GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName");
ExtLexerFunction Lexer = (ExtLexerFunction)(sptr_t)lib->FindFunction("Lex");
ExtFoldFunction Folder = (ExtFoldFunction)(sptr_t)lib->FindFunction("Fold");
// Assign a buffer for the lexer name.
char lexname[100];

View File

@@ -63,6 +63,12 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
surface->LineTo(rc.right, rcLine.top+1);
surface->LineTo(rc.left, rcLine.top+1);
surface->LineTo(rc.left, ymid+1);
} else if (style == INDIC_ROUNDBOX) {
PRectangle rcBox = rcLine;
rcBox.top = rcLine.top + 1;
rcBox.left = rc.left;
rcBox.right = rc.right;
surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0);
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);

View File

@@ -171,6 +171,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmGui4Cli);
LINK_LEXER(lmHaskell);
LINK_LEXER(lmHTML);
LINK_LEXER(lmInno);
LINK_LEXER(lmKix);
LINK_LEXER(lmLatex);
LINK_LEXER(lmLISP);
@@ -186,6 +187,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmNsis);
LINK_LEXER(lmNull);
LINK_LEXER(lmOctave);
LINK_LEXER(lmOpal);
LINK_LEXER(lmPascal);
LINK_LEXER(lmPB);
LINK_LEXER(lmPerl);
@@ -201,6 +203,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmScriptol);
LINK_LEXER(lmSmalltalk);
LINK_LEXER(lmSpecman);
LINK_LEXER(lmSpice);
LINK_LEXER(lmSQL);
LINK_LEXER(lmTADS3);
LINK_LEXER(lmTCL);

View File

@@ -39,6 +39,9 @@
// May 23, 2005 - Fixed the SentKey lexing in case of a missing }
// Aug 11, 2005 - Fixed possible bug with s_save length > 100.
// Aug 23, 2005 - Added Switch/endswitch support to the folding logic.
// Sep 27, 2005 - Fixed the SentKey lexing logic in case of multiple sentkeys.
// Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions.
// Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF)
//
// Copyright for Scintilla: 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@@ -92,6 +95,7 @@ static inline bool IsAOperator(char ch) {
static int GetSendKey(const char *szLine, char *szKey)
{
int nFlag = 0;
int nStartFound = 0;
int nKeyPos = 0;
int nSpecPos= 0;
int nSpecNum= 1;
@@ -102,11 +106,13 @@ static int GetSendKey(const char *szLine, char *szKey)
// split the portion of the sendkey in the part before and after the spaces
while ( ( (cTemp = szLine[nPos]) != '\0'))
{
// skip leading Ctrl/Shift/ALt state
if ((cTemp == '#' || cTemp == '!' || cTemp == '^') && (szLine[nPos+1] == '{') )
{
// skip leading Ctrl/Shift/Alt state
if (cTemp == '{') {
nStartFound = 1;
}
else if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space
//
if (nStartFound == 1) {
if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space
{
nFlag = 1;
// Add } to the end of the first bit for table lookup later.
@@ -128,6 +134,7 @@ static int GetSendKey(const char *szLine, char *szKey)
// check if Second portion is all numbers for repeat fuction
if (isdigit(cTemp) == false) {nSpecNum = 0;}
}
}
nPos++; // skip to next char
} // End While
@@ -190,6 +197,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
// find the first previous line without continuation character at the end
int lineCurrent = styler.GetLine(startPos);
int s_startPos = startPos;
@@ -325,6 +333,10 @@ static void ColouriseAU3Doc(unsigned int startPos,
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_DEFAULT);
}
else if (keywords8.InList(s)) {
sc.ChangeState(SCE_AU3_UDF);
sc.SetState(SCE_AU3_DEFAULT);
}
else if (strcmp(s, "_") == 0) {
sc.ChangeState(SCE_AU3_OPERATOR);
sc.SetState(SCE_AU3_DEFAULT);
@@ -411,9 +423,11 @@ static void ColouriseAU3Doc(unsigned int startPos,
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>'))
{
sc.ForwardSetState(SCE_AU3_DEFAULT);
si=0;
}
if (sc.atLineEnd)
{
si=0;
// at line end and not found a continuation char then reset to default
int lineCurrent = styler.GetLine(sc.currentPos);
if (!IsContinuationLine(lineCurrent,styler))
@@ -422,11 +436,8 @@ static void ColouriseAU3Doc(unsigned int startPos,
}
}
// find Sendkeys in a STRING
if (sc.ch == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '+' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '!' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '^' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '#' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ) {
sc.SetState(SCE_AU3_SENT);}
break;
}
@@ -459,6 +470,35 @@ static void ColouriseAU3Doc(unsigned int startPos,
}
sc.SetState(SCE_AU3_STRING);
}
else
{
// check if the start is a valid SendKey start
int nPos = 0;
int nState = 1;
char cTemp;
while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
{
if (cTemp == '{' && nState == 1)
{
nState = 2;
}
if (nState == 1 && !(cTemp == '+' || cTemp == '!' || cTemp == '^' || cTemp == '#' ))
{
nState = 0;
}
nPos++;
}
//Verify characters infront of { ... if not assume regular string
if (nState == 1 && (!(sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ))) {
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_STRING);
}
// If invalid character found then assume its a regular string
if (nState == 0) {
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_STRING);
}
}
// check if next portion is again a sendkey
if (sc.atLineEnd)
{
@@ -466,13 +506,12 @@ static void ColouriseAU3Doc(unsigned int startPos,
sc.SetState(SCE_AU3_DEFAULT);
si = 0; // reset string indicator
}
//if (sc.ch == '{' && sc.chPrev != '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '+' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '!' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '^' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '#' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
//* check in next characters following a sentkey are again a sent key
// Need this test incase of 2 sentkeys like {F1}{ENTER} but not detect {{}
if (sc.state == SCE_AU3_STRING && (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' )) {
sc.SetState(SCE_AU3_SENT);}
// check to see if the string ended...
// Sentkey string isn't complete but the string ended....
// Sendkey string isn't complete but the string ended....
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\''))
{
sc.ChangeState(SCE_AU3_STRING);
@@ -491,6 +530,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
else if (sc.ch == '$') {sc.SetState(SCE_AU3_VARIABLE);}
else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);}
else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);}
//else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);}
else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include
else if (sc.ch == '\"') {
sc.SetState(SCE_AU3_STRING);
@@ -543,6 +583,10 @@ static void ColouriseAU3Doc(unsigned int startPos,
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_EXPAND);
}
else if (keywords8.InList(s_save)) {
sc.ChangeState(SCE_AU3_UDF);
sc.SetState(SCE_AU3_UDF);
}
else {
sc.ChangeState(SCE_AU3_DEFAULT);
sc.SetState(SCE_AU3_DEFAULT);
@@ -841,6 +885,7 @@ static const char * const AU3WordLists[] = {
"#autoit Pre-processors",
"#autoit Special",
"#autoit Expand",
"#autoit UDF",
0
};
LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists);

View File

@@ -258,6 +258,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
if (state == SCE_SH_DEFAULT) {
if (ch == '\\') { // escaped character
if (i < lengthDoc - 1)
i++;
ch = chNext;
chNext = chNext2;
@@ -626,7 +627,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
&& !IsCommentLine(lineCurrent+1, styler))
levelCurrent--;
}
if (style == SCE_C_OPERATOR) {
if (style == SCE_SH_OPERATOR) {
if (ch == '{') {
levelCurrent++;
} else if (ch == '}') {

View File

@@ -147,7 +147,7 @@ static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
sc.ChangeState(SCE_B_ERROR);
sc.SetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_COMMENT) {
} else if (sc.state == SCE_B_COMMENT || sc.state == SCE_B_PREPROCESSOR) {
if (sc.atLineEnd) {
sc.SetState(SCE_B_DEFAULT);
}
@@ -163,6 +163,11 @@ static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
wasfirst = isfirst;
sc.SetState(SCE_B_IDENTIFIER);
} else if (sc.Match(comment_char)) {
// Hack to make deprecated QBASIC '$Include show
// up in freebasic with SCE_B_PREPROCESSOR.
if (comment_char == '\'' && sc.Match(comment_char, '$'))
sc.SetState(SCE_B_PREPROCESSOR);
else
sc.SetState(SCE_B_COMMENT);
} else if (sc.Match('"')) {
sc.SetState(SCE_B_STRING);

View File

@@ -459,4 +459,3 @@ static void ColouriseCppDocInsensitive(unsigned int startPos, int length, int in
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDocSensitive, "cpp", FoldCppDoc, cppWordLists);
LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, ColouriseCppDocInsensitive, "cppnocase", FoldCppDoc, cppWordLists);
LexerModule lmTCL(SCLEX_TCL, ColouriseCppDocSensitive, "tcl", FoldCppDoc, cppWordLists);

View File

@@ -32,7 +32,7 @@ static inline bool isEiffelOperator(unsigned int ch) {
}
static inline bool IsAWordChar(unsigned int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static inline bool IsAWordStart(unsigned int ch) {

View File

@@ -149,7 +149,13 @@ static inline bool isStringState(int state) {
case SCE_HB_STRING:
case SCE_HBA_STRING:
case SCE_HP_STRING:
case SCE_HP_CHARACTER:
case SCE_HP_TRIPLE:
case SCE_HP_TRIPLEDOUBLE:
case SCE_HPA_STRING:
case SCE_HPA_CHARACTER:
case SCE_HPA_TRIPLE:
case SCE_HPA_TRIPLEDOUBLE:
case SCE_HPHP_HSTRING:
case SCE_HPHP_SIMPLESTRING:
case SCE_HPHP_HSTRING_VARIABLE:
@@ -163,6 +169,19 @@ static inline bool isStringState(int state) {
return bResult;
}
static inline bool stateAllowsTermination(int state) {
bool allowTermination = !isStringState(state);
if (allowTermination) {
switch (state) {
case SCE_HPHP_COMMENT:
case SCE_HP_COMMENTLINE:
case SCE_HPA_COMMENTLINE:
allowTermination = false;
}
}
return allowTermination;
}
// not really well done, since it's only comments that should lex the %> and <%
static inline bool isCommentASPState(int state) {
bool bResult;
@@ -668,7 +687,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
(ch == '<') &&
(chNext == '?') &&
!IsScriptCommentState(state) ) {
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 10, eScriptPHP);
if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
@@ -763,9 +782,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
else if ((
((inScriptType == eNonHtmlPreProc)
|| (inScriptType == eNonHtmlScriptPreProc)) && (
((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
((scriptLanguage != eScriptNone) && !isStringState(state) &&
((ch == '%') || (ch == '?')))
((scriptLanguage != eScriptNone) && stateAllowsTermination(state) && ((ch == '%') || (ch == '?')))
) && (chNext == '>')) ||
((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
if (state == SCE_H_ASPAT) {

View File

@@ -0,0 +1,290 @@
// Scintilla source code edit control
/** @file LexInno.cxx
** Lexer for Inno Setup scripts.
**/
// Written by Friedrich Vedder <fvedd@t-online.de>, using code from LexOthers.cxx.
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
int state = SCE_INNO_DEFAULT;
char chPrev;
char ch = 0;
char chNext = styler[startPos];
int lengthDoc = startPos + length;
char *buffer = new char[length];
int bufferCount = 0;
bool isBOL, isEOL, isWS, isBOLWS = 0;
WordList &sectionKeywords = *keywordLists[0];
WordList &standardKeywords = *keywordLists[1];
WordList &parameterKeywords = *keywordLists[2];
WordList &preprocessorKeywords = *keywordLists[3];
WordList &pascalKeywords = *keywordLists[4];
WordList &userKeywords = *keywordLists[5];
// Go through all provided text segment
// using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
for (int i = startPos; i < lengthDoc; i++) {
chPrev = ch;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
i++;
continue;
}
isBOL = (chPrev == 0) || (chPrev == '\n') || (chPrev == '\r' && ch != '\n');
isBOLWS = (isBOL) ? 1 : (isBOLWS && (chPrev == ' ' || chPrev == '\t'));
isEOL = (ch == '\n' || ch == '\r');
isWS = (ch == ' ' || ch == '\t');
switch(state) {
case SCE_INNO_DEFAULT:
if (ch == ';' && isBOLWS) {
// Start of a comment
state = SCE_INNO_COMMENT;
} else if (ch == '[' && isBOLWS) {
// Start of a section name
bufferCount = 0;
state = SCE_INNO_SECTION;
} else if (ch == '#' && isBOLWS) {
// Start of a preprocessor directive
state = SCE_INNO_PREPROC;
} else if (ch == '{' && chNext == '#') {
// Start of a preprocessor inline directive
state = SCE_INNO_PREPROC_INLINE;
} else if ((ch == '{' && (chNext == ' ' || chNext == '\t'))
|| (ch == '(' && chNext == '*')) {
// Start of a Pascal comment
state = SCE_INNO_COMMENT_PASCAL;
} else if (ch == '"') {
// Start of a double-quote string
state = SCE_INNO_STRING_DOUBLE;
} else if (ch == '\'') {
// Start of a single-quote string
state = SCE_INNO_STRING_SINGLE;
} else if (isascii(ch) && (isalpha(ch) || (ch == '_'))) {
// Start of an identifier
bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch));
state = SCE_INNO_IDENTIFIER;
} else {
// Style it the default style
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_COMMENT:
if (isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_COMMENT);
}
break;
case SCE_INNO_IDENTIFIER:
if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else {
state = SCE_INNO_DEFAULT;
buffer[bufferCount] = '\0';
// Check if the buffer contains a keyword
if (standardKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD);
} else if (parameterKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_PARAMETER);
} else if (pascalKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD_PASCAL);
} else if (userKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD_USER);
} else {
styler.ColourTo(i-1,SCE_INNO_DEFAULT);
}
// Push back the faulty character
chNext = styler[i--];
ch = chPrev;
}
break;
case SCE_INNO_SECTION:
if (ch == ']') {
state = SCE_INNO_DEFAULT;
buffer[bufferCount] = '\0';
// Check if the buffer contains a section name
if (sectionKeywords.InList(buffer)) {
styler.ColourTo(i,SCE_INNO_SECTION);
} else {
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
} else if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_PREPROC:
if (isWS || isEOL) {
if (isascii(chPrev) && isalpha(chPrev)) {
state = SCE_INNO_DEFAULT;
buffer[bufferCount] = '\0';
// Check if the buffer contains a preprocessor directive
if (preprocessorKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_PREPROC);
} else {
styler.ColourTo(i-1,SCE_INNO_DEFAULT);
}
// Push back the faulty character
chNext = styler[i--];
ch = chPrev;
}
} else if (isascii(ch) && isalpha(ch)) {
if (chPrev == '#' || chPrev == ' ' || chPrev == '\t')
bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch));
}
break;
case SCE_INNO_STRING_DOUBLE:
if (ch == '"' || isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_STRING_SINGLE:
if (ch == '\'' || isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_PREPROC_INLINE:
if (ch == '}') {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_PREPROC_INLINE);
} else if (isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
case SCE_INNO_COMMENT_PASCAL:
if (ch == '}' || (ch == ')' && chPrev == '*')) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL);
} else if (isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
break;
}
}
delete []buffer;
}
static const char * const innoWordListDesc[] = {
"Sections",
"Keywords",
"Parameters",
"Preprocessor directives",
"Pascal keywords",
"User defined keywords",
0
};
static void FoldInnoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
bool headerPoint = false;
int lev;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler[i+1];
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_INNO_SECTION)
headerPoint = true;
if (atEOL) {
lev = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
int levelPrevious = styler.LevelAt(lineCurrent - 1);
if (levelPrevious & SC_FOLDLEVELHEADERFLAG)
lev = SC_FOLDLEVELBASE + 1;
else
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
}
if (headerPoint)
lev = SC_FOLDLEVELBASE;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (headerPoint)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent))
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
visibleChars = 0;
headerPoint = false;
}
if (!isspacechar(ch))
visibleChars++;
}
if (lineCurrent > 0) {
int levelPrevious = styler.LevelAt(lineCurrent - 1);
if (levelPrevious & SC_FOLDLEVELHEADERFLAG)
lev = SC_FOLDLEVELBASE + 1;
else
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
} else {
lev = SC_FOLDLEVELBASE;
}
int flagsNext = styler.LevelAt(lineCurrent);
styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK);
}
LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc);

View File

@@ -38,7 +38,8 @@ static inline bool IsANumberChar(int ch) {
// but probably enough in most cases.
return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+');
ch == '.' || ch == '-' || ch == '+' ||
(ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'));
}
static inline bool IsLuaOperator(int ch) {
@@ -51,7 +52,8 @@ static inline bool IsLuaOperator(int ch) {
ch == '{' || ch == '}' || ch == '~' ||
ch == '[' || ch == ']' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' ||
ch == '.' || ch == '^' || ch == '%' || ch == ':') {
ch == '.' || ch == '^' || ch == '%' || ch == ':' ||
ch == '#') {
return true;
}
return false;
@@ -144,7 +146,7 @@ static void ColouriseLuaDoc(
if (sc.state == SCE_LUA_OPERATOR) {
sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_NUMBER) {
// We stop the number definition on non-numerical non-dot non-eE non-sign char
// We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char
if (!IsANumberChar(sc.ch)) {
sc.SetState(SCE_LUA_DEFAULT);
}
@@ -225,6 +227,9 @@ static void ColouriseLuaDoc(
if (sc.state == SCE_LUA_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_LUA_NUMBER);
if (sc.ch == '0' && toupper(sc.chNext) == 'X') {
sc.Forward(1);
}
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_LUA_IDENTIFIER);
} else if (sc.ch == '\"') {

View File

@@ -3,7 +3,7 @@
** Lexer for MSSQL.
**/
// By Filip Yaghob <fyaghob@gmail.com>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>

View File

@@ -0,0 +1,518 @@
// Scintilla source code edit control
/** @file LexOpal.cxx
** Lexer for OPAL (functional language similar to Haskell)
** Written by Sebastian Pipping <webmaster@hartwork.org>
**/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
{
unsigned int i = 0;
while( ( i < end - start + 1 ) && ( i < len - 1 ) )
{
s[i] = static_cast<char>( styler[ start + i ] );
i++;
}
s[ i ] = '\0';
}
inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
{
char ch;
// Wait for string to close
bool even_backslash_count = true; // Without gaps in between
cur++; // Skip initial quote
for( ; ; )
{
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_STRING );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( ( ch == '\015' ) || ( ch == '\012' ) ) // Deny multi-line strings
{
styler.ColourTo( cur - 1, SCE_OPAL_STRING );
styler.StartSegment( cur );
return true;
}
else
{
if( even_backslash_count )
{
if( ch == '"' )
{
styler.ColourTo( cur, SCE_OPAL_STRING );
cur++;
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else if( ch == '\\' )
{
even_backslash_count = false;
}
}
else
{
even_backslash_count = true;
}
}
cur++;
}
}
inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
{
char ch;
if( could_fail )
{
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( ch != '*' )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
styler.StartSegment( cur );
return true;
}
}
// Wait for comment close
cur++;
bool star_found = false;
for( ; ; )
{
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_BLOCK );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( star_found )
{
if( ch == '/' )
{
styler.ColourTo( cur, SCE_OPAL_COMMENT_BLOCK );
cur++;
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else if( ch != '*' )
{
star_found = false;
}
}
else if( ch == '*' )
{
star_found = true;
}
cur++;
}
}
inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
{
char ch;
if( could_fail )
{
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( ch != '-' )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
styler.StartSegment( cur );
return true;
}
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( ( ch != ' ' ) && ( ch != '\t' ) )
{
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
styler.StartSegment( cur );
return true;
}
}
// Wait for end of line
bool fifteen_found = false;
for( ; ; )
{
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( fifteen_found )
{
/*
if( ch == '\012' )
{
// One newline on Windows (015, 012)
}
else
{
// One newline on MAC (015) and another char
}
*/
cur--;
styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
styler.StartSegment( cur );
return true;
}
else
{
if( ch == '\015' )
{
fifteen_found = true;
}
else if( ch == '\012' )
{
// One newline on Linux (012)
styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
styler.StartSegment( cur );
return true;
}
}
}
}
inline bool HandlePar( unsigned int & cur, Accessor & styler )
{
styler.ColourTo( cur, SCE_OPAL_PAR );
cur++;
styler.StartSegment( cur );
return true;
}
inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
{
char ch;
cur++;
for( ; ; )
{
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
return false;
}
ch = styler.SafeGetCharAt( cur );
switch( ch )
{
case ' ':
case '\t':
case '\015':
case '\012':
cur++;
break;
default:
styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
styler.StartSegment( cur );
return true;
}
}
}
inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
{
char ch;
for( ; ; )
{
cur++;
if( cur >= one_too_much )
{
styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
return false; // STOP
}
ch = styler.SafeGetCharAt( cur );
if( !isdigit( ch ) )
{
styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
styler.StartSegment( cur );
return true;
}
}
}
inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor & styler, WordList * keywordlists[] )
{
char ch;
const unsigned int beg = cur;
cur++;
for( ; ; )
{
ch = styler.SafeGetCharAt( cur );
if( ( ch != '_' ) && ( ch != '-' ) &&
!islower( ch ) && !isupper( ch ) && !isdigit( ch ) ) break;
cur++;
if( cur >= one_too_much )
{
break;
}
}
const int ide_len = cur - beg + 1;
char * ide = new char[ ide_len ];
getRange( beg, cur, styler, ide, ide_len );
WordList & keywords = *keywordlists[ 0 ];
WordList & classwords = *keywordlists[ 1 ];
if( keywords.InList( ide ) ) // Keyword
{
delete [] ide;
styler.ColourTo( cur - 1, SCE_OPAL_KEYWORD );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else if( classwords.InList( ide ) ) // Sort
{
delete [] ide;
styler.ColourTo( cur - 1, SCE_OPAL_SORT );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else if( !strcmp( ide, "true" ) || !strcmp( ide, "false" ) ) // Bool const
{
delete [] ide;
styler.ColourTo( cur - 1, SCE_OPAL_BOOL_CONST );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
else // Unknown keyword
{
delete [] ide;
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
}
inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
{
cur++;
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
if( cur >= one_too_much )
{
return false; // STOP
}
else
{
styler.StartSegment( cur );
return true;
}
}
static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor & styler )
{
styler.StartAt( startPos );
styler.StartSegment( startPos );
unsigned int & cur = startPos;
const unsigned int one_too_much = startPos + length;
int state = initStyle;
for( ; ; )
{
switch( state )
{
case SCE_OPAL_KEYWORD:
case SCE_OPAL_SORT:
if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
state = SCE_OPAL_DEFAULT;
break;
case SCE_OPAL_INTEGER:
if( !HandleInteger( cur, one_too_much, styler ) ) return;
state = SCE_OPAL_DEFAULT;
break;
case SCE_OPAL_COMMENT_BLOCK:
if( !HandleCommentBlock( cur, one_too_much, styler, false ) ) return;
state = SCE_OPAL_DEFAULT;
break;
case SCE_OPAL_COMMENT_LINE:
if( !HandleCommentLine( cur, one_too_much, styler, false ) ) return;
state = SCE_OPAL_DEFAULT;
break;
case SCE_OPAL_STRING:
if( !HandleString( cur, one_too_much, styler ) ) return;
state = SCE_OPAL_DEFAULT;
break;
default: // SCE_OPAL_DEFAULT:
{
char ch = styler.SafeGetCharAt( cur );
switch( ch )
{
// String
case '"':
if( !HandleString( cur, one_too_much, styler ) ) return;
break;
// Comment block
case '/':
if( !HandleCommentBlock( cur, one_too_much, styler, true ) ) return;
break;
// Comment line
case '-':
if( !HandleCommentLine( cur, one_too_much, styler, true ) ) return;
break;
// Par
case '(':
case ')':
case '[':
case ']':
case '{':
case '}':
if( !HandlePar( cur, styler ) ) return;
break;
// Whitespace
case ' ':
case '\t':
case '\015':
case '\012':
if( !HandleSpace( cur, one_too_much, styler ) ) return;
break;
default:
{
// Integer
if( isdigit( ch ) )
{
if( !HandleInteger( cur, one_too_much, styler ) ) return;
}
// Keyword
else if( islower( ch ) || isupper( ch ) )
{
if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
}
// Skip
else
{
if( !HandleSkip( cur, one_too_much, styler ) ) return;
}
}
}
break;
}
}
}
}
static const char * const opalWordListDesc[] = {
"Keywords",
"Sorts",
0
};
LexerModule lmOpal(SCLEX_OPAL, ColouriseOpalDoc, "opal", NULL, opalWordListDesc);

View File

@@ -41,7 +41,7 @@ static bool IsBOperator(char ch) {
// Tests for BATCH Separators
static bool IsBSeparator(char ch) {
return (ch == ':') || (ch == '\\') || (ch == '.') || (ch == ';') ||
return (ch == '\\') || (ch == '.') || (ch == ';') ||
(ch == '\"') || (ch == '\'') || (ch == '/') || (ch == ')');
}
@@ -50,7 +50,7 @@ static void ColouriseBatchLine(
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
WordList &keywords,
WordList *keywordlists[],
Accessor &styler) {
unsigned int offset = 0; // Line Buffer Offset
@@ -59,7 +59,9 @@ static void ColouriseBatchLine(
char wordBuffer[81]; // Word Buffer - large to catch long paths
unsigned int wbl; // Word Buffer Length
unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length
bool forFound = false; // No Local Variable without FOR statement
WordList &keywords = *keywordlists[0]; // Internal Commands
WordList &keywords2 = *keywordlists[1]; // External Commands (optional)
// CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
// Toggling Regular Keyword Checking off improves readability
// Other Regular Keywords and External Commands / Programs might also benefit from toggling
@@ -174,7 +176,13 @@ static void ColouriseBatchLine(
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Colorize External Command / Program
if (!keywords2) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else if (keywords2.InList(wordBuffer)) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else {
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// Reset External Command / Program Location
cmdLoc = offset;
} else {
@@ -186,10 +194,6 @@ static void ColouriseBatchLine(
// Check for Regular Keyword in list
} else if ((keywords.InList(wordBuffer)) &&
(continueProcessing)) {
// Local Variables do not exist if no FOR statement
if (CompareCaseInsensitive(wordBuffer, "for") == 0) {
forFound = true;
}
// ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking
if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) ||
(CompareCaseInsensitive(wordBuffer, "goto") == 0) ||
@@ -306,8 +310,14 @@ static void ColouriseBatchLine(
}
}
}
// Colorize External command / program
// Colorize External Command / Program
if (!keywords2) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else if (keywords2.InList(wordBuffer)) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else {
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// No need to Reset Offset
// Check for Default Text
} else {
@@ -360,7 +370,7 @@ static void ColouriseBatchLine(
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
// Check for Local Variable (%%a)
} else if ((forFound) &&
} else if (
(wordBuffer[1] == '%') &&
(wordBuffer[2] != '%') &&
(!IsBOperator(wordBuffer[2])) &&
@@ -447,7 +457,6 @@ static void ColouriseBatchDoc(
Accessor &styler) {
char lineBuffer[1024];
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
styler.StartSegment(startPos);
@@ -458,14 +467,14 @@ static void ColouriseBatchDoc(
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0';
ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywords, styler);
ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
keywords, styler);
keywordlists, styler);
}
}
@@ -593,8 +602,8 @@ static void ColourisePropsLine(
while ((i < lengthLine) && (lineBuffer[i] != '='))
i++;
if ((i < lengthLine) && (lineBuffer[i] == '=')) {
styler.ColourTo(startLine + i - 1, SCE_PROPS_DEFAULT);
styler.ColourTo(startLine + i, 3);
styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
@@ -1103,7 +1112,8 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
}
static const char * const batchWordListDesc[] = {
"Keywords",
"Internal Commands",
"External Commands",
0
};

View File

@@ -212,6 +212,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
} else if (sc.state == SCE_P_DECORATOR) {
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_P_DEFAULT);
} else if (sc.ch == '#') {
sc.SetState((sc.chNext == '#') ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
}
} else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
if (sc.ch == '\\') {

View File

@@ -43,7 +43,6 @@ static inline bool IsANumberChar(int ch) {
ch == '.' || ch == '-' || ch == '+');
}
static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
@@ -60,28 +59,8 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0;
int styleBeforeDCKeyword = SCE_C_DEFAULT;
bool fold = styler.GetPropertyInt("fold") != 0;
int lineCurrent = styler.GetLine(startPos);
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
for (; sc.More(); sc.Forward()) {
// Fold based on indentation
if (sc.atLineStart) {
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
int level = indentCurrent;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags);
if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) {
level |= SC_FOLDLEVELHEADERFLAG;
}
}
if (fold) {
styler.SetLevel(lineCurrent, level);
}
}
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_SQL_OPERATOR:
@@ -243,12 +222,14 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
levelCurrent = styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK;
levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
}
int levelNext = levelCurrent;
char chNext = styler[startPos];
@@ -306,7 +287,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
} else {
s[j] = '\0';
}
if (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0) {
if ((!foldOnlyBegin) && (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0)) {
if (endFound) {
// ignore
endFound = false;
@@ -326,16 +307,14 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
}
}
if (atEOL) {
int level = levelCurrent;
if (visibleChars == 0 && foldCompact) {
// Empty line
level |= SC_FOLDLEVELWHITEFLAG;
}
if (visibleChars > 0 && levelNext > levelCurrent) {
level |= SC_FOLDLEVELHEADERFLAG;
}
if (level != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, level);
int levelUse = levelCurrent;
int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;

View File

@@ -0,0 +1,221 @@
// Scintilla source code edit control
/** @file LexSpice.cxx
** Lexer for Spice
**/
// Copyright 2006 by Fabien Proriol
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include "Platform.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "PropSet.h"
#include "KeyWords.h"
#include "SciLexer.h"
#include "SString.h"
/*
* Interface
*/
static void ColouriseDocument(
unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
static const char * const spiceWordListDesc[] = {
"Keywords", // SPICE command
"Keywords2", // SPICE functions
"Keywords3", // SPICE params
0
};
LexerModule lmSpice(SCLEX_SPICE, ColouriseDocument, "spice", NULL, spiceWordListDesc);
/*
* Implementation
*/
static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute);
static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute);
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute);
static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute);
static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute);
static inline bool IsDelimiterCharacter(int ch);
static inline bool IsNumberStartCharacter(int ch);
static inline bool IsNumberCharacter(int ch);
static inline bool IsSeparatorOrDelimiterCharacter(int ch);
static inline bool IsWordStartCharacter(int ch);
static inline bool IsWordCharacter(int ch);
static void ColouriseComment(StyleContext& sc, bool&) {
sc.SetState(SCE_SPICE_COMMENTLINE);
while (!sc.atLineEnd) {
sc.Forward();
}
}
static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = sc.Match (')');
sc.SetState(SCE_SPICE_DELIMITER);
sc.ForwardSetState(SCE_SPICE_DEFAULT);
}
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
SString number;
sc.SetState(SCE_SPICE_NUMBER);
// Get all characters up to a delimiter or a separator, including points, but excluding
// double points (ranges).
while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) {
number += static_cast<char>(sc.ch);
sc.Forward();
}
// Special case: exponent with sign
if ((sc.chPrev == 'e' || sc.chPrev == 'E') &&
(sc.ch == '+' || sc.ch == '-')) {
number += static_cast<char>(sc.ch);
sc.Forward ();
while (!IsSeparatorOrDelimiterCharacter(sc.ch)) {
number += static_cast<char>(sc.ch);
sc.Forward();
}
}
sc.SetState(SCE_SPICE_DEFAULT);
}
static void ColouriseWhiteSpace(StyleContext& sc, bool& ) {
sc.SetState(SCE_SPICE_DEFAULT);
sc.ForwardSetState(SCE_SPICE_DEFAULT);
}
static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
sc.SetState(SCE_SPICE_IDENTIFIER);
SString word;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
word += static_cast<char>(tolower(sc.ch));
sc.Forward();
}
if (keywords.InList(word.c_str())) {
sc.ChangeState(SCE_SPICE_KEYWORD);
if (word != "all") {
apostropheStartsAttribute = false;
}
}
else if (keywords2.InList(word.c_str())) {
sc.ChangeState(SCE_SPICE_KEYWORD2);
if (word != "all") {
apostropheStartsAttribute = false;
}
}
else if (keywords3.InList(word.c_str())) {
sc.ChangeState(SCE_SPICE_KEYWORD3);
if (word != "all") {
apostropheStartsAttribute = false;
}
}
sc.SetState(SCE_SPICE_DEFAULT);
}
//
// ColouriseDocument
//
static void ColouriseDocument(
unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
StyleContext sc(startPos, length, initStyle, styler);
int lineCurrent = styler.GetLine(startPos);
bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
while (sc.More()) {
if (sc.atLineEnd) {
// Go to the next line
sc.Forward();
lineCurrent++;
// Remember the line state for future incremental lexing
styler.SetLineState(lineCurrent, apostropheStartsAttribute);
// Don't continue any styles on the next line
sc.SetState(SCE_SPICE_DEFAULT);
}
// Comments
if ((sc.Match('*') && sc.atLineStart) || sc.Match('*','~')) {
ColouriseComment(sc, apostropheStartsAttribute);
// Whitespace
} else if (IsASpace(sc.ch)) {
ColouriseWhiteSpace(sc, apostropheStartsAttribute);
// Delimiters
} else if (IsDelimiterCharacter(sc.ch)) {
ColouriseDelimiter(sc, apostropheStartsAttribute);
// Numbers
} else if (IsADigit(sc.ch) || sc.ch == '#') {
ColouriseNumber(sc, apostropheStartsAttribute);
// Keywords or identifiers
} else {
ColouriseWord(sc, keywords, keywords2, keywords3, apostropheStartsAttribute);
}
}
sc.Complete();
}
static inline bool IsDelimiterCharacter(int ch) {
switch (ch) {
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
case '-':
case '.':
case '/':
case ':':
case ';':
case '<':
case '=':
case '>':
case '|':
return true;
default:
return false;
}
}
static inline bool IsNumberCharacter(int ch) {
return IsNumberStartCharacter(ch) ||
ch == '_' ||
ch == '.' ||
ch == '#' ||
(ch >= 'a' && ch <= 'f') ||
(ch >= 'A' && ch <= 'F');
}
static inline bool IsNumberStartCharacter(int ch) {
return IsADigit(ch);
}
static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
return IsASpace(ch) || IsDelimiterCharacter(ch);
}
static inline bool IsWordCharacter(int ch) {
return IsWordStartCharacter(ch) || IsADigit(ch);
}
static inline bool IsWordStartCharacter(int ch) {
return (isascii(ch) && isalpha(ch)) || ch == '_';
}

View File

@@ -0,0 +1,362 @@
// Scintilla source code edit control
/** @file LexTCL.cxx
** Lexer for TCL language.
**/
// Copyright 1998-2001 by Andre Arpin <arpin@kingston.net>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
return ch >= 0x80 ||
(isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator
}
static inline bool IsAWordStart(int ch) {
return ch >= 0x80 || (ch ==':' || isalpha(ch) || ch == '_');
}
static inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
(IsADigit(ch, 0x10) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+');
}
static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *keywordlists[], Accessor &styler) {
#define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT)
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool commentLevel = false;
bool subBrace = false; // substitution begin with a brace ${.....}
enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,
LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 } lineState = LS_DEFAULT;
bool prevSlash = false;
int currentLevel = 0;
bool expected = 0;
bool subParen = 0;
int currentLine = styler.GetLine(startPos);
if (currentLine > 0)
currentLine--;
length += startPos - styler.LineStart(currentLine);
// make sure lines overlap
startPos = styler.LineStart(currentLine);
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
WordList &keywords9 = *keywordlists[8];
if (currentLine > 0) {
int ls = styler.GetLineState(currentLine - 1);
lineState = tLineState(ls & LS_MASK_STATE);
expected = LS_COMMAND_EXPECTED == tLineState(ls & LS_COMMAND_EXPECTED);
subBrace = LS_BRACE_ONLY == tLineState(ls & LS_BRACE_ONLY);
currentLevel = styler.LevelAt(currentLine - 1) >> 17;
commentLevel = (styler.LevelAt(currentLine - 1) >> 16) & 1;
} else
styler.SetLevel(0, SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG);
bool visibleChars = false;
int previousLevel = currentLevel;
StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler);
for (; ; sc.Forward()) {
next:
if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac
continue;
bool atEnd = !sc.More(); // make sure we coloured the last word
if (lineState != LS_DEFAULT) {
sc.SetState(SCE_TCL_DEFAULT);
if (lineState == LS_OPEN_COMMENT)
sc.SetState(SCE_TCL_COMMENTLINE);
else if (lineState == LS_OPEN_DOUBLE_QUOTE)
sc.SetState(SCE_TCL_IN_QUOTE);
else if (lineState == LS_COMMENT_BOX && (sc.ch == '#' || (sc.ch == ' ' && sc.chNext=='#')))
sc.SetState(SCE_TCL_COMMENT_BOX);
lineState = LS_DEFAULT;
}
if (subBrace) { // ${ overrides every thing even \ except }
if (sc.ch == '}') {
subBrace = false;
sc.SetState(SCE_TCL_OPERATOR);
sc.ForwardSetState(SCE_TCL_DEFAULT);
goto next;
}
else
sc.SetState(SCE_TCL_SUB_BRACE);
if (!sc.atLineEnd)
continue;
} else if (sc.state == SCE_TCL_DEFAULT || sc.state ==SCE_TCL_OPERATOR) {
expected &= isspacechar(static_cast<unsigned char>(sc.ch)) || IsAWordStart(sc.ch) || sc.ch =='#';
} else if (sc.state == SCE_TCL_SUBSTITUTION) {
switch(sc.ch) {
case '(':
subParen=true;
sc.SetState(SCE_TCL_OPERATOR);
sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
continue;
case ')':
sc.SetState(SCE_TCL_OPERATOR);
subParen=false;
continue;
case '$':
continue;
case ',':
sc.SetState(SCE_TCL_OPERATOR);
if (subParen)
sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
continue;
default :
// maybe spaces should be allowed ???
if (!IsAWordChar(sc.ch)) { // probably the code is wrong
sc.SetState(SCE_TCL_DEFAULT);
subParen = 0;
}
break;
}
} else if (isComment(sc.state)) {
} else if (!IsAWordChar(sc.ch)) {
if ((sc.state == SCE_TCL_IDENTIFIER && expected) || sc.state == SCE_TCL_MODIFIER) {
char w[100];
char *s=w;
sc.GetCurrent(w, sizeof(w));
if (w[strlen(w)-1]=='\r')
w[strlen(w)-1]=0;
while(*s == ':') // ignore leading : like in ::set a 10
++s;
bool quote = sc.state == SCE_TCL_IN_QUOTE;
if (commentLevel || expected) {
if (keywords.InList(s)) {
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD4);
} else if (sc.GetRelative(-static_cast<int>(strlen(s))-1) == '{' &&
keywords5.InList(s) && sc.ch == '}') { // {keyword} exactly no spaces
sc.ChangeState(SCE_TCL_EXPAND);
}
if (keywords6.InList(s)) {
sc.ChangeState(SCE_TCL_WORD5);
} else if (keywords7.InList(s)) {
sc.ChangeState(SCE_TCL_WORD6);
} else if (keywords8.InList(s)) {
sc.ChangeState(SCE_TCL_WORD7);
} else if (keywords9.InList(s)) {
sc.ChangeState(SCE_TCL_WORD8);
}
}
expected = false;
sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT);
} else if (sc.state == SCE_TCL_MODIFIER || sc.state == SCE_TCL_IDENTIFIER) {
sc.SetState(SCE_TCL_DEFAULT);
}
}
if (atEnd)
break;
if (sc.atLineEnd) {
lineState = LS_DEFAULT;
currentLine = styler.GetLine(sc.currentPos);
if (foldComment && sc.state!=SCE_TCL_COMMENT && isComment(sc.state)) {
if (currentLevel == 0) {
++currentLevel;
commentLevel = true;
}
} else {
if (visibleChars && commentLevel) {
--currentLevel;
--previousLevel;
commentLevel = false;
}
}
int flag = 0;
if (!visibleChars)
flag = SC_FOLDLEVELWHITEFLAG;
if (currentLevel > previousLevel)
flag = SC_FOLDLEVELHEADERFLAG;
styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16));
// Update the line state, so it can be seen by next line
if (sc.state == SCE_TCL_IN_QUOTE)
lineState = LS_OPEN_DOUBLE_QUOTE;
else {
if (prevSlash) {
if (isComment(sc.state))
lineState = LS_OPEN_COMMENT;
} else if (sc.state == SCE_TCL_COMMENT_BOX)
lineState = LS_COMMENT_BOX;
}
styler.SetLineState(currentLine,
(subBrace ? LS_BRACE_ONLY : 0) |
(expected ? LS_COMMAND_EXPECTED : 0) | lineState);
if (lineState == LS_COMMENT_BOX)
sc.ForwardSetState(SCE_TCL_COMMENT_BOX);
else if (lineState == LS_OPEN_DOUBLE_QUOTE)
sc.ForwardSetState(SCE_TCL_IN_QUOTE);
else
sc.ForwardSetState(SCE_TCL_DEFAULT);
prevSlash = false;
previousLevel = currentLevel;
goto next;
}
if (prevSlash) {
prevSlash = false;
if (sc.ch == '#' && IsANumberChar(sc.chNext))
sc.ForwardSetState(SCE_TCL_NUMBER);
continue;
}
prevSlash = sc.ch == '\\';
if (isComment(sc.state))
continue;
if (sc.atLineStart) {
visibleChars = false;
if (sc.state!=SCE_TCL_IN_QUOTE && !isComment(sc.state))
{
sc.SetState(SCE_TCL_DEFAULT);
expected = IsAWordStart(sc.ch)|| isspacechar(static_cast<unsigned char>(sc.ch));
}
}
switch (sc.state) {
case SCE_TCL_NUMBER:
if (!IsANumberChar(sc.ch))
sc.SetState(SCE_TCL_DEFAULT);
break;
case SCE_TCL_IN_QUOTE:
if (sc.ch == '"') {
sc.ForwardSetState(SCE_TCL_DEFAULT);
visibleChars = true; // necessary if a " is the first and only character on a line
goto next;
} else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') {
sc.SetState(SCE_TCL_OPERATOR);
expected = sc.ch == '[';
sc.ForwardSetState(SCE_TCL_IN_QUOTE);
goto next;
}
continue;
case SCE_TCL_OPERATOR:
sc.SetState(SCE_TCL_DEFAULT);
break;
}
if (sc.ch == '#') {
if (visibleChars) {
if (sc.state != SCE_TCL_IN_QUOTE && expected)
sc.SetState(SCE_TCL_COMMENT);
} else {
sc.SetState(SCE_TCL_COMMENTLINE);
if (sc.chNext == '~')
sc.SetState(SCE_TCL_BLOCK_COMMENT);
if (sc.atLineStart && (sc.chNext == '#' || sc.chNext == '-'))
sc.SetState(SCE_TCL_COMMENT_BOX);
}
}
if (!isspacechar(static_cast<unsigned char>(sc.ch))) {
visibleChars = true;
}
if (sc.ch == '\\') {
prevSlash = true;
continue;
}
// Determine if a new state should be entered.
if (sc.state == SCE_TCL_DEFAULT) {
if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_TCL_IDENTIFIER);
} else if (IsADigit(sc.ch) && !IsAWordChar(sc.chPrev)) {
sc.SetState(SCE_TCL_NUMBER);
} else {
switch (sc.ch) {
case '\"':
sc.SetState(SCE_TCL_IN_QUOTE);
break;
case '{':
sc.SetState(SCE_TCL_OPERATOR);
expected = true;
++currentLevel;
break;
case '}':
sc.SetState(SCE_TCL_OPERATOR);
--currentLevel;
break;
case '[':
expected = true;
case ']':
case '(':
case ')':
sc.SetState(SCE_TCL_OPERATOR);
break;
case ';':
expected = true;
break;
case '$':
subParen = 0;
if (sc.chNext != '{') {
sc.SetState(SCE_TCL_SUBSTITUTION);
}
else {
sc.SetState(SCE_TCL_OPERATOR); // $
sc.Forward(); // {
sc.ForwardSetState(SCE_TCL_SUB_BRACE);
subBrace = true;
}
break;
case '#':
if ((isspacechar(static_cast<unsigned char>(sc.chPrev))||
isoperator(static_cast<char>(sc.chPrev))) && IsADigit(sc.chNext,0x10))
sc.SetState(SCE_TCL_NUMBER);
break;
case '-':
sc.SetState(IsADigit(sc.chNext)? SCE_TCL_NUMBER: SCE_TCL_MODIFIER);
break;
default:
if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_TCL_OPERATOR);
}
}
}
}
}
sc.Complete();
}
static const char * const tclWordListDesc[] = {
"TCL Keywords",
"TK Keywords",
"iTCL Keywords",
"tkCommands",
"expand"
"user1",
"user2",
"user3",
"user4",
0
};
// this code supports folding in the colourizer
LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc);

View File

@@ -15,11 +15,13 @@ public:
int markType;
ColourPair fore;
ColourPair back;
int alpha;
XPM *pxpm;
LineMarker() {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
}
LineMarker(const LineMarker &) {
@@ -27,6 +29,7 @@ public:
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
}
~LineMarker() {
@@ -37,6 +40,7 @@ public:
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
delete pxpm;
pxpm = NULL;
return *this;

View File

@@ -15,7 +15,7 @@
* Removed all use of register.
* Converted to modern function prototypes.
* Put all global/static variables into an object so this code can be
* used from multiple threads etc.
* used from multiple threads, etc.
*
* These routines are the PUBLIC DOMAIN equivalents of regex
* routines as found in 4.nBSD UN*X, with minor extensions.
@@ -32,62 +32,60 @@
* Interfaces:
* RESearch::Compile: compile a regular expression into a NFA.
*
* char *RESearch::Compile(s)
* char *s;
* const char *RESearch::Compile(const char *pat, int length,
* bool caseSensitive, bool posix)
*
* Returns a short error string if they fail.
*
* RESearch::Execute: execute the NFA to match a pattern.
*
* int RESearch::Execute(s)
* char *s;
*
* RESearch::ModifyWord change RESearch::Execute's understanding of what a "word"
* looks like (for \< and \>) by adding into the
* hidden word-syntax table.
*
* void RESearch::ModifyWord(s)
* char *s;
* int RESearch::Execute(characterIndexer &ci, int lp, int endp)
*
* RESearch::Substitute: substitute the matched portions in a new string.
*
* int RESearch::Substitute(src, dst)
* char *src;
* char *dst;
* int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst)
*
* re_fail: failure routine for RESearch::Execute.
* re_fail: failure routine for RESearch::Execute. (no longer used)
*
* void re_fail(msg, op)
* char *msg;
* char op;
* void re_fail(char *msg, char op)
*
* Regular Expressions:
*
* [1] char matches itself, unless it is a special
* character (metachar): . \ [ ] * + ^ $
* and ( ) if posix option.
*
* [2] . matches any character.
*
* [3] \ matches the character following it, except
* when followed by a left or right round bracket,
* a digit 1 to 9 or a left or right angle bracket.
* (see [7], [8] and [9])
* [3] \ matches the character following it, except:
* - \a, \b, \f, \n, \t, \v match the
* corresponding C escape char;
* - if not in posix mode, when followed by a
* left or right round bracket (see [7]);
* - when followed by a digit 1 to 9 (see [8]);
* - when followed by a left or right angle bracket
* (see [9]).
* It is used as an escape character for all
* other meta-characters, and itself. When used
* in a set ([4]), it is treated as an ordinary
* character.
* character (except for escape chars).
*
* [4] [set] matches one of the characters in the set.
* If the first character in the set is "^",
* it matches a character NOT in the set, i.e.
* complements the set. A shorthand S-E is
* used to specify a set of characters S upto
* complements the set. A shorthand S-E (start-end)
* is used to specify a set of characters S upto
* E, inclusive. The special characters "]" and
* "-" have no special meaning if they appear
* as the first chars in the set.
* as the first chars in the set. To include both,
* put - first: [-]A-Z]:
* [-]|] matches these 2 chars,
* []-|] matches from ] to | chars.
* examples: match:
*
* [a-z] any lowercase alpha
*
* [^]-] any char except ] and -
* [^-]] any char except - and ]
*
* [^A-Z] any char except uppercase
* alpha
@@ -101,10 +99,10 @@
* [6] + same as [5], except it matches one or more.
*
* [7] a regular expression in the form [1] to [10], enclosed
* as \(form\) matches what form matches. The enclosure
* creates a set of tags, used for [8] and for
* pattern substution. The tagged forms are numbered
* starting from 1.
* as \(form\) (or (form) with posix flag) matches what
* form matches. The enclosure creates a set of tags,
* used for [8] and for pattern substitution.
* The tagged forms are numbered starting from 1.
*
* [8] a \ followed by a digit 1 to 9 matches whatever a
* previously tagged regular expression ([7]) matched.
@@ -147,8 +145,8 @@
*
* This implementation uses a bit-set representation for character
* classes for speed and compactness. Each character is represented
* by one bit in a 128-bit block. Thus, CCL always takes a
* constant 16 bytes in the internal nfa, and RESearch::Execute does a single
* by one bit in a 256-bit block. Thus, CCL always takes a
* constant 32 bytes in the internal nfa, and RESearch::Execute does a single
* bit comparison to locate the character in the set.
*
* Examples:
@@ -174,8 +172,14 @@
* matches: foo-foo fo-fo fob-fob foobar-foobar ...
*/
#include "CharClassify.h"
#include "RESearch.h"
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4514)
#endif
#define OKP 1
#define NOP 0
@@ -200,13 +204,19 @@
#define BLKIND 0370
#define BITIND 07
#define ASCIIB 0177
const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
#define badpat(x) (*nfa = END, x)
RESearch::RESearch() {
/*
* Character classification table for word boundary operators BOW
* and EOW is passed in by the creator of this object (Scintilla
* Document). The Document default state is that word chars are:
* 0-9,a-z, A-Z and _
*/
RESearch::RESearch(CharClassify *charClassTable) {
charClass = charClassTable;
Init();
}
@@ -285,8 +295,8 @@ const char escapeValue(char ch) {
const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
char *mp=nfa; /* nfa pointer */
char *lp; /* saved pointer.. */
char *sp=nfa; /* another one.. */
char *lp; /* saved pointer */
char *sp=nfa; /* another one */
char *mpMax = mp + MAXNFA - BITBLK - 10;
int tagi = 0; /* tag stack index */
@@ -310,11 +320,11 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
lp = mp;
switch(*p) {
case '.': /* match any char.. */
case '.': /* match any char */
*mp++ = ANY;
break;
case '^': /* match beginning.. */
case '^': /* match beginning */
if (p == pat)
*mp++ = BOL;
else {
@@ -323,7 +333,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
}
break;
case '$': /* match endofline.. */
case '$': /* match endofline */
if (!*(p+1))
*mp++ = EOL;
else {
@@ -332,7 +342,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
}
break;
case '[': /* match char class..*/
case '[': /* match char class */
*mp++ = CCL;
i++;
@@ -384,12 +394,12 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
break;
case '*': /* match 0 or more.. */
case '+': /* match 1 or more.. */
case '*': /* match 0 or more... */
case '+': /* match 1 or more... */
if (p == pat)
return badpat("Empty closure");
lp = sp; /* previous opcode */
if (*lp == CLO) /* equivalence.. */
if (*lp == CLO) /* equivalence... */
break;
switch(*lp) {
@@ -417,7 +427,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
mp = sp;
break;
case '\\': /* tags, backrefs .. */
case '\\': /* tags, backrefs... */
i++;
switch(*++p) {
@@ -619,53 +629,25 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
* At the end of a successful match, bopat[n] and eopat[n]
* are set to the beginning and end of subpatterns matched
* by tagged expressions (n = 1 to 9).
*
*/
extern void re_fail(char *,char);
/*
* character classification table for word boundary operators BOW
* and EOW. the reason for not using ctype macros is that we can
* let the user add into our own table. see RESearch::ModifyWord. This table
* is not in the bitset form, since we may wish to extend it in the
* future for other character classifications.
*
* TRUE for 0-9 A-Z a-z _
*/
static char chrtyp[MAXCHR] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 0
};
#define inascii(x) (0177&(x))
#define iswordc(x) chrtyp[inascii(x)]
#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
/*
* skip values for CLO XXX to skip past the closure
*/
#define ANYSKIP 2 /* [CLO] ANY END ... */
#define CHRSKIP 3 /* [CLO] CHR chr END ... */
#define CCLSKIP 34 /* [CLO] CCL 32bytes END ... */
#define ANYSKIP 2 /* [CLO] ANY END */
#define CHRSKIP 3 /* [CLO] CHR chr END */
#define CCLSKIP 34 /* [CLO] CCL 32 bytes END */
int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
int op, c, n;
int e; /* extra pointer for CLO */
int bp; /* beginning of subpat.. */
int ep; /* ending of subpat.. */
int bp; /* beginning of subpat... */
int ep; /* ending of subpat... */
int are; /* to save the line ptr. */
while ((op = *ap++) != END)
@@ -756,35 +738,6 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
return lp;
}
/*
* RESearch::ModifyWord:
* add new characters into the word table to change RESearch::Execute's
* understanding of what a word should look like. Note that we
* only accept additions into the word definition.
*
* If the string parameter is 0 or null string, the table is
* reset back to the default containing A-Z a-z 0-9 _. [We use
* the compact bitset representation for the default table]
*/
static char deftab[16] = {
0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',
'\376', '\377', '\377', 007
};
void RESearch::ModifyWord(char *s) {
int i;
if (!s || !*s) {
for (i = 0; i < MAXCHR; i++)
if (!isinset(deftab,i))
iswordc(i) = 0;
}
else
while(*s)
iswordc(*s++) = 1;
}
/*
* RESearch::Substitute:
* substitute the matched portions of the src in dst.

View File

@@ -27,16 +27,11 @@ public:
class RESearch {
public:
RESearch();
RESearch(CharClassify *charClassTable);
~RESearch();
void Init();
void Clear();
bool GrabMatches(CharacterIndexer &ci);
void ChSet(char c);
void ChSetWithCase(char c, bool caseSensitive);
const char *Compile(const char *pat, int length, bool caseSensitive, bool posix);
int Execute(CharacterIndexer &ci, int lp, int endp);
void ModifyWord(char *s);
int Substitute(CharacterIndexer &ci, char *src, char *dst);
enum {MAXTAG=10};
@@ -48,15 +43,23 @@ public:
char *pat[MAXTAG];
private:
void Init();
void Clear();
void ChSet(char c);
void ChSetWithCase(char c, bool caseSensitive);
int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
int bol;
int tagstk[MAXTAG]; /* subpat tag stack..*/
char nfa[MAXNFA]; /* automaton.. */
int tagstk[MAXTAG]; /* subpat tag stack */
char nfa[MAXNFA]; /* automaton */
int sta;
char bittab[BITBLK]; /* bit table for CCL */
/* pre-set bits... */
char bittab[BITBLK]; /* bit table for CCL pre-set bits */
int failure;
CharClassify *charClass;
bool iswordc(unsigned char x) {
return charClass->IsWord(x);
}
};
#endif

View File

@@ -31,6 +31,7 @@
#include "Style.h"
#include "ViewStyle.h"
#include "AutoComplete.h"
#include "CharClassify.h"
#include "Document.h"
#include "Editor.h"
#include "ScintillaBase.h"
@@ -368,12 +369,19 @@ int ScintillaBase::AutoCompleteGetCurrent() {
void ScintillaBase::CallTipShow(Point pt, const char *defn) {
AutoCompleteCancel();
pt.y += vs.lineHeight;
// If container knows about STYLE_CALLTIP then use it in place of the
// STYLE_DEFAULT for the face name, size and character set. Also use it
// for the foreground and background colour.
int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
if (ct.UseStyleCallTip()) {
ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
}
PRectangle rc = ct.CallTipStart(currentPos, pt,
defn,
vs.styles[STYLE_DEFAULT].fontName,
vs.styles[STYLE_DEFAULT].sizeZoomed,
vs.styles[ctStyle].fontName,
vs.styles[ctStyle].sizeZoomed,
CodePage(),
vs.styles[STYLE_DEFAULT].characterSet,
vs.styles[ctStyle].characterSet,
wMain);
// If the call-tip window would be out of the client
// space, adjust so it displays above the text.
@@ -461,7 +469,7 @@ void ScintillaBase::Colourise(int start, int end) {
int styleStart = 0;
if (start > 0)
styleStart = styler.StyleAt(start - 1);
styleStart = styler.StyleAt(start - 1) & pdoc->stylingBitsMask;
styler.SetCodePage(pdoc->dbcsCodePage);
if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available
@@ -624,11 +632,13 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
case SCI_CALLTIPSETBACK:
ct.colourBG = ColourDesired(wParam);
vs.styles[STYLE_CALLTIP].fore = ct.colourBG;
InvalidateStyleRedraw();
break;
case SCI_CALLTIPSETFORE:
ct.colourUnSel = ColourDesired(wParam);
vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
InvalidateStyleRedraw();
break;
@@ -637,6 +647,11 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
InvalidateStyleRedraw();
break;
case SCI_CALLTIPUSESTYLE:
ct.SetTabSize((int)wParam);
InvalidateStyleRedraw();
break;
case SCI_USEPOPUP:
displayPopupMenu = wParam != 0;
break;

View File

@@ -17,7 +17,7 @@
#include "ViewStyle.h"
MarginStyle::MarginStyle() :
symbol(false), width(16), mask(0xffffffff), sensitive(false) {
style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) {
}
// A list of the fontnames - avoids wasting space in each style
@@ -73,6 +73,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
selbackground2.desired = source.selbackground2.desired;
selAlpha = source.selAlpha;
foldmarginColourSet = source.foldmarginColourSet;
foldmarginColour.desired = source.foldmarginColour.desired;
@@ -95,6 +96,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
caretcolour.desired = source.caretcolour.desired;
showCaretLineBackground = source.showCaretLineBackground;
caretLineBackground.desired = source.caretLineBackground.desired;
caretLineAlpha = source.caretLineAlpha;
edgecolour.desired = source.edgecolour.desired;
edgeState = source.edgeState;
caretWidth = source.caretWidth;
@@ -140,6 +142,7 @@ void ViewStyle::Init() {
selbackset = true;
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
selAlpha = SC_ALPHA_NOALPHA;
foldmarginColourSet = false;
foldmarginColour.desired = ColourDesired(0xff, 0, 0);
@@ -157,6 +160,7 @@ void ViewStyle::Init() {
caretcolour.desired = ColourDesired(0, 0, 0);
showCaretLineBackground = false;
caretLineBackground.desired = ColourDesired(0xff, 0xff, 0);
caretLineAlpha = SC_ALPHA_NOALPHA;
edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
edgeState = EDGE_NONE;
caretWidth = 1;
@@ -171,13 +175,13 @@ void ViewStyle::Init() {
leftMarginWidth = 1;
rightMarginWidth = 1;
ms[0].symbol = false;
ms[0].style = SC_MARGIN_NUMBER;
ms[0].width = 0;
ms[0].mask = 0;
ms[1].symbol = true;
ms[1].style = SC_MARGIN_SYMBOL;
ms[1].width = 16;
ms[1].mask = ~SC_MASK_FOLDERS;
ms[2].symbol = true;
ms[2].style = SC_MARGIN_SYMBOL;
ms[2].width = 0;
ms[2].mask = 0;
fixedColumnWidth = leftMarginWidth;
@@ -185,7 +189,7 @@ void ViewStyle::Init() {
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
symbolMargin = symbolMargin || ms[margin].symbol;
symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
@@ -256,7 +260,7 @@ void ViewStyle::Refresh(Surface &surface) {
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
symbolMargin = symbolMargin || ms[margin].symbol;
symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
@@ -278,6 +282,10 @@ void ViewStyle::ClearStyles() {
}
}
styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
// Set call tip fore/back to match the values previously set for call tips
styles[STYLE_CALLTIP].back.desired = ColourDesired(0xff, 0xff, 0xff);
styles[STYLE_CALLTIP].fore.desired = ColourDesired(0x80, 0x80, 0x80);
}
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {

View File

@@ -12,7 +12,7 @@
*/
class MarginStyle {
public:
bool symbol;
int style;
int width;
int mask;
bool sensitive;
@@ -53,6 +53,7 @@ public:
bool selbackset;
ColourPair selbackground;
ColourPair selbackground2;
int selAlpha;
bool whitespaceForegroundSet;
ColourPair whitespaceForeground;
bool whitespaceBackgroundSet;
@@ -70,7 +71,7 @@ public:
bool hotspotUnderline;
bool hotspotSingleLine;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
enum { margins=3 };
enum { margins=5 };
int leftMarginWidth; ///< Spacing margin on left of text
int rightMarginWidth; ///< Spacing margin on left of text
bool symbolMargin;
@@ -85,6 +86,7 @@ public:
ColourPair caretcolour;
bool showCaretLineBackground;
ColourPair caretLineBackground;
int caretLineAlpha;
ColourPair edgecolour;
int edgeState;
int caretWidth;

View File

@@ -535,6 +535,11 @@ void wxStyledTextCtrl::MarkerAddSet(int line, int set) {
SendMsg(2466, line, set);
}
// Set the alpha used for a marker that is drawn in the text area, not the margin.
void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber, int alpha) {
SendMsg(2476, markerNumber, alpha);
}
// Set a margin to be either numeric or symbolic.
void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
SendMsg(2240, margin, marginType);
@@ -645,6 +650,16 @@ void wxStyledTextCtrl::SetSelBackground(bool useSetting, const wxColour& back) {
SendMsg(2068, useSetting, wxColourAsLong(back));
}
// Get the alpha of the selection.
int wxStyledTextCtrl::GetSelAlpha() {
return SendMsg(2477, 0, 0);
}
// Set the alpha of the selection.
void wxStyledTextCtrl::SetSelAlpha(int alpha) {
SendMsg(2478, alpha, 0);
}
// Set the foreground colour of the caret.
void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
SendMsg(2069, wxColourAsLong(fore), 0);
@@ -1445,6 +1460,11 @@ void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour& fore) {
SendMsg(2207, wxColourAsLong(fore), 0);
}
// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
void wxStyledTextCtrl::CallTipUseStyle(int tabSize) {
SendMsg(2212, tabSize, 0);
}
// Find the display line of a document line taking hidden lines into account.
int wxStyledTextCtrl::VisibleFromDocLine(int line) {
return SendMsg(2220, line, 0);
@@ -2481,6 +2501,16 @@ void wxStyledTextCtrl::SelectionDuplicate() {
SendMsg(2469, 0, 0);
}
// Set background alpha of the caret line.
void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha) {
SendMsg(2470, alpha, 0);
}
// Get the background alpha of the caret line.
int wxStyledTextCtrl::GetCaretLineBackAlpha() {
return SendMsg(2471, 0, 0);
}
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord() {
SendMsg(3001, 0, 0);

View File

@@ -155,6 +155,9 @@ DocStr(wxStyledTextCtrl::MarkerDefineBitmap,
DocStr(wxStyledTextCtrl::MarkerAddSet,
"Add a set of markers to a line.", "");
DocStr(wxStyledTextCtrl::MarkerSetAlpha,
"Set the alpha used for a marker that is drawn in the text area, not the margin.", "");
DocStr(wxStyledTextCtrl::SetMarginType,
"Set a margin to be either numeric or symbolic.", "");
@@ -221,6 +224,12 @@ DocStr(wxStyledTextCtrl::SetSelForeground,
DocStr(wxStyledTextCtrl::SetSelBackground,
"Set the background colour of the selection and whether to use this setting.", "");
DocStr(wxStyledTextCtrl::GetSelAlpha,
"Get the alpha of the selection.", "");
DocStr(wxStyledTextCtrl::SetSelAlpha,
"Set the alpha of the selection.", "");
DocStr(wxStyledTextCtrl::SetCaretForeground,
"Set the foreground colour of the caret.", "");
@@ -654,6 +663,9 @@ DocStr(wxStyledTextCtrl::CallTipSetForeground,
DocStr(wxStyledTextCtrl::CallTipSetForegroundHighlight,
"Set the foreground colour for the highlighted part of the call tip.", "");
DocStr(wxStyledTextCtrl::CallTipUseStyle,
"Enable use of STYLE_CALLTIP and set call tip tab size in pixels.", "");
DocStr(wxStyledTextCtrl::VisibleFromDocLine,
"Find the display line of a document line taking hidden lines into account.", "");
@@ -1302,6 +1314,12 @@ DocStr(wxStyledTextCtrl::GetPasteConvertEndings,
DocStr(wxStyledTextCtrl::SelectionDuplicate,
"Duplicate the selection. If selection empty duplicate the line containing the caret.", "");
DocStr(wxStyledTextCtrl::SetCaretLineBackAlpha,
"Set background alpha of the caret line.", "");
DocStr(wxStyledTextCtrl::GetCaretLineBackAlpha,
"Get the background alpha of the caret line.", "");
DocStr(wxStyledTextCtrl::StartRecord,
"Start notifying the container of all key presses and commands.", "");

View File

@@ -3,6 +3,7 @@ Recent Changes for wxPython
2.7.0.0
-------
*
The following deprecated items have been removed:
@@ -175,10 +176,48 @@ Added wrappers for the wxAUI classes, in the wx.aui module.
Added the PseudoDC class from Paul Lanier. It provides a way to
record operations on a DC and then play them back later.
Upgraded to Scintilla 1.70 for wx.stc.StyledTextCtrl.
2.6.3.3
-------
* 15-July-2006
wx.lib.pubsub updates from Oliver Schoenborn:
- fixed the hash problem with non-hashable objects
- now supports listeners that use \*args as an argument
(listener(\*args) was not passing the validity test)
- corrected some mistakes in documentation
- added some clarifications (hopefully useful for first time
users)
- changed the way singleton is implemented since old way prevented
pydoc etc from extracting docs for Publisher
DocView and ActiveGrid IDE updates from Morgan Hua:
New Features: In Tab-View mode, Ctrl-number will take the user to
the numbered tab view. Modified files now show an '*' astrisk in
the view title. Debugger framework can now support PHP debugging.
Not important for python development, but at least that means the
debugger framework is more generalized.
wx.lib.mixins.listctrl.TextEditMixin: Fixed the double END_LABEL_EDIT
event problem in TextEditMixin by checking if the editor was already
hidden before continuing with the CloseEditor method. Also added code
to OpenEditor to send the BEGIN_LABEL_EDIT event and to not allow the
opening of the editor to continue if the event handler doesn't allow
it.
Undeprecated wx.GetNumberFromUser and added wx.NumberEntryDialog.
Made necessaary changes for building wxPython for Python 2.5. There
may still be some issues related to the new Py_ssize_t type and 64-bit
machines, but at least all compile errors and warnings related to it
have been resolved.
2.6.3.2
-------