Updated to Scintilla 1.54
Applied most of patch #806092 Added new wxSTC sample from Otto Wyss git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -61,14 +61,18 @@ STCDLL_OBJECTS = \
|
||||
$(OBJS)\stcdll_LexLisp.obj \
|
||||
$(OBJS)\stcdll_LexLout.obj \
|
||||
$(OBJS)\stcdll_LexLua.obj \
|
||||
$(OBJS)\stcdll_LexMMIXAL.obj \
|
||||
$(OBJS)\stcdll_LexMatlab.obj \
|
||||
$(OBJS)\stcdll_LexNsis.obj \
|
||||
$(OBJS)\stcdll_LexOthers.obj \
|
||||
$(OBJS)\stcdll_LexPOV.obj \
|
||||
$(OBJS)\stcdll_LexPS.obj \
|
||||
$(OBJS)\stcdll_LexPascal.obj \
|
||||
$(OBJS)\stcdll_LexPerl.obj \
|
||||
$(OBJS)\stcdll_LexPython.obj \
|
||||
$(OBJS)\stcdll_LexRuby.obj \
|
||||
$(OBJS)\stcdll_LexSQL.obj \
|
||||
$(OBJS)\stcdll_LexScriptol.obj \
|
||||
$(OBJS)\stcdll_LexVB.obj \
|
||||
$(OBJS)\stcdll_LineMarker.obj \
|
||||
$(OBJS)\stcdll_PropSet.obj \
|
||||
@@ -117,14 +121,18 @@ STCLIB_OBJECTS = \
|
||||
$(OBJS)\stclib_LexLisp.obj \
|
||||
$(OBJS)\stclib_LexLout.obj \
|
||||
$(OBJS)\stclib_LexLua.obj \
|
||||
$(OBJS)\stclib_LexMMIXAL.obj \
|
||||
$(OBJS)\stclib_LexMatlab.obj \
|
||||
$(OBJS)\stclib_LexNsis.obj \
|
||||
$(OBJS)\stclib_LexOthers.obj \
|
||||
$(OBJS)\stclib_LexPOV.obj \
|
||||
$(OBJS)\stclib_LexPS.obj \
|
||||
$(OBJS)\stclib_LexPascal.obj \
|
||||
$(OBJS)\stclib_LexPerl.obj \
|
||||
$(OBJS)\stclib_LexPython.obj \
|
||||
$(OBJS)\stclib_LexRuby.obj \
|
||||
$(OBJS)\stclib_LexSQL.obj \
|
||||
$(OBJS)\stclib_LexScriptol.obj \
|
||||
$(OBJS)\stclib_LexVB.obj \
|
||||
$(OBJS)\stclib_LineMarker.obj \
|
||||
$(OBJS)\stclib_PropSet.obj \
|
||||
@@ -336,15 +344,24 @@ $(OBJS)\stcdll_LexLout.obj: ../../src/stc\scintilla\src\LexLout.cxx
|
||||
$(OBJS)\stcdll_LexLua.obj: ../../src/stc\scintilla\src\LexLua.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexMMIXAL.obj: ../../src/stc\scintilla\src\LexMMIXAL.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexMatlab.obj: ../../src/stc\scintilla\src\LexMatlab.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.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) $**
|
||||
|
||||
$(OBJS)\stcdll_LexPOV.obj: ../../src/stc\scintilla\src\LexPOV.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexPS.obj: ../../src/stc\scintilla\src\LexPS.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexPascal.obj: ../../src/stc\scintilla\src\LexPascal.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
@@ -360,6 +377,9 @@ $(OBJS)\stcdll_LexRuby.obj: ../../src/stc\scintilla\src\LexRuby.cxx
|
||||
$(OBJS)\stcdll_LexSQL.obj: ../../src/stc\scintilla\src\LexSQL.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexVB.obj: ../../src/stc\scintilla\src\LexVB.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
@@ -483,15 +503,24 @@ $(OBJS)\stclib_LexLout.obj: ../../src/stc\scintilla\src\LexLout.cxx
|
||||
$(OBJS)\stclib_LexLua.obj: ../../src/stc\scintilla\src\LexLua.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexMMIXAL.obj: ../../src/stc\scintilla\src\LexMMIXAL.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexMatlab.obj: ../../src/stc\scintilla\src\LexMatlab.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.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) $**
|
||||
|
||||
$(OBJS)\stclib_LexPOV.obj: ../../src/stc\scintilla\src\LexPOV.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexPS.obj: ../../src/stc\scintilla\src\LexPS.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexPascal.obj: ../../src/stc\scintilla\src\LexPascal.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
@@ -507,6 +536,9 @@ $(OBJS)\stclib_LexRuby.obj: ../../src/stc\scintilla\src\LexRuby.cxx
|
||||
$(OBJS)\stclib_LexSQL.obj: ../../src/stc\scintilla\src\LexSQL.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexVB.obj: ../../src/stc\scintilla\src\LexVB.cxx
|
||||
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
|
@@ -53,14 +53,18 @@ STCDLL_OBJECTS = \
|
||||
$(OBJS)\stcdll_LexLisp.o \
|
||||
$(OBJS)\stcdll_LexLout.o \
|
||||
$(OBJS)\stcdll_LexLua.o \
|
||||
$(OBJS)\stcdll_LexMMIXAL.o \
|
||||
$(OBJS)\stcdll_LexMatlab.o \
|
||||
$(OBJS)\stcdll_LexNsis.o \
|
||||
$(OBJS)\stcdll_LexOthers.o \
|
||||
$(OBJS)\stcdll_LexPOV.o \
|
||||
$(OBJS)\stcdll_LexPS.o \
|
||||
$(OBJS)\stcdll_LexPascal.o \
|
||||
$(OBJS)\stcdll_LexPerl.o \
|
||||
$(OBJS)\stcdll_LexPython.o \
|
||||
$(OBJS)\stcdll_LexRuby.o \
|
||||
$(OBJS)\stcdll_LexSQL.o \
|
||||
$(OBJS)\stcdll_LexScriptol.o \
|
||||
$(OBJS)\stcdll_LexVB.o \
|
||||
$(OBJS)\stcdll_LineMarker.o \
|
||||
$(OBJS)\stcdll_PropSet.o \
|
||||
@@ -108,14 +112,18 @@ STCLIB_OBJECTS = \
|
||||
$(OBJS)\stclib_LexLisp.o \
|
||||
$(OBJS)\stclib_LexLout.o \
|
||||
$(OBJS)\stclib_LexLua.o \
|
||||
$(OBJS)\stclib_LexMMIXAL.o \
|
||||
$(OBJS)\stclib_LexMatlab.o \
|
||||
$(OBJS)\stclib_LexNsis.o \
|
||||
$(OBJS)\stclib_LexOthers.o \
|
||||
$(OBJS)\stclib_LexPOV.o \
|
||||
$(OBJS)\stclib_LexPS.o \
|
||||
$(OBJS)\stclib_LexPascal.o \
|
||||
$(OBJS)\stclib_LexPerl.o \
|
||||
$(OBJS)\stclib_LexPython.o \
|
||||
$(OBJS)\stclib_LexRuby.o \
|
||||
$(OBJS)\stclib_LexSQL.o \
|
||||
$(OBJS)\stclib_LexScriptol.o \
|
||||
$(OBJS)\stclib_LexVB.o \
|
||||
$(OBJS)\stclib_LineMarker.o \
|
||||
$(OBJS)\stclib_PropSet.o \
|
||||
@@ -326,15 +334,24 @@ $(OBJS)\stcdll_LexLout.o: ../../src/stc/scintilla/src/LexLout.cxx
|
||||
$(OBJS)\stcdll_LexLua.o: ../../src/stc/scintilla/src/LexLua.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexMMIXAL.o: ../../src/stc/scintilla/src/LexMMIXAL.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexMatlab.o: ../../src/stc/scintilla/src/LexMatlab.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexNsis.o: ../../src/stc/scintilla/src/LexNsis.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexOthers.o: ../../src/stc/scintilla/src/LexOthers.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexPOV.o: ../../src/stc/scintilla/src/LexPOV.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexPS.o: ../../src/stc/scintilla/src/LexPS.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexPascal.o: ../../src/stc/scintilla/src/LexPascal.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -350,6 +367,9 @@ $(OBJS)\stcdll_LexRuby.o: ../../src/stc/scintilla/src/LexRuby.cxx
|
||||
$(OBJS)\stcdll_LexSQL.o: ../../src/stc/scintilla/src/LexSQL.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexScriptol.o: ../../src/stc/scintilla/src/LexScriptol.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexVB.o: ../../src/stc/scintilla/src/LexVB.cxx
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -473,15 +493,24 @@ $(OBJS)\stclib_LexLout.o: ../../src/stc/scintilla/src/LexLout.cxx
|
||||
$(OBJS)\stclib_LexLua.o: ../../src/stc/scintilla/src/LexLua.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexMMIXAL.o: ../../src/stc/scintilla/src/LexMMIXAL.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexMatlab.o: ../../src/stc/scintilla/src/LexMatlab.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexNsis.o: ../../src/stc/scintilla/src/LexNsis.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexOthers.o: ../../src/stc/scintilla/src/LexOthers.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexPOV.o: ../../src/stc/scintilla/src/LexPOV.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexPS.o: ../../src/stc/scintilla/src/LexPS.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexPascal.o: ../../src/stc/scintilla/src/LexPascal.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
@@ -497,6 +526,9 @@ $(OBJS)\stclib_LexRuby.o: ../../src/stc/scintilla/src/LexRuby.cxx
|
||||
$(OBJS)\stclib_LexSQL.o: ../../src/stc/scintilla/src/LexSQL.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexScriptol.o: ../../src/stc/scintilla/src/LexScriptol.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexVB.o: ../../src/stc/scintilla/src/LexVB.cxx
|
||||
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
|
@@ -56,14 +56,18 @@ STCDLL_OBJECTS = \
|
||||
$(OBJS)\stcdll_LexLisp.obj \
|
||||
$(OBJS)\stcdll_LexLout.obj \
|
||||
$(OBJS)\stcdll_LexLua.obj \
|
||||
$(OBJS)\stcdll_LexMMIXAL.obj \
|
||||
$(OBJS)\stcdll_LexMatlab.obj \
|
||||
$(OBJS)\stcdll_LexNsis.obj \
|
||||
$(OBJS)\stcdll_LexOthers.obj \
|
||||
$(OBJS)\stcdll_LexPOV.obj \
|
||||
$(OBJS)\stcdll_LexPS.obj \
|
||||
$(OBJS)\stcdll_LexPascal.obj \
|
||||
$(OBJS)\stcdll_LexPerl.obj \
|
||||
$(OBJS)\stcdll_LexPython.obj \
|
||||
$(OBJS)\stcdll_LexRuby.obj \
|
||||
$(OBJS)\stcdll_LexSQL.obj \
|
||||
$(OBJS)\stcdll_LexScriptol.obj \
|
||||
$(OBJS)\stcdll_LexVB.obj \
|
||||
$(OBJS)\stcdll_LineMarker.obj \
|
||||
$(OBJS)\stcdll_PropSet.obj \
|
||||
@@ -115,14 +119,18 @@ STCLIB_OBJECTS = \
|
||||
$(OBJS)\stclib_LexLisp.obj \
|
||||
$(OBJS)\stclib_LexLout.obj \
|
||||
$(OBJS)\stclib_LexLua.obj \
|
||||
$(OBJS)\stclib_LexMMIXAL.obj \
|
||||
$(OBJS)\stclib_LexMatlab.obj \
|
||||
$(OBJS)\stclib_LexNsis.obj \
|
||||
$(OBJS)\stclib_LexOthers.obj \
|
||||
$(OBJS)\stclib_LexPOV.obj \
|
||||
$(OBJS)\stclib_LexPS.obj \
|
||||
$(OBJS)\stclib_LexPascal.obj \
|
||||
$(OBJS)\stclib_LexPerl.obj \
|
||||
$(OBJS)\stclib_LexPython.obj \
|
||||
$(OBJS)\stclib_LexRuby.obj \
|
||||
$(OBJS)\stclib_LexSQL.obj \
|
||||
$(OBJS)\stclib_LexScriptol.obj \
|
||||
$(OBJS)\stclib_LexVB.obj \
|
||||
$(OBJS)\stclib_LineMarker.obj \
|
||||
$(OBJS)\stclib_PropSet.obj \
|
||||
@@ -406,15 +414,24 @@ $(OBJS)\stcdll_LexLout.obj: ../../src/stc\scintilla\src\LexLout.cxx
|
||||
$(OBJS)\stcdll_LexLua.obj: ../../src/stc\scintilla\src\LexLua.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexMMIXAL.obj: ../../src/stc\scintilla\src\LexMMIXAL.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexMatlab.obj: ../../src/stc\scintilla\src\LexMatlab.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.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) $**
|
||||
|
||||
$(OBJS)\stcdll_LexPOV.obj: ../../src/stc\scintilla\src\LexPOV.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexPS.obj: ../../src/stc\scintilla\src\LexPS.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexPascal.obj: ../../src/stc\scintilla\src\LexPascal.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
@@ -430,6 +447,9 @@ $(OBJS)\stcdll_LexRuby.obj: ../../src/stc\scintilla\src\LexRuby.cxx
|
||||
$(OBJS)\stcdll_LexSQL.obj: ../../src/stc\scintilla\src\LexSQL.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stcdll_LexVB.obj: ../../src/stc\scintilla\src\LexVB.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
|
||||
|
||||
@@ -553,15 +573,24 @@ $(OBJS)\stclib_LexLout.obj: ../../src/stc\scintilla\src\LexLout.cxx
|
||||
$(OBJS)\stclib_LexLua.obj: ../../src/stc\scintilla\src\LexLua.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexMMIXAL.obj: ../../src/stc\scintilla\src\LexMMIXAL.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexMatlab.obj: ../../src/stc\scintilla\src\LexMatlab.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.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) $**
|
||||
|
||||
$(OBJS)\stclib_LexPOV.obj: ../../src/stc\scintilla\src\LexPOV.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexPS.obj: ../../src/stc\scintilla\src\LexPS.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexPascal.obj: ../../src/stc\scintilla\src\LexPascal.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
@@ -577,6 +606,9 @@ $(OBJS)\stclib_LexRuby.obj: ../../src/stc\scintilla\src\LexRuby.cxx
|
||||
$(OBJS)\stclib_LexSQL.obj: ../../src/stc\scintilla\src\LexSQL.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stclib_LexVB.obj: ../../src/stc\scintilla\src\LexVB.cxx
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
|
||||
|
||||
|
@@ -214,14 +214,18 @@ STCDLL_OBJECTS = &
|
||||
$(OBJS)\stcdll_LexLisp.obj &
|
||||
$(OBJS)\stcdll_LexLout.obj &
|
||||
$(OBJS)\stcdll_LexLua.obj &
|
||||
$(OBJS)\stcdll_LexMMIXAL.obj &
|
||||
$(OBJS)\stcdll_LexMatlab.obj &
|
||||
$(OBJS)\stcdll_LexNsis.obj &
|
||||
$(OBJS)\stcdll_LexOthers.obj &
|
||||
$(OBJS)\stcdll_LexPOV.obj &
|
||||
$(OBJS)\stcdll_LexPS.obj &
|
||||
$(OBJS)\stcdll_LexPascal.obj &
|
||||
$(OBJS)\stcdll_LexPerl.obj &
|
||||
$(OBJS)\stcdll_LexPython.obj &
|
||||
$(OBJS)\stcdll_LexRuby.obj &
|
||||
$(OBJS)\stcdll_LexSQL.obj &
|
||||
$(OBJS)\stcdll_LexScriptol.obj &
|
||||
$(OBJS)\stcdll_LexVB.obj &
|
||||
$(OBJS)\stcdll_LineMarker.obj &
|
||||
$(OBJS)\stcdll_PropSet.obj &
|
||||
@@ -270,14 +274,18 @@ STCLIB_OBJECTS = &
|
||||
$(OBJS)\stclib_LexLisp.obj &
|
||||
$(OBJS)\stclib_LexLout.obj &
|
||||
$(OBJS)\stclib_LexLua.obj &
|
||||
$(OBJS)\stclib_LexMMIXAL.obj &
|
||||
$(OBJS)\stclib_LexMatlab.obj &
|
||||
$(OBJS)\stclib_LexNsis.obj &
|
||||
$(OBJS)\stclib_LexOthers.obj &
|
||||
$(OBJS)\stclib_LexPOV.obj &
|
||||
$(OBJS)\stclib_LexPS.obj &
|
||||
$(OBJS)\stclib_LexPascal.obj &
|
||||
$(OBJS)\stclib_LexPerl.obj &
|
||||
$(OBJS)\stclib_LexPython.obj &
|
||||
$(OBJS)\stclib_LexRuby.obj &
|
||||
$(OBJS)\stclib_LexSQL.obj &
|
||||
$(OBJS)\stclib_LexScriptol.obj &
|
||||
$(OBJS)\stclib_LexVB.obj &
|
||||
$(OBJS)\stclib_LineMarker.obj &
|
||||
$(OBJS)\stclib_PropSet.obj &
|
||||
@@ -380,15 +388,24 @@ $(OBJS)\stcdll_LexLout.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexLout.cx
|
||||
$(OBJS)\stcdll_LexLua.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexLua.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexMMIXAL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexMMIXAL.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexMatlab.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexMatlab.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexNsis.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexNsis.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexOthers.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOthers.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexPOV.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPOV.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexPS.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPS.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexPascal.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPascal.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -404,6 +421,9 @@ $(OBJS)\stcdll_LexRuby.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexRuby.cx
|
||||
$(OBJS)\stcdll_LexSQL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSQL.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexScriptol.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexScriptol.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_LexVB.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexVB.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -527,15 +547,24 @@ $(OBJS)\stclib_LexLout.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexLout.cx
|
||||
$(OBJS)\stclib_LexLua.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexLua.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexMMIXAL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexMMIXAL.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexMatlab.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexMatlab.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexNsis.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexNsis.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexOthers.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOthers.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexPOV.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPOV.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexPS.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPS.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexPascal.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPascal.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
@@ -551,6 +580,9 @@ $(OBJS)\stclib_LexRuby.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexRuby.cx
|
||||
$(OBJS)\stclib_LexSQL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSQL.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexScriptol.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexScriptol.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stclib_LexVB.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexVB.cxx
|
||||
$(CXX) -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
|
@@ -39,14 +39,18 @@
|
||||
scintilla/src/LexLisp.cxx
|
||||
scintilla/src/LexLout.cxx
|
||||
scintilla/src/LexLua.cxx
|
||||
scintilla/src/LexMMIXAL.cxx
|
||||
scintilla/src/LexMatlab.cxx
|
||||
scintilla/src/LexNsis.cxx
|
||||
scintilla/src/LexOthers.cxx
|
||||
scintilla/src/LexPOV.cxx
|
||||
scintilla/src/LexPS.cxx
|
||||
scintilla/src/LexPascal.cxx
|
||||
scintilla/src/LexPerl.cxx
|
||||
scintilla/src/LexPython.cxx
|
||||
scintilla/src/LexRuby.cxx
|
||||
scintilla/src/LexSQL.cxx
|
||||
scintilla/src/LexScriptol.cxx
|
||||
scintilla/src/LexVB.cxx
|
||||
scintilla/src/LineMarker.cxx
|
||||
scintilla/src/PropSet.cxx
|
||||
|
@@ -560,10 +560,18 @@ SOURCE=../../src/stc\scintilla\src\LexLua.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=../../src/stc\scintilla\src\LexMMIXAL.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=../../src/stc\scintilla\src\LexMatlab.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=../../src/stc\scintilla\src\LexNsis.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=../../src/stc\scintilla\src\LexOthers.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -572,6 +580,10 @@ SOURCE=../../src/stc\scintilla\src\LexPOV.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=../../src/stc\scintilla\src\LexPS.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=../../src/stc\scintilla\src\LexPascal.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -592,6 +604,10 @@ SOURCE=../../src/stc\scintilla\src\LexSQL.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=../../src/stc\scintilla\src\LexScriptol.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=../../src/stc\scintilla\src\LexVB.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@@ -153,6 +153,7 @@
|
||||
#define wxSTC_INDIC_TT 2
|
||||
#define wxSTC_INDIC_DIAGONAL 3
|
||||
#define wxSTC_INDIC_STRIKE 4
|
||||
#define wxSTC_INDIC_HIDDEN 5
|
||||
#define wxSTC_INDIC0_MASK 0x20
|
||||
#define wxSTC_INDIC1_MASK 0x40
|
||||
#define wxSTC_INDIC2_MASK 0x80
|
||||
@@ -234,6 +235,9 @@
|
||||
// where most code reside, and the lines after the caret, eg. the body of a function.
|
||||
#define wxSTC_CARET_EVEN 0x08
|
||||
|
||||
// Maximum value of keywordSet parameter of SetKeyWords.
|
||||
#define wxSTC_KEYWORDSET_MAX 8
|
||||
|
||||
// Notifications
|
||||
// Type of modification and the action which caused the modification.
|
||||
// These are defined as a bit mask to make it easy to specify which notifications are wanted.
|
||||
@@ -318,6 +322,9 @@
|
||||
#define wxSTC_LEX_POV 39
|
||||
#define wxSTC_LEX_LOUT 40
|
||||
#define wxSTC_LEX_ESCRIPT 41
|
||||
#define wxSTC_LEX_PS 42
|
||||
#define wxSTC_LEX_NSIS 43
|
||||
#define wxSTC_LEX_MMIXAL 44
|
||||
|
||||
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -571,6 +578,8 @@
|
||||
#define wxSTC_LUA_WORD4 15
|
||||
#define wxSTC_LUA_WORD5 16
|
||||
#define wxSTC_LUA_WORD6 17
|
||||
#define wxSTC_LUA_WORD7 18
|
||||
#define wxSTC_LUA_WORD8 19
|
||||
|
||||
// Lexical states for SCLEX_ERRORLIST
|
||||
#define wxSTC_ERR_DEFAULT 0
|
||||
@@ -792,14 +801,20 @@
|
||||
#define wxSTC_POV_DEFAULT 0
|
||||
#define wxSTC_POV_COMMENT 1
|
||||
#define wxSTC_POV_COMMENTLINE 2
|
||||
#define wxSTC_POV_COMMENTDOC 3
|
||||
#define wxSTC_POV_NUMBER 4
|
||||
#define wxSTC_POV_WORD 5
|
||||
#define wxSTC_POV_NUMBER 3
|
||||
#define wxSTC_POV_OPERATOR 4
|
||||
#define wxSTC_POV_IDENTIFIER 5
|
||||
#define wxSTC_POV_STRING 6
|
||||
#define wxSTC_POV_OPERATOR 7
|
||||
#define wxSTC_POV_IDENTIFIER 8
|
||||
#define wxSTC_POV_BRACE 9
|
||||
#define wxSTC_POV_STRINGEOL 7
|
||||
#define wxSTC_POV_DIRECTIVE 8
|
||||
#define wxSTC_POV_BADDIRECTIVE 9
|
||||
#define wxSTC_POV_WORD2 10
|
||||
#define wxSTC_POV_WORD3 11
|
||||
#define wxSTC_POV_WORD4 12
|
||||
#define wxSTC_POV_WORD5 13
|
||||
#define wxSTC_POV_WORD6 14
|
||||
#define wxSTC_POV_WORD7 15
|
||||
#define wxSTC_POV_WORD8 16
|
||||
|
||||
// Lexical states for SCLEX_LOUT
|
||||
#define wxSTC_LOUT_DEFAULT 0
|
||||
@@ -828,10 +843,65 @@
|
||||
#define wxSTC_ESCRIPT_WORD2 10
|
||||
#define wxSTC_ESCRIPT_WORD3 11
|
||||
|
||||
// Lexical states for SCLEX_PS
|
||||
#define wxSTC_PS_DEFAULT 0
|
||||
#define wxSTC_PS_COMMENT 1
|
||||
#define wxSTC_PS_DSC_COMMENT 2
|
||||
#define wxSTC_PS_DSC_VALUE 3
|
||||
#define wxSTC_PS_NUMBER 4
|
||||
#define wxSTC_PS_NAME 5
|
||||
#define wxSTC_PS_KEYWORD 6
|
||||
#define wxSTC_PS_LITERAL 7
|
||||
#define wxSTC_PS_IMMEVAL 8
|
||||
#define wxSTC_PS_PAREN_ARRAY 9
|
||||
#define wxSTC_PS_PAREN_DICT 10
|
||||
#define wxSTC_PS_PAREN_PROC 11
|
||||
#define wxSTC_PS_TEXT 12
|
||||
#define wxSTC_PS_HEXSTRING 13
|
||||
#define wxSTC_PS_BASE85STRING 14
|
||||
#define wxSTC_PS_BADSTRINGCHAR 15
|
||||
|
||||
// Lexical states for SCLEX_NSIS
|
||||
#define wxSTC_NSIS_DEFAULT 0
|
||||
#define wxSTC_NSIS_COMMENT 1
|
||||
#define wxSTC_NSIS_STRINGDQ 2
|
||||
#define wxSTC_NSIS_STRINGLQ 3
|
||||
#define wxSTC_NSIS_STRINGRQ 4
|
||||
#define wxSTC_NSIS_FUNCTION 5
|
||||
#define wxSTC_NSIS_VARIABLE 6
|
||||
#define wxSTC_NSIS_LABEL 7
|
||||
#define wxSTC_NSIS_USERDEFINED 8
|
||||
#define wxSTC_NSIS_SECTIONDEF 9
|
||||
#define wxSTC_NSIS_SUBSECTIONDEF 10
|
||||
#define wxSTC_NSIS_IFDEFINEDEF 11
|
||||
#define wxSTC_NSIS_MACRODEF 12
|
||||
#define wxSTC_NSIS_STRINGVAR 13
|
||||
|
||||
// Lexical states for SCLEX_MMIXAL
|
||||
#define wxSTC_MMIXAL_LEADWS 0
|
||||
#define wxSTC_MMIXAL_COMMENT 1
|
||||
#define wxSTC_MMIXAL_LABEL 2
|
||||
#define wxSTC_MMIXAL_OPCODE 3
|
||||
#define wxSTC_MMIXAL_OPCODE_PRE 4
|
||||
#define wxSTC_MMIXAL_OPCODE_VALID 5
|
||||
#define wxSTC_MMIXAL_OPCODE_UNKNOWN 6
|
||||
#define wxSTC_MMIXAL_OPCODE_POST 7
|
||||
#define wxSTC_MMIXAL_OPERANDS 8
|
||||
#define wxSTC_MMIXAL_NUMBER 9
|
||||
#define wxSTC_MMIXAL_REF 10
|
||||
#define wxSTC_MMIXAL_CHAR 11
|
||||
#define wxSTC_MMIXAL_STRING 12
|
||||
#define wxSTC_MMIXAL_REGISTER 13
|
||||
#define wxSTC_MMIXAL_HEX 14
|
||||
#define wxSTC_MMIXAL_OPERATOR 15
|
||||
#define wxSTC_MMIXAL_SYMBOL 16
|
||||
#define wxSTC_MMIXAL_INCLUDE 17
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Commands that can be bound to keystrokes
|
||||
|
||||
|
||||
// Redoes the next action on the undo history.
|
||||
#define wxSTC_CMD_REDO 2011
|
||||
|
||||
@@ -2014,10 +2084,10 @@ public:
|
||||
bool GetMouseDownCaptures();
|
||||
|
||||
// Sets the cursor to one of the SC_CURSOR* values.
|
||||
void SetCursor(int cursorType);
|
||||
void SetSTCCursor(int cursorType);
|
||||
|
||||
// Get cursor type.
|
||||
int GetCursor();
|
||||
int GetSTCCursor();
|
||||
|
||||
// Change the way control characters are displayed:
|
||||
// If symbol is < 32, keep the drawn way, else, use the given character.
|
||||
|
@@ -40,7 +40,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||
-I$(srcdir)/../../../samples -I$(srcdir)/../../include $(CXXFLAGS)
|
||||
STCTEST_OBJECTS = \
|
||||
$(__stctest___win32rc) \
|
||||
stctest_stctest.o
|
||||
stctest_stctest.o \
|
||||
stctest_edit.o \
|
||||
stctest_prefs.o
|
||||
WX_VERSION = 2.5.1
|
||||
|
||||
### Conditionally set variables: ###
|
||||
@@ -102,7 +104,7 @@ COND_PLATFORM_OS2_1___stctest___os2_emxbindcmd = $(NM) stctest$(EXEEXT) | if \
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: stctest$(EXEEXT) $(__stctest_bundle___depname) data
|
||||
all: stctest$(EXEEXT) $(__stctest_bundle___depname)
|
||||
|
||||
clean:
|
||||
rm -rf ./.deps ./.pch
|
||||
@@ -110,14 +112,6 @@ clean:
|
||||
rm -f stctest$(EXEEXT)
|
||||
rm -rf stctest.app
|
||||
|
||||
data:
|
||||
@mkdir -p .
|
||||
@for f in stctest.cpp; do \
|
||||
if test \( ! -s ./$$f \) -o \( $(srcdir)/$$f -nt ./$$f \) ; then \
|
||||
cp -pRf $(srcdir)/$$f . ; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
distclean: clean
|
||||
rm -f configure config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
|
||||
|
||||
@@ -155,6 +149,12 @@ stctest.app/Contents/PkgInfo: stctest$(EXEEXT) $(top_srcdir)/src/mac/Info.plist.
|
||||
|
||||
@COND_PLATFORM_MACOSX_1@stctest_bundle: stctest.app/Contents/PkgInfo
|
||||
|
||||
stctest_edit.o: $(srcdir)/edit.cpp
|
||||
$(CXXC) -c -o $@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
stctest_prefs.o: $(srcdir)/prefs.cpp
|
||||
$(CXXC) -c -o $@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
stctest_sample_rc.o: $(srcdir)/../../../samples/sample.rc
|
||||
$(RESCOMP) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_2) --include-dir $(top_srcdir)/include --include-dir $(srcdir) $(__DLLFLAG_p_2) --include-dir $(srcdir)/../../../samples
|
||||
|
||||
@@ -167,4 +167,4 @@ uninstall:
|
||||
# Include dependency info, if present:
|
||||
@IF_GNU_MAKE@-include .deps/*.d
|
||||
|
||||
.PHONY: all clean data distclean install stctest_bundle uninstall
|
||||
.PHONY: all clean distclean install stctest_bundle uninstall
|
||||
|
104
contrib/samples/stc/defsext.h
Normal file
104
contrib/samples/stc/defsext.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: defsext.h extensions
|
||||
// Purpose: STC test declarations
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DEFSEXT_H_
|
||||
#define _WX_DEFSEXT_H_
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//! wxWindows headers
|
||||
#include <wx/print.h> // printing support
|
||||
#include <wx/printdlg.h> // printing dialog
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
#define DEFAULT_LANGUAGE _("<default>")
|
||||
|
||||
#define PAGE_COMMON _("Common")
|
||||
#define PAGE_LANGUAGES _("Languages")
|
||||
#define PAGE_STYLE_TYPES _("Style types")
|
||||
|
||||
#define STYLE_TYPES_COUNT 32
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// standard IDs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
// menu IDs
|
||||
myID_PROPERTIES = wxID_HIGHEST,
|
||||
myID_INDENTINC,
|
||||
myID_INDENTRED,
|
||||
myID_FINDNEXT,
|
||||
myID_REPLACE,
|
||||
myID_REPLACENEXT,
|
||||
myID_BRACEMATCH,
|
||||
myID_GOTO,
|
||||
myID_PAGEACTIVE,
|
||||
myID_DISPLAYEOL,
|
||||
myID_INDENTGUIDE,
|
||||
myID_LINENUMBER,
|
||||
myID_LONGLINEON,
|
||||
myID_WHITESPACE,
|
||||
myID_FOLDTOGGLE,
|
||||
myID_OVERTYPE,
|
||||
myID_READONLY,
|
||||
myID_WRAPMODEON,
|
||||
myID_CHANGECASE,
|
||||
myID_CHANGELOWER,
|
||||
myID_CHANGEUPPER,
|
||||
myID_HILIGHTLANG,
|
||||
myID_HILIGHTFIRST,
|
||||
myID_HILIGHTLAST = myID_HILIGHTFIRST + 99,
|
||||
myID_CONVERTEOL,
|
||||
myID_CONVERTCR,
|
||||
myID_CONVERTCRLF,
|
||||
myID_CONVERTLF,
|
||||
myID_USECHARSET,
|
||||
myID_CHARSETANSI,
|
||||
myID_CHARSETMAC,
|
||||
myID_PAGEPREV,
|
||||
myID_PAGENEXT,
|
||||
myID_SELECTLINE,
|
||||
|
||||
// other IDs
|
||||
myID_STATUSBAR,
|
||||
myID_TITLEBAR,
|
||||
myID_ABOUTTIMER,
|
||||
myID_UPDATETIMER,
|
||||
|
||||
// dialog find IDs
|
||||
myID_DLG_FIND_TEXT,
|
||||
|
||||
// preferences IDs
|
||||
myID_PREFS_LANGUAGE,
|
||||
myID_PREFS_STYLETYPE,
|
||||
myID_PREFS_KEYWORDS,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global items
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//! global application name
|
||||
extern wxString *g_appname;
|
||||
|
||||
//! global print data, to remember settings during the session
|
||||
extern wxPrintData *g_printData;
|
||||
extern wxPageSetupData *g_pageSetupData;
|
||||
|
||||
#endif // _WX_DEFSEXT_H_
|
||||
|
825
contrib/samples/stc/edit.cpp
Normal file
825
contrib/samples/stc/edit.cpp
Normal file
@@ -0,0 +1,825 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: edit.cpp
|
||||
// Purpose: STC test module
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// informations
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes <wx/wx.h>.
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all 'standard' wxWindows headers)
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
//! wxWindows headers
|
||||
#include <wx/file.h> // raw file io support
|
||||
#include <wx/filename.h> // filename support
|
||||
|
||||
//! application headers
|
||||
#include "defsext.h" // additional definitions
|
||||
|
||||
#include "edit.h" // edit module
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// resources
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
|
||||
//============================================================================
|
||||
// implementation
|
||||
//============================================================================
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Edit
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl)
|
||||
// common
|
||||
EVT_SIZE ( Edit::OnSize)
|
||||
// edit
|
||||
EVT_MENU (wxID_CLEAR, Edit::OnEditClear)
|
||||
EVT_MENU (wxID_CUT, Edit::OnEditCut)
|
||||
EVT_MENU (wxID_COPY, Edit::OnEditCopy)
|
||||
EVT_MENU (wxID_PASTE, Edit::OnEditPaste)
|
||||
EVT_MENU (myID_INDENTINC, Edit::OnEditIndentInc)
|
||||
EVT_MENU (myID_INDENTRED, Edit::OnEditIndentRed)
|
||||
EVT_MENU (wxID_SELECTALL, Edit::OnEditSelectAll)
|
||||
EVT_MENU (myID_SELECTLINE, Edit::OnEditSelectLine)
|
||||
EVT_MENU (wxID_REDO, Edit::OnEditRedo)
|
||||
EVT_MENU (wxID_UNDO, Edit::OnEditUndo)
|
||||
// find
|
||||
EVT_MENU (wxID_FIND, Edit::OnFind)
|
||||
EVT_MENU (myID_FINDNEXT, Edit::OnFindNext)
|
||||
EVT_MENU (myID_REPLACE, Edit::OnReplace)
|
||||
EVT_MENU (myID_REPLACENEXT, Edit::OnReplaceNext)
|
||||
EVT_MENU (myID_BRACEMATCH, Edit::OnBraceMatch)
|
||||
EVT_MENU (myID_GOTO, Edit::OnGoto)
|
||||
// view
|
||||
EVT_MENU_RANGE (myID_HILIGHTFIRST, myID_HILIGHTLAST,
|
||||
Edit::OnHilightLang)
|
||||
EVT_MENU (myID_DISPLAYEOL, Edit::OnDisplayEOL)
|
||||
EVT_MENU (myID_INDENTGUIDE, Edit::OnIndentGuide)
|
||||
EVT_MENU (myID_LINENUMBER, Edit::OnLineNumber)
|
||||
EVT_MENU (myID_LONGLINEON, Edit::OnLongLineOn)
|
||||
EVT_MENU (myID_WHITESPACE, Edit::OnWhiteSpace)
|
||||
EVT_MENU (myID_FOLDTOGGLE, Edit::OnFoldToggle)
|
||||
EVT_MENU (myID_OVERTYPE, Edit::OnSetOverType)
|
||||
EVT_MENU (myID_READONLY, Edit::OnSetReadOnly)
|
||||
EVT_MENU (myID_WRAPMODEON, Edit::OnWrapmodeOn)
|
||||
EVT_MENU (myID_CHARSETANSI, Edit::OnUseCharset)
|
||||
EVT_MENU (myID_CHARSETMAC, Edit::OnUseCharset)
|
||||
// extra
|
||||
EVT_MENU (myID_CHANGELOWER, Edit::OnChangeCase)
|
||||
EVT_MENU (myID_CHANGEUPPER, Edit::OnChangeCase)
|
||||
EVT_MENU (myID_CONVERTCR, Edit::OnConvertEOL)
|
||||
EVT_MENU (myID_CONVERTCRLF, Edit::OnConvertEOL)
|
||||
EVT_MENU (myID_CONVERTLF, Edit::OnConvertEOL)
|
||||
// stc
|
||||
EVT_STC_MARGINCLICK (-1, Edit::OnMarginClick)
|
||||
EVT_STC_CHARADDED (-1, Edit::OnCharAdded)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
Edit::Edit (wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
long style)
|
||||
: wxStyledTextCtrl (parent, id, pos, size, style) {
|
||||
|
||||
m_filename = _T("");
|
||||
|
||||
m_LineNrID = 0;
|
||||
m_DividerID = 1;
|
||||
m_FoldingID = 2;
|
||||
|
||||
// initialize language
|
||||
m_language = NULL;
|
||||
|
||||
// default font for all styles
|
||||
SetViewEOL (g_CommonPrefs.displayEOLEnable);
|
||||
SetIndentationGuides (g_CommonPrefs.indentGuideEnable);
|
||||
SetEdgeMode (g_CommonPrefs.longLineOnEnable?
|
||||
wxSTC_EDGE_LINE: wxSTC_EDGE_NONE);
|
||||
SetViewWhiteSpace (g_CommonPrefs.whiteSpaceEnable?
|
||||
wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE);
|
||||
SetOvertype (g_CommonPrefs.overTypeInitial);
|
||||
SetReadOnly (g_CommonPrefs.readOnlyInitial);
|
||||
SetWrapMode (g_CommonPrefs.wrapModeInitial?
|
||||
wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);
|
||||
wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
StyleSetFont (wxSTC_STYLE_DEFAULT, font);
|
||||
StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour ("BLACK"));
|
||||
StyleSetBackground (wxSTC_STYLE_DEFAULT, wxColour ("WHITE"));
|
||||
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY"));
|
||||
StyleSetBackground (wxSTC_STYLE_LINENUMBER, wxColour ("WHITE"));
|
||||
StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY"));
|
||||
InitializePrefs (DEFAULT_LANGUAGE);
|
||||
|
||||
// set visibility
|
||||
SetVisiblePolicy (wxSTC_VISIBLE_STRICT|wxSTC_VISIBLE_SLOP, 1);
|
||||
SetXCaretPolicy (wxSTC_CARET_EVEN|wxSTC_VISIBLE_STRICT|wxSTC_CARET_SLOP, 1);
|
||||
SetYCaretPolicy (wxSTC_CARET_EVEN|wxSTC_VISIBLE_STRICT|wxSTC_CARET_SLOP, 1);
|
||||
|
||||
// markers
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, "BLACK", "BLACK");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, "BLACK", "BLACK");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, "BLACK", "WHITE");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, "BLACK", "WHITE");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
|
||||
|
||||
// miscelaneous
|
||||
m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, _T("_999999"));
|
||||
m_FoldingMargin = 16;
|
||||
SetMarginWidth (m_LineNrID,
|
||||
g_CommonPrefs.lineNumberEnable? m_LineNrMargin: 0);
|
||||
CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key
|
||||
UsePopUp (0);
|
||||
SetLayoutCache (wxSTC_CACHE_PAGE);
|
||||
|
||||
}
|
||||
|
||||
Edit::~Edit () {}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// common event handlers
|
||||
void Edit::OnSize( wxSizeEvent& event ) {
|
||||
int x = GetClientSize().x +
|
||||
(g_CommonPrefs.lineNumberEnable? m_LineNrMargin: 0) +
|
||||
(g_CommonPrefs.foldEnable? m_FoldingMargin: 0);
|
||||
if (x > 0) SetScrollWidth (x);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// edit event handlers
|
||||
void Edit::OnEditRedo (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!CanRedo()) return;
|
||||
Redo ();
|
||||
}
|
||||
|
||||
void Edit::OnEditUndo (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!CanUndo()) return;
|
||||
Undo ();
|
||||
}
|
||||
|
||||
void Edit::OnEditClear (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (GetReadOnly()) return;
|
||||
Clear ();
|
||||
}
|
||||
|
||||
void Edit::OnEditCut (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (GetReadOnly() || (GetSelectionEnd()-GetSelectionStart() <= 0)) return;
|
||||
Cut ();
|
||||
}
|
||||
|
||||
void Edit::OnEditCopy (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (GetSelectionEnd()-GetSelectionStart() <= 0) return;
|
||||
Copy ();
|
||||
}
|
||||
|
||||
void Edit::OnEditPaste (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!CanPaste()) return;
|
||||
Paste ();
|
||||
}
|
||||
|
||||
void Edit::OnFind (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnFindNext (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnReplace (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnReplaceNext (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnBraceMatch (wxCommandEvent &WXUNUSED(event)) {
|
||||
int min = GetCurrentPos ();
|
||||
int max = BraceMatch (min);
|
||||
if (max > (min+1)) {
|
||||
BraceHighlight (min+1, max);
|
||||
SetSelection (min+1, max);
|
||||
}else{
|
||||
BraceBadLight (min);
|
||||
}
|
||||
}
|
||||
|
||||
void Edit::OnGoto (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnEditIndentInc (wxCommandEvent &event) {
|
||||
CmdKeyExecute (wxSTC_CMD_TAB);
|
||||
}
|
||||
|
||||
void Edit::OnEditIndentRed (wxCommandEvent &event) {
|
||||
CmdKeyExecute (wxSTC_CMD_DELETEBACK);
|
||||
}
|
||||
|
||||
void Edit::OnEditSelectAll (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetSelection (0, GetTextLength ());
|
||||
}
|
||||
|
||||
void Edit::OnEditSelectLine (wxCommandEvent &WXUNUSED(event)) {
|
||||
int lineStart = PositionFromLine (GetCurrentLine());
|
||||
int lineEnd = PositionFromLine (GetCurrentLine() + 1);
|
||||
SetSelection (lineStart, lineEnd);
|
||||
}
|
||||
|
||||
void Edit::OnHilightLang (wxCommandEvent &event) {
|
||||
InitializePrefs (g_LanguagePrefs [event.GetId() - myID_HILIGHTFIRST].name);
|
||||
}
|
||||
|
||||
void Edit::OnDisplayEOL (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetViewEOL (!GetViewEOL());
|
||||
}
|
||||
|
||||
void Edit::OnIndentGuide (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetIndentationGuides (!GetIndentationGuides());
|
||||
}
|
||||
|
||||
void Edit::OnLineNumber (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetMarginWidth (m_LineNrID,
|
||||
GetMarginWidth (m_LineNrID) == 0? m_LineNrMargin: 0);
|
||||
}
|
||||
|
||||
void Edit::OnLongLineOn (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetEdgeMode (GetEdgeMode() == 0? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE);
|
||||
}
|
||||
|
||||
void Edit::OnWhiteSpace (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetViewWhiteSpace (GetViewWhiteSpace() == 0?
|
||||
wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE);
|
||||
}
|
||||
|
||||
void Edit::OnFoldToggle (wxCommandEvent &WXUNUSED(event)) {
|
||||
ToggleFold (GetFoldParent(GetCurrentLine()));
|
||||
}
|
||||
|
||||
void Edit::OnSetOverType (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetOvertype (!GetOvertype());
|
||||
}
|
||||
|
||||
void Edit::OnSetReadOnly (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetReadOnly (!GetReadOnly());
|
||||
}
|
||||
|
||||
void Edit::OnWrapmodeOn (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetWrapMode (GetWrapMode() == 0? wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);
|
||||
}
|
||||
|
||||
void Edit::OnUseCharset (wxCommandEvent &event) {
|
||||
int Nr;
|
||||
int charset = GetCodePage();
|
||||
switch (event.GetId()) {
|
||||
case myID_CHARSETANSI: {charset = wxSTC_CHARSET_ANSI; break;}
|
||||
case myID_CHARSETMAC: {charset = wxSTC_CHARSET_ANSI; break;}
|
||||
}
|
||||
for (Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) {
|
||||
StyleSetCharacterSet (Nr, charset);
|
||||
}
|
||||
SetCodePage (charset);
|
||||
}
|
||||
|
||||
void Edit::OnChangeCase (wxCommandEvent &event) {
|
||||
switch (event.GetId()) {
|
||||
case myID_CHANGELOWER: {
|
||||
CmdKeyExecute (wxSTC_CMD_LOWERCASE);
|
||||
break;
|
||||
}
|
||||
case myID_CHANGEUPPER: {
|
||||
CmdKeyExecute (wxSTC_CMD_UPPERCASE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Edit::OnConvertEOL (wxCommandEvent &event) {
|
||||
int eolMode = GetEOLMode();
|
||||
switch (event.GetId()) {
|
||||
case myID_CONVERTCR: { eolMode = wxSTC_EOL_CR; break;}
|
||||
case myID_CONVERTCRLF: { eolMode = wxSTC_EOL_CRLF; break;}
|
||||
case myID_CONVERTLF: { eolMode = wxSTC_EOL_LF; break;}
|
||||
}
|
||||
ConvertEOLs (eolMode);
|
||||
SetEOLMode (eolMode);
|
||||
}
|
||||
|
||||
//! misc
|
||||
void Edit::OnMarginClick (wxStyledTextEvent &event) {
|
||||
if (event.GetMargin() == 2) {
|
||||
int lineClick = LineFromPosition (event.GetPosition());
|
||||
int levelClick = GetFoldLevel (lineClick);
|
||||
if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) {
|
||||
ToggleFold (lineClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Edit::OnCharAdded (wxStyledTextEvent &event) {
|
||||
char chr = event.GetKey();
|
||||
int currentLine = GetCurrentLine();
|
||||
// Change this if support for mac files with \r is needed
|
||||
if (chr == '\n') {
|
||||
int lineInd = 0;
|
||||
if (currentLine > 0) {
|
||||
lineInd = GetLineIndentation(currentLine - 1);
|
||||
}
|
||||
if (lineInd == 0) return;
|
||||
SetLineIndentation (currentLine, lineInd);
|
||||
GotoPos(PositionFromLine (currentLine) + lineInd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// private functions
|
||||
wxString Edit::DeterminePrefs (const wxString &filename) {
|
||||
|
||||
LanguageInfo const* curInfo = NULL;
|
||||
|
||||
// determine language from filepatterns
|
||||
int languageNr;
|
||||
for (languageNr = 0; languageNr < g_LanguagePrefsSize; languageNr++) {
|
||||
curInfo = &g_LanguagePrefs [languageNr];
|
||||
wxString filepattern = curInfo->filepattern;
|
||||
filepattern.Lower();
|
||||
while (!filepattern.IsEmpty()) {
|
||||
wxString cur = filepattern.BeforeFirst (';');
|
||||
if ((cur == filename) ||
|
||||
(cur == (filename.BeforeLast ('.') + _T(".*"))) ||
|
||||
(cur == (_T("*.") + filename.AfterLast ('.')))) {
|
||||
return curInfo->name;
|
||||
}
|
||||
filepattern = filepattern.AfterFirst (';');
|
||||
}
|
||||
}
|
||||
return wxEmptyString;
|
||||
|
||||
}
|
||||
|
||||
bool Edit::InitializePrefs (const wxString &name) {
|
||||
|
||||
// initialize styles
|
||||
StyleClearAll();
|
||||
LanguageInfo const* curInfo = NULL;
|
||||
|
||||
// determine language
|
||||
bool found = false;
|
||||
int languageNr;
|
||||
for (languageNr = 0; languageNr < g_LanguagePrefsSize; languageNr++) {
|
||||
curInfo = &g_LanguagePrefs [languageNr];
|
||||
if (curInfo->name == name) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) return false;
|
||||
|
||||
// set lexer and language
|
||||
SetLexer (curInfo->lexer);
|
||||
m_language = curInfo;
|
||||
|
||||
// set margin for line numbers
|
||||
SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER);
|
||||
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY"));
|
||||
StyleSetBackground (wxSTC_STYLE_LINENUMBER, wxColour ("WHITE"));
|
||||
SetMarginWidth (m_LineNrID,
|
||||
g_CommonPrefs.lineNumberEnable? m_LineNrMargin: 0);
|
||||
|
||||
// default fonts for all styles!
|
||||
int Nr;
|
||||
for (Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) {
|
||||
wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
StyleSetFont (Nr, font);
|
||||
}
|
||||
|
||||
// set common styles
|
||||
StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour ("DARK GREY"));
|
||||
StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY"));
|
||||
|
||||
// initialize settings
|
||||
if (g_CommonPrefs.syntaxEnable) {
|
||||
int keywordnr = 0;
|
||||
for (Nr = 0; Nr < STYLE_TYPES_COUNT; Nr++) {
|
||||
if (curInfo->styles[Nr].type == -1) continue;
|
||||
const StyleInfo &curType = g_StylePrefs [curInfo->styles[Nr].type];
|
||||
wxFont font (curType.fontsize, wxMODERN, wxNORMAL, wxNORMAL, false,
|
||||
curType.fontname);
|
||||
StyleSetFont (Nr, font);
|
||||
if (curType.foreground) {
|
||||
StyleSetForeground (Nr, wxColour (curType.foreground));
|
||||
}
|
||||
if (curType.background) {
|
||||
StyleSetBackground (Nr, wxColour (curType.background));
|
||||
}
|
||||
StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0);
|
||||
StyleSetItalic (Nr, (curType.fontstyle & mySTC_STYLE_ITALIC) > 0);
|
||||
StyleSetUnderline (Nr, (curType.fontstyle & mySTC_STYLE_UNDERL) > 0);
|
||||
StyleSetVisible (Nr, (curType.fontstyle & mySTC_STYLE_HIDDEN) == 0);
|
||||
StyleSetCase (Nr, curType.lettercase);
|
||||
const wxChar *pwords = curInfo->styles[Nr].words;
|
||||
if (pwords) {
|
||||
SetKeyWords (keywordnr, pwords);
|
||||
keywordnr += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set margin as unused
|
||||
SetMarginType (m_DividerID, wxSTC_MARGIN_SYMBOL);
|
||||
SetMarginWidth (m_DividerID, 0);
|
||||
SetMarginSensitive (m_DividerID, false);
|
||||
|
||||
// folding
|
||||
SetMarginType (m_FoldingID, wxSTC_MARGIN_SYMBOL);
|
||||
SetMarginMask (m_FoldingID, wxSTC_MASK_FOLDERS);
|
||||
StyleSetBackground (m_FoldingID, wxColour ("WHITE"));
|
||||
SetMarginWidth (m_FoldingID, 0);
|
||||
SetMarginSensitive (m_FoldingID, false);
|
||||
if (g_CommonPrefs.foldEnable) {
|
||||
SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0);
|
||||
SetMarginSensitive (m_FoldingID, curInfo->folds != 0);
|
||||
SetProperty (_T("fold"), curInfo->folds != 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.comment"),
|
||||
(curInfo->folds & mySTC_FOLD_COMMENT) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.compact"),
|
||||
(curInfo->folds & mySTC_FOLD_COMPACT) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.preprocessor"),
|
||||
(curInfo->folds & mySTC_FOLD_PREPROC) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.html"),
|
||||
(curInfo->folds & mySTC_FOLD_HTML) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.html.preprocessor"),
|
||||
(curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.comment.python"),
|
||||
(curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.quotes.python"),
|
||||
(curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? _T("1"): _T("0"));
|
||||
}
|
||||
SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED |
|
||||
wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);
|
||||
|
||||
// set spaces and indention
|
||||
SetTabWidth (4);
|
||||
SetUseTabs (false);
|
||||
SetTabIndents (true);
|
||||
SetBackSpaceUnIndents (true);
|
||||
SetIndent (g_CommonPrefs.indentEnable? 4: 0);
|
||||
|
||||
// others
|
||||
SetViewEOL (g_CommonPrefs.displayEOLEnable);
|
||||
SetIndentationGuides (g_CommonPrefs.indentGuideEnable);
|
||||
SetEdgeColumn (80);
|
||||
SetEdgeMode (g_CommonPrefs.longLineOnEnable? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE);
|
||||
SetViewWhiteSpace (g_CommonPrefs.whiteSpaceEnable?
|
||||
wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE);
|
||||
SetOvertype (g_CommonPrefs.overTypeInitial);
|
||||
SetReadOnly (g_CommonPrefs.readOnlyInitial);
|
||||
SetWrapMode (g_CommonPrefs.wrapModeInitial?
|
||||
wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Edit::LoadFile () {
|
||||
|
||||
// get filname
|
||||
if (!m_filename) {
|
||||
wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""),
|
||||
_T("Any file (*)|*"), wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
|
||||
if (dlg.ShowModal() != wxID_OK) return false;
|
||||
m_filename = dlg.GetPath();
|
||||
}
|
||||
|
||||
// load file
|
||||
return LoadFile (m_filename);
|
||||
}
|
||||
|
||||
bool Edit::LoadFile (const wxString &filename) {
|
||||
|
||||
// load file in edit and clear undo
|
||||
if (!filename.IsEmpty()) m_filename = filename;
|
||||
// wxFile file (m_filename);
|
||||
// if (!file.IsOpened()) return false;
|
||||
ClearAll ();
|
||||
// long lng = file.Length ();
|
||||
// if (lng > 0) {
|
||||
// wxString buf;
|
||||
// wxChar *buff = buf.GetWriteBuf (lng);
|
||||
// file.Read (buff, lng);
|
||||
// buf.UngetWriteBuf ();
|
||||
// InsertText (0, buf);
|
||||
// }
|
||||
// file.Close();
|
||||
|
||||
wxStyledTextCtrl::LoadFile(m_filename);
|
||||
|
||||
EmptyUndoBuffer();
|
||||
|
||||
// determine lexer language
|
||||
wxFileName fname (m_filename);
|
||||
InitializePrefs (DeterminePrefs (fname.GetFullName()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Edit::SaveFile () {
|
||||
|
||||
// return if no change
|
||||
if (!Modified()) return true;
|
||||
|
||||
// get filname
|
||||
if (!m_filename) {
|
||||
wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"),
|
||||
wxSAVE | wxOVERWRITE_PROMPT);
|
||||
if (dlg.ShowModal() != wxID_OK) return false;
|
||||
m_filename = dlg.GetPath();
|
||||
}
|
||||
|
||||
// save file
|
||||
return SaveFile (m_filename);
|
||||
}
|
||||
|
||||
bool Edit::SaveFile (const wxString &filename) {
|
||||
|
||||
// return if no change
|
||||
if (!Modified()) return true;
|
||||
|
||||
// // save edit in file and clear undo
|
||||
// if (!filename.IsEmpty()) m_filename = filename;
|
||||
// wxFile file (m_filename, wxFile::write);
|
||||
// if (!file.IsOpened()) return false;
|
||||
// wxString buf = GetText();
|
||||
// bool okay = file.Write (buf);
|
||||
// file.Close();
|
||||
// if (!okay) return false;
|
||||
// EmptyUndoBuffer();
|
||||
// SetSavePoint();
|
||||
|
||||
// return true;
|
||||
|
||||
return wxStyledTextCtrl::SaveFile(filename);
|
||||
|
||||
}
|
||||
|
||||
bool Edit::Modified () {
|
||||
|
||||
// return modified state
|
||||
return (GetModify() && !GetReadOnly());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// EditProperties
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
EditProperties::EditProperties (Edit *edit,
|
||||
long style)
|
||||
: wxDialog (edit, -1, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
|
||||
|
||||
// sets the application title
|
||||
SetTitle (_("Properties"));
|
||||
wxString text;
|
||||
|
||||
// fullname
|
||||
wxBoxSizer *fullname = new wxBoxSizer (wxHORIZONTAL);
|
||||
fullname->Add (10, 0);
|
||||
fullname->Add (new wxStaticText (this, -1, _("Full filename"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
|
||||
fullname->Add (new wxStaticText (this, -1, edit->GetFilename()),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
// text info
|
||||
wxGridSizer *textinfo = new wxGridSizer (4, 0, 2);
|
||||
textinfo->Add (new wxStaticText (this, -1, _("Language"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
textinfo->Add (new wxStaticText (this, -1, edit->m_language->name),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
textinfo->Add (new wxStaticText (this, -1, _("Lexer-ID: "),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetLexer());
|
||||
textinfo->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
wxString EOLtype = _T("");
|
||||
switch (edit->GetEOLMode()) {
|
||||
case wxSTC_EOL_CR: {EOLtype = _T("CR (Unix)"); break; }
|
||||
case wxSTC_EOL_CRLF: {EOLtype = _T("CRLF (Windows)"); break; }
|
||||
case wxSTC_EOL_LF: {EOLtype = _T("CR (Macintosh)"); break; }
|
||||
}
|
||||
textinfo->Add (new wxStaticText (this, -1, _("Line endings"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
textinfo->Add (new wxStaticText (this, -1, EOLtype),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
|
||||
// text info box
|
||||
wxStaticBoxSizer *textinfos = new wxStaticBoxSizer (
|
||||
new wxStaticBox (this, -1, _("Informations")),
|
||||
wxVERTICAL);
|
||||
textinfos->Add (textinfo, 0, wxEXPAND);
|
||||
textinfos->Add (0, 6);
|
||||
|
||||
// statistic
|
||||
wxGridSizer *statistic = new wxGridSizer (4, 0, 2);
|
||||
statistic->Add (new wxStaticText (this, -1, _("Total lines"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetLineCount());
|
||||
statistic->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
statistic->Add (new wxStaticText (this, -1, _("Total chars"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetTextLength());
|
||||
statistic->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
statistic->Add (new wxStaticText (this, -1, _("Current line"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetCurrentLine());
|
||||
statistic->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
statistic->Add (new wxStaticText (this, -1, _("Current pos"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetCurrentPos());
|
||||
statistic->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
|
||||
// char/line statistics
|
||||
wxStaticBoxSizer *statistics = new wxStaticBoxSizer (
|
||||
new wxStaticBox (this, -1, _("Statistics")),
|
||||
wxVERTICAL);
|
||||
statistics->Add (statistic, 0, wxEXPAND);
|
||||
statistics->Add (0, 6);
|
||||
|
||||
// total pane
|
||||
wxBoxSizer *totalpane = new wxBoxSizer (wxVERTICAL);
|
||||
totalpane->Add (fullname, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10);
|
||||
totalpane->Add (0, 6);
|
||||
totalpane->Add (textinfos, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||
totalpane->Add (0, 10);
|
||||
totalpane->Add (statistics, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||
totalpane->Add (0, 6);
|
||||
wxButton *okButton = new wxButton (this, wxID_OK, _("OK"));
|
||||
okButton->SetDefault();
|
||||
totalpane->Add (okButton, 0, wxALIGN_CENTER | wxALL, 10);
|
||||
|
||||
SetSizerAndFit (totalpane);
|
||||
|
||||
ShowModal();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// EditPrint
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
EditPrint::EditPrint (Edit *edit, wxChar *title)
|
||||
: wxPrintout(title) {
|
||||
m_edit = edit;
|
||||
m_printed = 0;
|
||||
|
||||
}
|
||||
|
||||
bool EditPrint::OnPrintPage (int page) {
|
||||
|
||||
wxDC *dc = GetDC();
|
||||
if (!dc) return false;
|
||||
|
||||
// scale DC
|
||||
PrintScaling (dc);
|
||||
|
||||
// print page
|
||||
if (page == 1) m_printed = 0;
|
||||
m_printed = m_edit->FormatRange (1, m_printed, m_edit->GetLength(),
|
||||
dc, dc, m_printRect, m_pageRect);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditPrint::OnBeginDocument (int startPage, int endPage) {
|
||||
|
||||
if (!wxPrintout::OnBeginDocument (startPage, endPage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditPrint::GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) {
|
||||
|
||||
// initialize values
|
||||
*minPage = 0;
|
||||
*maxPage = 0;
|
||||
*selPageFrom = 0;
|
||||
*selPageTo = 0;
|
||||
|
||||
// scale DC if possible
|
||||
wxDC *dc = GetDC();
|
||||
if (!dc) return;
|
||||
PrintScaling (dc);
|
||||
|
||||
// get print page informations and convert to printer pixels
|
||||
wxSize ppiScr;
|
||||
GetPPIScreen (&ppiScr.x, &ppiScr.y);
|
||||
wxSize page = g_pageSetupData->GetPaperSize();
|
||||
page.x = static_cast<int> (page.x * ppiScr.x / 25.4);
|
||||
page.y = static_cast<int> (page.y * ppiScr.y / 25.4);
|
||||
m_pageRect = wxRect (0,
|
||||
0,
|
||||
page.x,
|
||||
page.y);
|
||||
|
||||
// get margins informations and convert to printer pixels
|
||||
int top = 25; // default 25
|
||||
int bottom = 25; // default 25
|
||||
int left = 20; // default 20
|
||||
int right = 20; // default 20
|
||||
wxPoint (top, left) = g_pageSetupData->GetMarginTopLeft();
|
||||
wxPoint (bottom, right) = g_pageSetupData->GetMarginBottomRight();
|
||||
top = static_cast<int> (top * ppiScr.y / 25.4);
|
||||
bottom = static_cast<int> (bottom * ppiScr.y / 25.4);
|
||||
left = static_cast<int> (left * ppiScr.x / 25.4);
|
||||
right = static_cast<int> (right * ppiScr.x / 25.4);
|
||||
m_printRect = wxRect (left,
|
||||
top,
|
||||
page.x - (left + right),
|
||||
page.y - (top + bottom));
|
||||
|
||||
// count pages
|
||||
while (HasPage (*maxPage)) {
|
||||
m_printed = m_edit->FormatRange (0, m_printed, m_edit->GetLength(),
|
||||
dc, dc, m_printRect, m_pageRect);
|
||||
*maxPage += 1;
|
||||
}
|
||||
if (*maxPage > 0) *minPage = 1;
|
||||
*selPageFrom = *minPage;
|
||||
*selPageTo = *maxPage;
|
||||
}
|
||||
|
||||
bool EditPrint::HasPage (int page) {
|
||||
|
||||
return (m_printed < m_edit->GetLength());
|
||||
}
|
||||
|
||||
bool EditPrint::PrintScaling (wxDC *dc){
|
||||
|
||||
// check for dc, return if none
|
||||
if (!dc) return false;
|
||||
|
||||
// get printer and screen sizing values
|
||||
wxSize ppiScr;
|
||||
GetPPIScreen (&ppiScr.x, &ppiScr.y);
|
||||
if (ppiScr.x == 0) { // most possible guess 96 dpi
|
||||
ppiScr.x = 96;
|
||||
ppiScr.y = 96;
|
||||
}
|
||||
wxSize ppiPrt;
|
||||
GetPPIPrinter (&ppiPrt.x, &ppiPrt.y);
|
||||
if (ppiPrt.x == 0) { // scaling factor to 1
|
||||
ppiPrt.x = ppiScr.x;
|
||||
ppiPrt.y = ppiScr.y;
|
||||
}
|
||||
wxSize dcSize = dc->GetSize();
|
||||
wxSize pageSize;
|
||||
GetPageSizePixels (&pageSize.x, &pageSize.y);
|
||||
|
||||
// set user scale
|
||||
float scale_x = (float)(ppiPrt.x * dcSize.x) /
|
||||
(float)(ppiScr.x * pageSize.x);
|
||||
float scale_y = (float)(ppiPrt.y * dcSize.y) /
|
||||
(float)(ppiScr.y * pageSize.y);
|
||||
dc->SetUserScale (scale_x, scale_y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
169
contrib/samples/stc/edit.h
Normal file
169
contrib/samples/stc/edit.h
Normal file
@@ -0,0 +1,169 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: edit.h
|
||||
// Purpose: STC test module
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _EDIT_H_
|
||||
#define _EDIT_H_
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// informations
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//! wxWindows headers
|
||||
|
||||
//! wxWindows/contrib headers
|
||||
#include <wx/stc/stc.h> // styled text control
|
||||
|
||||
//! application headers
|
||||
#include "prefs.h" // preferences
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
class EditPrint;
|
||||
class EditProperties;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! Edit
|
||||
class Edit: public wxStyledTextCtrl {
|
||||
friend class EditProperties;
|
||||
friend class EditPrint;
|
||||
|
||||
public:
|
||||
//! constructor
|
||||
Edit (wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxSUNKEN_BORDER|wxVSCROLL
|
||||
);
|
||||
|
||||
//! destructor
|
||||
~Edit ();
|
||||
|
||||
// event handlers
|
||||
// common
|
||||
void OnSize( wxSizeEvent &event );
|
||||
// edit
|
||||
void OnEditRedo (wxCommandEvent &event);
|
||||
void OnEditUndo (wxCommandEvent &event);
|
||||
void OnEditClear (wxCommandEvent &event);
|
||||
void OnEditCut (wxCommandEvent &event);
|
||||
void OnEditCopy (wxCommandEvent &event);
|
||||
void OnEditPaste (wxCommandEvent &event);
|
||||
// find
|
||||
void OnFind (wxCommandEvent &event);
|
||||
void OnFindNext (wxCommandEvent &event);
|
||||
void OnReplace (wxCommandEvent &event);
|
||||
void OnReplaceNext (wxCommandEvent &event);
|
||||
void OnBraceMatch (wxCommandEvent &event);
|
||||
void OnGoto (wxCommandEvent &event);
|
||||
void OnEditIndentInc (wxCommandEvent &event);
|
||||
void OnEditIndentRed (wxCommandEvent &event);
|
||||
void OnEditSelectAll (wxCommandEvent &event);
|
||||
void OnEditSelectLine (wxCommandEvent &event);
|
||||
//! view
|
||||
void OnHilightLang (wxCommandEvent &event);
|
||||
void OnDisplayEOL (wxCommandEvent &event);
|
||||
void OnIndentGuide (wxCommandEvent &event);
|
||||
void OnLineNumber (wxCommandEvent &event);
|
||||
void OnLongLineOn (wxCommandEvent &event);
|
||||
void OnWhiteSpace (wxCommandEvent &event);
|
||||
void OnFoldToggle (wxCommandEvent &event);
|
||||
void OnSetOverType (wxCommandEvent &event);
|
||||
void OnSetReadOnly (wxCommandEvent &event);
|
||||
void OnWrapmodeOn (wxCommandEvent &event);
|
||||
void OnUseCharset (wxCommandEvent &event);
|
||||
//! extra
|
||||
void OnChangeCase (wxCommandEvent &event);
|
||||
void OnConvertEOL (wxCommandEvent &event);
|
||||
// stc
|
||||
void OnMarginClick (wxStyledTextEvent &event);
|
||||
void OnCharAdded (wxStyledTextEvent &event);
|
||||
|
||||
//! language/lexer
|
||||
wxString DeterminePrefs (const wxString &filename);
|
||||
bool InitializePrefs (const wxString &filename);
|
||||
bool UserSettings (const wxString &filename);
|
||||
LanguageInfo const* GetLanguageInfo () {return m_language;};
|
||||
|
||||
//! load/save file
|
||||
bool LoadFile ();
|
||||
bool LoadFile (const wxString &filename);
|
||||
bool SaveFile ();
|
||||
bool SaveFile (const wxString &filename);
|
||||
bool Modified ();
|
||||
wxString GetFilename () {return m_filename;};
|
||||
void SetFilename (const wxString &filename) {m_filename = filename;};
|
||||
|
||||
private:
|
||||
// file
|
||||
wxString m_filename;
|
||||
|
||||
// lanugage properties
|
||||
LanguageInfo const* m_language;
|
||||
|
||||
// margin variables
|
||||
int m_LineNrID;
|
||||
int m_LineNrMargin;
|
||||
int m_FoldingID;
|
||||
int m_FoldingMargin;
|
||||
int m_DividerID;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! EditProperties
|
||||
class EditProperties: public wxDialog {
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
EditProperties (Edit *edit, long style = 0);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! EditPrint
|
||||
class EditPrint: public wxPrintout {
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
EditPrint (Edit *edit, wxChar *title = _T(""));
|
||||
|
||||
//! event handlers
|
||||
bool OnPrintPage (int page);
|
||||
bool OnBeginDocument (int startPage, int endPage);
|
||||
|
||||
//! print functions
|
||||
bool HasPage (int page);
|
||||
void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
|
||||
|
||||
private:
|
||||
Edit *m_edit;
|
||||
int m_printed;
|
||||
wxRect m_pageRect;
|
||||
wxRect m_printRect;
|
||||
|
||||
bool PrintScaling (wxDC *dc);
|
||||
};
|
||||
|
||||
#endif // _EDIT_H_
|
||||
|
@@ -30,7 +30,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) $(__RUNTIME_LIBS_6) -I$(BCCDIR)\include \
|
||||
-I$(SETUPHDIR) -I. $(__DLLFLAG_p) -I.\..\..\..\samples -I.\..\..\include \
|
||||
$(CXXFLAGS)
|
||||
STCTEST_OBJECTS = \
|
||||
$(OBJS)\stctest_stctest.obj
|
||||
$(OBJS)\stctest_stctest.obj \
|
||||
$(OBJS)\stctest_edit.obj \
|
||||
$(OBJS)\stctest_prefs.obj
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@@ -152,7 +154,13 @@ $(OBJS):
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS)\stctest.exe data
|
||||
all: $(OBJS)\stctest.exe
|
||||
|
||||
$(OBJS)\stctest_edit.obj: .\edit.cpp
|
||||
$(CXX) -q -c -P -o$@ $(STCTEST_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stctest_prefs.obj: .\prefs.cpp
|
||||
$(CXX) -q -c -P -o$@ $(STCTEST_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stctest_sample.res: .\..\..\..\samples\sample.rc
|
||||
brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) -i.\..\..\..\include -i$(SETUPHDIR) -i. $(__DLLFLAG_p_1) -i.\..\..\..\samples $**
|
||||
@@ -170,10 +178,6 @@ clean:
|
||||
-if exist $(OBJS)\stctest.ilf del $(OBJS)\stctest.ilf
|
||||
-if exist $(OBJS)\stctest.ils del $(OBJS)\stctest.ils
|
||||
|
||||
data:
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
for %f in (stctest.cpp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
|
||||
|
||||
$(OBJS)\stctest.exe: $(STCTEST_OBJECTS) $(OBJS)\stctest_sample.res
|
||||
ilink32 -Tpe -q $(LDFLAGS) -L$(BCCDIR)\lib $(__DEBUGINFO) -L$(LIBDIRNAME) -aa @&&|
|
||||
c0w32.obj $(STCTEST_OBJECTS),$@,, wx$(PORTNAME)$(WXUNIVNAME)25$(WXUNICODEFLAG)$(WXDEBUGFLAG)_stc.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(__UNICOWS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32mt$(__RUNTIME_LIBS_7).lib,, $(OBJS)\stctest_sample.res
|
||||
|
@@ -22,7 +22,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(GCCFLAGS) \
|
||||
$(__DLLFLAG_p) -I.\..\..\..\samples -I.\..\..\include $(CXXFLAGS)
|
||||
STCTEST_OBJECTS = \
|
||||
$(OBJS)\stctest_sample_rc.o \
|
||||
$(OBJS)\stctest_stctest.o
|
||||
$(OBJS)\stctest_stctest.o \
|
||||
$(OBJS)\stctest_edit.o \
|
||||
$(OBJS)\stctest_prefs.o
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@@ -145,7 +147,13 @@ $(OBJS):
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS)\stctest.exe data
|
||||
all: $(OBJS)\stctest.exe
|
||||
|
||||
$(OBJS)\stctest_edit.o: ./edit.cpp
|
||||
$(CXX) -c -o $@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stctest_prefs.o: ./prefs.cpp
|
||||
$(CXX) -c -o $@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stctest_sample_rc.o: ./../../../samples/sample.rc
|
||||
windres --use-temp-file -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) --include-dir ./../../../include --include-dir $(SETUPHDIR) --include-dir . $(__DLLFLAG_p_1) --include-dir ./../../../samples
|
||||
@@ -157,11 +165,7 @@ clean:
|
||||
-if exist $(OBJS)\*.o del $(OBJS)\*.o
|
||||
-if exist $(OBJS)\stctest.exe del $(OBJS)\stctest.exe
|
||||
|
||||
data:
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
for %%f in (stctest.cpp) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
|
||||
|
||||
$(OBJS)\stctest.exe: $(STCTEST_OBJECTS) $(OBJS)\stctest_sample_rc.o
|
||||
$(CXX) -o $@ $(STCTEST_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) -mthreads -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows -lwx$(PORTNAME)$(WXUNIVNAME)25$(WXUNICODEFLAG)$(WXDEBUGFLAG)_stc $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(__UNICOWS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lodbc32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
|
||||
|
||||
.PHONY: all clean data
|
||||
.PHONY: all clean
|
||||
|
@@ -24,7 +24,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) /M$(__RUNTIME_LIBS_7)$(__DEBUGRUNTIME_3) \
|
||||
/I.\..\..\include $(CXXFLAGS) /GR /GX
|
||||
STCTEST_OBJECTS = \
|
||||
$(OBJS)\stctest_sample.res \
|
||||
$(OBJS)\stctest_stctest.obj
|
||||
$(OBJS)\stctest_stctest.obj \
|
||||
$(OBJS)\stctest_edit.obj \
|
||||
$(OBJS)\stctest_prefs.obj
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@@ -227,7 +229,13 @@ $(OBJS):
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS)\stctest.exe data
|
||||
all: $(OBJS)\stctest.exe
|
||||
|
||||
$(OBJS)\stctest_edit.obj: .\edit.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCTEST_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stctest_prefs.obj: .\prefs.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCTEST_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stctest_sample.res: .\..\..\..\samples\sample.rc
|
||||
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_2_p_1) $(__NO_VC_CRTDBG_p_1) /d __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) /i .\..\..\..\include /i $(SETUPHDIR) /i . $(__DLLFLAG_p_1) /d _WINDOWS /i .\..\..\..\samples $**
|
||||
@@ -242,10 +250,6 @@ clean:
|
||||
-if exist $(OBJS)\stctest.ilk del $(OBJS)\stctest.ilk
|
||||
-if exist $(OBJS)\stctest.pdb del $(OBJS)\stctest.pdb
|
||||
|
||||
data:
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
for %f in (stctest.cpp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
|
||||
|
||||
$(OBJS)\stctest.exe: $(STCTEST_OBJECTS) $(OBJS)\stctest_sample.res
|
||||
link /NOLOGO /OUT:$@ $(LDFLAGS) $(__DEBUGINFO_1) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS @<<
|
||||
$(STCTEST_OBJECTS) wx$(PORTNAME)$(WXUNIVNAME)25$(WXUNICODEFLAG)$(WXDEBUGFLAG)_stc.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(__UNICOWS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib odbc32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib oleacc.lib
|
||||
|
@@ -169,7 +169,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) $(__DEBUGINFO_0) $(__OPTIMIZEFLAG_2) -bm &
|
||||
$(__UNICODE_DEFINE_p) -i=.\..\..\..\include -i=$(SETUPHDIR) -i=. &
|
||||
$(__DLLFLAG_p) -i=.\..\..\..\samples -i=.\..\..\include $(CXXFLAGS)
|
||||
STCTEST_OBJECTS = &
|
||||
$(OBJS)\stctest_stctest.obj
|
||||
$(OBJS)\stctest_stctest.obj &
|
||||
$(OBJS)\stctest_edit.obj &
|
||||
$(OBJS)\stctest_prefs.obj
|
||||
|
||||
|
||||
all : $(OBJS)
|
||||
@@ -178,7 +180,13 @@ $(OBJS) :
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all : .SYMBOLIC $(OBJS)\stctest.exe data
|
||||
all : .SYMBOLIC $(OBJS)\stctest.exe
|
||||
|
||||
$(OBJS)\stctest_edit.obj : .AUTODEPEND .\edit.cpp
|
||||
$(CXX) -zq -fo=$^@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stctest_prefs.obj : .AUTODEPEND .\prefs.cpp
|
||||
$(CXX) -zq -fo=$^@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stctest_sample.res : .AUTODEPEND .\..\..\..\samples\sample.rc
|
||||
wrc -q -ad -bt=nt -r -fo=$^@ -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__UNICODE_DEFINE_p) -i=.\..\..\..\include -i=$(SETUPHDIR) -i=. $(__DLLFLAG_p) -i=.\..\..\..\samples $<
|
||||
@@ -193,10 +201,6 @@ clean : .SYMBOLIC
|
||||
-if exist $(OBJS)\*.ilk del $(OBJS)\*.ilk
|
||||
-if exist $(OBJS)\stctest.exe del $(OBJS)\stctest.exe
|
||||
|
||||
data : .SYMBOLIC
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
for %f in (stctest.cpp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
|
||||
|
||||
$(OBJS)\stctest.exe : $(STCTEST_OBJECTS) $(OBJS)\stctest_sample.res
|
||||
@%create $(OBJS)\stctest.lbc
|
||||
@%append $(OBJS)\stctest.lbc option quiet
|
||||
|
BIN
contrib/samples/stc/mondrian.ico
Normal file
BIN
contrib/samples/stc/mondrian.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
44
contrib/samples/stc/mondrian.xpm
Normal file
44
contrib/samples/stc/mondrian.xpm
Normal file
@@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char *mondrian_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 6 1",
|
||||
" c Black",
|
||||
". c Blue",
|
||||
"X c #00bf00",
|
||||
"o c Red",
|
||||
"O c Yellow",
|
||||
"+ c Gray100",
|
||||
/* pixels */
|
||||
" ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" "
|
||||
};
|
379
contrib/samples/stc/prefs.cpp
Normal file
379
contrib/samples/stc/prefs.cpp
Normal file
@@ -0,0 +1,379 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: prefs.cpp
|
||||
// Purpose: STC test Preferences initialization
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes <wx/wx.h>.
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all 'standard' wxWindows headers)
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
//! wxWindows headers
|
||||
|
||||
//! wxWindows/contrib headers
|
||||
|
||||
//! application headers
|
||||
#include "defsext.h" // Additional definitions
|
||||
#include "prefs.h" // Preferences
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! language types
|
||||
const CommonInfo g_CommonPrefs = {
|
||||
// editor functionality prefs
|
||||
true, // syntaxEnable
|
||||
true, // foldEnable
|
||||
true, // indentEnable
|
||||
// display defaults prefs
|
||||
false, // overTypeInitial
|
||||
false, // readOnlyInitial
|
||||
false, // wrapModeInitial
|
||||
false, // displayEOLEnable
|
||||
false, // IndentGuideEnable
|
||||
true, // lineNumberEnable
|
||||
false, // longLineOnEnable
|
||||
false, // whiteSpaceEnable
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// keywordlists
|
||||
// C++
|
||||
wxChar* CppWordlist1 =
|
||||
_T("asm auto bool break case catch char class const const_cast \
|
||||
continue default delete do double dynamic_cast else enum explicit \
|
||||
export extern false float for friend goto if inline int long \
|
||||
mutable namespace new operator private protected public register \
|
||||
reinterpret_cast return short signed sizeof static static_cast \
|
||||
struct switch template this throw true try typedef typeid \
|
||||
typename union unsigned using virtual void volatile wchar_t \
|
||||
while");
|
||||
wxChar* CppWordlist2 =
|
||||
_T("file");
|
||||
wxChar* CppWordlist3 =
|
||||
_T("a addindex addtogroup anchor arg attention author b brief bug c \
|
||||
class code date def defgroup deprecated dontinclude e em endcode \
|
||||
endhtmlonly endif endlatexonly endlink endverbatim enum example \
|
||||
exception f$ f[ f] file fn hideinitializer htmlinclude \
|
||||
htmlonly if image include ingroup internal invariant interface \
|
||||
latexonly li line link mainpage name namespace nosubgrouping note \
|
||||
overload p page par param post pre ref relates remarks return \
|
||||
retval sa section see showinitializer since skip skipline struct \
|
||||
subsection test throw todo typedef union until var verbatim \
|
||||
verbinclude version warning weakgroup $ @ "" & < > # { }");
|
||||
|
||||
// Python
|
||||
wxChar* PythonWordlist1 =
|
||||
_T("and assert break class continue def del elif else except exec \
|
||||
finally for from global if import in is lambda None not or pass \
|
||||
print raise return try while yield");
|
||||
wxChar* PythonWordlist2 =
|
||||
_T("ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON BEGIN \
|
||||
BITMAP BLOCK BUTTON CAPTION CHARACTERISTICS CHECKBOX CLASS \
|
||||
COMBOBOX CONTROL CTEXT CURSOR DEFPUSHBUTTON DIALOG DIALOGEX \
|
||||
DISCARDABLE EDITTEXT END EXSTYLE FONT GROUPBOX ICON LANGUAGE \
|
||||
LISTBOX LTEXT MENU MENUEX MENUITEM MESSAGETABLE POPUP PUSHBUTTON \
|
||||
RADIOBUTTON RCDATA RTEXT SCROLLBAR SEPARATOR SHIFT STATE3 \
|
||||
STRINGTABLE STYLE TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY");
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! languages
|
||||
const LanguageInfo g_LanguagePrefs [] = {
|
||||
// C++
|
||||
{_T("C++"),
|
||||
_T("*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hpp;*.hxx;*.sma"),
|
||||
wxSTC_LEX_CPP,
|
||||
{{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_COMMENT, NULL},
|
||||
{mySTC_TYPE_COMMENT_LINE, NULL},
|
||||
{mySTC_TYPE_COMMENT_DOC, NULL},
|
||||
{mySTC_TYPE_NUMBER, NULL},
|
||||
{mySTC_TYPE_WORD1, CppWordlist1}, // KEYWORDS
|
||||
{mySTC_TYPE_STRING, NULL},
|
||||
{mySTC_TYPE_CHARACTER, NULL},
|
||||
{mySTC_TYPE_UUID, NULL},
|
||||
{mySTC_TYPE_PREPROCESSOR, NULL},
|
||||
{mySTC_TYPE_OPERATOR, NULL},
|
||||
{mySTC_TYPE_IDENTIFIER, NULL},
|
||||
{mySTC_TYPE_STRING_EOL, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // VERBATIM
|
||||
{mySTC_TYPE_REGEX, NULL},
|
||||
{mySTC_TYPE_COMMENT_SPECIAL, NULL}, // DOXY
|
||||
{mySTC_TYPE_WORD2, CppWordlist2}, // EXTRA WORDS
|
||||
{mySTC_TYPE_WORD3, CppWordlist3}, // DOXY KEYWORDS
|
||||
{mySTC_TYPE_ERROR, NULL}, // KEYWORDS ERROR
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL}},
|
||||
mySTC_FOLD_COMMENT | mySTC_FOLD_COMPACT | mySTC_FOLD_PREPROC},
|
||||
// Python
|
||||
{_T("Python"),
|
||||
_T("*.py;*.pyw"),
|
||||
wxSTC_LEX_PYTHON,
|
||||
{{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_COMMENT_LINE, NULL},
|
||||
{mySTC_TYPE_NUMBER, NULL},
|
||||
{mySTC_TYPE_STRING, NULL},
|
||||
{mySTC_TYPE_CHARACTER, NULL},
|
||||
{mySTC_TYPE_WORD1, PythonWordlist1}, // KEYWORDS
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // TRIPLE
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // TRIPLEDOUBLE
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // CLASSNAME
|
||||
{mySTC_TYPE_DEFAULT, PythonWordlist2}, // DEFNAME
|
||||
{mySTC_TYPE_OPERATOR, NULL},
|
||||
{mySTC_TYPE_IDENTIFIER, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // COMMENT_BLOCK
|
||||
{mySTC_TYPE_STRING_EOL, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL}},
|
||||
mySTC_FOLD_COMMENTPY | mySTC_FOLD_QUOTESPY},
|
||||
// * (any)
|
||||
{(wxChar *)DEFAULT_LANGUAGE,
|
||||
_T("*.*"),
|
||||
wxSTC_LEX_PROPERTIES,
|
||||
{{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL}},
|
||||
0},
|
||||
};
|
||||
|
||||
const int g_LanguagePrefsSize = WXSIZEOF(g_LanguagePrefs);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! style types
|
||||
const StyleInfo g_StylePrefs [] = {
|
||||
// mySTC_TYPE_DEFAULT
|
||||
{_T("Default"),
|
||||
_T("BLACK"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD1
|
||||
{_T("Keyword1"),
|
||||
_T("BLUE"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_BOLD, 0},
|
||||
|
||||
// mySTC_TYPE_WORD2
|
||||
{_T("Keyword2"),
|
||||
_T("DARK BLUE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD3
|
||||
{_T("Keyword3"),
|
||||
_T("CORNFLOWER BLUE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD4
|
||||
{_T("Keyword4"),
|
||||
_T("CYAN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD5
|
||||
{_T("Keyword5"),
|
||||
_T("DARK GREY"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD6
|
||||
{_T("Keyword6"),
|
||||
_T("GREY"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMENT
|
||||
{_T("Comment"),
|
||||
_T("FOREST GREEN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMENT_DOC
|
||||
{_T("Comment (Doc)"),
|
||||
_T("FOREST GREEN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMENT_LINE
|
||||
{_T("Comment line"),
|
||||
_T("FOREST GREEN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMENT_SPECIAL
|
||||
{_T("Special comment"),
|
||||
_T("FOREST GREEN"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_ITALIC, 0},
|
||||
|
||||
// mySTC_TYPE_CHARACTER
|
||||
{_T("Character"),
|
||||
_T("KHAKI"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_CHARACTER_EOL
|
||||
{_T("Character (EOL)"),
|
||||
_T("KHAKI"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_STRING
|
||||
{_T("String"),
|
||||
_T("BROWN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_STRING_EOL
|
||||
{_T("String (EOL)"),
|
||||
_T("BROWN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_DELIMITER
|
||||
{_T("Delimiter"),
|
||||
_T("ORANGE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_PUNCTUATION
|
||||
{_T("Punctuation"),
|
||||
_T("ORANGE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_OPERATOR
|
||||
{_T("Operator"),
|
||||
_T("BLACK"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_BOLD, 0},
|
||||
|
||||
// mySTC_TYPE_BRACE
|
||||
{_T("Label"),
|
||||
_T("VIOLET"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMAND
|
||||
{_T("Command"),
|
||||
_T("BLUE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_IDENTIFIER
|
||||
{_T("Identifier"),
|
||||
_T("BLACK"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_LABEL
|
||||
{_T("Label"),
|
||||
_T("VIOLET"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_NUMBER
|
||||
{_T("Number"),
|
||||
_T("SIENNA"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_PARAMETER
|
||||
{_T("Parameter"),
|
||||
_T("VIOLET"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_ITALIC, 0},
|
||||
|
||||
// mySTC_TYPE_REGEX
|
||||
{_T("Regular expression"),
|
||||
_T("ORCHID"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_UUID
|
||||
{_T("UUID"),
|
||||
_T("ORCHID"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_VALUE
|
||||
{_T("Value"),
|
||||
_T("ORCHID"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_ITALIC, 0},
|
||||
|
||||
// mySTC_TYPE_PREPROCESSOR
|
||||
{_T("Preprocessor"),
|
||||
_T("GREY"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_SCRIPT
|
||||
{_T("Script"),
|
||||
_T("DARK GREY"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_ERROR
|
||||
{_T("Error"),
|
||||
_T("RED"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_UNDEFINED
|
||||
{_T("Undefined"),
|
||||
_T("ORANGE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0}
|
||||
|
||||
};
|
||||
|
||||
const int g_StylePrefsSize = WXSIZEOF(g_StylePrefs);
|
||||
|
153
contrib/samples/stc/prefs.h
Normal file
153
contrib/samples/stc/prefs.h
Normal file
@@ -0,0 +1,153 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: prefs.h
|
||||
// Purpose: STC test Preferences initialization
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _PREFS_H_
|
||||
#define _PREFS_H_
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// informations
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//! wxWindows headers
|
||||
|
||||
//! wxWindows/contrib headers
|
||||
#include <wx/stc/stc.h> // styled text control
|
||||
|
||||
//! application headers
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
//! general style types
|
||||
#define mySTC_TYPE_DEFAULT 0
|
||||
|
||||
#define mySTC_TYPE_WORD1 1
|
||||
#define mySTC_TYPE_WORD2 2
|
||||
#define mySTC_TYPE_WORD3 3
|
||||
#define mySTC_TYPE_WORD4 4
|
||||
#define mySTC_TYPE_WORD5 5
|
||||
#define mySTC_TYPE_WORD6 6
|
||||
|
||||
#define mySTC_TYPE_COMMENT 7
|
||||
#define mySTC_TYPE_COMMENT_DOC 8
|
||||
#define mySTC_TYPE_COMMENT_LINE 9
|
||||
#define mySTC_TYPE_COMMENT_SPECIAL 10
|
||||
|
||||
#define mySTC_TYPE_CHARACTER 11
|
||||
#define mySTC_TYPE_CHARACTER_EOL 12
|
||||
#define mySTC_TYPE_STRING 13
|
||||
#define mySTC_TYPE_STRING_EOL 14
|
||||
|
||||
#define mySTC_TYPE_DELIMITER 15
|
||||
|
||||
#define mySTC_TYPE_PUNCTUATION 16
|
||||
|
||||
#define mySTC_TYPE_OPERATOR 17
|
||||
|
||||
#define mySTC_TYPE_BRACE 18
|
||||
|
||||
#define mySTC_TYPE_COMMAND 19
|
||||
#define mySTC_TYPE_IDENTIFIER 20
|
||||
#define mySTC_TYPE_LABEL 21
|
||||
#define mySTC_TYPE_NUMBER 22
|
||||
#define mySTC_TYPE_PARAMETER 23
|
||||
#define mySTC_TYPE_REGEX 24
|
||||
#define mySTC_TYPE_UUID 25
|
||||
#define mySTC_TYPE_VALUE 26
|
||||
|
||||
#define mySTC_TYPE_PREPROCESSOR 27
|
||||
#define mySTC_TYPE_SCRIPT 28
|
||||
|
||||
#define mySTC_TYPE_ERROR 29
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! style bits types
|
||||
#define mySTC_STYLE_BOLD 1
|
||||
#define mySTC_STYLE_ITALIC 2
|
||||
#define mySTC_STYLE_UNDERL 4
|
||||
#define mySTC_STYLE_HIDDEN 8
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! general folding types
|
||||
#define mySTC_FOLD_COMMENT 1
|
||||
#define mySTC_FOLD_COMPACT 2
|
||||
#define mySTC_FOLD_PREPROC 4
|
||||
|
||||
#define mySTC_FOLD_HTML 16
|
||||
#define mySTC_FOLD_HTMLPREP 32
|
||||
|
||||
#define mySTC_FOLD_COMMENTPY 64
|
||||
#define mySTC_FOLD_QUOTESPY 128
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! flags
|
||||
#define mySTC_FLAG_WRAPMODE 16
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// CommonInfo
|
||||
|
||||
struct CommonInfo {
|
||||
// editor functionality prefs
|
||||
bool syntaxEnable;
|
||||
bool foldEnable;
|
||||
bool indentEnable;
|
||||
// display defaults prefs
|
||||
bool readOnlyInitial;
|
||||
bool overTypeInitial;
|
||||
bool wrapModeInitial;
|
||||
bool displayEOLEnable;
|
||||
bool indentGuideEnable;
|
||||
bool lineNumberEnable;
|
||||
bool longLineOnEnable;
|
||||
bool whiteSpaceEnable;
|
||||
};
|
||||
extern const CommonInfo g_CommonPrefs;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// LanguageInfo
|
||||
|
||||
struct LanguageInfo {
|
||||
wxChar *name;
|
||||
wxChar *filepattern;
|
||||
int lexer;
|
||||
struct {
|
||||
int type;
|
||||
const wxChar *words;
|
||||
} styles [STYLE_TYPES_COUNT];
|
||||
int folds;
|
||||
};
|
||||
|
||||
extern const LanguageInfo g_LanguagePrefs[];
|
||||
extern const int g_LanguagePrefsSize;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// StyleInfo
|
||||
struct StyleInfo {
|
||||
wxChar *name;
|
||||
wxChar *foreground;
|
||||
wxChar *background;
|
||||
wxChar *fontname;
|
||||
int fontsize;
|
||||
int fontstyle;
|
||||
int lettercase;
|
||||
};
|
||||
|
||||
extern const StyleInfo g_StylePrefs[];
|
||||
extern const int g_StylePrefsSize;
|
||||
|
||||
#endif // _PREFS_H_
|
||||
|
@@ -7,16 +7,12 @@
|
||||
<exe id="stctest" template="wx_contrib_sample" template_append="wx_append">
|
||||
<sources>
|
||||
stctest.cpp
|
||||
edit.cpp
|
||||
prefs.cpp
|
||||
</sources>
|
||||
<wx-lib>stc</wx-lib>
|
||||
<wx-lib>core</wx-lib>
|
||||
<wx-lib>base</wx-lib>
|
||||
</exe>
|
||||
|
||||
<wx-data id="data">
|
||||
<files>
|
||||
stctest.cpp
|
||||
</files>
|
||||
</wx-data>
|
||||
|
||||
|
||||
</makefile>
|
||||
|
@@ -1,254 +1,659 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: stctest.cpp
|
||||
// Purpose: sample of using wxStyledTextCtrl
|
||||
// Author: Robin Dunn
|
||||
// Modified by:
|
||||
// Created: 3-Feb-2000
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: app.cpp
|
||||
// Purpose: STC test application
|
||||
// Maintainer: Otto Wyss
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 by Total Control Software
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma implementation "stctest.cpp"
|
||||
#pragma interface "stctest.cpp"
|
||||
#endif
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
// For compilers that support precompilation, includes <wx/wx.h>.
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
// need because it includes almost all 'standard' wxWindows headers)
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#include <wx/wfstream.h>
|
||||
//! wxWindows headers
|
||||
#include <wx/config.h> // configuration support
|
||||
#include <wx/filedlg.h> // file dialog support
|
||||
#include <wx/filename.h> // filename support
|
||||
#include <wx/notebook.h> // notebook support
|
||||
#include <wx/settings.h> // system settings
|
||||
#include <wx/string.h> // strings support
|
||||
|
||||
#include <wx/stc/stc.h>
|
||||
//! application headers
|
||||
#include "defsext.h" // Additional definitions
|
||||
#include "edit.h" // Edit module
|
||||
#include "prefs.h" // Prefs
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
//----------------------------------------------------------------------------
|
||||
// resources
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// the application icon (under Windows and OS/2 it is in resources)
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
|
||||
#include "mondrian.xpm"
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
#define APP_NAME _T("STC-Test")
|
||||
#define APP_DESCR _("See http://wxguide.sourceforge.net/indexedit.html")
|
||||
|
||||
#define APP_MAINT _T("Otto Wyss")
|
||||
#define APP_VENDOR _T("wxWindows")
|
||||
#define APP_COPYRIGTH _T("(C) 2003 Otto Wyss")
|
||||
#define APP_LICENCE _T("wxWindows")
|
||||
|
||||
#define APP_VERSION _T("0.1.alpha")
|
||||
#define APP_BUILD __DATE__
|
||||
|
||||
#define APP_WEBSITE _T("http://www.wxWindows.org")
|
||||
#define APP_MAIL _T("mailto://???")
|
||||
|
||||
#define NONAME _("<untitled>")
|
||||
|
||||
class AppBook;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! global application name
|
||||
wxString *g_appname = NULL;
|
||||
|
||||
//! global print data, to remember settings during the session
|
||||
wxPrintData *g_printData = (wxPrintData*) NULL;
|
||||
wxPageSetupData *g_pageSetupData = (wxPageSetupData*) NULL;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! application APP_VENDOR-APP_NAME.
|
||||
class App: public wxApp {
|
||||
friend class AppFrame;
|
||||
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
};
|
||||
//! the main function called durning application start
|
||||
virtual bool OnInit ();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Make an editor class
|
||||
|
||||
class MySTC : public wxStyledTextCtrl
|
||||
{
|
||||
public:
|
||||
MySTC(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0);
|
||||
|
||||
void OnKeyPressed(wxKeyEvent& evt);
|
||||
//! application exit function
|
||||
virtual int OnExit ();
|
||||
|
||||
private:
|
||||
//! frame window
|
||||
AppFrame* m_frame;
|
||||
|
||||
};
|
||||
|
||||
// created dynamically by wxWindows
|
||||
DECLARE_APP (App);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! frame of the application APP_VENDOR-APP_NAME.
|
||||
class AppFrame: public wxFrame {
|
||||
friend class App;
|
||||
friend class AppBook;
|
||||
friend class AppAbout;
|
||||
|
||||
public:
|
||||
//! constructor
|
||||
AppFrame (const wxString &title);
|
||||
|
||||
//! destructor
|
||||
~AppFrame ();
|
||||
|
||||
//! event handlers
|
||||
//! common
|
||||
void OnClose (wxCloseEvent &event);
|
||||
void OnAbout (wxCommandEvent &event);
|
||||
void OnExit (wxCommandEvent &event);
|
||||
void OnTimerEvent (wxTimerEvent &event);
|
||||
//! file
|
||||
void OnFileNew (wxCommandEvent &event);
|
||||
void OnFileNewFrame (wxCommandEvent &event);
|
||||
void OnFileOpen (wxCommandEvent &event);
|
||||
void OnFileOpenFrame (wxCommandEvent &event);
|
||||
void OnFileSave (wxCommandEvent &event);
|
||||
void OnFileSaveAs (wxCommandEvent &event);
|
||||
void OnFileClose (wxCommandEvent &event);
|
||||
//! properties
|
||||
void OnProperties (wxCommandEvent &event);
|
||||
//! print
|
||||
void OnPrintSetup (wxCommandEvent &event);
|
||||
void OnPrintPreview (wxCommandEvent &event);
|
||||
void OnPrint (wxCommandEvent &event);
|
||||
//! edit events
|
||||
void OnEdit (wxCommandEvent &event);
|
||||
|
||||
private:
|
||||
// edit object
|
||||
Edit *m_edit;
|
||||
void FileOpen (wxString fname);
|
||||
|
||||
//! creates the application menu bar
|
||||
wxMenuBar *m_menuBar;
|
||||
void CreateMenu ();
|
||||
|
||||
// print preview position and size
|
||||
wxRect DeterminePrintSize ();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(MySTC, wxStyledTextCtrl)
|
||||
EVT_KEY_DOWN(MySTC::OnKeyPressed)
|
||||
END_EVENT_TABLE()
|
||||
//----------------------------------------------------------------------------
|
||||
//! about box of the application APP_VENDOR-APP_NAME
|
||||
class AppAbout: public wxDialog {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Define a new frame type: this is going to be our main frame
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
//! constructor
|
||||
AppAbout (wxWindow *parent,
|
||||
int milliseconds = 0,
|
||||
long style = 0);
|
||||
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
//! destructor
|
||||
~AppAbout ();
|
||||
|
||||
// event handlers
|
||||
void OnTimerEvent (wxTimerEvent &event);
|
||||
|
||||
private:
|
||||
MySTC* ed;
|
||||
// timer
|
||||
wxTimer *m_timer;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
// IDs for the controls and the menu commands
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
ID_Quit = 1,
|
||||
ID_About,
|
||||
ID_ED
|
||||
};
|
||||
//============================================================================
|
||||
// implementation
|
||||
//============================================================================
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU (ID_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU (ID_About, MyFrame::OnAbout)
|
||||
END_EVENT_TABLE()
|
||||
IMPLEMENT_APP (App)
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
//----------------------------------------------------------------------------
|
||||
// App
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// `Main program' equivalent: the program execution "starts" here
|
||||
bool App::OnInit () {
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
MyFrame *frame = new MyFrame(_T("Testing wxStyledTextCtrl"),
|
||||
wxPoint(5, 5), wxSize(600, 600));
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
// set application and vendor name
|
||||
SetAppName (APP_NAME);
|
||||
SetVendorName (APP_VENDOR);
|
||||
g_appname = new wxString ();
|
||||
g_appname->Append (APP_VENDOR);
|
||||
g_appname->Append (_T("-"));
|
||||
g_appname->Append (APP_NAME);
|
||||
|
||||
frame->Show(TRUE);
|
||||
return TRUE;
|
||||
// initialize print data and setup
|
||||
g_printData = new wxPrintData;
|
||||
g_pageSetupData = new wxPageSetupDialogData;
|
||||
|
||||
// create application frame
|
||||
m_frame = new AppFrame (*g_appname);
|
||||
|
||||
// open application frame
|
||||
m_frame->Layout ();
|
||||
m_frame->Show (true);
|
||||
SetTopWindow (m_frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int App::OnExit () {
|
||||
|
||||
// frame constructor
|
||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// we need this in order to allow the about menu relocation, since ABOUT is
|
||||
// not the default id of the about menu
|
||||
wxApp::s_macAboutMenuItemId = ID_About;
|
||||
#endif
|
||||
// delete global appname
|
||||
delete g_appname;
|
||||
|
||||
// delete global print data and setup
|
||||
if (g_printData) delete g_printData;
|
||||
if (g_pageSetupData) delete g_pageSetupData;
|
||||
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(ID_About, _T("&About...\tCtrl-A"), _T("Show about dialog"));
|
||||
|
||||
menuFile->Append(ID_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, _T("&File"));
|
||||
menuBar->Append(helpMenu, _T("&Help"));
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(_T("Testing wxStyledTextCtrl"));
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
// Setup the editor
|
||||
ed = new MySTC(this, ID_ED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// AppFrame
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// event handlers
|
||||
BEGIN_EVENT_TABLE (AppFrame, wxFrame)
|
||||
// common
|
||||
EVT_CLOSE ( AppFrame::OnClose)
|
||||
// file
|
||||
EVT_MENU (wxID_OPEN, AppFrame::OnFileOpen)
|
||||
EVT_MENU (wxID_SAVE, AppFrame::OnFileSave)
|
||||
EVT_MENU (wxID_SAVEAS, AppFrame::OnFileSaveAs)
|
||||
EVT_MENU (wxID_CLOSE, AppFrame::OnFileClose)
|
||||
// properties
|
||||
EVT_MENU (myID_PROPERTIES, AppFrame::OnProperties)
|
||||
// print and exit
|
||||
EVT_MENU (wxID_PRINT_SETUP, AppFrame::OnPrintSetup)
|
||||
EVT_MENU (wxID_PREVIEW, AppFrame::OnPrintPreview)
|
||||
EVT_MENU (wxID_PRINT, AppFrame::OnPrint)
|
||||
EVT_MENU (wxID_EXIT, AppFrame::OnExit)
|
||||
// edit
|
||||
EVT_MENU (wxID_CLEAR, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_CUT, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_COPY, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_PASTE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_INDENTINC, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_INDENTRED, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_SELECTALL, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_SELECTLINE, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_REDO, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_UNDO, AppFrame::OnEdit)
|
||||
// find
|
||||
EVT_MENU (wxID_FIND, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_FINDNEXT, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_REPLACE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_REPLACENEXT, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_BRACEMATCH, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_GOTO, AppFrame::OnEdit)
|
||||
// view
|
||||
EVT_MENU_RANGE (myID_HILIGHTFIRST, myID_HILIGHTLAST,
|
||||
AppFrame::OnEdit)
|
||||
EVT_MENU (myID_DISPLAYEOL, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_INDENTGUIDE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_LINENUMBER, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_LONGLINEON, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_WHITESPACE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_FOLDTOGGLE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_OVERTYPE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_READONLY, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_WRAPMODEON, AppFrame::OnEdit)
|
||||
// extra
|
||||
EVT_MENU (myID_CHANGELOWER, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CHANGEUPPER, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CONVERTCR, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CONVERTCRLF, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CONVERTLF, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CHARSETANSI, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CHARSETMAC, AppFrame::OnEdit)
|
||||
// help
|
||||
EVT_MENU (wxID_ABOUT, AppFrame::OnAbout)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
AppFrame::AppFrame (const wxString &title)
|
||||
: wxFrame ((wxFrame *)NULL, -1, title, wxDefaultPosition, wxSize(600,400),
|
||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) {
|
||||
|
||||
// intitialize important variables
|
||||
m_edit = NULL;
|
||||
|
||||
// set icon and background
|
||||
SetTitle (*g_appname);
|
||||
SetIcon (wxICON (mondrian));
|
||||
SetBackgroundColour (_T("WHITE"));
|
||||
|
||||
// about box shown for 1 seconds
|
||||
AppAbout (this, 1000);
|
||||
|
||||
// create menu
|
||||
m_menuBar = new wxMenuBar;
|
||||
CreateMenu ();
|
||||
|
||||
// open first page
|
||||
m_edit = new Edit (this, -1);
|
||||
m_edit->SetFocus();
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// TRUE is to force the frame to close
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _T("Testing wxStyledTextCtrl...\n"));
|
||||
|
||||
wxMessageBox(msg, _T("About This Test"), wxOK | wxICON_INFORMATION, this);
|
||||
AppFrame::~AppFrame () {
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
wxChar* keywords =
|
||||
_T("asm auto bool break case catch char class const \
|
||||
const_cast continue default delete do double \
|
||||
dynamic_cast else enum explicit export extern \
|
||||
false float for friend goto if inline int long \
|
||||
mutable namespace new operator private protected \
|
||||
public register reinterpret_cast return short signed \
|
||||
sizeof static static_cast struct switch template this \
|
||||
throw true try typedef typeid typename union unsigned \
|
||||
using virtual void volatile wchar_t while");
|
||||
|
||||
|
||||
|
||||
MySTC::MySTC(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style)
|
||||
: wxStyledTextCtrl(parent, id, pos, size, style)
|
||||
{
|
||||
// Default font
|
||||
wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
StyleSetFont(wxSTC_STYLE_DEFAULT, font);
|
||||
StyleClearAll();
|
||||
|
||||
StyleSetForeground(0, wxColour(0x80, 0x80, 0x80));
|
||||
StyleSetForeground(1, wxColour(0x00, 0x7f, 0x00));
|
||||
//StyleSetForeground(2, wxColour(0x00, 0x7f, 0x00));
|
||||
StyleSetForeground(3, wxColour(0x7f, 0x7f, 0x7f));
|
||||
StyleSetForeground(4, wxColour(0x00, 0x7f, 0x7f));
|
||||
StyleSetForeground(5, wxColour(0x00, 0x00, 0x7f));
|
||||
StyleSetForeground(6, wxColour(0x7f, 0x00, 0x7f));
|
||||
StyleSetForeground(7, wxColour(0x7f, 0x00, 0x7f));
|
||||
StyleSetForeground(8, wxColour(0x00, 0x7f, 0x7f));
|
||||
StyleSetForeground(9, wxColour(0x7f, 0x7f, 0x7f));
|
||||
StyleSetForeground(10, wxColour(0x00, 0x00, 0x00));
|
||||
StyleSetForeground(11, wxColour(0x00, 0x00, 0x00));
|
||||
StyleSetBold(5, TRUE);
|
||||
StyleSetBold(10, TRUE);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
StyleSetSpec(2, _T("fore:#007f00,bold,face:Arial,size:9"));
|
||||
#else
|
||||
StyleSetSpec(2, _T("fore:#007f00,bold,face:Helvetica,size:9"));
|
||||
#endif
|
||||
|
||||
// give it some text to play with
|
||||
wxString st;
|
||||
wxFileInputStream stream(wxT("stctest.cpp"));
|
||||
size_t sz = stream.GetSize();
|
||||
char* buf = new char[sz + 1];
|
||||
stream.Read((void*) buf, stream.GetSize());
|
||||
buf[sz] = 0;
|
||||
st = wxString::FromAscii(buf);
|
||||
delete[] buf;
|
||||
|
||||
InsertText(0, st);
|
||||
EmptyUndoBuffer();
|
||||
|
||||
SetLexer(wxSTC_LEX_CPP);
|
||||
SetKeyWords(0, keywords);
|
||||
// common event handlers
|
||||
void AppFrame::OnClose (wxCloseEvent &event) {
|
||||
wxCommandEvent evt;
|
||||
OnFileClose (evt);
|
||||
if (m_edit && m_edit->Modified()) {
|
||||
if (event.CanVeto()) event.Veto (true);
|
||||
return;
|
||||
}
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void MySTC::OnKeyPressed(wxKeyEvent& evt)
|
||||
{
|
||||
if (CallTipActive())
|
||||
CallTipCancel();
|
||||
void AppFrame::OnAbout (wxCommandEvent &WXUNUSED(event)) {
|
||||
AppAbout (this);
|
||||
}
|
||||
|
||||
int key = evt.GetKeyCode();
|
||||
if ( key == WXK_SPACE && evt.ControlDown()) {
|
||||
int pos = GetCurrentPos();
|
||||
void AppFrame::OnExit (wxCommandEvent &WXUNUSED(event)) {
|
||||
Close (true);
|
||||
}
|
||||
|
||||
if (evt.ShiftDown()) {
|
||||
// show how to do CallTips
|
||||
CallTipSetBackground(wxColour(_T("YELLOW")));
|
||||
CallTipShow(pos, _T("lots of of text: blah, blah, blah\n\n\
|
||||
show some suff, maybe parameters..\n\n\
|
||||
fubar(param1, param2)"));
|
||||
}
|
||||
else {
|
||||
// show how to do AutoComplete
|
||||
AutoCompSetIgnoreCase(false);
|
||||
AutoCompShow(0, keywords); // reuse the keyword list here
|
||||
// normally you would build a string of completion texts...
|
||||
// file event handlers
|
||||
void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
wxString fname;
|
||||
wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""), _T("Any file (*)|*"),
|
||||
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
|
||||
if (dlg.ShowModal() != wxID_OK) return;
|
||||
fname = dlg.GetPath ();
|
||||
FileOpen (fname);
|
||||
}
|
||||
|
||||
void AppFrame::OnFileSave (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
if (!m_edit->Modified()) {
|
||||
wxMessageBox (_("There is nothing to save!"), _("Save file"),
|
||||
wxOK | wxICON_EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
m_edit->SaveFile ();
|
||||
}
|
||||
|
||||
void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
wxString filename = wxEmptyString;
|
||||
wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
|
||||
if (dlg.ShowModal() != wxID_OK) return;
|
||||
filename = dlg.GetPath();
|
||||
m_edit->SaveFile (filename);
|
||||
}
|
||||
|
||||
void AppFrame::OnFileClose (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
if (m_edit->Modified()) {
|
||||
if (wxMessageBox (_("Text is not saved, save before closing?"), _("Close"),
|
||||
wxYES_NO | wxICON_QUESTION) == wxYES) {
|
||||
m_edit->SaveFile();
|
||||
if (m_edit->Modified()) {
|
||||
wxMessageBox (_("Text could not be saved!"), _("Close abort"),
|
||||
wxOK | wxICON_EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
// properties event handlers
|
||||
void AppFrame::OnProperties (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
EditProperties (m_edit, 0);
|
||||
}
|
||||
|
||||
// print event handlers
|
||||
void AppFrame::OnPrintSetup (wxCommandEvent &WXUNUSED(event)) {
|
||||
(*g_pageSetupData) = * g_printData;
|
||||
wxPageSetupDialog pageSetupDialog(this, g_pageSetupData);
|
||||
pageSetupDialog.ShowModal();
|
||||
(*g_printData) = pageSetupDialog.GetPageSetupData().GetPrintData();
|
||||
(*g_pageSetupData) = pageSetupDialog.GetPageSetupData();
|
||||
}
|
||||
|
||||
void AppFrame::OnPrintPreview (wxCommandEvent &WXUNUSED(event)) {
|
||||
wxPrintDialogData printDialogData( *g_printData);
|
||||
wxPrintPreview *preview =
|
||||
new wxPrintPreview (new EditPrint (m_edit),
|
||||
new EditPrint (m_edit),
|
||||
&printDialogData);
|
||||
if (!preview->Ok()) {
|
||||
delete preview;
|
||||
wxMessageBox (_("There was a problem with previewing.\n\
|
||||
Perhaps your current printer is not correctly?"),
|
||||
_("Previewing"), wxOK);
|
||||
return;
|
||||
}
|
||||
wxRect rect = DeterminePrintSize();
|
||||
wxPreviewFrame *frame = new wxPreviewFrame (preview, this, _("Print Preview"));
|
||||
frame->SetSize (rect);
|
||||
frame->Centre(wxBOTH);
|
||||
frame->Initialize();
|
||||
frame->Show(true);
|
||||
}
|
||||
|
||||
void AppFrame::OnPrint (wxCommandEvent &WXUNUSED(event)) {
|
||||
wxPrintDialogData printDialogData( *g_printData);
|
||||
wxPrinter printer (&printDialogData);
|
||||
EditPrint printout (m_edit);
|
||||
if (!printer.Print (this, &printout, true)) {
|
||||
if (wxPrinter::GetLastError() == wxPRINTER_ERROR) {
|
||||
wxMessageBox (_("There was a problem with printing.\n\
|
||||
Perhaps your current printer is not correctly?"),
|
||||
_("Previewing"), wxOK);
|
||||
return;
|
||||
}
|
||||
}
|
||||
(*g_printData) = printer.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
|
||||
// edit events
|
||||
void AppFrame::OnEdit (wxCommandEvent &event) {
|
||||
if (m_edit) m_edit->ProcessEvent (event);
|
||||
}
|
||||
|
||||
// private functions
|
||||
void AppFrame::CreateMenu () {
|
||||
|
||||
// File menu
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuFile->Append (wxID_OPEN, _("&Open ..\tCtrl+O"));
|
||||
menuFile->Append (wxID_SAVE, _("&Save\tCtrl+S"));
|
||||
menuFile->Append (wxID_SAVEAS, _("Save &as ..\tCtrl+Shift+S"));
|
||||
menuFile->Append (wxID_CLOSE, _("&Close\tCtrl+W"));
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append (myID_PROPERTIES, _("Proper&ties ..\tCtrl+I"));
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append (wxID_PRINT_SETUP, _("Print Set&up .."));
|
||||
menuFile->Append (wxID_PREVIEW, _("Print Pre&view\tCtrl+Shift+P"));
|
||||
menuFile->Append (wxID_PRINT, _("&Print ..\tCtrl+P"));
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append (wxID_EXIT, _("&Quit\tCtrl+Q"));
|
||||
|
||||
// Edit menu
|
||||
wxMenu *menuEdit = new wxMenu;
|
||||
menuEdit->Append (wxID_UNDO, _("&Undo\tCtrl+Z"));
|
||||
menuEdit->Append (wxID_REDO, _("&Redo\tCtrl+Shift+Z"));
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (wxID_CUT, _("Cu&t\tCtrl+X"));
|
||||
menuEdit->Append (wxID_COPY, _("&Copy\tCtrl+C"));
|
||||
menuEdit->Append (wxID_PASTE, _("&Paste\tCtrl+V"));
|
||||
menuEdit->Append (wxID_CLEAR, _("&Delete\tDel"));
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (wxID_FIND, _("&Find\tCtrl+F"));
|
||||
menuEdit->Enable (wxID_FIND, false);
|
||||
menuEdit->Append (myID_FINDNEXT, _("Find &next\tF3"));
|
||||
menuEdit->Enable (myID_FINDNEXT, false);
|
||||
menuEdit->Append (myID_REPLACE, _("&Replace\tCtrl+H"));
|
||||
menuEdit->Enable (myID_REPLACE, false);
|
||||
menuEdit->Append (myID_REPLACENEXT, _("Replace &again\tShift+F4"));
|
||||
menuEdit->Enable (myID_REPLACENEXT, false);
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (myID_BRACEMATCH, _("&Match brace\tCtrl+M"));
|
||||
menuEdit->Append (myID_GOTO, _("&Goto\tCtrl+G"));
|
||||
menuEdit->Enable (myID_GOTO, false);
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (myID_INDENTINC, _("&Indent increase\tTab"));
|
||||
menuEdit->Append (myID_INDENTRED, _("I&ndent reduce\tBksp"));
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (wxID_SELECTALL, _("&Select all\tCtrl+A"));
|
||||
menuEdit->Append (myID_SELECTLINE, _("Select &line\tCtrl+L"));
|
||||
|
||||
// hilight submenu
|
||||
wxMenu *menuHilight = new wxMenu;
|
||||
int Nr;
|
||||
for (Nr = 0; Nr < g_LanguagePrefsSize; Nr++) {
|
||||
menuHilight->Append (myID_HILIGHTFIRST + Nr,
|
||||
g_LanguagePrefs [Nr].name);
|
||||
}
|
||||
|
||||
// charset submenu
|
||||
wxMenu *menuCharset = new wxMenu;
|
||||
menuCharset->Append (myID_CHARSETANSI, _("&ANSI (Windows)"));
|
||||
menuCharset->Append (myID_CHARSETMAC, _("&MAC (Macintosh)"));
|
||||
|
||||
// View menu
|
||||
wxMenu *menuView = new wxMenu;
|
||||
menuView->Append (myID_HILIGHTLANG, _("&Hilight language .."), menuHilight);
|
||||
menuView->AppendSeparator();
|
||||
menuView->AppendCheckItem (myID_FOLDTOGGLE, _("&Toggle current fold\tCtrl+T"));
|
||||
menuView->AppendCheckItem (myID_OVERTYPE, _("&Overwrite mode\tIns"));
|
||||
menuView->AppendCheckItem (myID_WRAPMODEON, _("&Wrap mode\tCtrl+U"));
|
||||
menuView->AppendSeparator();
|
||||
menuView->AppendCheckItem (myID_DISPLAYEOL, _("Show line &endings"));
|
||||
menuView->AppendCheckItem (myID_INDENTGUIDE, _("Show &indent guides"));
|
||||
menuView->AppendCheckItem (myID_LINENUMBER, _("Show line &numbers"));
|
||||
menuView->AppendCheckItem (myID_LONGLINEON, _("Show &long line marker"));
|
||||
menuView->AppendCheckItem (myID_WHITESPACE, _("Show white&space"));
|
||||
menuView->AppendSeparator();
|
||||
menuView->Append (myID_USECHARSET, _("Use &code page of .."), menuCharset);
|
||||
|
||||
// change case submenu
|
||||
wxMenu *menuChangeCase = new wxMenu;
|
||||
menuChangeCase->Append (myID_CHANGEUPPER, _("&Upper case"));
|
||||
menuChangeCase->Append (myID_CHANGELOWER, _("&Lower case"));
|
||||
|
||||
// convert EOL submenu
|
||||
wxMenu *menuConvertEOL = new wxMenu;
|
||||
menuConvertEOL->Append (myID_CONVERTCR, _("CR (&Linux)"));
|
||||
menuConvertEOL->Append (myID_CONVERTCRLF, _("CR+LF (&Windows)"));
|
||||
menuConvertEOL->Append (myID_CONVERTLF, _("LF (&Macintosh)"));
|
||||
|
||||
// Extra menu
|
||||
wxMenu *menuExtra = new wxMenu;
|
||||
menuExtra->AppendCheckItem (myID_READONLY, _("&Readonly mode"));
|
||||
menuExtra->AppendSeparator();
|
||||
menuExtra->Append (myID_CHANGECASE, _("Change &case to .."), menuChangeCase);
|
||||
menuExtra->AppendSeparator();
|
||||
menuExtra->Append (myID_CONVERTEOL, _("Convert line &endings to .."), menuConvertEOL);
|
||||
|
||||
// Window menu
|
||||
wxMenu *menuWindow = new wxMenu;
|
||||
menuWindow->Append (myID_PAGEPREV, _("&Previous\tCtrl+Shift+Tab"));
|
||||
menuWindow->Append (myID_PAGENEXT, _("&Next\tCtrl+Tab"));
|
||||
|
||||
// Help menu
|
||||
wxMenu *menuHelp = new wxMenu;
|
||||
menuHelp->Append (wxID_ABOUT, _("&About ..\tShift+F1"));
|
||||
|
||||
// construct menu
|
||||
m_menuBar->Append (menuFile, _("&File"));
|
||||
m_menuBar->Append (menuEdit, _("&Edit"));
|
||||
m_menuBar->Append (menuView, _("&View"));
|
||||
m_menuBar->Append (menuExtra, _("E&xtra"));
|
||||
m_menuBar->Append (menuWindow, _("&Window"));
|
||||
m_menuBar->Append (menuHelp, _("&Help"));
|
||||
SetMenuBar (m_menuBar);
|
||||
|
||||
}
|
||||
|
||||
void AppFrame::FileOpen (wxString fname) {
|
||||
wxFileName w(fname); w.Normalize(); fname = w.GetFullPath();
|
||||
m_edit->LoadFile (fname);
|
||||
}
|
||||
|
||||
wxRect AppFrame::DeterminePrintSize () {
|
||||
|
||||
wxSize scr = wxGetDisplaySize();
|
||||
|
||||
// determine position and size (shifting 16 left and down)
|
||||
wxRect rect = GetRect();
|
||||
rect.x += 16;
|
||||
rect.y += 16;
|
||||
rect.width = wxMin (rect.width, (scr.x - rect.x));
|
||||
rect.height = wxMin (rect.height, (scr.x - rect.y));
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// AppAbout
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE (AppAbout, wxDialog)
|
||||
EVT_TIMER (myID_ABOUTTIMER, AppAbout::OnTimerEvent)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
AppAbout::AppAbout (wxWindow *parent,
|
||||
int milliseconds,
|
||||
long style)
|
||||
: wxDialog (parent, -1, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
|
||||
|
||||
// set timer if any
|
||||
m_timer = NULL;
|
||||
if (milliseconds > 0) {
|
||||
m_timer = new wxTimer (this, myID_ABOUTTIMER);
|
||||
m_timer->Start (milliseconds, wxTIMER_ONE_SHOT);
|
||||
}
|
||||
|
||||
// sets the application title
|
||||
SetTitle (_("About .."));
|
||||
|
||||
// about info
|
||||
wxGridSizer *aboutinfo = new wxGridSizer (2, 0, 2);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, _("Written by: ")),
|
||||
0, wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, APP_MAINT),
|
||||
1, wxEXPAND | wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, _("Version: ")),
|
||||
0, wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, APP_VERSION),
|
||||
1, wxEXPAND | wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, _("Licence type: ")),
|
||||
0, wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, APP_LICENCE),
|
||||
1, wxEXPAND | wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, _("Copyright: ")),
|
||||
0, wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, APP_COPYRIGTH),
|
||||
1, wxEXPAND | wxALIGN_LEFT);
|
||||
|
||||
// about icontitle//info
|
||||
wxBoxSizer *aboutpane = new wxBoxSizer (wxHORIZONTAL);
|
||||
wxBitmap bitmap = wxBitmap(wxICON (mondrian));
|
||||
aboutpane->Add (new wxStaticBitmap (this, -1, bitmap),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 20);
|
||||
aboutpane->Add (aboutinfo, 1, wxEXPAND);
|
||||
aboutpane->Add (60, 0);
|
||||
|
||||
// about complete
|
||||
wxBoxSizer *totalpane = new wxBoxSizer (wxVERTICAL);
|
||||
totalpane->Add (0, 20);
|
||||
wxStaticText *appname = new wxStaticText(this, -1, *g_appname);
|
||||
appname->SetFont (wxFont (24, wxDEFAULT, wxNORMAL, wxBOLD));
|
||||
totalpane->Add (appname, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 40);
|
||||
totalpane->Add (0, 10);
|
||||
totalpane->Add (aboutpane, 0, wxEXPAND | wxALL, 4);
|
||||
totalpane->Add (new wxStaticText(this, -1, APP_DESCR),
|
||||
0, wxALIGN_CENTER | wxALL, 10);
|
||||
wxButton *okButton = new wxButton (this, wxID_OK, _("OK"));
|
||||
okButton->SetDefault();
|
||||
totalpane->Add (okButton, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
||||
|
||||
SetSizerAndFit (totalpane);
|
||||
|
||||
CenterOnScreen();
|
||||
ShowModal();
|
||||
}
|
||||
|
||||
AppAbout::~AppAbout () {
|
||||
if (m_timer) {
|
||||
delete m_timer;
|
||||
m_timer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
void AppAbout::OnTimerEvent (wxTimerEvent &event) {
|
||||
if (m_timer) delete m_timer;
|
||||
m_timer = NULL;
|
||||
EndModal (wxID_OK);
|
||||
}
|
||||
|
||||
|
@@ -468,6 +468,14 @@ LINK32=link.exe
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\edit.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prefs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\..\..\..\samples\sample.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@@ -1 +1,5 @@
|
||||
mondrian ICON "mondrian.ico"
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
print BITMAP "bitmaps/print.bmp"
|
||||
|
||||
|
@@ -80,14 +80,18 @@ STCDLL_OBJECTS = \
|
||||
stcdll_LexLisp.o \
|
||||
stcdll_LexLout.o \
|
||||
stcdll_LexLua.o \
|
||||
stcdll_LexMMIXAL.o \
|
||||
stcdll_LexMatlab.o \
|
||||
stcdll_LexNsis.o \
|
||||
stcdll_LexOthers.o \
|
||||
stcdll_LexPOV.o \
|
||||
stcdll_LexPS.o \
|
||||
stcdll_LexPascal.o \
|
||||
stcdll_LexPerl.o \
|
||||
stcdll_LexPython.o \
|
||||
stcdll_LexRuby.o \
|
||||
stcdll_LexSQL.o \
|
||||
stcdll_LexScriptol.o \
|
||||
stcdll_LexVB.o \
|
||||
stcdll_LineMarker.o \
|
||||
stcdll_PropSet.o \
|
||||
@@ -134,14 +138,18 @@ STCLIB_OBJECTS = \
|
||||
stclib_LexLisp.o \
|
||||
stclib_LexLout.o \
|
||||
stclib_LexLua.o \
|
||||
stclib_LexMMIXAL.o \
|
||||
stclib_LexMatlab.o \
|
||||
stclib_LexNsis.o \
|
||||
stclib_LexOthers.o \
|
||||
stclib_LexPOV.o \
|
||||
stclib_LexPS.o \
|
||||
stclib_LexPascal.o \
|
||||
stclib_LexPerl.o \
|
||||
stclib_LexPython.o \
|
||||
stclib_LexRuby.o \
|
||||
stclib_LexSQL.o \
|
||||
stclib_LexScriptol.o \
|
||||
stclib_LexVB.o \
|
||||
stclib_LineMarker.o \
|
||||
stclib_PropSet.o \
|
||||
@@ -378,15 +386,24 @@ stcdll_LexLout.o: $(srcdir)/scintilla/src/LexLout.cxx
|
||||
stcdll_LexLua.o: $(srcdir)/scintilla/src/LexLua.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexMMIXAL.o: $(srcdir)/scintilla/src/LexMMIXAL.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPOV.o: $(srcdir)/scintilla/src/LexPOV.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPS.o: $(srcdir)/scintilla/src/LexPS.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -402,6 +419,9 @@ stcdll_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
|
||||
stcdll_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexVB.o: $(srcdir)/scintilla/src/LexVB.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -530,15 +550,24 @@ stclib_LexLout.o: $(srcdir)/scintilla/src/LexLout.cxx
|
||||
stclib_LexLua.o: $(srcdir)/scintilla/src/LexLua.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexMMIXAL.o: $(srcdir)/scintilla/src/LexMMIXAL.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPOV.o: $(srcdir)/scintilla/src/LexPOV.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPS.o: $(srcdir)/scintilla/src/LexPS.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
@@ -554,6 +583,9 @@ stclib_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
|
||||
stclib_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexVB.o: $(srcdir)/scintilla/src/LexVB.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
|
@@ -288,7 +288,7 @@ void SurfaceImpl::Init(SurfaceID hdc_, WindowID) {
|
||||
hdc = (wxDC*)hdc_;
|
||||
}
|
||||
|
||||
void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID) {
|
||||
void SurfaceImpl::InitPixMap(int width, int height, Surface *WXUNUSED(surface_), WindowID) {
|
||||
Release();
|
||||
hdc = new wxMemoryDC();
|
||||
hdcOwned = true;
|
||||
@@ -542,7 +542,7 @@ int SurfaceImpl::Descent(Font &font) {
|
||||
return d;
|
||||
}
|
||||
|
||||
int SurfaceImpl::InternalLeading(Font &font) {
|
||||
int SurfaceImpl::InternalLeading(Font &WXUNUSED(font)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ int SurfaceImpl::AverageCharWidth(Font &font) {
|
||||
return hdc->GetCharWidth();
|
||||
}
|
||||
|
||||
int SurfaceImpl::SetPalette(Palette *pal, bool inBackGround) {
|
||||
int SurfaceImpl::SetPalette(Palette *WXUNUSED(pal), bool WXUNUSED(inBackGround)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) {
|
||||
unicodeMode=unicodeMode_;
|
||||
}
|
||||
|
||||
void SurfaceImpl::SetDBCSMode(int codePage) {
|
||||
void SurfaceImpl::SetDBCSMode(int WXUNUSED(codePage)) {
|
||||
// dbcsMode = codePage == SC_CP_DBCS;
|
||||
}
|
||||
|
||||
@@ -969,7 +969,7 @@ int ListBoxImpl::GetSelection() {
|
||||
}
|
||||
|
||||
|
||||
int ListBoxImpl::Find(const char *prefix) {
|
||||
int ListBoxImpl::Find(const char *WXUNUSED(prefix)) {
|
||||
// No longer used
|
||||
return -1;
|
||||
}
|
||||
@@ -1063,7 +1063,7 @@ void Menu::Show(Point pt, Window &w) {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
DynamicLibrary *DynamicLibrary::Load(const char *modulePath) {
|
||||
DynamicLibrary *DynamicLibrary::Load(const char *WXUNUSED(modulePath)) {
|
||||
wxFAIL_MSG(wxT("Dynamic lexer loading not implemented yet"));
|
||||
return NULL;
|
||||
}
|
||||
@@ -1103,7 +1103,7 @@ void Platform::DebugDisplay(const char *s) {
|
||||
wxLogDebug(stc2wx(s));
|
||||
}
|
||||
|
||||
bool Platform::IsKeyDown(int key) {
|
||||
bool Platform::IsKeyDown(int WXUNUSED(key)) {
|
||||
return false; // I don't think we'll need this.
|
||||
}
|
||||
|
||||
@@ -1196,11 +1196,11 @@ int Platform::Clamp(int val, int minVal, int maxVal) {
|
||||
}
|
||||
|
||||
|
||||
bool Platform::IsDBCSLeadByte(int codePage, char ch) {
|
||||
bool Platform::IsDBCSLeadByte(int WXUNUSED(codePage), char WXUNUSED(ch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int Platform::DBCSCharLength(int codePage, const char *s) {
|
||||
int Platform::DBCSCharLength(int WXUNUSED(codePage), const char *WXUNUSED(s)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -383,7 +383,8 @@ bool ScintillaWX::CanPaste() {
|
||||
bool didOpen;
|
||||
|
||||
if (Editor::CanPaste()) {
|
||||
if ( (didOpen = !wxTheClipboard->IsOpened()) )
|
||||
didOpen = !wxTheClipboard->IsOpened();
|
||||
if ( didOpen )
|
||||
wxTheClipboard->Open();
|
||||
|
||||
if (wxTheClipboard->IsOpened()) {
|
||||
@@ -597,7 +598,7 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta,
|
||||
}
|
||||
|
||||
|
||||
void ScintillaWX::DoSize(int width, int height) {
|
||||
void ScintillaWX::DoSize(int WXUNUSED(width), int WXUNUSED(height)) {
|
||||
// PRectangle rcClient(0,0,width,height);
|
||||
// SetScrollBarsTo(rcClient);
|
||||
// DropGraphics();
|
||||
@@ -628,8 +629,8 @@ void ScintillaWX::DoLeftButtonMove(Point pt) {
|
||||
ButtonMove(pt);
|
||||
}
|
||||
|
||||
void ScintillaWX::DoMiddleButtonUp(Point pt) {
|
||||
#ifdef __WXGTK__
|
||||
void ScintillaWX::DoMiddleButtonUp(Point pt) {
|
||||
// Set the current position to the mouse click point and
|
||||
// then paste in the PRIMARY selection, if any. wxGTK only.
|
||||
int newPos = PositionFromLocation(pt);
|
||||
@@ -656,8 +657,11 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) {
|
||||
|
||||
ShowCaretAtCurrentPosition();
|
||||
EnsureCaretVisible();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void ScintillaWX::DoMiddleButtonUp(Point WXUNUSED(pt)) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void ScintillaWX::DoAddChar(int key) {
|
||||
@@ -673,9 +677,10 @@ void ScintillaWX::DoAddChar(int key) {
|
||||
}
|
||||
|
||||
|
||||
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) {
|
||||
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed) {
|
||||
#if defined(__WXGTK__) || defined(__WXMAC__)
|
||||
// Ctrl chars (A-Z) end up with the wrong keycode on wxGTK...
|
||||
// Ctrl chars (A-Z) end up with the wrong keycode on wxGTK
|
||||
// TODO: Check this, it shouldn't be true any longer.
|
||||
if (ctrl && key >= 1 && key <= 26)
|
||||
key += 'A' - 1;
|
||||
#endif
|
||||
@@ -709,6 +714,21 @@ int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* cons
|
||||
case WXK_MENU: key = 0; break;
|
||||
}
|
||||
|
||||
#ifdef __WXMAC__
|
||||
if ( meta ) {
|
||||
// check for a few common Mac Meta-key combos and remap them to Ctrl
|
||||
// for Scintilla
|
||||
switch ( key ) {
|
||||
case 'Z': // Undo
|
||||
case 'X': // Cut
|
||||
case 'C': // Copy
|
||||
case 'V': // Paste
|
||||
case 'A': // Select All
|
||||
ctrl = true;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
int rv = KeyDown(key, shift, ctrl, alt, consumed);
|
||||
|
||||
if (key)
|
||||
@@ -760,7 +780,7 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
|
||||
}
|
||||
|
||||
|
||||
wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) {
|
||||
wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def) {
|
||||
dragResult = def;
|
||||
return dragResult;
|
||||
}
|
||||
@@ -817,8 +837,8 @@ void ScintillaWX::DoScrollToColumn(int column) {
|
||||
HorizontalScrollTo(column * vs.spaceWidth);
|
||||
}
|
||||
|
||||
void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
|
||||
#ifdef __WXGTK__
|
||||
void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
|
||||
wxRegion rgn(wxRectFromPRectangle(rect));
|
||||
if (ac.Active()) {
|
||||
wxRect childRect = ((wxWindow*)ac.lb->GetID())->GetRect();
|
||||
@@ -830,9 +850,11 @@ void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
|
||||
}
|
||||
|
||||
dc.SetClippingRegion(rgn);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
void ScintillaWX::ClipChildren(wxDC& WXUNUSED(dc), PRectangle WXUNUSED(rect)) {
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
|
@@ -139,7 +139,7 @@ public:
|
||||
void DoMiddleButtonUp(Point pt);
|
||||
void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
|
||||
void DoAddChar(int key);
|
||||
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
|
||||
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed);
|
||||
void DoTick() { Tick(); }
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
@@ -547,9 +547,12 @@ methodOverrideMap = {
|
||||
|
||||
|
||||
'GrabFocus' : (None, 0, 0, 0),
|
||||
|
||||
# Rename some that woudl otherwise hid the wxWindow methods
|
||||
'SetFocus' : ('SetSTCFocus', 0, 0, 0),
|
||||
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
|
||||
|
||||
'SetCursor' : ('SetSTCCursor', 0, 0, 0),
|
||||
'GetCursor' : ('GetSTCCursor', 0, 0, 0),
|
||||
|
||||
'LoadLexerLibrary' : (None, 0,0,0),
|
||||
|
||||
|
@@ -3,4 +3,4 @@ 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.53
|
||||
The current version of the Scintilla code is 1.54
|
||||
|
@@ -25,7 +25,7 @@ protected:
|
||||
char buf[bufferSize+1];
|
||||
int startPos;
|
||||
int endPos;
|
||||
int codePage;
|
||||
int codePage;
|
||||
|
||||
virtual bool InternalIsLeadByte(char ch)=0;
|
||||
virtual void Fill(int position)=0;
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
if (position < startPos || position >= endPos) {
|
||||
Fill(position);
|
||||
if (position < startPos || position >= endPos) {
|
||||
// Position is outside range of document
|
||||
// Position is outside range of document
|
||||
return chDefault;
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler);
|
||||
|
||||
|
||||
/**
|
||||
* A LexerModule is responsible for lexing and folding a particular language.
|
||||
* The class maintains a list of LexerModules which can be searched to find a
|
||||
@@ -26,7 +26,7 @@ protected:
|
||||
|
||||
public:
|
||||
const char *languageName;
|
||||
LexerModule(int language_, LexerFunction fnLexer_,
|
||||
LexerModule(int language_, LexerFunction fnLexer_,
|
||||
const char *languageName_=0, LexerFunction fnFolder_=0,
|
||||
const char * const wordListDescriptions_[] = NULL);
|
||||
int GetLanguage() const { return language; }
|
||||
|
@@ -24,11 +24,21 @@ struct Property {
|
||||
/**
|
||||
*/
|
||||
class PropSet {
|
||||
private:
|
||||
protected:
|
||||
enum { hashRoots=31 };
|
||||
Property *props[hashRoots];
|
||||
Property *enumnext;
|
||||
int enumhash;
|
||||
static unsigned int HashString(const char *s, size_t len) {
|
||||
unsigned int ret = 0;
|
||||
while (len--) {
|
||||
ret <<= 4;
|
||||
ret ^= *s;
|
||||
s++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
static bool IncludesVar(const char *value, const char *key);
|
||||
public:
|
||||
PropSet *superPS;
|
||||
PropSet();
|
||||
|
@@ -56,6 +56,9 @@
|
||||
#define SCLEX_POV 39
|
||||
#define SCLEX_LOUT 40
|
||||
#define SCLEX_ESCRIPT 41
|
||||
#define SCLEX_PS 42
|
||||
#define SCLEX_NSIS 43
|
||||
#define SCLEX_MMIXAL 44
|
||||
#define SCLEX_AUTOMATIC 1000
|
||||
#define SCE_P_DEFAULT 0
|
||||
#define SCE_P_COMMENTLINE 1
|
||||
@@ -268,6 +271,8 @@
|
||||
#define SCE_LUA_WORD4 15
|
||||
#define SCE_LUA_WORD5 16
|
||||
#define SCE_LUA_WORD6 17
|
||||
#define SCE_LUA_WORD7 18
|
||||
#define SCE_LUA_WORD8 19
|
||||
#define SCE_ERR_DEFAULT 0
|
||||
#define SCE_ERR_PYTHON 1
|
||||
#define SCE_ERR_GCC 2
|
||||
@@ -455,14 +460,20 @@
|
||||
#define SCE_POV_DEFAULT 0
|
||||
#define SCE_POV_COMMENT 1
|
||||
#define SCE_POV_COMMENTLINE 2
|
||||
#define SCE_POV_COMMENTDOC 3
|
||||
#define SCE_POV_NUMBER 4
|
||||
#define SCE_POV_WORD 5
|
||||
#define SCE_POV_NUMBER 3
|
||||
#define SCE_POV_OPERATOR 4
|
||||
#define SCE_POV_IDENTIFIER 5
|
||||
#define SCE_POV_STRING 6
|
||||
#define SCE_POV_OPERATOR 7
|
||||
#define SCE_POV_IDENTIFIER 8
|
||||
#define SCE_POV_BRACE 9
|
||||
#define SCE_POV_STRINGEOL 7
|
||||
#define SCE_POV_DIRECTIVE 8
|
||||
#define SCE_POV_BADDIRECTIVE 9
|
||||
#define SCE_POV_WORD2 10
|
||||
#define SCE_POV_WORD3 11
|
||||
#define SCE_POV_WORD4 12
|
||||
#define SCE_POV_WORD5 13
|
||||
#define SCE_POV_WORD6 14
|
||||
#define SCE_POV_WORD7 15
|
||||
#define SCE_POV_WORD8 16
|
||||
#define SCE_LOUT_DEFAULT 0
|
||||
#define SCE_LOUT_COMMENT 1
|
||||
#define SCE_LOUT_NUMBER 2
|
||||
@@ -486,6 +497,54 @@
|
||||
#define SCE_ESCRIPT_BRACE 9
|
||||
#define SCE_ESCRIPT_WORD2 10
|
||||
#define SCE_ESCRIPT_WORD3 11
|
||||
#define SCE_PS_DEFAULT 0
|
||||
#define SCE_PS_COMMENT 1
|
||||
#define SCE_PS_DSC_COMMENT 2
|
||||
#define SCE_PS_DSC_VALUE 3
|
||||
#define SCE_PS_NUMBER 4
|
||||
#define SCE_PS_NAME 5
|
||||
#define SCE_PS_KEYWORD 6
|
||||
#define SCE_PS_LITERAL 7
|
||||
#define SCE_PS_IMMEVAL 8
|
||||
#define SCE_PS_PAREN_ARRAY 9
|
||||
#define SCE_PS_PAREN_DICT 10
|
||||
#define SCE_PS_PAREN_PROC 11
|
||||
#define SCE_PS_TEXT 12
|
||||
#define SCE_PS_HEXSTRING 13
|
||||
#define SCE_PS_BASE85STRING 14
|
||||
#define SCE_PS_BADSTRINGCHAR 15
|
||||
#define SCE_NSIS_DEFAULT 0
|
||||
#define SCE_NSIS_COMMENT 1
|
||||
#define SCE_NSIS_STRINGDQ 2
|
||||
#define SCE_NSIS_STRINGLQ 3
|
||||
#define SCE_NSIS_STRINGRQ 4
|
||||
#define SCE_NSIS_FUNCTION 5
|
||||
#define SCE_NSIS_VARIABLE 6
|
||||
#define SCE_NSIS_LABEL 7
|
||||
#define SCE_NSIS_USERDEFINED 8
|
||||
#define SCE_NSIS_SECTIONDEF 9
|
||||
#define SCE_NSIS_SUBSECTIONDEF 10
|
||||
#define SCE_NSIS_IFDEFINEDEF 11
|
||||
#define SCE_NSIS_MACRODEF 12
|
||||
#define SCE_NSIS_STRINGVAR 13
|
||||
#define SCE_MMIXAL_LEADWS 0
|
||||
#define SCE_MMIXAL_COMMENT 1
|
||||
#define SCE_MMIXAL_LABEL 2
|
||||
#define SCE_MMIXAL_OPCODE 3
|
||||
#define SCE_MMIXAL_OPCODE_PRE 4
|
||||
#define SCE_MMIXAL_OPCODE_VALID 5
|
||||
#define SCE_MMIXAL_OPCODE_UNKNOWN 6
|
||||
#define SCE_MMIXAL_OPCODE_POST 7
|
||||
#define SCE_MMIXAL_OPERANDS 8
|
||||
#define SCE_MMIXAL_NUMBER 9
|
||||
#define SCE_MMIXAL_REF 10
|
||||
#define SCE_MMIXAL_CHAR 11
|
||||
#define SCE_MMIXAL_STRING 12
|
||||
#define SCE_MMIXAL_REGISTER 13
|
||||
#define SCE_MMIXAL_HEX 14
|
||||
#define SCE_MMIXAL_OPERATOR 15
|
||||
#define SCE_MMIXAL_SYMBOL 16
|
||||
#define SCE_MMIXAL_INCLUDE 17
|
||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||
|
||||
#endif
|
||||
|
@@ -204,6 +204,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define INDIC_TT 2
|
||||
#define INDIC_DIAGONAL 3
|
||||
#define INDIC_STRIKE 4
|
||||
#define INDIC_HIDDEN 5
|
||||
#define INDIC0_MASK 0x20
|
||||
#define INDIC1_MASK 0x40
|
||||
#define INDIC2_MASK 0x80
|
||||
@@ -546,6 +547,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_GETLEXER 4002
|
||||
#define SCI_COLOURISE 4003
|
||||
#define SCI_SETPROPERTY 4004
|
||||
#define KEYWORDSET_MAX 8
|
||||
#define SCI_SETKEYWORDS 4005
|
||||
#define SCI_SETLEXERLANGUAGE 4006
|
||||
#define SCI_LOADLEXERLIBRARY 4007
|
||||
|
@@ -462,6 +462,7 @@ val INDIC_SQUIGGLE=1
|
||||
val INDIC_TT=2
|
||||
val INDIC_DIAGONAL=3
|
||||
val INDIC_STRIKE=4
|
||||
val INDIC_HIDDEN=5
|
||||
val INDIC0_MASK=0x20
|
||||
val INDIC1_MASK=0x40
|
||||
val INDIC2_MASK=0x80
|
||||
@@ -1476,6 +1477,9 @@ fun void Colourise=4003(position start, position end)
|
||||
# Set up a value that may be used by a lexer for some optional feature.
|
||||
set void SetProperty=4004(string key, string value)
|
||||
|
||||
# Maximum value of keywordSet parameter of SetKeyWords.
|
||||
val KEYWORDSET_MAX=8
|
||||
|
||||
# Set up the key words used by the lexer.
|
||||
set void SetKeyWords=4005(int keywordSet, string keyWords)
|
||||
|
||||
@@ -1584,6 +1588,9 @@ val SCLEX_CSS=38
|
||||
val SCLEX_POV=39
|
||||
val SCLEX_LOUT=40
|
||||
val SCLEX_ESCRIPT=41
|
||||
val SCLEX_PS=42
|
||||
val SCLEX_NSIS=43
|
||||
val SCLEX_MMIXAL=44
|
||||
|
||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -1835,6 +1842,8 @@ val SCE_LUA_WORD3=14
|
||||
val SCE_LUA_WORD4=15
|
||||
val SCE_LUA_WORD5=16
|
||||
val SCE_LUA_WORD6=17
|
||||
val SCE_LUA_WORD7=18
|
||||
val SCE_LUA_WORD8=19
|
||||
# Lexical states for SCLEX_ERRORLIST
|
||||
lex ErrorList=SCLEX_ERRORLIST SCE_ERR_
|
||||
val SCE_ERR_DEFAULT=0
|
||||
@@ -2058,14 +2067,20 @@ lex POV=SCLEX_POV SCE_POV_
|
||||
val SCE_POV_DEFAULT=0
|
||||
val SCE_POV_COMMENT=1
|
||||
val SCE_POV_COMMENTLINE=2
|
||||
val SCE_POV_COMMENTDOC=3
|
||||
val SCE_POV_NUMBER=4
|
||||
val SCE_POV_WORD=5
|
||||
val SCE_POV_NUMBER=3
|
||||
val SCE_POV_OPERATOR=4
|
||||
val SCE_POV_IDENTIFIER=5
|
||||
val SCE_POV_STRING=6
|
||||
val SCE_POV_OPERATOR=7
|
||||
val SCE_POV_IDENTIFIER=8
|
||||
val SCE_POV_BRACE=9
|
||||
val SCE_POV_STRINGEOL=7
|
||||
val SCE_POV_DIRECTIVE=8
|
||||
val SCE_POV_BADDIRECTIVE=9
|
||||
val SCE_POV_WORD2=10
|
||||
val SCE_POV_WORD3=11
|
||||
val SCE_POV_WORD4=12
|
||||
val SCE_POV_WORD5=13
|
||||
val SCE_POV_WORD6=14
|
||||
val SCE_POV_WORD7=15
|
||||
val SCE_POV_WORD8=16
|
||||
# Lexical states for SCLEX_LOUT
|
||||
lex LOUT=SCLEX_LOUT SCE_LOUT_
|
||||
val SCE_LOUT_DEFAULT=0
|
||||
@@ -2093,6 +2108,60 @@ val SCE_ESCRIPT_IDENTIFIER=8
|
||||
val SCE_ESCRIPT_BRACE=9
|
||||
val SCE_ESCRIPT_WORD2=10
|
||||
val SCE_ESCRIPT_WORD3=11
|
||||
# Lexical states for SCLEX_PS
|
||||
lex PS=SCLEX_PS SCE_PS_
|
||||
val SCE_PS_DEFAULT=0
|
||||
val SCE_PS_COMMENT=1
|
||||
val SCE_PS_DSC_COMMENT=2
|
||||
val SCE_PS_DSC_VALUE=3
|
||||
val SCE_PS_NUMBER=4
|
||||
val SCE_PS_NAME=5
|
||||
val SCE_PS_KEYWORD=6
|
||||
val SCE_PS_LITERAL=7
|
||||
val SCE_PS_IMMEVAL=8
|
||||
val SCE_PS_PAREN_ARRAY=9
|
||||
val SCE_PS_PAREN_DICT=10
|
||||
val SCE_PS_PAREN_PROC=11
|
||||
val SCE_PS_TEXT=12
|
||||
val SCE_PS_HEXSTRING=13
|
||||
val SCE_PS_BASE85STRING=14
|
||||
val SCE_PS_BADSTRINGCHAR=15
|
||||
# Lexical states for SCLEX_NSIS
|
||||
lex NSIS=SCLEX_NSIS SCE_NSIS_
|
||||
val SCE_NSIS_DEFAULT=0
|
||||
val SCE_NSIS_COMMENT=1
|
||||
val SCE_NSIS_STRINGDQ=2
|
||||
val SCE_NSIS_STRINGLQ=3
|
||||
val SCE_NSIS_STRINGRQ=4
|
||||
val SCE_NSIS_FUNCTION=5
|
||||
val SCE_NSIS_VARIABLE=6
|
||||
val SCE_NSIS_LABEL=7
|
||||
val SCE_NSIS_USERDEFINED=8
|
||||
val SCE_NSIS_SECTIONDEF=9
|
||||
val SCE_NSIS_SUBSECTIONDEF=10
|
||||
val SCE_NSIS_IFDEFINEDEF=11
|
||||
val SCE_NSIS_MACRODEF=12
|
||||
val SCE_NSIS_STRINGVAR=13
|
||||
# Lexical states for SCLEX_MMIXAL
|
||||
lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_
|
||||
val SCE_MMIXAL_LEADWS=0
|
||||
val SCE_MMIXAL_COMMENT=1
|
||||
val SCE_MMIXAL_LABEL=2
|
||||
val SCE_MMIXAL_OPCODE=3
|
||||
val SCE_MMIXAL_OPCODE_PRE=4
|
||||
val SCE_MMIXAL_OPCODE_VALID=5
|
||||
val SCE_MMIXAL_OPCODE_UNKNOWN=6
|
||||
val SCE_MMIXAL_OPCODE_POST=7
|
||||
val SCE_MMIXAL_OPERANDS=8
|
||||
val SCE_MMIXAL_NUMBER=9
|
||||
val SCE_MMIXAL_REF=10
|
||||
val SCE_MMIXAL_CHAR=11
|
||||
val SCE_MMIXAL_STRING=12
|
||||
val SCE_MMIXAL_REGISTER=13
|
||||
val SCE_MMIXAL_HEX=14
|
||||
val SCE_MMIXAL_OPERATOR=15
|
||||
val SCE_MMIXAL_SYMBOL=16
|
||||
val SCE_MMIXAL_INCLUDE=17
|
||||
|
||||
# Events
|
||||
|
||||
|
@@ -26,8 +26,8 @@ protected:
|
||||
bool InternalIsLeadByte(char ch);
|
||||
void Fill(int position);
|
||||
public:
|
||||
WindowAccessor(WindowID id_, PropSet &props_) :
|
||||
Accessor(), id(id_), props(props_),
|
||||
WindowAccessor(WindowID id_, PropSet &props_) :
|
||||
Accessor(), id(id_), props(props_),
|
||||
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
|
||||
}
|
||||
~WindowAccessor();
|
||||
@@ -40,8 +40,8 @@ public:
|
||||
void Flush();
|
||||
int GetLineState(int line);
|
||||
int SetLineState(int line, int state);
|
||||
int GetPropertyInt(const char *key, int defaultValue=0) {
|
||||
return props.GetInt(key, defaultValue);
|
||||
int GetPropertyInt(const char *key, int defaultValue=0) {
|
||||
return props.GetInt(key, defaultValue);
|
||||
}
|
||||
char *GetProperties() {
|
||||
return props.ToString();
|
||||
|
@@ -103,9 +103,9 @@ void MarkerHandleSet::RemoveNumber(int markerNum) {
|
||||
if (mhn->number == markerNum) {
|
||||
*pmhn = mhn->next;
|
||||
delete mhn;
|
||||
return ;
|
||||
} else {
|
||||
pmhn = &((*pmhn)->next);
|
||||
}
|
||||
pmhn = &((*pmhn)->next);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -212,7 +212,7 @@ public:
|
||||
int GetMark(int line);
|
||||
void DeleteAllMarks(int markerNum);
|
||||
int LineFromHandle(int markerHandle);
|
||||
|
||||
|
||||
/// Actions without undo
|
||||
void BasicInsertString(int position, char *s, int insertLength);
|
||||
void BasicDeleteChars(int position, int deleteLength);
|
||||
|
@@ -394,7 +394,7 @@ bool Document::InsertStyledString(int position, char *s, int insertLength) {
|
||||
DocModification(
|
||||
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
|
||||
position / 2, insertLength / 2,
|
||||
0, 0));
|
||||
0, s));
|
||||
int prevLinesTotal = LinesTotal();
|
||||
bool startSavePoint = cb.IsSavePoint();
|
||||
const char *text = cb.InsertString(position, s, insertLength);
|
||||
@@ -926,7 +926,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
||||
if (line == lineRangeStart) {
|
||||
if ((startPos != endOfLine) && (searchEnd == '$'))
|
||||
continue; // Can't match end of line if start position before end of line
|
||||
endOfLine = startPos;
|
||||
endOfLine = startPos+1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,10 +938,10 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
||||
if (increment == -1) {
|
||||
// Check for the last match on this line.
|
||||
int repetitions = 1000; // Break out of infinite loop
|
||||
while (success && (pre->eopat[0] < endOfLine) && (repetitions--)) {
|
||||
success = pre->Execute(di, pre->eopat[0], endOfLine);
|
||||
while (success && (pre->eopat[0] <= (endOfLine+1)) && (repetitions--)) {
|
||||
success = pre->Execute(di, pos+1, endOfLine+1);
|
||||
if (success) {
|
||||
if (pre->eopat[0] <= minPos) {
|
||||
if (pre->eopat[0] <= (minPos+1)) {
|
||||
pos = pre->bopat[0];
|
||||
lenRet = pre->eopat[0] - pre->bopat[0];
|
||||
} else {
|
||||
|
@@ -130,8 +130,8 @@ void DocumentAccessor::Flush() {
|
||||
lenDoc = -1;
|
||||
if (validLen > 0) {
|
||||
pdoc->SetStyles(validLen, styleBuf);
|
||||
validLen = 0;
|
||||
startPosStyling += validLen;
|
||||
validLen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,9 +32,9 @@ protected:
|
||||
void Fill(int position);
|
||||
|
||||
public:
|
||||
DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
|
||||
DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
|
||||
Accessor(), pdoc(pdoc_), props(props_), id(id_),
|
||||
lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
|
||||
lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
|
||||
startSeg(0), startPosStyling(0) {
|
||||
}
|
||||
~DocumentAccessor();
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
void Flush();
|
||||
int GetLineState(int line);
|
||||
int SetLineState(int line, int state);
|
||||
int GetPropertyInt(const char *key, int defaultValue=0) {
|
||||
return props.GetInt(key, defaultValue);
|
||||
int GetPropertyInt(const char *key, int defaultValue=0) {
|
||||
return props.GetInt(key, defaultValue);
|
||||
}
|
||||
char *GetProperties() {
|
||||
return props.ToString();
|
||||
|
@@ -1414,7 +1414,7 @@ void Editor::LinesSplit(int pixelWidth) {
|
||||
for (int subLine = 1; subLine < ll->lines; subLine++) {
|
||||
pdoc->InsertString(posLineStart + (subLine - 1) * strlen(eol) +
|
||||
ll->LineStart(subLine), eol);
|
||||
targetEnd += strlen(eol);
|
||||
targetEnd += static_cast<int>(strlen(eol));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1428,6 +1428,12 @@ int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) {
|
||||
return markerCheck;
|
||||
}
|
||||
|
||||
// Avoid 64 bit compiler warnings.
|
||||
// Scintilla does not support text buffers larger than 2**31
|
||||
static int istrlen(const char *s) {
|
||||
return static_cast<int>(strlen(s));
|
||||
}
|
||||
|
||||
void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
|
||||
if (vs.fixedColumnWidth == 0)
|
||||
return;
|
||||
@@ -1589,11 +1595,11 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
|
||||
}
|
||||
PRectangle rcNumber = rcMarker;
|
||||
// Right justify
|
||||
int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, strlen(number));
|
||||
int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
|
||||
int xpos = rcNumber.right - width - 3;
|
||||
rcNumber.left = xpos;
|
||||
surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font,
|
||||
rcNumber.top + vs.maxAscent, number, strlen(number),
|
||||
rcNumber.top + vs.maxAscent, number, istrlen(number),
|
||||
vs.styles[STYLE_LINENUMBER].fore.allocated,
|
||||
vs.styles[STYLE_LINENUMBER].back.allocated);
|
||||
}
|
||||
@@ -1770,7 +1776,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
|
||||
} else if (controlCharSymbol < 32) {
|
||||
const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]);
|
||||
// +3 For a blank on front and rounded edge each side:
|
||||
ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, strlen(ctrlChar)) + 3;
|
||||
ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3;
|
||||
} else {
|
||||
char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
|
||||
surface->MeasureWidths(ctrlCharsFont, cc, 1,
|
||||
@@ -2135,7 +2141,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
|
||||
rcChar.left++;
|
||||
rcChar.right--;
|
||||
surface->DrawTextClipped(rcChar, ctrlCharsFont,
|
||||
rcSegment.top + vsDraw.maxAscent, ctrlChar, strlen(ctrlChar),
|
||||
rcSegment.top + vsDraw.maxAscent, ctrlChar, istrlen(ctrlChar),
|
||||
textBack, textFore);
|
||||
} else {
|
||||
char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
|
||||
@@ -2360,7 +2366,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
if (AbandonPaint()) {
|
||||
return;
|
||||
}
|
||||
RefreshPixMaps(surfaceWindow); // In case pixmaps invalidated by scrollbar change
|
||||
}
|
||||
PLATFORM_ASSERT(pixmapSelPattern->Initialised());
|
||||
|
||||
PRectangle rcRightMargin = rcClient;
|
||||
rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth;
|
||||
@@ -2389,6 +2397,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
|
||||
Surface *surface = surfaceWindow;
|
||||
if (bufferedDraw) {
|
||||
surface = pixmapLine;
|
||||
PLATFORM_ASSERT(pixmapLine->Initialised());
|
||||
}
|
||||
surface->SetUnicodeMode(IsUnicodeMode());
|
||||
surface->SetDBCSMode(CodePage());
|
||||
@@ -2680,7 +2689,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
|
||||
int lineNumberWidth = 0;
|
||||
if (lineNumberIndex >= 0) {
|
||||
lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font,
|
||||
"99999" lineNumberPrintSpace, 5 + strlen(lineNumberPrintSpace));
|
||||
"99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace));
|
||||
vsPrint.ms[lineNumberIndex].width = lineNumberWidth;
|
||||
}
|
||||
|
||||
@@ -2760,10 +2769,10 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
|
||||
rcNumber.right = rcNumber.left + lineNumberWidth;
|
||||
// Right justify
|
||||
rcNumber.left -= surfaceMeasure->WidthText(
|
||||
vsPrint.styles[STYLE_LINENUMBER].font, number, strlen(number));
|
||||
vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number));
|
||||
surface->FlushCachedState();
|
||||
surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font,
|
||||
ypos + vsPrint.maxAscent, number, strlen(number),
|
||||
ypos + vsPrint.maxAscent, number, istrlen(number),
|
||||
vsPrint.styles[STYLE_LINENUMBER].fore.allocated,
|
||||
vsPrint.styles[STYLE_LINENUMBER].back.allocated);
|
||||
}
|
||||
@@ -2799,7 +2808,7 @@ int Editor::TextWidth(int style, const char *text) {
|
||||
RefreshStyleData();
|
||||
AutoSurface surface(this);
|
||||
if (surface) {
|
||||
return surface->WidthText(vs.styles[style].font, text, strlen(text));
|
||||
return surface->WidthText(vs.styles[style].font, text, istrlen(text));
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@@ -3553,7 +3562,7 @@ void Editor::LineDuplicate() {
|
||||
char *thisLine = CopyRange(start, end);
|
||||
const char *eol = StringFromEOLMode(pdoc->eolMode);
|
||||
pdoc->InsertString(end, eol);
|
||||
pdoc->InsertString(end + strlen(eol), thisLine, end - start);
|
||||
pdoc->InsertString(end + istrlen(eol), thisLine, end - start);
|
||||
delete []thisLine;
|
||||
}
|
||||
|
||||
@@ -3568,7 +3577,7 @@ void Editor::NewLine() {
|
||||
eol = "\r";
|
||||
} // else SC_EOL_LF -> "\n" already set
|
||||
if (pdoc->InsertString(currentPos, eol)) {
|
||||
SetEmptySelection(currentPos + strlen(eol));
|
||||
SetEmptySelection(currentPos + istrlen(eol));
|
||||
while (*eol) {
|
||||
NotifyChar(*eol);
|
||||
eol++;
|
||||
@@ -4069,7 +4078,7 @@ long Editor::FindText(
|
||||
sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range.
|
||||
|
||||
TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
|
||||
int lengthFound = strlen(ft->lpstrText);
|
||||
int lengthFound = istrlen(ft->lpstrText);
|
||||
int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText,
|
||||
(wParam & SCFIND_MATCHCASE) != 0,
|
||||
(wParam & SCFIND_WHOLEWORD) != 0,
|
||||
@@ -4112,7 +4121,7 @@ long Editor::SearchText(
|
||||
|
||||
const char *txt = reinterpret_cast<char *>(lParam);
|
||||
int pos;
|
||||
int lengthFound = strlen(txt);
|
||||
int lengthFound = istrlen(txt);
|
||||
if (iMessage == SCI_SEARCHNEXT) {
|
||||
pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt,
|
||||
(wParam & SCFIND_MATCHCASE) != 0,
|
||||
@@ -4315,14 +4324,14 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul
|
||||
position = positionAfterDeletion;
|
||||
|
||||
if (rectangular) {
|
||||
PasteRectangular(position, value, strlen(value));
|
||||
PasteRectangular(position, value, istrlen(value));
|
||||
pdoc->EndUndoAction();
|
||||
// Should try to select new rectangle but it may not be a rectangle now so just select the drop position
|
||||
SetSelection(position, position);
|
||||
} else {
|
||||
position = MovePositionOutsideChar(position, currentPos - position);
|
||||
if (pdoc->InsertString(position, value)) {
|
||||
SetSelection(position + strlen(value), position);
|
||||
SetSelection(position + istrlen(value), position);
|
||||
}
|
||||
pdoc->EndUndoAction();
|
||||
}
|
||||
@@ -4990,7 +4999,7 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) {
|
||||
int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) {
|
||||
pdoc->BeginUndoAction();
|
||||
if (length == -1)
|
||||
length = strlen(text);
|
||||
length = istrlen(text);
|
||||
if (replacePatterns) {
|
||||
text = pdoc->SubstituteByPosition(text, &length);
|
||||
if (!text)
|
||||
@@ -5186,7 +5195,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
char *replacement = CharPtrFromSPtr(lParam);
|
||||
pdoc->InsertString(currentPos, replacement);
|
||||
pdoc->EndUndoAction();
|
||||
SetEmptySelection(currentPos + strlen(replacement));
|
||||
SetEmptySelection(currentPos + istrlen(replacement));
|
||||
EnsureCaretVisible();
|
||||
}
|
||||
break;
|
||||
@@ -5357,7 +5366,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
char *sz = CharPtrFromSPtr(lParam);
|
||||
pdoc->InsertString(insertPos, sz);
|
||||
if (newCurrent > insertPos)
|
||||
newCurrent += strlen(sz);
|
||||
newCurrent += istrlen(sz);
|
||||
SetEmptySelection(newCurrent);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -10,16 +10,8 @@
|
||||
|
||||
#if PLAT_WIN
|
||||
#define EXT_LEXER_DECL __stdcall
|
||||
#elif PLAT_GTK
|
||||
#define EXT_LEXER_DECL
|
||||
#endif
|
||||
|
||||
#if PLAT_WX
|
||||
#ifdef __WXMSW__
|
||||
#define EXT_LEXER_DECL __stdcall
|
||||
#else
|
||||
#define EXT_LEXER_DECL
|
||||
#endif
|
||||
#define EXT_LEXER_DECL
|
||||
#endif
|
||||
|
||||
// External Lexer function definitions...
|
||||
@@ -41,7 +33,7 @@ protected:
|
||||
int externalLanguage;
|
||||
char name[100];
|
||||
public:
|
||||
ExternalLexerModule(int language_, LexerFunction fnLexer_,
|
||||
ExternalLexerModule(int language_, LexerFunction fnLexer_,
|
||||
const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){
|
||||
strncpy(name, languageName_, sizeof(name));
|
||||
languageName = name;
|
||||
@@ -70,7 +62,7 @@ public:
|
||||
LexerLibrary(const char* ModuleName);
|
||||
~LexerLibrary();
|
||||
void Release();
|
||||
|
||||
|
||||
LexerLibrary *next;
|
||||
SString m_sModuleName;
|
||||
};
|
||||
@@ -79,10 +71,10 @@ public:
|
||||
class LexerManager {
|
||||
public:
|
||||
~LexerManager();
|
||||
|
||||
|
||||
static LexerManager *GetInstance();
|
||||
static void DeleteInstance();
|
||||
|
||||
|
||||
void Load(const char* path);
|
||||
void Clear();
|
||||
|
||||
|
@@ -55,6 +55,8 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) {
|
||||
} else if (style == INDIC_STRIKE) {
|
||||
surface->MoveTo(rc.left, rc.top - 4);
|
||||
surface->LineTo(rc.right, rc.top - 4);
|
||||
} else if (style == INDIC_HIDDEN) {
|
||||
// Draw nothing
|
||||
} else { // Either INDIC_PLAIN or unknown
|
||||
surface->MoveTo(rc.left, ymid);
|
||||
surface->LineTo(rc.right, ymid);
|
||||
|
@@ -153,6 +153,8 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmLout);
|
||||
LINK_LEXER(lmLua);
|
||||
LINK_LEXER(lmMatlab);
|
||||
LINK_LEXER(lmMMIXAL);
|
||||
LINK_LEXER(lmNsis);
|
||||
LINK_LEXER(lmBatch);
|
||||
LINK_LEXER(lmDiff);
|
||||
LINK_LEXER(lmProps);
|
||||
@@ -163,8 +165,10 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmPascal);
|
||||
LINK_LEXER(lmPerl);
|
||||
LINK_LEXER(lmPOV);
|
||||
LINK_LEXER(lmPS);
|
||||
LINK_LEXER(lmPython);
|
||||
LINK_LEXER(lmRuby);
|
||||
LINK_LEXER(lmScriptol);
|
||||
LINK_LEXER(lmSQL);
|
||||
LINK_LEXER(lmVB);
|
||||
LINK_LEXER(lmVBScript);
|
||||
|
@@ -321,7 +321,7 @@ static bool IsValidIdentifier(const SString& identifier) {
|
||||
// First character can't be '_', so initialize the flag to true
|
||||
bool lastWasUnderscore = true;
|
||||
|
||||
int length = identifier.length();
|
||||
size_t length = identifier.length();
|
||||
|
||||
// Zero-length identifiers are not valid (these can occur inside labels)
|
||||
if (length == 0) {
|
||||
@@ -334,7 +334,7 @@ static bool IsValidIdentifier(const SString& identifier) {
|
||||
}
|
||||
|
||||
// Check for only valid characters and no double underscores
|
||||
for (int i = 0; i < length; i++) {
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
if (!IsWordCharacter(identifier[i]) ||
|
||||
(identifier[i] == '_' && lastWasUnderscore)) {
|
||||
return false;
|
||||
@@ -355,8 +355,8 @@ static bool IsValidNumber(const SString& number) {
|
||||
int hashPos = number.search("#");
|
||||
bool seenDot = false;
|
||||
|
||||
int i = 0;
|
||||
int length = number.length();
|
||||
size_t i = 0;
|
||||
size_t length = number.length();
|
||||
|
||||
if (length == 0)
|
||||
return false; // Just in case
|
||||
|
@@ -108,7 +108,8 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
sc.SetState(SCE_CSS_DEFAULT);
|
||||
break;
|
||||
case ':':
|
||||
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID)
|
||||
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
|
||||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
|
||||
sc.SetState(SCE_CSS_PSEUDOCLASS);
|
||||
else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_UNKNOWN_IDENTIFIER)
|
||||
sc.SetState(SCE_CSS_VALUE);
|
||||
|
@@ -195,7 +195,7 @@ static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
|
||||
|
||||
|
||||
if (foldComment && IsStreamCommentStyle(style)) {
|
||||
if (!IsStreamCommentStyle(stylePrev)) {
|
||||
levelCurrent++;
|
||||
|
@@ -127,7 +127,7 @@ static int stateForPrintState(int StateToPrint) {
|
||||
}
|
||||
|
||||
static inline bool IsNumber(unsigned int start, Accessor &styler) {
|
||||
return isdigit(styler[start]) || (styler[start] == '.') ||
|
||||
return IsADigit(styler[start]) || (styler[start] == '.') ||
|
||||
(styler[start] == '-') || (styler[start] == '#');
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
|
||||
static void classifyWordHTJS(unsigned int start, unsigned int end,
|
||||
WordList &keywords, Accessor &styler, script_mode inScriptType) {
|
||||
char chAttr = SCE_HJ_WORD;
|
||||
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
|
||||
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
|
||||
if (wordIsNumber)
|
||||
chAttr = SCE_HJ_NUMBER;
|
||||
else {
|
||||
@@ -264,7 +264,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end,
|
||||
|
||||
static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
|
||||
char chAttr = SCE_HB_IDENTIFIER;
|
||||
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
|
||||
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
|
||||
if (wordIsNumber)
|
||||
chAttr = SCE_HB_NUMBER;
|
||||
else {
|
||||
@@ -288,7 +288,7 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
|
||||
}
|
||||
|
||||
static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType) {
|
||||
bool wordIsNumber = isdigit(styler[start]) != 0;
|
||||
bool wordIsNumber = IsADigit(styler[start]);
|
||||
char s[30 + 1];
|
||||
unsigned int i = 0;
|
||||
for (; i < end - start + 1 && i < 30; i++) {
|
||||
@@ -312,7 +312,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key
|
||||
// Called when in a PHP word
|
||||
static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
char chAttr = SCE_HPHP_DEFAULT;
|
||||
bool wordIsNumber = isdigit(styler[start]) != 0;
|
||||
bool wordIsNumber = IsADigit(styler[start]);
|
||||
if (wordIsNumber)
|
||||
chAttr = SCE_HPHP_NUMBER;
|
||||
else {
|
||||
@@ -375,19 +375,21 @@ static int StateForScript(script_type scriptLanguage) {
|
||||
}
|
||||
|
||||
static inline bool ishtmlwordchar(char ch) {
|
||||
return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#';
|
||||
return !isascii(ch) ||
|
||||
(isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#');
|
||||
}
|
||||
|
||||
static inline bool issgmlwordchar(char ch) {
|
||||
return isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[';
|
||||
return !isascii(ch) ||
|
||||
(isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[');
|
||||
}
|
||||
|
||||
static inline bool IsPhpWordStart(const unsigned char ch) {
|
||||
return isalpha(ch) || (ch == '_') || (ch >= 0x7f);
|
||||
return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f);
|
||||
}
|
||||
|
||||
static inline bool IsPhpWordChar(char ch) {
|
||||
return isdigit(ch) || IsPhpWordStart(ch);
|
||||
return IsADigit(ch) || IsPhpWordStart(ch);
|
||||
}
|
||||
|
||||
static bool InTagState(int state) {
|
||||
@@ -787,7 +789,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
} else if ((ch == '-') && (chPrev == '-')) {
|
||||
styler.ColourTo(i - 2, StateToPrint);
|
||||
state = SCE_H_SGML_COMMENT;
|
||||
} else if (isalpha(ch) && (chPrev == '%')) {
|
||||
} else if (isascii(ch) && isalpha(ch) && (chPrev == '%')) {
|
||||
styler.ColourTo(i - 2, StateToPrint);
|
||||
state = SCE_H_SGML_ENTITY;
|
||||
} else if (ch == '#') {
|
||||
@@ -905,7 +907,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
}
|
||||
break;
|
||||
case SCE_H_SGML_SPECIAL:
|
||||
if (!isupper(ch)) {
|
||||
if (!(isascii(ch) && isupper(ch))) {
|
||||
styler.ColourTo(i - 1, StateToPrint);
|
||||
if (isalnum(ch)) {
|
||||
state = SCE_H_SGML_ERROR;
|
||||
@@ -918,7 +920,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
if (ch == ';') {
|
||||
styler.ColourTo(i, StateToPrint);
|
||||
state = SCE_H_SGML_DEFAULT;
|
||||
} else if (!isalnum(ch) && ch != '-' && ch != '.') {
|
||||
} else if (!(isascii(ch) && isalnum(ch)) && ch != '-' && ch != '.') {
|
||||
styler.ColourTo(i, SCE_H_SGML_ERROR);
|
||||
state = SCE_H_SGML_DEFAULT;
|
||||
}
|
||||
@@ -928,7 +930,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
styler.ColourTo(i, StateToPrint);
|
||||
state = SCE_H_DEFAULT;
|
||||
}
|
||||
if (ch != '#' && !isalnum(ch)) { // Should check that '#' follows '&', but it is unlikely anyway...
|
||||
if (ch != '#' && !(isascii(ch) && isalnum(ch))) { // Should check that '#' follows '&', but it is unlikely anyway...
|
||||
styler.ColourTo(i, SCE_H_TAGUNKNOWN);
|
||||
state = SCE_H_DEFAULT;
|
||||
}
|
||||
@@ -1464,7 +1466,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
}
|
||||
break;
|
||||
case SCE_HPHP_NUMBER:
|
||||
if (!isdigit(ch)) {
|
||||
if (!IsADigit(ch)) {
|
||||
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
|
||||
if (isoperator(ch))
|
||||
state = SCE_HPHP_OPERATOR;
|
||||
@@ -1524,7 +1526,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
case SCE_HPHP_OPERATOR:
|
||||
case SCE_HPHP_DEFAULT:
|
||||
styler.ColourTo(i - 1, StateToPrint);
|
||||
if (isdigit(ch)) {
|
||||
if (IsADigit(ch)) {
|
||||
state = SCE_HPHP_NUMBER;
|
||||
} else if (iswordstart(ch)) {
|
||||
state = SCE_HPHP_WORD;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include "SciLexer.h"
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
|
||||
}
|
||||
|
||||
inline bool IsAWordStart(const int ch) {
|
||||
@@ -58,6 +58,8 @@ static void ColouriseLuaDoc(
|
||||
WordList &keywords4 = *keywordlists[3];
|
||||
WordList &keywords5 = *keywordlists[4];
|
||||
WordList &keywords6 = *keywordlists[5];
|
||||
WordList &keywords7 = *keywordlists[6];
|
||||
WordList &keywords8 = *keywordlists[7];
|
||||
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
// Initialize the literal string [[ ... ]] nesting level, if we are inside such a string.
|
||||
@@ -121,11 +123,15 @@ static void ColouriseLuaDoc(
|
||||
if (sc.state == SCE_LUA_OPERATOR) {
|
||||
sc.SetState(SCE_LUA_DEFAULT);
|
||||
} else if (sc.state == SCE_LUA_NUMBER) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
sc.SetState(SCE_LUA_DEFAULT);
|
||||
// We stop the number definition on non-numerical non-dot non-eE non-sign char
|
||||
if (!(isdigit(sc.ch) || sc.ch == '.' ||
|
||||
toupper(sc.ch) == 'E' || sc.ch == '-' || sc.ch == '+')) {
|
||||
// Not exactly following number definition (several dots are seen as OK, etc.)
|
||||
// but probably enough in most cases.
|
||||
sc.SetState(SCE_LUA_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_LUA_IDENTIFIER) {
|
||||
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
char s[100];
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
if (keywords.InList(s)) {
|
||||
@@ -140,6 +146,12 @@ static void ColouriseLuaDoc(
|
||||
sc.ChangeState(SCE_LUA_WORD5);
|
||||
} else if (keywords6.InList(s)) {
|
||||
sc.ChangeState(SCE_LUA_WORD6);
|
||||
} else if (keywords6.InList(s)) {
|
||||
sc.ChangeState(SCE_LUA_WORD6);
|
||||
} else if (keywords7.InList(s)) {
|
||||
sc.ChangeState(SCE_LUA_WORD7);
|
||||
} else if (keywords8.InList(s)) {
|
||||
sc.ChangeState(SCE_LUA_WORD8);
|
||||
}
|
||||
sc.SetState(SCE_LUA_DEFAULT);
|
||||
}
|
||||
@@ -300,8 +312,8 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
|
||||
static const char * const luaWordListDesc[] = {
|
||||
"Keywords",
|
||||
"Basic functions",
|
||||
"String & math functions",
|
||||
"I/O & system facilities",
|
||||
"String, (table) & math functions",
|
||||
"(coroutines), I/O & system facilities",
|
||||
"XXX",
|
||||
"XXX",
|
||||
0
|
||||
|
183
contrib/src/stc/scintilla/src/LexMMIXAL.cxx
Normal file
183
contrib/src/stc/scintilla/src/LexMMIXAL.cxx
Normal file
@@ -0,0 +1,183 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexMMIXAL.cxx
|
||||
** Lexer for MMIX Assembler Language.
|
||||
** Written by Christoph H<>sler <christoph.hoesler@student.uni-tuebingen.de>
|
||||
** For information about MMIX visit http://www-cs-faculty.stanford.edu/~knuth/mmix.html
|
||||
**/
|
||||
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == ':' || ch == '_');
|
||||
}
|
||||
|
||||
inline bool isMMIXALOperator(char ch) {
|
||||
if (isalnum(ch))
|
||||
return false;
|
||||
if (ch == '+' || ch == '-' || ch == '|' || ch == '^' ||
|
||||
ch == '*' || ch == '/' || ch == '/' ||
|
||||
ch == '%' || ch == '<' || ch == '>' || ch == '&' ||
|
||||
ch == '~' || ch == '$' ||
|
||||
ch == ',' || ch == '(' || ch == ')' ||
|
||||
ch == '[' || ch == ']')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ColouriseMMIXALDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &opcodes = *keywordlists[0];
|
||||
WordList &special_register = *keywordlists[1];
|
||||
WordList &predef_symbols = *keywordlists[2];
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
for (; sc.More(); sc.Forward())
|
||||
{
|
||||
// No EOL continuation
|
||||
if (sc.atLineStart) {
|
||||
if (sc.ch == '@' && sc.chNext == 'i') {
|
||||
sc.SetState(SCE_MMIXAL_INCLUDE);
|
||||
} else {
|
||||
sc.SetState(SCE_MMIXAL_LEADWS);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if first non whitespace character in line is alphanumeric
|
||||
if (sc.state == SCE_MMIXAL_LEADWS && !isspace(sc.ch)) { // LEADWS
|
||||
if(!IsAWordChar(sc.ch)) {
|
||||
sc.SetState(SCE_MMIXAL_COMMENT);
|
||||
} else {
|
||||
if(sc.atLineStart) {
|
||||
sc.SetState(SCE_MMIXAL_LABEL);
|
||||
} else {
|
||||
sc.SetState(SCE_MMIXAL_OPCODE_PRE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if the current state should terminate.
|
||||
if (sc.state == SCE_MMIXAL_OPERATOR) { // OPERATOR
|
||||
sc.SetState(SCE_MMIXAL_OPERANDS);
|
||||
} else if (sc.state == SCE_MMIXAL_NUMBER) { // NUMBER
|
||||
if (!isdigit(sc.ch)) {
|
||||
if (IsAWordChar(sc.ch)) {
|
||||
char s[100];
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
sc.ChangeState(SCE_MMIXAL_REF);
|
||||
sc.SetState(SCE_MMIXAL_REF);
|
||||
} else {
|
||||
sc.SetState(SCE_MMIXAL_OPERANDS);
|
||||
}
|
||||
}
|
||||
} else if (sc.state == SCE_MMIXAL_LABEL) { // LABEL
|
||||
if (!IsAWordChar(sc.ch) ) {
|
||||
sc.SetState(SCE_MMIXAL_OPCODE_PRE);
|
||||
}
|
||||
} else if (sc.state == SCE_MMIXAL_REF) { // REF
|
||||
if (!IsAWordChar(sc.ch) ) {
|
||||
char s[100];
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
if (*s == ':') { // ignore base prefix for match
|
||||
for (size_t i = 0; i != sizeof(s); ++i) {
|
||||
*(s+i) = *(s+i+1);
|
||||
}
|
||||
}
|
||||
if (special_register.InList(s)) {
|
||||
sc.ChangeState(SCE_MMIXAL_REGISTER);
|
||||
} else if (predef_symbols.InList(s)) {
|
||||
sc.ChangeState(SCE_MMIXAL_SYMBOL);
|
||||
}
|
||||
sc.SetState(SCE_MMIXAL_OPERANDS);
|
||||
}
|
||||
} else if (sc.state == SCE_MMIXAL_OPCODE_PRE) { // OPCODE_PRE
|
||||
if (!isspace(sc.ch)) {
|
||||
sc.SetState(SCE_MMIXAL_OPCODE);
|
||||
}
|
||||
} else if (sc.state == SCE_MMIXAL_OPCODE) { // OPCODE
|
||||
if (!IsAWordChar(sc.ch) ) {
|
||||
char s[100];
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
if (opcodes.InList(s)) {
|
||||
sc.ChangeState(SCE_MMIXAL_OPCODE_VALID);
|
||||
} else {
|
||||
sc.ChangeState(SCE_MMIXAL_OPCODE_UNKNOWN);
|
||||
}
|
||||
sc.SetState(SCE_MMIXAL_OPCODE_POST);
|
||||
}
|
||||
} else if (sc.state == SCE_MMIXAL_STRING) { // STRING
|
||||
if (sc.ch == '\"') {
|
||||
sc.ForwardSetState(SCE_MMIXAL_OPERANDS);
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.ForwardSetState(SCE_MMIXAL_OPERANDS);
|
||||
}
|
||||
} else if (sc.state == SCE_MMIXAL_CHAR) { // CHAR
|
||||
if (sc.ch == '\'') {
|
||||
sc.ForwardSetState(SCE_MMIXAL_OPERANDS);
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.ForwardSetState(SCE_MMIXAL_OPERANDS);
|
||||
}
|
||||
} else if (sc.state == SCE_MMIXAL_REGISTER) { // REGISTER
|
||||
if (!isdigit(sc.ch)) {
|
||||
sc.SetState(SCE_MMIXAL_OPERANDS);
|
||||
}
|
||||
} else if (sc.state == SCE_MMIXAL_HEX) { // HEX
|
||||
if (!isxdigit(sc.ch)) {
|
||||
sc.SetState(SCE_MMIXAL_OPERANDS);
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if a new state should be entered.
|
||||
if (sc.state == SCE_MMIXAL_OPCODE_POST || // OPCODE_POST
|
||||
sc.state == SCE_MMIXAL_OPERANDS) { // OPERANDS
|
||||
if (sc.state == SCE_MMIXAL_OPERANDS && isspace(sc.ch)) {
|
||||
if (!sc.atLineEnd) {
|
||||
sc.SetState(SCE_MMIXAL_COMMENT);
|
||||
}
|
||||
} else if (isdigit(sc.ch)) {
|
||||
sc.SetState(SCE_MMIXAL_NUMBER);
|
||||
} else if (IsAWordChar(sc.ch) || sc.Match('@')) {
|
||||
sc.SetState(SCE_MMIXAL_REF);
|
||||
} else if (sc.Match('\"')) {
|
||||
sc.SetState(SCE_MMIXAL_STRING);
|
||||
} else if (sc.Match('\'')) {
|
||||
sc.SetState(SCE_MMIXAL_CHAR);
|
||||
} else if (sc.Match('$')) {
|
||||
sc.SetState(SCE_MMIXAL_REGISTER);
|
||||
} else if (sc.Match('#')) {
|
||||
sc.SetState(SCE_MMIXAL_HEX);
|
||||
} else if (isMMIXALOperator(static_cast<char>(sc.ch))) {
|
||||
sc.SetState(SCE_MMIXAL_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static const char * const MMIXALWordListDesc[] = {
|
||||
"Operation Codes",
|
||||
"Special Register",
|
||||
"Predefined Symbols",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmMMIXAL(SCLEX_MMIXAL, ColouriseMMIXALDoc, "mmixal", 0, MMIXALWordListDesc);
|
||||
|
346
contrib/src/stc/scintilla/src/LexNsis.cxx
Normal file
346
contrib/src/stc/scintilla/src/LexNsis.cxx
Normal file
@@ -0,0 +1,346 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexNsis.cxx
|
||||
** Lexer for NSIS
|
||||
**/
|
||||
// Copyright 2003 by Angelo Mandato <angelo@spaceblue.com>
|
||||
// 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 "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
/*
|
||||
// Put in SciLexer.h
|
||||
#define SCLEX_NSIS 34
|
||||
|
||||
#define SCE_NSIS_DEFAULT 0
|
||||
#define SCE_NSIS_COMMENT 1
|
||||
#define SCE_NSIS_STRINGDQ 2
|
||||
#define SCE_NSIS_STRINGLQ 3
|
||||
#define SCE_NSIS_STRINGRQ 4
|
||||
#define SCE_NSIS_FUNCTION 5
|
||||
#define SCE_NSIS_VARIABLE 6
|
||||
#define SCE_NSIS_LABEL 7
|
||||
#define SCE_NSIS_USERDEFINED 8
|
||||
#define SCE_NSIS_SECTIONDEF 9
|
||||
#define SCE_NSIS_SUBSECTIONDEF 10
|
||||
#define SCE_NSIS_IFDEFINEDEF 11
|
||||
#define SCE_NSIS_MACRODEF 12
|
||||
#define SCE_NSIS_STRINGVAR 13
|
||||
*/
|
||||
|
||||
static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler)
|
||||
{
|
||||
char s[100];
|
||||
|
||||
WordList &Functions = *keywordLists[0];
|
||||
WordList &Variables = *keywordLists[1];
|
||||
WordList &Lables = *keywordLists[2];
|
||||
WordList &UserDefined = *keywordLists[3];
|
||||
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
|
||||
{
|
||||
s[i] = static_cast<char>( styler[ start + i ] );
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
|
||||
// Check for special words...
|
||||
|
||||
if( strcmp(s, "!macro") == 0 || strcmp(s, "!macroend") == 0 ) // Covers !micro and !microend
|
||||
return SCE_NSIS_MACRODEF;
|
||||
|
||||
if( strcmp(s, "!ifdef") == 0 || strcmp(s, "!ifndef") == 0 || strcmp(s, "!endif") == 0 )
|
||||
return SCE_NSIS_IFDEFINEDEF;
|
||||
|
||||
if( strcmp(s, "Section") == 0 || strcmp(s, "SectionEnd") == 0 ) // Covers Section and SectionEnd
|
||||
return SCE_NSIS_SECTIONDEF;
|
||||
|
||||
if( strcmp(s, "SubSection") == 0 || strcmp(s, "SubSectionEnd") == 0 ) // Covers SubSection and SubSectionEnd
|
||||
return SCE_NSIS_SUBSECTIONDEF;
|
||||
|
||||
if( strcmp(s, "Function") == 0 || strcmp(s, "FunctionEnd") == 0 ) // Covers SubSection and SubSectionEnd
|
||||
return SCE_NSIS_FUNCTION;
|
||||
|
||||
if ( Functions.InList(s) )
|
||||
return SCE_NSIS_FUNCTION;
|
||||
|
||||
if ( Variables.InList(s) )
|
||||
return SCE_NSIS_VARIABLE;
|
||||
|
||||
if ( Lables.InList(s) )
|
||||
return SCE_NSIS_LABEL;
|
||||
|
||||
if( UserDefined.InList(s) )
|
||||
return SCE_NSIS_USERDEFINED;
|
||||
|
||||
if( strlen(s) > 2 )
|
||||
{
|
||||
if( s[1] == '{' && s[strlen(s)-1] == '}' )
|
||||
return SCE_NSIS_VARIABLE;
|
||||
}
|
||||
|
||||
return SCE_NSIS_DEFAULT;
|
||||
}
|
||||
|
||||
static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
|
||||
{
|
||||
int state = SCE_NSIS_DEFAULT;
|
||||
styler.StartAt( startPos );
|
||||
styler.GetLine( startPos );
|
||||
|
||||
unsigned int nLengthDoc = startPos + length;
|
||||
styler.StartSegment( startPos );
|
||||
|
||||
char cCurrChar;
|
||||
bool bVarInString = true;
|
||||
|
||||
unsigned int i;
|
||||
for( i = startPos; i < nLengthDoc; i++ )
|
||||
{
|
||||
cCurrChar = styler.SafeGetCharAt( i );
|
||||
char cNextChar = styler.SafeGetCharAt( i+1, EOF );
|
||||
|
||||
|
||||
|
||||
switch(state)
|
||||
{
|
||||
case SCE_NSIS_DEFAULT:
|
||||
if( cNextChar == EOF )
|
||||
{
|
||||
styler.ColourTo(i,SCE_NSIS_DEFAULT);
|
||||
break;
|
||||
}
|
||||
if( cCurrChar == ';' || cCurrChar == '#' ) // we have a comment line
|
||||
{
|
||||
styler.ColourTo(i-1, state );
|
||||
state = SCE_NSIS_COMMENT;
|
||||
break;
|
||||
}
|
||||
if( cCurrChar == '"' )
|
||||
{
|
||||
styler.ColourTo(i-1, state );
|
||||
state = SCE_NSIS_STRINGDQ;
|
||||
bVarInString = false;
|
||||
break;
|
||||
}
|
||||
if( cCurrChar == '\'' )
|
||||
{
|
||||
styler.ColourTo(i-1, state );
|
||||
state = SCE_NSIS_STRINGRQ;
|
||||
bVarInString = false;
|
||||
break;
|
||||
}
|
||||
if( cCurrChar == '`' )
|
||||
{
|
||||
styler.ColourTo(i-1, state );
|
||||
state = SCE_NSIS_STRINGLQ;
|
||||
bVarInString = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// NSIS KeyWord,Function, Variable, UserDefined:
|
||||
if( cCurrChar == '$' || iswordchar(cCurrChar) || cCurrChar == '!' )
|
||||
{
|
||||
styler.ColourTo(i-1,state);
|
||||
state = SCE_NSIS_FUNCTION;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SCE_NSIS_COMMENT:
|
||||
if( cNextChar == '\n' || cNextChar == '\r' || cNextChar == EOF )
|
||||
{
|
||||
styler.ColourTo(i,state);
|
||||
state = SCE_NSIS_DEFAULT;
|
||||
}
|
||||
break;
|
||||
case SCE_NSIS_STRINGDQ:
|
||||
if( cCurrChar == '"' || cNextChar == '\r' || cNextChar == '\n' )
|
||||
{
|
||||
styler.ColourTo(i,SCE_NSIS_STRINGDQ);
|
||||
state = SCE_NSIS_DEFAULT;
|
||||
}
|
||||
break;
|
||||
case SCE_NSIS_STRINGLQ:
|
||||
if( cCurrChar == '`' || cNextChar == '\r' || cNextChar == '\n' )
|
||||
{
|
||||
styler.ColourTo(i,SCE_NSIS_STRINGLQ);
|
||||
state = SCE_NSIS_DEFAULT;
|
||||
}
|
||||
break;
|
||||
case SCE_NSIS_STRINGRQ:
|
||||
if( cCurrChar == '\'' || cNextChar == '\r' || cNextChar == '\n' )
|
||||
{
|
||||
styler.ColourTo(i,SCE_NSIS_STRINGRQ);
|
||||
state = SCE_NSIS_DEFAULT;
|
||||
}
|
||||
break;
|
||||
case SCE_NSIS_FUNCTION:
|
||||
|
||||
// NSIS KeyWord:
|
||||
if( (iswordchar(cCurrChar) && !iswordchar( cNextChar) && cNextChar != '}') || cCurrChar == '}' )
|
||||
{
|
||||
state = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler);
|
||||
styler.ColourTo( i, state);
|
||||
state = SCE_NSIS_DEFAULT; // Everything after goes back to the default state
|
||||
}
|
||||
else if( !iswordchar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' )
|
||||
{
|
||||
state = SCE_NSIS_DEFAULT;
|
||||
|
||||
if( cCurrChar == '"' ) // Next
|
||||
{
|
||||
state = SCE_NSIS_STRINGDQ;
|
||||
bVarInString = false;
|
||||
}
|
||||
if( cCurrChar == '`' )
|
||||
{
|
||||
state = SCE_NSIS_STRINGLQ;
|
||||
bVarInString = false;
|
||||
}
|
||||
if( cCurrChar == '\'' )
|
||||
{
|
||||
state = SCE_NSIS_STRINGRQ;
|
||||
bVarInString = false;
|
||||
}
|
||||
if( cCurrChar == '#' || cCurrChar == ';' )
|
||||
state = SCE_NSIS_COMMENT;
|
||||
|
||||
styler.ColourTo( i, state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( state == SCE_NSIS_COMMENT )
|
||||
{
|
||||
styler.ColourTo(i,state);
|
||||
}
|
||||
else if( state == SCE_NSIS_STRINGDQ || state == SCE_NSIS_STRINGLQ || state == SCE_NSIS_STRINGRQ )
|
||||
{
|
||||
// Check for var in String..
|
||||
if( bVarInString && (iswordchar(cCurrChar) || cCurrChar == '}') ) // || cCurrChar == '{' ) )
|
||||
{
|
||||
int nWordState = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler);
|
||||
if( nWordState == SCE_NSIS_VARIABLE )
|
||||
{
|
||||
styler.ColourTo( i, SCE_NSIS_STRINGVAR);
|
||||
bVarInString = false;
|
||||
}
|
||||
}
|
||||
if( cCurrChar == '$' )
|
||||
{
|
||||
styler.ColourTo( i-1, state);
|
||||
bVarInString = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
// No folding enabled, no reason to continue...
|
||||
if( styler.GetPropertyInt("fold") == 0 )
|
||||
return;
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
int levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style;
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++)
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
// Functions Start: Function, Section, SubSection
|
||||
// Functions End: FunctionEnd, SectionEnd, SubSectionEnd
|
||||
// Label Start: !ifdef, !ifndef
|
||||
// Label End: !endif
|
||||
|
||||
if( style == SCE_NSIS_FUNCTION )
|
||||
{
|
||||
if( styler.Match(i, "FunctionEnd") )
|
||||
levelNext--;
|
||||
else if( styler.Match(i, "Function") )
|
||||
levelNext++;
|
||||
}
|
||||
else if( style == SCE_NSIS_SECTIONDEF )
|
||||
{
|
||||
if( styler.Match(i, "SectionEnd") )
|
||||
levelNext--;
|
||||
else if( styler.Match(i, "Section") )
|
||||
levelNext++;
|
||||
}
|
||||
else if( style == SCE_NSIS_SUBSECTIONDEF )
|
||||
{
|
||||
if( styler.Match(i, "SubSectionEnd") )
|
||||
levelNext--;
|
||||
else if( styler.Match(i, "SubSection") )
|
||||
levelNext++;
|
||||
}
|
||||
else if( style == SCE_NSIS_IFDEFINEDEF )
|
||||
{
|
||||
if( styler.Match(i, "!endif") )
|
||||
levelNext--;
|
||||
else if( styler.Match(i, "!ifdef") || styler.Match(i, "!ifndef"))
|
||||
levelNext++;
|
||||
}
|
||||
else if( style == SCE_NSIS_MACRODEF )
|
||||
{
|
||||
if( styler.Match(i, "!macroend") )
|
||||
levelNext--;
|
||||
else if( styler.Match(i, "!macro") )
|
||||
levelNext++;
|
||||
}
|
||||
|
||||
if( atEOL )
|
||||
{
|
||||
int levelUse = levelCurrent;
|
||||
int lev = levelUse | levelNext << 16;
|
||||
if (levelUse < levelNext)
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
if (lev != styler.LevelAt(lineCurrent))
|
||||
{
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
lineCurrent++;
|
||||
levelCurrent = levelNext;
|
||||
}
|
||||
}
|
||||
|
||||
int levelUse = levelCurrent;
|
||||
int lev = levelUse | levelNext << 16;
|
||||
if (levelUse < levelNext)
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
if (lev != styler.LevelAt(lineCurrent))
|
||||
{
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
}
|
||||
|
||||
static const char * const nsisWordLists[] = {
|
||||
"Functions",
|
||||
"Variables",
|
||||
"Lables",
|
||||
"UserDefined",
|
||||
0, };
|
||||
|
||||
|
||||
LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists);
|
@@ -268,6 +268,59 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *
|
||||
}
|
||||
}
|
||||
|
||||
// adaption by ksc, using the "} else {" trick of 1.53
|
||||
// 030721
|
||||
static void FoldPropsDoc(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;
|
||||
|
||||
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==2) {
|
||||
headerPoint = true;
|
||||
}
|
||||
|
||||
if (atEOL) {
|
||||
int lev = SC_FOLDLEVELBASE+1;
|
||||
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++;
|
||||
}
|
||||
|
||||
int lev = headerPoint ? SC_FOLDLEVELBASE : SC_FOLDLEVELBASE+1;
|
||||
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||
styler.SetLevel(lineCurrent, lev | flagsNext);
|
||||
}
|
||||
|
||||
static void ColouriseMakeLine(
|
||||
char *lineBuffer,
|
||||
unsigned int lengthLine,
|
||||
@@ -638,7 +691,7 @@ static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[
|
||||
|
||||
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);
|
||||
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", 0, emptyWordListDesc);
|
||||
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", 0, emptyWordListDesc);
|
||||
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc);
|
||||
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc);
|
||||
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);
|
||||
LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex", 0, emptyWordListDesc);
|
||||
|
@@ -1,10 +1,19 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexPOV.cxx
|
||||
** Lexer for POV-Ray, based on lexer for C++.
|
||||
** Lexer for POV-Ray SDL (Persistance of Vision Raytracer, Scene Description Language).
|
||||
** Written by Philippe Lhoste but this is mostly a derivative of LexCPP...
|
||||
**/
|
||||
// Copyright 2003 by Steven te Brinke <steven.t.b@zonnet.nl>
|
||||
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
// Some points that distinguish from a simple C lexer:
|
||||
// Identifiers start only by a character.
|
||||
// No line continuation character.
|
||||
// Strings are limited to 256 characters.
|
||||
// Directives are similar to preprocessor commands,
|
||||
// but we match directive keywords and colorize incorrect ones.
|
||||
// Block comments can be nested (code stolen from my code in LexLua).
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@@ -20,101 +29,152 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#define KEYWORD_BOXHEADER 1
|
||||
#define KEYWORD_FOLDCONTRACTED 2
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||
return ch < 0x80 && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
inline bool IsAWordStart(const int ch) {
|
||||
return ch < 0x80 && isalpha(ch);
|
||||
}
|
||||
|
||||
static inline bool IsStateComment(const int state) {
|
||||
return ((state == SCE_POV_COMMENT) ||
|
||||
(state == SCE_POV_COMMENTLINE) ||
|
||||
(state == SCE_POV_COMMENTDOC));
|
||||
}
|
||||
static void ColourisePovDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
static inline bool IsStateString(const int state) {
|
||||
return ((state == SCE_POV_STRING));
|
||||
}
|
||||
|
||||
static void ColourisePOVDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords1 = *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];
|
||||
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
// Initialize the block comment /* */ nesting level, if we are inside such a comment.
|
||||
int blockCommentLevel = 0;
|
||||
if (initStyle == SCE_POV_COMMENT) {
|
||||
blockCommentLevel = styler.GetLineState(currentLine - 1);
|
||||
}
|
||||
|
||||
// Do not leak onto next line
|
||||
/*if (initStyle == SCE_POV_STRINGEOL)
|
||||
initStyle = SCE_POV_DEFAULT;*/
|
||||
if (initStyle == SCE_POV_STRINGEOL) {
|
||||
initStyle = SCE_POV_DEFAULT;
|
||||
}
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
bool caseSensitive = styler.GetPropertyInt("pov.case.sensitive", 1) != 0;
|
||||
short stringLen = 0;
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
|
||||
/*if (sc.atLineStart && (sc.state == SCE_POV_STRING)) {
|
||||
// Prevent SCE_POV_STRINGEOL from leaking back to previous line
|
||||
sc.SetState(SCE_POV_STRING);
|
||||
}*/
|
||||
|
||||
// Handle line continuation generically.
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\n' || sc.chNext == '\r') {
|
||||
sc.Forward();
|
||||
if (sc.ch == '\r' && sc.chNext == '\n') {
|
||||
sc.Forward();
|
||||
}
|
||||
continue;
|
||||
if (sc.atLineEnd) {
|
||||
// Update the line state, so it can be seen by next line
|
||||
currentLine = styler.GetLine(sc.currentPos);
|
||||
if (sc.state == SCE_POV_COMMENT) {
|
||||
// Inside a block comment, we set the line state
|
||||
styler.SetLineState(currentLine, blockCommentLevel);
|
||||
} else {
|
||||
// Reset the line state
|
||||
styler.SetLineState(currentLine, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (sc.atLineStart && (sc.state == SCE_POV_STRING)) {
|
||||
// Prevent SCE_POV_STRINGEOL from leaking back to previous line
|
||||
sc.SetState(SCE_POV_STRING);
|
||||
}
|
||||
|
||||
// Determine if the current state should terminate.
|
||||
if (sc.state == SCE_POV_OPERATOR || sc.state == SCE_POV_BRACE) {
|
||||
if (sc.state == SCE_POV_OPERATOR) {
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
} else if (sc.state == SCE_POV_NUMBER) {
|
||||
if (!IsADigit(sc.ch) || sc.ch != '.') {
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
// We stop the number definition on non-numerical non-dot non-eE non-sign char
|
||||
if (!(isdigit(sc.ch) || sc.ch == '.' ||
|
||||
toupper(sc.ch) == 'E' || sc.ch == '-' || sc.ch == '+')) {
|
||||
// Not exactly following number definition (several dots are seen as OK, etc.)
|
||||
// but probably enough in most cases.
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_IDENTIFIER) {
|
||||
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
char s[100];
|
||||
if (caseSensitive) {
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
} else {
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
}
|
||||
if (keywords.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD);
|
||||
} else if (keywords2.InList(s)) {
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
if (keywords2.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD2);
|
||||
} else if (keywords3.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD3);
|
||||
} else if (keywords4.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD4);
|
||||
} else if (keywords5.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD5);
|
||||
} else if (keywords6.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD6);
|
||||
} else if (keywords7.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD7);
|
||||
} else if (keywords8.InList(s)) {
|
||||
sc.ChangeState(SCE_POV_WORD8);
|
||||
}
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_DIRECTIVE) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
char s[100], *p;
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
p = s;
|
||||
// Skip # and whitespace between # and directive word
|
||||
do {
|
||||
p++;
|
||||
} while ((*p == ' ' || *p == '\t') && *p != '\0');
|
||||
if (!keywords1.InList(p)) {
|
||||
sc.ChangeState(SCE_POV_BADDIRECTIVE);
|
||||
}
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_COMMENT) {
|
||||
if (sc.Match('*', '/')) {
|
||||
if (sc.Match('/', '*')) {
|
||||
blockCommentLevel++;
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_COMMENTDOC) {
|
||||
if (sc.Match('*', '/')) {
|
||||
} else if (sc.Match('*', '/') && blockCommentLevel > 0) {
|
||||
blockCommentLevel--;
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
if (blockCommentLevel == 0) {
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
}
|
||||
} else if (sc.state == SCE_POV_COMMENTLINE) {
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_STRING) {
|
||||
if (sc.ch == '\\') {
|
||||
stringLen++;
|
||||
if (strchr("abfnrtuv0'\"", sc.chNext)) {
|
||||
// Compound characters are counted as one.
|
||||
// Note: for Unicode chars \u, we shouldn't count the next 4 digits...
|
||||
sc.Forward();
|
||||
}
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.ChangeState(SCE_POV_STRINGEOL);
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
} else {
|
||||
stringLen++;
|
||||
}
|
||||
if (stringLen > 256) {
|
||||
// Strings are limited to 256 chars
|
||||
sc.SetState(SCE_POV_STRINGEOL);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_STRINGEOL) {
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\"' || sc.chNext == '\\') {
|
||||
sc.Forward();
|
||||
}
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.ForwardSetState(SCE_C_DEFAULT);
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.ForwardSetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
}
|
||||
@@ -123,35 +183,43 @@ static void ColourisePOVDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
if (sc.state == SCE_POV_DEFAULT) {
|
||||
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
sc.SetState(SCE_POV_NUMBER);
|
||||
} else if (IsAWordStart(sc.ch) || (sc.ch == '#')) {
|
||||
} else if (IsAWordStart(sc.ch)) {
|
||||
sc.SetState(SCE_POV_IDENTIFIER);
|
||||
} else if (sc.Match('/', '*')) {
|
||||
blockCommentLevel = 1;
|
||||
sc.SetState(SCE_POV_COMMENT);
|
||||
sc.Forward(); // Eat the * so it isn't used for the end of the comment
|
||||
} else if (sc.Match('/', '/')) {
|
||||
sc.SetState(SCE_POV_COMMENTLINE);
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_POV_STRING);
|
||||
//} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||
} else if (sc.ch == '+' || sc.ch == '-' || sc.ch == '*' || sc.ch == '/' || sc.ch == '=' || sc.ch == '<' || sc.ch == '>' || sc.ch == '&' || sc.ch == '|' || sc.ch == '!' || sc.ch == '?' || sc.ch == ':') {
|
||||
stringLen = 0;
|
||||
} else if (sc.ch == '#') {
|
||||
sc.SetState(SCE_POV_DIRECTIVE);
|
||||
// Skip whitespace between # and directive word
|
||||
do {
|
||||
sc.Forward();
|
||||
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||
sc.SetState(SCE_POV_OPERATOR);
|
||||
} else if (sc.ch == '{' || sc.ch == '}') {
|
||||
sc.SetState(SCE_POV_BRACE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_POV_COMMENT ||
|
||||
style == SCE_POV_COMMENTDOC;
|
||||
}
|
||||
static void FoldPovDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
int initStyle,
|
||||
WordList *[],
|
||||
Accessor &styler) {
|
||||
|
||||
static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle,
|
||||
Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0;
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldDirective = styler.GetPropertyInt("fold.directive") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
@@ -168,15 +236,33 @@ static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle,
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
if (foldComment && IsStreamCommentStyle(style)) {
|
||||
if (!IsStreamCommentStyle(stylePrev)) {
|
||||
if (foldComment && (style == SCE_POV_COMMENT)) {
|
||||
if (stylePrev != SCE_POV_COMMENT) {
|
||||
levelCurrent++;
|
||||
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
|
||||
} else if ((styleNext != SCE_POV_COMMENT) && !atEOL) {
|
||||
// Comments don't end at end of line and the next character may be unstyled.
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
if (style == SCE_POV_BRACE) {
|
||||
if (foldComment && (style == SCE_POV_COMMENTLINE)) {
|
||||
if ((ch == '/') && (chNext == '/')) {
|
||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||
if (chNext2 == '{') {
|
||||
levelCurrent++;
|
||||
} else if (chNext2 == '}') {
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foldDirective && (style == SCE_POV_DIRECTIVE)) {
|
||||
if (ch == '#') {
|
||||
unsigned int j=i+1;
|
||||
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (style == SCE_POV_OPERATOR) {
|
||||
if (ch == '{') {
|
||||
levelCurrent++;
|
||||
} else if (ch == '}') {
|
||||
@@ -204,19 +290,16 @@ static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle,
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
static void FoldPOVDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
|
||||
FoldNoBoxPOVDoc(startPos, length, initStyle, styler);
|
||||
}
|
||||
static const char * const povWordLists[] = {
|
||||
"Language directives",
|
||||
"Objects & CSG & Appearance",
|
||||
"Types & Modifiers & Items",
|
||||
"Predefined Identifiers",
|
||||
"Predefined Functions",
|
||||
"User defined 1",
|
||||
"User defined 2",
|
||||
"User defined 3",
|
||||
0,
|
||||
};
|
||||
|
||||
static const char * const POVWordLists[] = {
|
||||
"Primary keywords and identifiers",
|
||||
"Secondary keywords and identifiers",
|
||||
0,
|
||||
};
|
||||
|
||||
static void ColourisePOVDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
ColourisePOVDoc(startPos, length, initStyle, keywordlists, styler);
|
||||
}
|
||||
|
||||
LexerModule lmPOV(SCLEX_POV, ColourisePOVDocSensitive, "pov", FoldPOVDoc, POVWordLists);
|
||||
LexerModule lmPOV(SCLEX_POV, ColourisePovDoc, "pov", FoldPovDoc, povWordLists);
|
||||
|
344
contrib/src/stc/scintilla/src/LexPS.cxx
Normal file
344
contrib/src/stc/scintilla/src/LexPS.cxx
Normal file
@@ -0,0 +1,344 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexPS.cxx
|
||||
** Lexer for PostScript
|
||||
**
|
||||
** Written by Nigel Hathaway <nigel@bprj.co.uk>.
|
||||
** 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 <fcntl.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
static inline bool IsASelfDelimitingChar(const int ch) {
|
||||
return (ch == '[' || ch == ']' || ch == '{' || ch == '}' ||
|
||||
ch == '/' || ch == '<' || ch == '>' ||
|
||||
ch == '(' || ch == ')' || ch == '%');
|
||||
}
|
||||
|
||||
static inline bool IsAWhitespaceChar(const int ch) {
|
||||
return (ch == ' ' || ch == '\t' || ch == '\r' ||
|
||||
ch == '\n' || ch == '\f' || ch == '\0');
|
||||
}
|
||||
|
||||
static bool IsABaseNDigit(const int ch, const int base) {
|
||||
int maxdig = '9';
|
||||
int letterext = -1;
|
||||
|
||||
if (base <= 10)
|
||||
maxdig = '0' + base - 1;
|
||||
else
|
||||
letterext = base - 11;
|
||||
|
||||
return ((ch >= '0' && ch <= maxdig) ||
|
||||
(ch >= 'A' && ch <= ('A' + letterext)) ||
|
||||
(ch >= 'a' && ch <= ('a' + letterext)));
|
||||
}
|
||||
|
||||
static inline bool IsABase85Char(const int ch) {
|
||||
return ((ch >= '!' && ch <= 'u') || ch == 'z');
|
||||
}
|
||||
|
||||
static void ColourisePSDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords1 = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
WordList &keywords3 = *keywordlists[2];
|
||||
WordList &keywords4 = *keywordlists[3];
|
||||
WordList &keywords5 = *keywordlists[4];
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
bool tokenizing = styler.GetPropertyInt("ps.tokenize") != 0;
|
||||
int pslevel = styler.GetPropertyInt("ps.level", 3);
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int nestTextCurrent = 0;
|
||||
if (lineCurrent > 0 && initStyle == SCE_PS_TEXT)
|
||||
nestTextCurrent = styler.GetLineState(lineCurrent - 1);
|
||||
int numRadix = 0;
|
||||
bool numHasPoint = false;
|
||||
bool numHasExponent = false;
|
||||
bool numHasSign = false;
|
||||
|
||||
// Clear out existing tokenization
|
||||
if (tokenizing && length > 0) {
|
||||
styler.StartAt(startPos, static_cast<char>(INDIC2_MASK));
|
||||
styler.ColourTo(startPos + length-1, 0);
|
||||
styler.Flush();
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
}
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
if (sc.atLineStart)
|
||||
lineCurrent = styler.GetLine(sc.currentPos);
|
||||
|
||||
// Determine if the current state should terminate.
|
||||
if (sc.state == SCE_PS_COMMENT || sc.state == SCE_PS_DSC_VALUE) {
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_C_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_PS_DSC_COMMENT) {
|
||||
if (sc.ch == ':') {
|
||||
sc.Forward();
|
||||
if (!sc.atLineEnd)
|
||||
sc.SetState(SCE_PS_DSC_VALUE);
|
||||
else
|
||||
sc.SetState(SCE_C_DEFAULT);
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_C_DEFAULT);
|
||||
} else if (IsAWhitespaceChar(sc.ch)) {
|
||||
sc.ChangeState(SCE_PS_COMMENT);
|
||||
}
|
||||
} else if (sc.state == SCE_PS_NUMBER) {
|
||||
if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch)) {
|
||||
if ((sc.chPrev == '+' || sc.chPrev == '-' ||
|
||||
sc.chPrev == 'E' || sc.chPrev == 'e') && numRadix == 0)
|
||||
sc.ChangeState(SCE_PS_NAME);
|
||||
sc.SetState(SCE_C_DEFAULT);
|
||||
} else if (sc.ch == '#') {
|
||||
if (numHasPoint || numHasExponent || numHasSign || numRadix != 0) {
|
||||
sc.ChangeState(SCE_PS_NAME);
|
||||
} else {
|
||||
char szradix[5];
|
||||
sc.GetCurrent(szradix, 4);
|
||||
numRadix = atoi(szradix);
|
||||
if (numRadix < 2 || numRadix > 36)
|
||||
sc.ChangeState(SCE_PS_NAME);
|
||||
}
|
||||
} else if ((sc.ch == 'E' || sc.ch == 'e') && numRadix == 0) {
|
||||
if (numHasExponent) {
|
||||
sc.ChangeState(SCE_PS_NAME);
|
||||
} else {
|
||||
numHasExponent = true;
|
||||
if (sc.chNext == '+' || sc.chNext == '-')
|
||||
sc.Forward();
|
||||
}
|
||||
} else if (sc.ch == '.') {
|
||||
if (numHasPoint || numHasExponent || numRadix != 0) {
|
||||
sc.ChangeState(SCE_PS_NAME);
|
||||
} else {
|
||||
numHasPoint = true;
|
||||
}
|
||||
} else if (numRadix == 0) {
|
||||
if (!IsABaseNDigit(sc.ch, 10))
|
||||
sc.ChangeState(SCE_PS_NAME);
|
||||
} else {
|
||||
if (!IsABaseNDigit(sc.ch, numRadix))
|
||||
sc.ChangeState(SCE_PS_NAME);
|
||||
}
|
||||
} else if (sc.state == SCE_PS_NAME || sc.state == SCE_PS_KEYWORD) {
|
||||
if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch)) {
|
||||
char s[100];
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
if ((pslevel >= 1 && keywords1.InList(s)) ||
|
||||
(pslevel >= 2 && keywords2.InList(s)) ||
|
||||
(pslevel >= 3 && keywords3.InList(s)) ||
|
||||
keywords4.InList(s) || keywords5.InList(s)) {
|
||||
sc.ChangeState(SCE_PS_KEYWORD);
|
||||
}
|
||||
sc.SetState(SCE_C_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_PS_LITERAL || sc.state == SCE_PS_IMMEVAL) {
|
||||
if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch))
|
||||
sc.SetState(SCE_C_DEFAULT);
|
||||
} else if (sc.state == SCE_PS_PAREN_ARRAY || sc.state == SCE_PS_PAREN_DICT ||
|
||||
sc.state == SCE_PS_PAREN_PROC) {
|
||||
sc.SetState(SCE_C_DEFAULT);
|
||||
} else if (sc.state == SCE_PS_TEXT) {
|
||||
if (sc.ch == '(') {
|
||||
nestTextCurrent++;
|
||||
} else if (sc.ch == ')') {
|
||||
if (--nestTextCurrent == 0)
|
||||
sc.ForwardSetState(SCE_PS_DEFAULT);
|
||||
} else if (sc.ch == '\\') {
|
||||
sc.Forward();
|
||||
}
|
||||
} else if (sc.state == SCE_PS_HEXSTRING) {
|
||||
if (sc.ch == '>') {
|
||||
sc.ForwardSetState(SCE_PS_DEFAULT);
|
||||
} else if (!IsABaseNDigit(sc.ch, 16) && !IsAWhitespaceChar(sc.ch)) {
|
||||
sc.SetState(SCE_PS_HEXSTRING);
|
||||
styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR);
|
||||
}
|
||||
} else if (sc.state == SCE_PS_BASE85STRING) {
|
||||
if (sc.Match('~', '>')) {
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_PS_DEFAULT);
|
||||
} else if (!IsABase85Char(sc.ch) && !IsAWhitespaceChar(sc.ch)) {
|
||||
sc.SetState(SCE_PS_BASE85STRING);
|
||||
styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR);
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if a new state should be entered.
|
||||
if (sc.state == SCE_C_DEFAULT) {
|
||||
unsigned int tokenpos = sc.currentPos;
|
||||
|
||||
if (sc.ch == '[' || sc.ch == ']') {
|
||||
sc.SetState(SCE_PS_PAREN_ARRAY);
|
||||
} else if (sc.ch == '{' || sc.ch == '}') {
|
||||
sc.SetState(SCE_PS_PAREN_PROC);
|
||||
} else if (sc.ch == '/') {
|
||||
if (sc.chNext == '/') {
|
||||
sc.SetState(SCE_PS_IMMEVAL);
|
||||
sc.Forward();
|
||||
} else {
|
||||
sc.SetState(SCE_PS_LITERAL);
|
||||
}
|
||||
} else if (sc.ch == '<') {
|
||||
if (sc.chNext == '<') {
|
||||
sc.SetState(SCE_PS_PAREN_DICT);
|
||||
sc.Forward();
|
||||
} else if (sc.chNext == '~') {
|
||||
sc.SetState(SCE_PS_BASE85STRING);
|
||||
sc.Forward();
|
||||
} else {
|
||||
sc.SetState(SCE_PS_HEXSTRING);
|
||||
}
|
||||
} else if (sc.ch == '>' && sc.chNext == '>') {
|
||||
sc.SetState(SCE_PS_PAREN_DICT);
|
||||
sc.Forward();
|
||||
} else if (sc.ch == '>' || sc.ch == ')') {
|
||||
sc.SetState(SCE_C_DEFAULT);
|
||||
styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR);
|
||||
} else if (sc.ch == '(') {
|
||||
sc.SetState(SCE_PS_TEXT);
|
||||
nestTextCurrent = 1;
|
||||
} else if (sc.ch == '%') {
|
||||
if (sc.chNext == '%' && sc.atLineStart) {
|
||||
sc.SetState(SCE_PS_DSC_COMMENT);
|
||||
sc.Forward();
|
||||
if (sc.chNext == '+') {
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_PS_DSC_VALUE);
|
||||
}
|
||||
} else {
|
||||
sc.SetState(SCE_PS_COMMENT);
|
||||
}
|
||||
} else if ((sc.ch == '+' || sc.ch == '-' || sc.ch == '.') &&
|
||||
IsABaseNDigit(sc.chNext, 10)) {
|
||||
sc.SetState(SCE_PS_NUMBER);
|
||||
numRadix = 0;
|
||||
numHasPoint = (sc.ch == '.');
|
||||
numHasExponent = false;
|
||||
numHasSign = (sc.ch == '+' || sc.ch == '-');
|
||||
} else if ((sc.ch == '+' || sc.ch == '-') && sc.chNext == '.' &&
|
||||
IsABaseNDigit(sc.GetRelative(2), 10)) {
|
||||
sc.SetState(SCE_PS_NUMBER);
|
||||
numRadix = 0;
|
||||
numHasPoint = false;
|
||||
numHasExponent = false;
|
||||
numHasSign = true;
|
||||
} else if (IsABaseNDigit(sc.ch, 10)) {
|
||||
sc.SetState(SCE_PS_NUMBER);
|
||||
numRadix = 0;
|
||||
numHasPoint = false;
|
||||
numHasExponent = false;
|
||||
numHasSign = false;
|
||||
} else if (!IsAWhitespaceChar(sc.ch)) {
|
||||
sc.SetState(SCE_PS_NAME);
|
||||
}
|
||||
|
||||
// Mark the start of tokens
|
||||
if (tokenizing && sc.state != SCE_C_DEFAULT && sc.state != SCE_PS_COMMENT &&
|
||||
sc.state != SCE_PS_DSC_COMMENT && sc.state != SCE_PS_DSC_VALUE) {
|
||||
styler.Flush();
|
||||
styler.StartAt(tokenpos, static_cast<char>(INDIC2_MASK));
|
||||
styler.ColourTo(tokenpos, INDIC2_MASK);
|
||||
styler.Flush();
|
||||
styler.StartAt(tokenpos);
|
||||
styler.StartSegment(tokenpos);
|
||||
}
|
||||
}
|
||||
|
||||
if (sc.atLineEnd)
|
||||
styler.SetLineState(lineCurrent, nestTextCurrent);
|
||||
}
|
||||
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
Accessor &styler) {
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 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) >> 16;
|
||||
int levelMinCurrent = levelCurrent;
|
||||
int levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac??
|
||||
if ((style & 31) == SCE_PS_PAREN_PROC) {
|
||||
if (ch == '{') {
|
||||
// Measure the minimum before a '{' to allow
|
||||
// folding on "} {"
|
||||
if (levelMinCurrent > levelNext) {
|
||||
levelMinCurrent = levelNext;
|
||||
}
|
||||
levelNext++;
|
||||
} else if (ch == '}') {
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
if (atEOL) {
|
||||
int levelUse = levelCurrent;
|
||||
if (foldAtElse) {
|
||||
levelUse = levelMinCurrent;
|
||||
}
|
||||
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;
|
||||
levelMinCurrent = levelCurrent;
|
||||
visibleChars = 0;
|
||||
}
|
||||
if (!isspacechar(ch))
|
||||
visibleChars++;
|
||||
}
|
||||
}
|
||||
|
||||
static const char * const psWordListDesc[] = {
|
||||
"PS Level 1 operators",
|
||||
"PS Level 2 operators",
|
||||
"PS Level 3 operators",
|
||||
"RIP-specific operators",
|
||||
"User-defined operators",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmPS(SCLEX_PS, ColourisePSDoc, "ps", FoldPSDoc, psWordListDesc);
|
@@ -3,6 +3,7 @@
|
||||
** Lexer for Pascal.
|
||||
** Written by Laurent le Tynevez
|
||||
** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
|
||||
** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments)
|
||||
**/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -40,12 +41,15 @@ static bool IsStreamCommentStyle(int style) {
|
||||
style == SCE_C_COMMENTDOCKEYWORDERROR;
|
||||
}
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||
static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) {
|
||||
if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) {
|
||||
styler.ColourTo(end, SCE_C_REGEX);
|
||||
} else
|
||||
styler.ColourTo(end, attr);
|
||||
}
|
||||
|
||||
// returns 1 if the item starts a class definition, and -1 if the word is "end".
|
||||
static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass) {
|
||||
// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm"
|
||||
static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass, bool bInAsm) {
|
||||
int ret = 0;
|
||||
|
||||
WordList& keywords = *keywordlists[0];
|
||||
@@ -55,24 +59,34 @@ static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &
|
||||
getRange(start, end, styler, s, sizeof(s));
|
||||
|
||||
char chAttr = SCE_C_IDENTIFIER;
|
||||
if (isdigit(s[0]) || (s[0] == '.')) {
|
||||
if (isdigit(s[0]) || (s[0] == '.') ||(s[0] == '$')) {
|
||||
chAttr = SCE_C_NUMBER;
|
||||
}
|
||||
else {
|
||||
if (keywords.InList(s)) {
|
||||
chAttr = SCE_C_WORD;
|
||||
|
||||
if(strcmp(s, "class") == 0)
|
||||
ret = 1;
|
||||
else if(strcmp(s, "end") == 0)
|
||||
ret = -1;
|
||||
} else if (bInClass) {
|
||||
if (classwords.InList(s)) {
|
||||
if (s[0] == '#') {
|
||||
chAttr = SCE_C_CHARACTER;
|
||||
}
|
||||
else {
|
||||
if (keywords.InList(s)) {
|
||||
chAttr = SCE_C_WORD;
|
||||
|
||||
if(strcmp(s, "class") == 0) {
|
||||
ret = 1;
|
||||
}
|
||||
else if (strcmp(s, "asm") == 0) {
|
||||
ret = 2;
|
||||
}
|
||||
else if (strcmp(s, "end") == 0) {
|
||||
ret = -1;
|
||||
}
|
||||
} else if (bInClass) {
|
||||
if (classwords.InList(s)) {
|
||||
chAttr = SCE_C_WORD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
ColourTo(styler, end, chAttr, (bInAsm && ret != -1));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -99,14 +113,14 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
|
||||
styler.StartAt(startPos);
|
||||
|
||||
int state = initStyle;
|
||||
if (state == SCE_C_STRINGEOL) // Does not leak onto next line
|
||||
if (state == SCE_C_CHARACTER) // Does not leak onto next line
|
||||
state = SCE_C_DEFAULT;
|
||||
char chPrev = ' ';
|
||||
char chNext = styler[startPos];
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
|
||||
bool bInClassDefinition;
|
||||
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
if (currentLine > 0) {
|
||||
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
|
||||
@@ -116,6 +130,10 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
|
||||
bInClassDefinition = false;
|
||||
}
|
||||
|
||||
bool bInAsm = (state == SCE_C_REGEX);
|
||||
if (bInAsm)
|
||||
state = SCE_C_DEFAULT;
|
||||
|
||||
styler.StartSegment(startPos);
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
@@ -126,16 +144,13 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
|
||||
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
|
||||
// Avoid triggering two times on Dos/Win
|
||||
// End of line
|
||||
if (state == SCE_C_STRINGEOL) {
|
||||
styler.ColourTo(i, state);
|
||||
if (state == SCE_C_CHARACTER) {
|
||||
ColourTo(styler, i, state, bInAsm);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
visibleChars = 0;
|
||||
currentLine++;
|
||||
styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0));
|
||||
}
|
||||
if (!isspacechar(ch))
|
||||
visibleChars++;
|
||||
|
||||
if (styler.IsLeadByte(ch)) {
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
@@ -145,41 +160,50 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
|
||||
if (state == SCE_C_DEFAULT) {
|
||||
if (iswordstart(ch) || (ch == '@')) {
|
||||
styler.ColourTo(i-1, state);
|
||||
if (iswordstart(ch) || ch == '#' || ch == '$' || (ch == '@' && bInAsm)) {
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_IDENTIFIER;
|
||||
} else if (ch == '{' && chNext != '$' && chNext != '&') {
|
||||
styler.ColourTo(i-1, state);
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '(' && chNext == '*'
|
||||
&& styler.SafeGetCharAt(i + 2) != '$'
|
||||
&& styler.SafeGetCharAt(i + 2) != '&') {
|
||||
styler.ColourTo(i-1, state);
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_COMMENTDOC;
|
||||
} else if (ch == '/' && chNext == '/') {
|
||||
styler.ColourTo(i-1, state);
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i-1, state);
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_CHARACTER;
|
||||
} else if (ch == '{' && (chNext == '$' || chNext=='&') && visibleChars == 1) {
|
||||
styler.ColourTo(i-1, state);
|
||||
} else if (ch == '{' && (chNext == '$' || chNext=='&')) {
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_PREPROCESSOR;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i-1, state);
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
|
||||
|
||||
}
|
||||
} else if (state == SCE_C_IDENTIFIER) {
|
||||
if (!iswordchar(ch)) {
|
||||
int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition);
|
||||
bool bDoublePoint = ((ch == '.') && (chPrev == '.'));
|
||||
if ((!iswordchar(ch) && ch != '$' && ch != '#' && (ch != '@' || !bInAsm)) || bDoublePoint) {
|
||||
if (bDoublePoint) i--;
|
||||
int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition, bInAsm);
|
||||
|
||||
if(lStateChange == 1) {
|
||||
styler.SetLineState(currentLine, 1);
|
||||
bInClassDefinition = true;
|
||||
} else if(lStateChange == 2) {
|
||||
bInAsm = true;
|
||||
} else if(lStateChange == -1) {
|
||||
styler.SetLineState(currentLine, 0);
|
||||
bInClassDefinition = false;
|
||||
bInAsm = false;
|
||||
}
|
||||
if (bDoublePoint) {
|
||||
i++;
|
||||
ColourTo(styler, i-1, SCE_C_DEFAULT, bInAsm);
|
||||
}
|
||||
|
||||
state = SCE_C_DEFAULT;
|
||||
@@ -189,30 +213,30 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else if (ch == '(' && chNext == '*'
|
||||
&& styler.SafeGetCharAt(i + 2) != '$'
|
||||
&& styler.SafeGetCharAt(i + 2) != '&') {
|
||||
styler.ColourTo(i-1, state);
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_COMMENTDOC;
|
||||
} else if (ch == '/' && chNext == '/') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_C_CHARACTER;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (state == SCE_C_PREPROCESSOR) {
|
||||
if (ch=='}'){
|
||||
styler.ColourTo(i, state);
|
||||
ColourTo(styler, i, state, bInAsm);
|
||||
state = SCE_C_DEFAULT;
|
||||
} else {
|
||||
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
|
||||
styler.ColourTo(i-1, state);
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_C_COMMENT) {
|
||||
if (ch == '}' ) {
|
||||
styler.ColourTo(i, state);
|
||||
ColourTo(styler, i, state, bInAsm);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_C_COMMENTDOC) {
|
||||
@@ -220,28 +244,25 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (((i > styler.GetStartSegment() + 2) || (
|
||||
(initStyle == SCE_C_COMMENTDOC) &&
|
||||
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
|
||||
styler.ColourTo(i, state);
|
||||
ColourTo(styler, i, state, bInAsm);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_C_COMMENTLINE) {
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
styler.ColourTo(i-1, state);
|
||||
ColourTo(styler, i-1, state, bInAsm);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_C_CHARACTER) {
|
||||
if ((ch == '\r' || ch == '\n')) {
|
||||
styler.ColourTo(i-1, SCE_C_STRINGEOL);
|
||||
state = SCE_C_STRINGEOL;
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i, state);
|
||||
if (ch == '\'') {
|
||||
ColourTo(styler, i, state, bInAsm);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
chPrev = ch;
|
||||
}
|
||||
styler.ColourTo(lengthDoc - 1, state);
|
||||
ColourTo(styler, lengthDoc - 1, state, bInAsm);
|
||||
}
|
||||
|
||||
static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
||||
|
@@ -23,7 +23,7 @@ static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keyw
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = static_cast<char>(toupper(styler[start + i]));
|
||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
char chAttr = SCE_C_IDENTIFIER;
|
||||
@@ -88,7 +88,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\'') {
|
||||
} else if ((ch == '\'') || (ch == '"')) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_STRING;
|
||||
} else if (isoperator(ch)) {
|
||||
@@ -103,7 +103,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\'') {
|
||||
} else if ((ch == '\'') || (ch == '"')) {
|
||||
state = SCE_C_STRING;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
@@ -134,6 +134,16 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
}
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else if (ch == '"') {
|
||||
if (chNext == '"') {
|
||||
i++;
|
||||
} else {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
i++;
|
||||
}
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
if (state == SCE_C_DEFAULT) { // One of the above succeeded
|
||||
@@ -141,7 +151,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if (ch == '\'') {
|
||||
} else if ((ch == '\'') || (ch == '"')) {
|
||||
state = SCE_C_STRING;
|
||||
} else if (iswordstart(ch)) {
|
||||
state = SCE_C_WORD;
|
||||
|
427
contrib/src/stc/scintilla/src/LexScriptol.cxx
Normal file
427
contrib/src/stc/scintilla/src/LexScriptol.cxx
Normal file
@@ -0,0 +1,427 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexScriptol.cxx
|
||||
** Lexer for Scriptol.
|
||||
**/
|
||||
|
||||
#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"
|
||||
|
||||
static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
|
||||
{
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) != 0;
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
|
||||
{
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
char chAttr = SCE_P_IDENTIFIER;
|
||||
if (0 == strcmp(prevWord, "class")) chAttr = SCE_P_CLASSNAME;
|
||||
else if (wordIsNumber) chAttr = SCE_P_NUMBER;
|
||||
else if (keywords.InList(s)) chAttr = SCE_P_WORD;
|
||||
else for (unsigned int i = 0; i < end - start + 1; i++) // test dotted idents
|
||||
{
|
||||
if (styler[start + i] == '.')
|
||||
{
|
||||
styler.ColourTo(start + i - 1, chAttr);
|
||||
styler.ColourTo(start + i, SCE_P_OPERATOR);
|
||||
}
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
strcpy(prevWord, s);
|
||||
}
|
||||
|
||||
static bool IsSolComment(Accessor &styler, int pos, int len)
|
||||
{
|
||||
// return len > 0 && styler[pos]=='`';
|
||||
char c;
|
||||
if(len > 0)
|
||||
{
|
||||
c = styler[pos];
|
||||
if(c == '`') return true;
|
||||
if(len > 1)
|
||||
{
|
||||
if(c == '/')
|
||||
{
|
||||
c = styler[pos + 1];
|
||||
if(c == '/') return true;
|
||||
if(c == '*') return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsSolStringStart(char ch, char /*chNext*/)
|
||||
{
|
||||
if (ch == '\'' || ch == '"') return true;
|
||||
//chNext = chNext; // for future use
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsSolWordStart(char ch, char chNext)
|
||||
{
|
||||
return (iswordchar(ch) && !IsSolStringStart(ch, chNext));
|
||||
}
|
||||
|
||||
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
|
||||
static int GetSolStringState(Accessor &styler, int i, int *nextIndex)
|
||||
{
|
||||
char ch = styler.SafeGetCharAt(i);
|
||||
char chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if (ch != '"' && ch != '\'') {
|
||||
*nextIndex = i + 1;
|
||||
return SCE_P_DEFAULT;
|
||||
}
|
||||
|
||||
if (ch == chNext && ch == styler.SafeGetCharAt(i + 2))
|
||||
{
|
||||
*nextIndex = i + 3;
|
||||
if (ch == '"') return SCE_P_TRIPLEDOUBLE;
|
||||
else return SCE_P_TRIPLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*nextIndex = i + 1;
|
||||
if (ch == '"') return SCE_P_STRING;
|
||||
else return SCE_P_CHARACTER;
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
|
||||
int lengthDoc = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its tab whinging
|
||||
if (startPos > 0)
|
||||
{
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
if (lineCurrent > 0)
|
||||
{
|
||||
startPos = styler.LineStart(lineCurrent-1);
|
||||
if (startPos == 0) initStyle = SCE_P_DEFAULT;
|
||||
else initStyle = styler.StyleAt(startPos-1);
|
||||
}
|
||||
}
|
||||
|
||||
styler.StartAt(startPos, 127);
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
||||
char prevWord[200];
|
||||
prevWord[0] = '\0';
|
||||
if (length == 0) return ;
|
||||
|
||||
int state = initStyle & 31;
|
||||
|
||||
int nextIndex = 0;
|
||||
char chPrev = ' ';
|
||||
//char chPrev2 = ' ';
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
bool atStartLine = true;
|
||||
int spaceFlags = 0;
|
||||
for (int i = startPos; i < lengthDoc; i++)
|
||||
{
|
||||
|
||||
if (atStartLine)
|
||||
{
|
||||
char chBad = static_cast<char>(64);
|
||||
char chGood = static_cast<char>(0);
|
||||
char chFlags = chGood;
|
||||
|
||||
if (whingeLevel == 1)
|
||||
{
|
||||
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
||||
}
|
||||
else if (whingeLevel == 2)
|
||||
{
|
||||
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
|
||||
}
|
||||
else if (whingeLevel == 3)
|
||||
{
|
||||
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
|
||||
}
|
||||
else if (whingeLevel == 4)
|
||||
{
|
||||
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
||||
}
|
||||
styler.SetFlags(chFlags, static_cast<char>(state));
|
||||
atStartLine = false;
|
||||
}
|
||||
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc))
|
||||
{
|
||||
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
}
|
||||
atStartLine = true;
|
||||
}
|
||||
|
||||
if (styler.IsLeadByte(ch))
|
||||
{
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
chPrev = ' ';
|
||||
//chPrev2 = ' ';
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == SCE_P_STRINGEOL)
|
||||
{
|
||||
if (ch != '\r' && ch != '\n')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
if (state == SCE_P_DEFAULT)
|
||||
{
|
||||
if (IsSolWordStart(ch, chNext))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_WORD;
|
||||
}
|
||||
else if (ch == '`')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_COMMENTLINE;
|
||||
}
|
||||
else if (ch == '/')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
if(chNext == '/') state = SCE_P_COMMENTLINE;
|
||||
if(chNext == '*') state = SCE_P_COMMENTBLOCK;
|
||||
}
|
||||
|
||||
else if (ch == '=' && chNext == 'b')
|
||||
{
|
||||
// =begin indicates the start of a comment (doc) block
|
||||
if(styler.SafeGetCharAt(i + 2) == 'e' && styler.SafeGetCharAt(i + 3) == 'g' && styler.SafeGetCharAt(i + 4) == 'i' && styler.SafeGetCharAt(i + 5) == 'n')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_TRIPLEDOUBLE; //SCE_C_COMMENT;
|
||||
}
|
||||
}
|
||||
else if (IsSolStringStart(ch, chNext))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = GetSolStringState(styler, i, &nextIndex);
|
||||
if (nextIndex != i + 1)
|
||||
{
|
||||
i = nextIndex - 1;
|
||||
ch = ' ';
|
||||
//chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else if (isoperator(ch))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
||||
}
|
||||
}
|
||||
else if (state == SCE_P_WORD)
|
||||
{
|
||||
if (!iswordchar(ch))
|
||||
{
|
||||
ClassifyWordSol(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
|
||||
state = SCE_P_DEFAULT;
|
||||
if (ch == '`')
|
||||
{
|
||||
state = chNext == '`' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
|
||||
}
|
||||
else if (IsSolStringStart(ch, chNext))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = GetSolStringState(styler, i, &nextIndex);
|
||||
if (nextIndex != i + 1)
|
||||
{
|
||||
i = nextIndex - 1;
|
||||
ch = ' ';
|
||||
//chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else if (isoperator(ch))
|
||||
{
|
||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state == SCE_P_COMMENTLINE)
|
||||
{
|
||||
if (ch == '\r' || ch == '\n')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
else if(state == SCE_P_COMMENTBLOCK)
|
||||
{
|
||||
if(ch == '*' && chNext == '/') state = SCE_P_DEFAULT;
|
||||
}
|
||||
else if (state == SCE_P_STRING)
|
||||
{
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_STRINGEOL;
|
||||
}
|
||||
else if (ch == '\\')
|
||||
{
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\')
|
||||
{
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else if (ch == '\"')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
else if (state == SCE_P_CHARACTER)
|
||||
{
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_STRINGEOL;
|
||||
}
|
||||
else if (ch == '\\')
|
||||
{
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\')
|
||||
{
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else if (ch == '\'')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
/*
|
||||
else if (state == SCE_P_TRIPLE)
|
||||
{
|
||||
if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
else if (state == SCE_P_TRIPLEDOUBLE)
|
||||
{
|
||||
// =end terminates the comment block
|
||||
if (ch == 'd' && chPrev == 'n' && chPrev2 == 'e')
|
||||
{
|
||||
if (styler.SafeGetCharAt(i - 3) == '=')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
//chPrev2 = chPrev;
|
||||
chPrev = ch;
|
||||
}
|
||||
if (state == SCE_P_WORD)
|
||||
{
|
||||
ClassifyWordSol(styler.GetStartSegment(), lengthDoc-1, keywords, styler, prevWord);
|
||||
}
|
||||
else
|
||||
{
|
||||
styler.ColourTo(lengthDoc-1, state);
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *[], Accessor &styler)
|
||||
{
|
||||
int lengthDoc = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0) {
|
||||
if (lineCurrent > 0)
|
||||
{
|
||||
lineCurrent--;
|
||||
startPos = styler.LineStart(lineCurrent);
|
||||
if (startPos == 0)
|
||||
initStyle = SCE_P_DEFAULT;
|
||||
else
|
||||
initStyle = styler.StyleAt(startPos-1);
|
||||
}
|
||||
}
|
||||
int state = initStyle & 31;
|
||||
int spaceFlags = 0;
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsSolComment);
|
||||
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
|
||||
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
|
||||
char chNext = styler[startPos];
|
||||
for (int i = startPos; i < lengthDoc; i++)
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styler.StyleAt(i) & 31;
|
||||
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc))
|
||||
{
|
||||
int lev = indentCurrent;
|
||||
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsSolComment);
|
||||
if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
|
||||
indentNext |= SC_FOLDLEVELWHITEFLAG;
|
||||
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG))
|
||||
{
|
||||
// Only non whitespace lines can be headers
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
|
||||
{
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
} else if (indentNext & SC_FOLDLEVELWHITEFLAG)
|
||||
{
|
||||
// Line after is blank so check the next - maybe should continue further?
|
||||
int spaceFlags2 = 0;
|
||||
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsSolComment);
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK))
|
||||
{
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
indentCurrent = indentNext;
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
lineCurrent++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LexerModule lmScriptol(SCLEX_SCRIPTOL, ColouriseSolDoc, "scriptol", FoldSolDoc);
|
@@ -71,16 +71,6 @@ bool EqualCaseInsensitive(const char *a, const char *b) {
|
||||
return 0 == CompareCaseInsensitive(a, b);
|
||||
}
|
||||
|
||||
inline unsigned int HashString(const char *s, size_t len) {
|
||||
unsigned int ret = 0;
|
||||
while (len--) {
|
||||
ret <<= 4;
|
||||
ret ^= *s;
|
||||
s++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
PropSet::PropSet() {
|
||||
superPS = 0;
|
||||
for (int root = 0; root < hashRoots; root++)
|
||||
@@ -160,7 +150,7 @@ SString PropSet::Get(const char *key) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool IncludesVar(const char *value, const char *key) {
|
||||
bool PropSet::IncludesVar(const char *value, const char *key) {
|
||||
const char *var = strstr(value, "$(");
|
||||
while (var) {
|
||||
if (isprefix(var + 2, key) && (var[2 + strlen(key)] == ')')) {
|
||||
|
@@ -10,11 +10,11 @@
|
||||
* Dept. of Computer Science
|
||||
* York University
|
||||
*
|
||||
* Original code available from http://www.cs.yorku.ca/~oz/
|
||||
* Original code available from http://www.cs.yorku.ca/~oz/
|
||||
* Translation to C++ by Neil Hodgson neilh@scintilla.org
|
||||
* Removed all use of register.
|
||||
* Converted to modern function prototypes.
|
||||
* Put all global/static variables into an object so this code can be
|
||||
* Put all global/static variables into an object so this code can be
|
||||
* used from multiple threads etc.
|
||||
*
|
||||
* These routines are the PUBLIC DOMAIN equivalents of regex
|
||||
@@ -30,8 +30,10 @@
|
||||
* Modification history:
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.7 2003/07/18 06:43:23 RD
|
||||
* Update to Scintilla 1.53
|
||||
* Revision 1.8 2003/09/18 05:05:38 RD
|
||||
* Updated to Scintilla 1.54
|
||||
* Applied most of patch #806092
|
||||
* Added new wxSTC sample from Otto Wyss
|
||||
*
|
||||
* Revision 1.9 2003/03/21 10:36:08 nyamatongwe
|
||||
* Detect patterns too long in regular expression search.
|
||||
@@ -82,17 +84,17 @@
|
||||
*
|
||||
* Revision 1.2 88/08/28 15:36:04 oz
|
||||
* Use a complement bitmap to represent NCL.
|
||||
* This removes the need to have seperate
|
||||
* code in the PMatch case block - it is
|
||||
* This removes the need to have seperate
|
||||
* code in the PMatch case block - it is
|
||||
* just CCL code now.
|
||||
*
|
||||
*
|
||||
* Use the actual CCL code in the CLO
|
||||
* section of PMatch. No need for a recursive
|
||||
* PMatch call.
|
||||
*
|
||||
*
|
||||
* Use a bitmap table to set char bits in an
|
||||
* 8-bit chunk.
|
||||
*
|
||||
*
|
||||
* Interfaces:
|
||||
* RESearch::Compile: compile a regular expression into a NFA.
|
||||
*
|
||||
@@ -122,7 +124,7 @@
|
||||
* void re_fail(msg, op)
|
||||
* char *msg;
|
||||
* char op;
|
||||
*
|
||||
*
|
||||
* Regular Expressions:
|
||||
*
|
||||
* [1] char matches itself, unless it is a special
|
||||
@@ -132,20 +134,20 @@
|
||||
*
|
||||
* [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.
|
||||
* a digit 1 to 9 or a left or right angle bracket.
|
||||
* (see [7], [8] and [9])
|
||||
* It is used as an escape character for all
|
||||
* 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.
|
||||
*
|
||||
* [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
|
||||
* E, inclusive. The special characters "]" and
|
||||
* "-" have no special meaning if they appear
|
||||
* 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
|
||||
* E, inclusive. The special characters "]" and
|
||||
* "-" have no special meaning if they appear
|
||||
* as the first chars in the set.
|
||||
* examples: match:
|
||||
*
|
||||
@@ -210,8 +212,8 @@
|
||||
* Notes:
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
* bit comparison to locate the character in the set.
|
||||
*
|
||||
@@ -221,7 +223,7 @@
|
||||
* compile: CHR f CHR o CLO CHR o END CLO ANY END END
|
||||
* matches: fo foo fooo foobar fobar foxx ...
|
||||
*
|
||||
* pattern: fo[ob]a[rz]
|
||||
* pattern: fo[ob]a[rz]
|
||||
* compile: CHR f CHR o CCL bitset CHR a CCL bitset END
|
||||
* matches: fobar fooar fobaz fooaz
|
||||
*
|
||||
@@ -269,7 +271,7 @@
|
||||
const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
|
||||
|
||||
#define badpat(x) (*nfa = END, x)
|
||||
|
||||
|
||||
RESearch::RESearch() {
|
||||
Init();
|
||||
}
|
||||
@@ -359,7 +361,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
|
||||
int n;
|
||||
char mask; /* xor mask -CCL/NCL */
|
||||
int c1, c2;
|
||||
|
||||
|
||||
if (!pat || !length)
|
||||
if (sta)
|
||||
return 0;
|
||||
@@ -401,7 +403,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
|
||||
|
||||
i++;
|
||||
if (*++p == '^') {
|
||||
mask = '\377';
|
||||
mask = '\377';
|
||||
i++;
|
||||
p++;
|
||||
} else
|
||||
@@ -445,7 +447,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
|
||||
|
||||
for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
|
||||
*mp++ = static_cast<char>(mask ^ bittab[n]);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case '*': /* match 0 or more.. */
|
||||
@@ -590,7 +592,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
|
||||
* RESearch::Execute:
|
||||
* execute nfa to find a match.
|
||||
*
|
||||
* special cases: (nfa[0])
|
||||
* special cases: (nfa[0])
|
||||
* BOL
|
||||
* Match only once, starting from the
|
||||
* beginning.
|
||||
@@ -615,7 +617,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
|
||||
|
||||
bol = lp;
|
||||
failure = 0;
|
||||
|
||||
|
||||
Clear();
|
||||
|
||||
switch(*ap) {
|
||||
@@ -656,7 +658,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* PMatch: internal routine for the hard part
|
||||
*
|
||||
* This code is partly snarfed from an early grep written by
|
||||
@@ -682,7 +684,7 @@ 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).
|
||||
* by tagged expressions (n = 1 to 9).
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -693,23 +695,23 @@ extern void re_fail(char *,char);
|
||||
* 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.
|
||||
* 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,
|
||||
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
|
||||
};
|
||||
|
||||
@@ -831,10 +833,10 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
|
||||
* 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
|
||||
};
|
||||
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;
|
||||
@@ -881,7 +883,7 @@ int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
|
||||
pin = c - '0';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
*dst++ = c;
|
||||
continue;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#define BITBLK MAXCHR/CHRBIT
|
||||
|
||||
class CharacterIndexer {
|
||||
public:
|
||||
public:
|
||||
virtual char CharAt(int index)=0;
|
||||
};
|
||||
|
||||
|
@@ -15,18 +15,18 @@
|
||||
*/
|
||||
class SVector {
|
||||
enum { allocSize = 4000 };
|
||||
|
||||
|
||||
int *v; ///< The vector
|
||||
unsigned int size; ///< Number of elements allocated
|
||||
unsigned int len; ///< Number of elements used in vector
|
||||
bool allocFailure; ///< A memory allocation call has failed
|
||||
|
||||
|
||||
/** Internally allocate more elements than the user wants
|
||||
* to avoid thrashing the memory allocator. */
|
||||
void SizeTo(int newSize) {
|
||||
if (newSize < allocSize)
|
||||
newSize += allocSize;
|
||||
else
|
||||
else
|
||||
newSize = (newSize * 3) / 2;
|
||||
int* newv = new int[newSize];
|
||||
if (!newv) {
|
||||
@@ -44,7 +44,7 @@ class SVector {
|
||||
delete []v;
|
||||
v = newv;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
SVector() {
|
||||
allocFailure = false;
|
||||
|
@@ -203,11 +203,11 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
pdoc->DeleteChars(currentPos, lenEntered);
|
||||
SetEmptySelection(currentPos);
|
||||
pdoc->InsertString(currentPos, list);
|
||||
SetEmptySelection(currentPos + strlen(list));
|
||||
SetEmptySelection(currentPos + static_cast<int>(strlen(list)));
|
||||
} else {
|
||||
SetEmptySelection(currentPos);
|
||||
pdoc->InsertString(currentPos, list + lenEntered);
|
||||
SetEmptySelection(currentPos + strlen(list + lenEntered));
|
||||
SetEmptySelection(currentPos + static_cast<int>(strlen(list + lenEntered)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -340,7 +340,7 @@ void ScintillaBase::AutoCompleteCompleted() {
|
||||
if (item != -1) {
|
||||
SString piece = selected;
|
||||
pdoc->InsertString(firstPos, piece.c_str());
|
||||
SetEmptySelection(firstPos + piece.length());
|
||||
SetEmptySelection(firstPos + static_cast<int>(piece.length()));
|
||||
}
|
||||
pdoc->EndUndoAction();
|
||||
}
|
||||
@@ -557,7 +557,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ac.GetTypesep();
|
||||
|
||||
case SCI_CALLTIPSHOW:
|
||||
CallTipShow(LocationFromPosition(wParam),
|
||||
CallTipShow(LocationFromPosition(wParam),
|
||||
reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
|
@@ -43,7 +43,7 @@ protected:
|
||||
int lexLanguage;
|
||||
const LexerModule *lexCurrent;
|
||||
PropSet props;
|
||||
enum {numWordLists=9};
|
||||
enum {numWordLists=KEYWORDSET_MAX+1};
|
||||
WordList *keyWordLists[numWordLists+1];
|
||||
void SetLexer(uptr_t wParam);
|
||||
void SetLexerLanguage(const char *languageName);
|
||||
|
@@ -67,8 +67,8 @@ Style &Style::operator=(const Style &source) {
|
||||
|
||||
void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,
|
||||
const char *fontName_, int characterSet_,
|
||||
bool bold_, bool italic_, bool eolFilled_,
|
||||
bool underline_, ecaseForced caseForce_,
|
||||
bool bold_, bool italic_, bool eolFilled_,
|
||||
bool underline_, ecaseForced caseForce_,
|
||||
bool visible_, bool changeable_, bool hotspot_) {
|
||||
fore.desired = fore_;
|
||||
back.desired = back_;
|
||||
@@ -102,7 +102,7 @@ void Style::ClearTo(const Style &source) {
|
||||
source.eolFilled,
|
||||
source.underline,
|
||||
source.caseForce,
|
||||
source.visible,
|
||||
source.visible,
|
||||
source.changeable,
|
||||
source.hotspot);
|
||||
}
|
||||
|
@@ -44,8 +44,8 @@ public:
|
||||
void Clear(ColourDesired fore_, ColourDesired back_,
|
||||
int size_,
|
||||
const char *fontName_, int characterSet_,
|
||||
bool bold_, bool italic_, bool eolFilled_,
|
||||
bool underline_, ecaseForced caseForce_,
|
||||
bool bold_, bool italic_, bool eolFilled_,
|
||||
bool underline_, ecaseForced caseForce_,
|
||||
bool visible_, bool changeable_, bool hotspot_);
|
||||
void ClearTo(const Style &source);
|
||||
bool EquivalentFontTo(const Style *other) const;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Platform.h"
|
||||
@@ -24,7 +24,7 @@ bool WindowAccessor::InternalIsLeadByte(char ch) {
|
||||
if (SC_CP_UTF8 == codePage)
|
||||
// For lexing, all characters >= 0x80 are treated the
|
||||
// same so none is considered a lead byte.
|
||||
return false;
|
||||
return false;
|
||||
else
|
||||
return Platform::IsDBCSLeadByte(codePage, ch);
|
||||
}
|
||||
@@ -71,10 +71,10 @@ int WindowAccessor::LevelAt(int line) {
|
||||
return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0);
|
||||
}
|
||||
|
||||
int WindowAccessor::Length() {
|
||||
if (lenDoc == -1)
|
||||
int WindowAccessor::Length() {
|
||||
if (lenDoc == -1)
|
||||
lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0);
|
||||
return lenDoc;
|
||||
return lenDoc;
|
||||
}
|
||||
|
||||
int WindowAccessor::GetLineState(int line) {
|
||||
@@ -125,7 +125,7 @@ void WindowAccessor::Flush() {
|
||||
startPos = extremePosition;
|
||||
lenDoc = -1;
|
||||
if (validLen > 0) {
|
||||
Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
|
||||
Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
|
||||
styleBuf);
|
||||
validLen = 0;
|
||||
}
|
||||
@@ -134,12 +134,12 @@ void WindowAccessor::Flush() {
|
||||
int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
|
||||
int end = Length();
|
||||
int spaceFlags = 0;
|
||||
|
||||
// Determines the indentation level of the current line and also checks for consistent
|
||||
|
||||
// Determines the indentation level of the current line and also checks for consistent
|
||||
// indentation compared to the previous line.
|
||||
// Indentation is judged consistent when the indentation whitespace of each line lines
|
||||
// Indentation is judged consistent when the indentation whitespace of each line lines
|
||||
// the same or the indentation of one line is a prefix of the other.
|
||||
|
||||
|
||||
int pos = LineStart(line);
|
||||
char ch = (*this)[pos];
|
||||
int indent = 0;
|
||||
@@ -166,7 +166,7 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC
|
||||
}
|
||||
ch = (*this)[++pos];
|
||||
}
|
||||
|
||||
|
||||
*flags = spaceFlags;
|
||||
indent += SC_FOLDLEVELBASE;
|
||||
// if completely empty line or the start of a comment...
|
||||
|
@@ -49,7 +49,7 @@ void XPM::FillRun(Surface *surface, int code, int startX, int y, int x) {
|
||||
}
|
||||
}
|
||||
|
||||
XPM::XPM(const char *textForm) :
|
||||
XPM::XPM(const char *textForm) :
|
||||
data(0), codes(0), colours(0), lines(0) {
|
||||
Init(textForm);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ void XPM::Init(const char * const *linesForm) {
|
||||
|
||||
int strings = 1+height+nColours;
|
||||
lines = new char *[strings];
|
||||
int allocation = 0;
|
||||
size_t allocation = 0;
|
||||
for (int i=0; i<strings; i++) {
|
||||
allocation += MeasureLength(linesForm[i]) + 1;
|
||||
}
|
||||
|
@@ -475,7 +475,7 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp)
|
||||
buff[len] = 0;
|
||||
SendMsg(2049, markerNumber, (long)buff);
|
||||
delete [] buff;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Set a margin to be either numeric or symbolic.
|
||||
@@ -858,7 +858,7 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
|
||||
buff[len] = 0;
|
||||
SendMsg(2405, type, (long)buff);
|
||||
delete [] buff;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Clear all the registered images.
|
||||
@@ -1802,12 +1802,12 @@ bool wxStyledTextCtrl::GetMouseDownCaptures() {
|
||||
}
|
||||
|
||||
// Sets the cursor to one of the SC_CURSOR* values.
|
||||
void wxStyledTextCtrl::SetCursor(int cursorType) {
|
||||
void wxStyledTextCtrl::SetSTCCursor(int cursorType) {
|
||||
SendMsg(2386, cursorType, 0);
|
||||
}
|
||||
|
||||
// Get cursor type.
|
||||
int wxStyledTextCtrl::GetCursor() {
|
||||
int wxStyledTextCtrl::GetSTCCursor() {
|
||||
return SendMsg(2387, 0, 0);
|
||||
}
|
||||
|
||||
@@ -2115,11 +2115,11 @@ bool wxStyledTextCtrl::SaveFile(const wxString& filename)
|
||||
if (!file.IsOpened())
|
||||
return FALSE;
|
||||
|
||||
bool success = file.Write(GetText());
|
||||
bool success = file.Write(GetText(), *wxConvCurrent);
|
||||
|
||||
if (success)
|
||||
if (success) {
|
||||
SetSavePoint();
|
||||
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -2131,13 +2131,23 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
|
||||
if (file.IsOpened())
|
||||
{
|
||||
wxString contents;
|
||||
#if wxUSE_UNICODE
|
||||
wxMemoryBuffer buffer;
|
||||
#else
|
||||
wxString buffer;
|
||||
#endif
|
||||
|
||||
off_t len = file.Length();
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
wxChar *buf = contents.GetWriteBuf(len);
|
||||
success = (file.Read(buf, len) == len);
|
||||
contents.UngetWriteBuf();
|
||||
void *bufptr = buffer.GetWriteBuf(len);
|
||||
success = (file.Read(bufptr, len) == len);
|
||||
buffer.UngetWriteBuf(len);
|
||||
#if wxUSE_UNICODE
|
||||
contents = wxString(buffer, *wxConvCurrent);
|
||||
#else
|
||||
contents = buffer;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
success = true; // empty file is ok
|
||||
@@ -2157,7 +2167,7 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
|
||||
//----------------------------------------------------------------------
|
||||
// Event handlers
|
||||
|
||||
void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
|
||||
void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
|
||||
wxPaintDC dc(this);
|
||||
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
|
||||
}
|
||||
@@ -2179,7 +2189,7 @@ void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
|
||||
}
|
||||
}
|
||||
|
||||
void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
|
||||
void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
|
||||
wxSize sz = GetClientSize();
|
||||
m_swx->DoSize(sz.x, sz.y);
|
||||
}
|
||||
@@ -2257,9 +2267,10 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
|
||||
int key = evt.GetKeyCode();
|
||||
bool shift = evt.ShiftDown(),
|
||||
ctrl = evt.ControlDown(),
|
||||
alt = evt.AltDown();
|
||||
alt = evt.AltDown(),
|
||||
meta = evt.MetaDown();
|
||||
|
||||
int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, &m_lastKeyDownConsumed);
|
||||
int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed);
|
||||
|
||||
// printf("KeyDn key:%d shift:%d ctrl:%d alt:%d processed:%d consumed:%d\n",
|
||||
// key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
|
||||
@@ -2269,22 +2280,22 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
|
||||
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoLoseFocus();
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
|
||||
void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoGainFocus();
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) {
|
||||
void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoSysColourChange();
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) {
|
||||
void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
|
||||
// do nothing to help avoid flashing
|
||||
}
|
||||
|
||||
@@ -2295,7 +2306,7 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) {
|
||||
void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoOnListBox();
|
||||
}
|
||||
|
||||
|
@@ -362,7 +362,7 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
|
||||
//----------------------------------------------------------------------
|
||||
// Event handlers
|
||||
|
||||
void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
|
||||
void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
|
||||
wxPaintDC dc(this);
|
||||
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
|
||||
}
|
||||
@@ -384,7 +384,7 @@ void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
|
||||
}
|
||||
}
|
||||
|
||||
void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
|
||||
void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
|
||||
wxSize sz = GetClientSize();
|
||||
m_swx->DoSize(sz.x, sz.y);
|
||||
}
|
||||
@@ -462,9 +462,10 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
|
||||
int key = evt.GetKeyCode();
|
||||
bool shift = evt.ShiftDown(),
|
||||
ctrl = evt.ControlDown(),
|
||||
alt = evt.AltDown();
|
||||
alt = evt.AltDown(),
|
||||
meta = evt.MetaDown();
|
||||
|
||||
int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, &m_lastKeyDownConsumed);
|
||||
int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed);
|
||||
|
||||
// printf("KeyDn key:%%d shift:%%d ctrl:%%d alt:%%d processed:%%d consumed:%%d\n",
|
||||
// key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
|
||||
@@ -474,22 +475,22 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
|
||||
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoLoseFocus();
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
|
||||
void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoGainFocus();
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) {
|
||||
void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoSysColourChange();
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) {
|
||||
void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
|
||||
// do nothing to help avoid flashing
|
||||
}
|
||||
|
||||
@@ -500,7 +501,7 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) {
|
||||
void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoOnListBox();
|
||||
}
|
||||
|
||||
|
@@ -52,6 +52,7 @@
|
||||
|
||||
//-----------------------------------------
|
||||
// Commands that can be bound to keystrokes
|
||||
|
||||
%(CMDS)s
|
||||
|
||||
|
||||
|
@@ -153,6 +153,7 @@
|
||||
#define wxSTC_INDIC_TT 2
|
||||
#define wxSTC_INDIC_DIAGONAL 3
|
||||
#define wxSTC_INDIC_STRIKE 4
|
||||
#define wxSTC_INDIC_HIDDEN 5
|
||||
#define wxSTC_INDIC0_MASK 0x20
|
||||
#define wxSTC_INDIC1_MASK 0x40
|
||||
#define wxSTC_INDIC2_MASK 0x80
|
||||
@@ -234,6 +235,9 @@
|
||||
// where most code reside, and the lines after the caret, eg. the body of a function.
|
||||
#define wxSTC_CARET_EVEN 0x08
|
||||
|
||||
// Maximum value of keywordSet parameter of SetKeyWords.
|
||||
#define wxSTC_KEYWORDSET_MAX 8
|
||||
|
||||
// Notifications
|
||||
// Type of modification and the action which caused the modification.
|
||||
// These are defined as a bit mask to make it easy to specify which notifications are wanted.
|
||||
@@ -318,6 +322,9 @@
|
||||
#define wxSTC_LEX_POV 39
|
||||
#define wxSTC_LEX_LOUT 40
|
||||
#define wxSTC_LEX_ESCRIPT 41
|
||||
#define wxSTC_LEX_PS 42
|
||||
#define wxSTC_LEX_NSIS 43
|
||||
#define wxSTC_LEX_MMIXAL 44
|
||||
|
||||
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -571,6 +578,8 @@
|
||||
#define wxSTC_LUA_WORD4 15
|
||||
#define wxSTC_LUA_WORD5 16
|
||||
#define wxSTC_LUA_WORD6 17
|
||||
#define wxSTC_LUA_WORD7 18
|
||||
#define wxSTC_LUA_WORD8 19
|
||||
|
||||
// Lexical states for SCLEX_ERRORLIST
|
||||
#define wxSTC_ERR_DEFAULT 0
|
||||
@@ -792,14 +801,20 @@
|
||||
#define wxSTC_POV_DEFAULT 0
|
||||
#define wxSTC_POV_COMMENT 1
|
||||
#define wxSTC_POV_COMMENTLINE 2
|
||||
#define wxSTC_POV_COMMENTDOC 3
|
||||
#define wxSTC_POV_NUMBER 4
|
||||
#define wxSTC_POV_WORD 5
|
||||
#define wxSTC_POV_NUMBER 3
|
||||
#define wxSTC_POV_OPERATOR 4
|
||||
#define wxSTC_POV_IDENTIFIER 5
|
||||
#define wxSTC_POV_STRING 6
|
||||
#define wxSTC_POV_OPERATOR 7
|
||||
#define wxSTC_POV_IDENTIFIER 8
|
||||
#define wxSTC_POV_BRACE 9
|
||||
#define wxSTC_POV_STRINGEOL 7
|
||||
#define wxSTC_POV_DIRECTIVE 8
|
||||
#define wxSTC_POV_BADDIRECTIVE 9
|
||||
#define wxSTC_POV_WORD2 10
|
||||
#define wxSTC_POV_WORD3 11
|
||||
#define wxSTC_POV_WORD4 12
|
||||
#define wxSTC_POV_WORD5 13
|
||||
#define wxSTC_POV_WORD6 14
|
||||
#define wxSTC_POV_WORD7 15
|
||||
#define wxSTC_POV_WORD8 16
|
||||
|
||||
// Lexical states for SCLEX_LOUT
|
||||
#define wxSTC_LOUT_DEFAULT 0
|
||||
@@ -828,10 +843,65 @@
|
||||
#define wxSTC_ESCRIPT_WORD2 10
|
||||
#define wxSTC_ESCRIPT_WORD3 11
|
||||
|
||||
// Lexical states for SCLEX_PS
|
||||
#define wxSTC_PS_DEFAULT 0
|
||||
#define wxSTC_PS_COMMENT 1
|
||||
#define wxSTC_PS_DSC_COMMENT 2
|
||||
#define wxSTC_PS_DSC_VALUE 3
|
||||
#define wxSTC_PS_NUMBER 4
|
||||
#define wxSTC_PS_NAME 5
|
||||
#define wxSTC_PS_KEYWORD 6
|
||||
#define wxSTC_PS_LITERAL 7
|
||||
#define wxSTC_PS_IMMEVAL 8
|
||||
#define wxSTC_PS_PAREN_ARRAY 9
|
||||
#define wxSTC_PS_PAREN_DICT 10
|
||||
#define wxSTC_PS_PAREN_PROC 11
|
||||
#define wxSTC_PS_TEXT 12
|
||||
#define wxSTC_PS_HEXSTRING 13
|
||||
#define wxSTC_PS_BASE85STRING 14
|
||||
#define wxSTC_PS_BADSTRINGCHAR 15
|
||||
|
||||
// Lexical states for SCLEX_NSIS
|
||||
#define wxSTC_NSIS_DEFAULT 0
|
||||
#define wxSTC_NSIS_COMMENT 1
|
||||
#define wxSTC_NSIS_STRINGDQ 2
|
||||
#define wxSTC_NSIS_STRINGLQ 3
|
||||
#define wxSTC_NSIS_STRINGRQ 4
|
||||
#define wxSTC_NSIS_FUNCTION 5
|
||||
#define wxSTC_NSIS_VARIABLE 6
|
||||
#define wxSTC_NSIS_LABEL 7
|
||||
#define wxSTC_NSIS_USERDEFINED 8
|
||||
#define wxSTC_NSIS_SECTIONDEF 9
|
||||
#define wxSTC_NSIS_SUBSECTIONDEF 10
|
||||
#define wxSTC_NSIS_IFDEFINEDEF 11
|
||||
#define wxSTC_NSIS_MACRODEF 12
|
||||
#define wxSTC_NSIS_STRINGVAR 13
|
||||
|
||||
// Lexical states for SCLEX_MMIXAL
|
||||
#define wxSTC_MMIXAL_LEADWS 0
|
||||
#define wxSTC_MMIXAL_COMMENT 1
|
||||
#define wxSTC_MMIXAL_LABEL 2
|
||||
#define wxSTC_MMIXAL_OPCODE 3
|
||||
#define wxSTC_MMIXAL_OPCODE_PRE 4
|
||||
#define wxSTC_MMIXAL_OPCODE_VALID 5
|
||||
#define wxSTC_MMIXAL_OPCODE_UNKNOWN 6
|
||||
#define wxSTC_MMIXAL_OPCODE_POST 7
|
||||
#define wxSTC_MMIXAL_OPERANDS 8
|
||||
#define wxSTC_MMIXAL_NUMBER 9
|
||||
#define wxSTC_MMIXAL_REF 10
|
||||
#define wxSTC_MMIXAL_CHAR 11
|
||||
#define wxSTC_MMIXAL_STRING 12
|
||||
#define wxSTC_MMIXAL_REGISTER 13
|
||||
#define wxSTC_MMIXAL_HEX 14
|
||||
#define wxSTC_MMIXAL_OPERATOR 15
|
||||
#define wxSTC_MMIXAL_SYMBOL 16
|
||||
#define wxSTC_MMIXAL_INCLUDE 17
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Commands that can be bound to keystrokes
|
||||
|
||||
|
||||
// Redoes the next action on the undo history.
|
||||
#define wxSTC_CMD_REDO 2011
|
||||
|
||||
@@ -2014,10 +2084,10 @@ public:
|
||||
bool GetMouseDownCaptures();
|
||||
|
||||
// Sets the cursor to one of the SC_CURSOR* values.
|
||||
void SetCursor(int cursorType);
|
||||
void SetSTCCursor(int cursorType);
|
||||
|
||||
// Get cursor type.
|
||||
int GetCursor();
|
||||
int GetSTCCursor();
|
||||
|
||||
// Change the way control characters are displayed:
|
||||
// If symbol is < 32, keep the drawn way, else, use the given character.
|
||||
|
@@ -40,7 +40,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||
-I$(srcdir)/../../../samples -I$(srcdir)/../../include $(CXXFLAGS)
|
||||
STCTEST_OBJECTS = \
|
||||
$(__stctest___win32rc) \
|
||||
stctest_stctest.o
|
||||
stctest_stctest.o \
|
||||
stctest_edit.o \
|
||||
stctest_prefs.o
|
||||
WX_VERSION = 2.5.1
|
||||
|
||||
### Conditionally set variables: ###
|
||||
@@ -102,7 +104,7 @@ COND_PLATFORM_OS2_1___stctest___os2_emxbindcmd = $(NM) stctest$(EXEEXT) | if \
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: stctest$(EXEEXT) $(__stctest_bundle___depname) data
|
||||
all: stctest$(EXEEXT) $(__stctest_bundle___depname)
|
||||
|
||||
clean:
|
||||
rm -rf ./.deps ./.pch
|
||||
@@ -110,14 +112,6 @@ clean:
|
||||
rm -f stctest$(EXEEXT)
|
||||
rm -rf stctest.app
|
||||
|
||||
data:
|
||||
@mkdir -p .
|
||||
@for f in stctest.cpp; do \
|
||||
if test \( ! -s ./$$f \) -o \( $(srcdir)/$$f -nt ./$$f \) ; then \
|
||||
cp -pRf $(srcdir)/$$f . ; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
distclean: clean
|
||||
rm -f configure config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
|
||||
|
||||
@@ -155,6 +149,12 @@ stctest.app/Contents/PkgInfo: stctest$(EXEEXT) $(top_srcdir)/src/mac/Info.plist.
|
||||
|
||||
@COND_PLATFORM_MACOSX_1@stctest_bundle: stctest.app/Contents/PkgInfo
|
||||
|
||||
stctest_edit.o: $(srcdir)/edit.cpp
|
||||
$(CXXC) -c -o $@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
stctest_prefs.o: $(srcdir)/prefs.cpp
|
||||
$(CXXC) -c -o $@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
stctest_sample_rc.o: $(srcdir)/../../../samples/sample.rc
|
||||
$(RESCOMP) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_2) --include-dir $(top_srcdir)/include --include-dir $(srcdir) $(__DLLFLAG_p_2) --include-dir $(srcdir)/../../../samples
|
||||
|
||||
@@ -167,4 +167,4 @@ uninstall:
|
||||
# Include dependency info, if present:
|
||||
@IF_GNU_MAKE@-include .deps/*.d
|
||||
|
||||
.PHONY: all clean data distclean install stctest_bundle uninstall
|
||||
.PHONY: all clean distclean install stctest_bundle uninstall
|
||||
|
104
samples/stc/defsext.h
Normal file
104
samples/stc/defsext.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: defsext.h extensions
|
||||
// Purpose: STC test declarations
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DEFSEXT_H_
|
||||
#define _WX_DEFSEXT_H_
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//! wxWindows headers
|
||||
#include <wx/print.h> // printing support
|
||||
#include <wx/printdlg.h> // printing dialog
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
#define DEFAULT_LANGUAGE _("<default>")
|
||||
|
||||
#define PAGE_COMMON _("Common")
|
||||
#define PAGE_LANGUAGES _("Languages")
|
||||
#define PAGE_STYLE_TYPES _("Style types")
|
||||
|
||||
#define STYLE_TYPES_COUNT 32
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// standard IDs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
// menu IDs
|
||||
myID_PROPERTIES = wxID_HIGHEST,
|
||||
myID_INDENTINC,
|
||||
myID_INDENTRED,
|
||||
myID_FINDNEXT,
|
||||
myID_REPLACE,
|
||||
myID_REPLACENEXT,
|
||||
myID_BRACEMATCH,
|
||||
myID_GOTO,
|
||||
myID_PAGEACTIVE,
|
||||
myID_DISPLAYEOL,
|
||||
myID_INDENTGUIDE,
|
||||
myID_LINENUMBER,
|
||||
myID_LONGLINEON,
|
||||
myID_WHITESPACE,
|
||||
myID_FOLDTOGGLE,
|
||||
myID_OVERTYPE,
|
||||
myID_READONLY,
|
||||
myID_WRAPMODEON,
|
||||
myID_CHANGECASE,
|
||||
myID_CHANGELOWER,
|
||||
myID_CHANGEUPPER,
|
||||
myID_HILIGHTLANG,
|
||||
myID_HILIGHTFIRST,
|
||||
myID_HILIGHTLAST = myID_HILIGHTFIRST + 99,
|
||||
myID_CONVERTEOL,
|
||||
myID_CONVERTCR,
|
||||
myID_CONVERTCRLF,
|
||||
myID_CONVERTLF,
|
||||
myID_USECHARSET,
|
||||
myID_CHARSETANSI,
|
||||
myID_CHARSETMAC,
|
||||
myID_PAGEPREV,
|
||||
myID_PAGENEXT,
|
||||
myID_SELECTLINE,
|
||||
|
||||
// other IDs
|
||||
myID_STATUSBAR,
|
||||
myID_TITLEBAR,
|
||||
myID_ABOUTTIMER,
|
||||
myID_UPDATETIMER,
|
||||
|
||||
// dialog find IDs
|
||||
myID_DLG_FIND_TEXT,
|
||||
|
||||
// preferences IDs
|
||||
myID_PREFS_LANGUAGE,
|
||||
myID_PREFS_STYLETYPE,
|
||||
myID_PREFS_KEYWORDS,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global items
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//! global application name
|
||||
extern wxString *g_appname;
|
||||
|
||||
//! global print data, to remember settings during the session
|
||||
extern wxPrintData *g_printData;
|
||||
extern wxPageSetupData *g_pageSetupData;
|
||||
|
||||
#endif // _WX_DEFSEXT_H_
|
||||
|
825
samples/stc/edit.cpp
Normal file
825
samples/stc/edit.cpp
Normal file
@@ -0,0 +1,825 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: edit.cpp
|
||||
// Purpose: STC test module
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// informations
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes <wx/wx.h>.
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all 'standard' wxWindows headers)
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
//! wxWindows headers
|
||||
#include <wx/file.h> // raw file io support
|
||||
#include <wx/filename.h> // filename support
|
||||
|
||||
//! application headers
|
||||
#include "defsext.h" // additional definitions
|
||||
|
||||
#include "edit.h" // edit module
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// resources
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
|
||||
//============================================================================
|
||||
// implementation
|
||||
//============================================================================
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Edit
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl)
|
||||
// common
|
||||
EVT_SIZE ( Edit::OnSize)
|
||||
// edit
|
||||
EVT_MENU (wxID_CLEAR, Edit::OnEditClear)
|
||||
EVT_MENU (wxID_CUT, Edit::OnEditCut)
|
||||
EVT_MENU (wxID_COPY, Edit::OnEditCopy)
|
||||
EVT_MENU (wxID_PASTE, Edit::OnEditPaste)
|
||||
EVT_MENU (myID_INDENTINC, Edit::OnEditIndentInc)
|
||||
EVT_MENU (myID_INDENTRED, Edit::OnEditIndentRed)
|
||||
EVT_MENU (wxID_SELECTALL, Edit::OnEditSelectAll)
|
||||
EVT_MENU (myID_SELECTLINE, Edit::OnEditSelectLine)
|
||||
EVT_MENU (wxID_REDO, Edit::OnEditRedo)
|
||||
EVT_MENU (wxID_UNDO, Edit::OnEditUndo)
|
||||
// find
|
||||
EVT_MENU (wxID_FIND, Edit::OnFind)
|
||||
EVT_MENU (myID_FINDNEXT, Edit::OnFindNext)
|
||||
EVT_MENU (myID_REPLACE, Edit::OnReplace)
|
||||
EVT_MENU (myID_REPLACENEXT, Edit::OnReplaceNext)
|
||||
EVT_MENU (myID_BRACEMATCH, Edit::OnBraceMatch)
|
||||
EVT_MENU (myID_GOTO, Edit::OnGoto)
|
||||
// view
|
||||
EVT_MENU_RANGE (myID_HILIGHTFIRST, myID_HILIGHTLAST,
|
||||
Edit::OnHilightLang)
|
||||
EVT_MENU (myID_DISPLAYEOL, Edit::OnDisplayEOL)
|
||||
EVT_MENU (myID_INDENTGUIDE, Edit::OnIndentGuide)
|
||||
EVT_MENU (myID_LINENUMBER, Edit::OnLineNumber)
|
||||
EVT_MENU (myID_LONGLINEON, Edit::OnLongLineOn)
|
||||
EVT_MENU (myID_WHITESPACE, Edit::OnWhiteSpace)
|
||||
EVT_MENU (myID_FOLDTOGGLE, Edit::OnFoldToggle)
|
||||
EVT_MENU (myID_OVERTYPE, Edit::OnSetOverType)
|
||||
EVT_MENU (myID_READONLY, Edit::OnSetReadOnly)
|
||||
EVT_MENU (myID_WRAPMODEON, Edit::OnWrapmodeOn)
|
||||
EVT_MENU (myID_CHARSETANSI, Edit::OnUseCharset)
|
||||
EVT_MENU (myID_CHARSETMAC, Edit::OnUseCharset)
|
||||
// extra
|
||||
EVT_MENU (myID_CHANGELOWER, Edit::OnChangeCase)
|
||||
EVT_MENU (myID_CHANGEUPPER, Edit::OnChangeCase)
|
||||
EVT_MENU (myID_CONVERTCR, Edit::OnConvertEOL)
|
||||
EVT_MENU (myID_CONVERTCRLF, Edit::OnConvertEOL)
|
||||
EVT_MENU (myID_CONVERTLF, Edit::OnConvertEOL)
|
||||
// stc
|
||||
EVT_STC_MARGINCLICK (-1, Edit::OnMarginClick)
|
||||
EVT_STC_CHARADDED (-1, Edit::OnCharAdded)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
Edit::Edit (wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
long style)
|
||||
: wxStyledTextCtrl (parent, id, pos, size, style) {
|
||||
|
||||
m_filename = _T("");
|
||||
|
||||
m_LineNrID = 0;
|
||||
m_DividerID = 1;
|
||||
m_FoldingID = 2;
|
||||
|
||||
// initialize language
|
||||
m_language = NULL;
|
||||
|
||||
// default font for all styles
|
||||
SetViewEOL (g_CommonPrefs.displayEOLEnable);
|
||||
SetIndentationGuides (g_CommonPrefs.indentGuideEnable);
|
||||
SetEdgeMode (g_CommonPrefs.longLineOnEnable?
|
||||
wxSTC_EDGE_LINE: wxSTC_EDGE_NONE);
|
||||
SetViewWhiteSpace (g_CommonPrefs.whiteSpaceEnable?
|
||||
wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE);
|
||||
SetOvertype (g_CommonPrefs.overTypeInitial);
|
||||
SetReadOnly (g_CommonPrefs.readOnlyInitial);
|
||||
SetWrapMode (g_CommonPrefs.wrapModeInitial?
|
||||
wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);
|
||||
wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
StyleSetFont (wxSTC_STYLE_DEFAULT, font);
|
||||
StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour ("BLACK"));
|
||||
StyleSetBackground (wxSTC_STYLE_DEFAULT, wxColour ("WHITE"));
|
||||
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY"));
|
||||
StyleSetBackground (wxSTC_STYLE_LINENUMBER, wxColour ("WHITE"));
|
||||
StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY"));
|
||||
InitializePrefs (DEFAULT_LANGUAGE);
|
||||
|
||||
// set visibility
|
||||
SetVisiblePolicy (wxSTC_VISIBLE_STRICT|wxSTC_VISIBLE_SLOP, 1);
|
||||
SetXCaretPolicy (wxSTC_CARET_EVEN|wxSTC_VISIBLE_STRICT|wxSTC_CARET_SLOP, 1);
|
||||
SetYCaretPolicy (wxSTC_CARET_EVEN|wxSTC_VISIBLE_STRICT|wxSTC_CARET_SLOP, 1);
|
||||
|
||||
// markers
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, "BLACK", "BLACK");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, "BLACK", "BLACK");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, "BLACK", "WHITE");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, "BLACK", "WHITE");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
|
||||
MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
|
||||
|
||||
// miscelaneous
|
||||
m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, _T("_999999"));
|
||||
m_FoldingMargin = 16;
|
||||
SetMarginWidth (m_LineNrID,
|
||||
g_CommonPrefs.lineNumberEnable? m_LineNrMargin: 0);
|
||||
CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key
|
||||
UsePopUp (0);
|
||||
SetLayoutCache (wxSTC_CACHE_PAGE);
|
||||
|
||||
}
|
||||
|
||||
Edit::~Edit () {}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// common event handlers
|
||||
void Edit::OnSize( wxSizeEvent& event ) {
|
||||
int x = GetClientSize().x +
|
||||
(g_CommonPrefs.lineNumberEnable? m_LineNrMargin: 0) +
|
||||
(g_CommonPrefs.foldEnable? m_FoldingMargin: 0);
|
||||
if (x > 0) SetScrollWidth (x);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// edit event handlers
|
||||
void Edit::OnEditRedo (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!CanRedo()) return;
|
||||
Redo ();
|
||||
}
|
||||
|
||||
void Edit::OnEditUndo (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!CanUndo()) return;
|
||||
Undo ();
|
||||
}
|
||||
|
||||
void Edit::OnEditClear (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (GetReadOnly()) return;
|
||||
Clear ();
|
||||
}
|
||||
|
||||
void Edit::OnEditCut (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (GetReadOnly() || (GetSelectionEnd()-GetSelectionStart() <= 0)) return;
|
||||
Cut ();
|
||||
}
|
||||
|
||||
void Edit::OnEditCopy (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (GetSelectionEnd()-GetSelectionStart() <= 0) return;
|
||||
Copy ();
|
||||
}
|
||||
|
||||
void Edit::OnEditPaste (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!CanPaste()) return;
|
||||
Paste ();
|
||||
}
|
||||
|
||||
void Edit::OnFind (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnFindNext (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnReplace (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnReplaceNext (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnBraceMatch (wxCommandEvent &WXUNUSED(event)) {
|
||||
int min = GetCurrentPos ();
|
||||
int max = BraceMatch (min);
|
||||
if (max > (min+1)) {
|
||||
BraceHighlight (min+1, max);
|
||||
SetSelection (min+1, max);
|
||||
}else{
|
||||
BraceBadLight (min);
|
||||
}
|
||||
}
|
||||
|
||||
void Edit::OnGoto (wxCommandEvent &WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void Edit::OnEditIndentInc (wxCommandEvent &event) {
|
||||
CmdKeyExecute (wxSTC_CMD_TAB);
|
||||
}
|
||||
|
||||
void Edit::OnEditIndentRed (wxCommandEvent &event) {
|
||||
CmdKeyExecute (wxSTC_CMD_DELETEBACK);
|
||||
}
|
||||
|
||||
void Edit::OnEditSelectAll (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetSelection (0, GetTextLength ());
|
||||
}
|
||||
|
||||
void Edit::OnEditSelectLine (wxCommandEvent &WXUNUSED(event)) {
|
||||
int lineStart = PositionFromLine (GetCurrentLine());
|
||||
int lineEnd = PositionFromLine (GetCurrentLine() + 1);
|
||||
SetSelection (lineStart, lineEnd);
|
||||
}
|
||||
|
||||
void Edit::OnHilightLang (wxCommandEvent &event) {
|
||||
InitializePrefs (g_LanguagePrefs [event.GetId() - myID_HILIGHTFIRST].name);
|
||||
}
|
||||
|
||||
void Edit::OnDisplayEOL (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetViewEOL (!GetViewEOL());
|
||||
}
|
||||
|
||||
void Edit::OnIndentGuide (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetIndentationGuides (!GetIndentationGuides());
|
||||
}
|
||||
|
||||
void Edit::OnLineNumber (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetMarginWidth (m_LineNrID,
|
||||
GetMarginWidth (m_LineNrID) == 0? m_LineNrMargin: 0);
|
||||
}
|
||||
|
||||
void Edit::OnLongLineOn (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetEdgeMode (GetEdgeMode() == 0? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE);
|
||||
}
|
||||
|
||||
void Edit::OnWhiteSpace (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetViewWhiteSpace (GetViewWhiteSpace() == 0?
|
||||
wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE);
|
||||
}
|
||||
|
||||
void Edit::OnFoldToggle (wxCommandEvent &WXUNUSED(event)) {
|
||||
ToggleFold (GetFoldParent(GetCurrentLine()));
|
||||
}
|
||||
|
||||
void Edit::OnSetOverType (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetOvertype (!GetOvertype());
|
||||
}
|
||||
|
||||
void Edit::OnSetReadOnly (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetReadOnly (!GetReadOnly());
|
||||
}
|
||||
|
||||
void Edit::OnWrapmodeOn (wxCommandEvent &WXUNUSED(event)) {
|
||||
SetWrapMode (GetWrapMode() == 0? wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);
|
||||
}
|
||||
|
||||
void Edit::OnUseCharset (wxCommandEvent &event) {
|
||||
int Nr;
|
||||
int charset = GetCodePage();
|
||||
switch (event.GetId()) {
|
||||
case myID_CHARSETANSI: {charset = wxSTC_CHARSET_ANSI; break;}
|
||||
case myID_CHARSETMAC: {charset = wxSTC_CHARSET_ANSI; break;}
|
||||
}
|
||||
for (Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) {
|
||||
StyleSetCharacterSet (Nr, charset);
|
||||
}
|
||||
SetCodePage (charset);
|
||||
}
|
||||
|
||||
void Edit::OnChangeCase (wxCommandEvent &event) {
|
||||
switch (event.GetId()) {
|
||||
case myID_CHANGELOWER: {
|
||||
CmdKeyExecute (wxSTC_CMD_LOWERCASE);
|
||||
break;
|
||||
}
|
||||
case myID_CHANGEUPPER: {
|
||||
CmdKeyExecute (wxSTC_CMD_UPPERCASE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Edit::OnConvertEOL (wxCommandEvent &event) {
|
||||
int eolMode = GetEOLMode();
|
||||
switch (event.GetId()) {
|
||||
case myID_CONVERTCR: { eolMode = wxSTC_EOL_CR; break;}
|
||||
case myID_CONVERTCRLF: { eolMode = wxSTC_EOL_CRLF; break;}
|
||||
case myID_CONVERTLF: { eolMode = wxSTC_EOL_LF; break;}
|
||||
}
|
||||
ConvertEOLs (eolMode);
|
||||
SetEOLMode (eolMode);
|
||||
}
|
||||
|
||||
//! misc
|
||||
void Edit::OnMarginClick (wxStyledTextEvent &event) {
|
||||
if (event.GetMargin() == 2) {
|
||||
int lineClick = LineFromPosition (event.GetPosition());
|
||||
int levelClick = GetFoldLevel (lineClick);
|
||||
if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) {
|
||||
ToggleFold (lineClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Edit::OnCharAdded (wxStyledTextEvent &event) {
|
||||
char chr = event.GetKey();
|
||||
int currentLine = GetCurrentLine();
|
||||
// Change this if support for mac files with \r is needed
|
||||
if (chr == '\n') {
|
||||
int lineInd = 0;
|
||||
if (currentLine > 0) {
|
||||
lineInd = GetLineIndentation(currentLine - 1);
|
||||
}
|
||||
if (lineInd == 0) return;
|
||||
SetLineIndentation (currentLine, lineInd);
|
||||
GotoPos(PositionFromLine (currentLine) + lineInd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// private functions
|
||||
wxString Edit::DeterminePrefs (const wxString &filename) {
|
||||
|
||||
LanguageInfo const* curInfo = NULL;
|
||||
|
||||
// determine language from filepatterns
|
||||
int languageNr;
|
||||
for (languageNr = 0; languageNr < g_LanguagePrefsSize; languageNr++) {
|
||||
curInfo = &g_LanguagePrefs [languageNr];
|
||||
wxString filepattern = curInfo->filepattern;
|
||||
filepattern.Lower();
|
||||
while (!filepattern.IsEmpty()) {
|
||||
wxString cur = filepattern.BeforeFirst (';');
|
||||
if ((cur == filename) ||
|
||||
(cur == (filename.BeforeLast ('.') + _T(".*"))) ||
|
||||
(cur == (_T("*.") + filename.AfterLast ('.')))) {
|
||||
return curInfo->name;
|
||||
}
|
||||
filepattern = filepattern.AfterFirst (';');
|
||||
}
|
||||
}
|
||||
return wxEmptyString;
|
||||
|
||||
}
|
||||
|
||||
bool Edit::InitializePrefs (const wxString &name) {
|
||||
|
||||
// initialize styles
|
||||
StyleClearAll();
|
||||
LanguageInfo const* curInfo = NULL;
|
||||
|
||||
// determine language
|
||||
bool found = false;
|
||||
int languageNr;
|
||||
for (languageNr = 0; languageNr < g_LanguagePrefsSize; languageNr++) {
|
||||
curInfo = &g_LanguagePrefs [languageNr];
|
||||
if (curInfo->name == name) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) return false;
|
||||
|
||||
// set lexer and language
|
||||
SetLexer (curInfo->lexer);
|
||||
m_language = curInfo;
|
||||
|
||||
// set margin for line numbers
|
||||
SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER);
|
||||
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY"));
|
||||
StyleSetBackground (wxSTC_STYLE_LINENUMBER, wxColour ("WHITE"));
|
||||
SetMarginWidth (m_LineNrID,
|
||||
g_CommonPrefs.lineNumberEnable? m_LineNrMargin: 0);
|
||||
|
||||
// default fonts for all styles!
|
||||
int Nr;
|
||||
for (Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) {
|
||||
wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
StyleSetFont (Nr, font);
|
||||
}
|
||||
|
||||
// set common styles
|
||||
StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour ("DARK GREY"));
|
||||
StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY"));
|
||||
|
||||
// initialize settings
|
||||
if (g_CommonPrefs.syntaxEnable) {
|
||||
int keywordnr = 0;
|
||||
for (Nr = 0; Nr < STYLE_TYPES_COUNT; Nr++) {
|
||||
if (curInfo->styles[Nr].type == -1) continue;
|
||||
const StyleInfo &curType = g_StylePrefs [curInfo->styles[Nr].type];
|
||||
wxFont font (curType.fontsize, wxMODERN, wxNORMAL, wxNORMAL, false,
|
||||
curType.fontname);
|
||||
StyleSetFont (Nr, font);
|
||||
if (curType.foreground) {
|
||||
StyleSetForeground (Nr, wxColour (curType.foreground));
|
||||
}
|
||||
if (curType.background) {
|
||||
StyleSetBackground (Nr, wxColour (curType.background));
|
||||
}
|
||||
StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0);
|
||||
StyleSetItalic (Nr, (curType.fontstyle & mySTC_STYLE_ITALIC) > 0);
|
||||
StyleSetUnderline (Nr, (curType.fontstyle & mySTC_STYLE_UNDERL) > 0);
|
||||
StyleSetVisible (Nr, (curType.fontstyle & mySTC_STYLE_HIDDEN) == 0);
|
||||
StyleSetCase (Nr, curType.lettercase);
|
||||
const wxChar *pwords = curInfo->styles[Nr].words;
|
||||
if (pwords) {
|
||||
SetKeyWords (keywordnr, pwords);
|
||||
keywordnr += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set margin as unused
|
||||
SetMarginType (m_DividerID, wxSTC_MARGIN_SYMBOL);
|
||||
SetMarginWidth (m_DividerID, 0);
|
||||
SetMarginSensitive (m_DividerID, false);
|
||||
|
||||
// folding
|
||||
SetMarginType (m_FoldingID, wxSTC_MARGIN_SYMBOL);
|
||||
SetMarginMask (m_FoldingID, wxSTC_MASK_FOLDERS);
|
||||
StyleSetBackground (m_FoldingID, wxColour ("WHITE"));
|
||||
SetMarginWidth (m_FoldingID, 0);
|
||||
SetMarginSensitive (m_FoldingID, false);
|
||||
if (g_CommonPrefs.foldEnable) {
|
||||
SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0);
|
||||
SetMarginSensitive (m_FoldingID, curInfo->folds != 0);
|
||||
SetProperty (_T("fold"), curInfo->folds != 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.comment"),
|
||||
(curInfo->folds & mySTC_FOLD_COMMENT) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.compact"),
|
||||
(curInfo->folds & mySTC_FOLD_COMPACT) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.preprocessor"),
|
||||
(curInfo->folds & mySTC_FOLD_PREPROC) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.html"),
|
||||
(curInfo->folds & mySTC_FOLD_HTML) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.html.preprocessor"),
|
||||
(curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.comment.python"),
|
||||
(curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? _T("1"): _T("0"));
|
||||
SetProperty (_T("fold.quotes.python"),
|
||||
(curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? _T("1"): _T("0"));
|
||||
}
|
||||
SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED |
|
||||
wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);
|
||||
|
||||
// set spaces and indention
|
||||
SetTabWidth (4);
|
||||
SetUseTabs (false);
|
||||
SetTabIndents (true);
|
||||
SetBackSpaceUnIndents (true);
|
||||
SetIndent (g_CommonPrefs.indentEnable? 4: 0);
|
||||
|
||||
// others
|
||||
SetViewEOL (g_CommonPrefs.displayEOLEnable);
|
||||
SetIndentationGuides (g_CommonPrefs.indentGuideEnable);
|
||||
SetEdgeColumn (80);
|
||||
SetEdgeMode (g_CommonPrefs.longLineOnEnable? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE);
|
||||
SetViewWhiteSpace (g_CommonPrefs.whiteSpaceEnable?
|
||||
wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE);
|
||||
SetOvertype (g_CommonPrefs.overTypeInitial);
|
||||
SetReadOnly (g_CommonPrefs.readOnlyInitial);
|
||||
SetWrapMode (g_CommonPrefs.wrapModeInitial?
|
||||
wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Edit::LoadFile () {
|
||||
|
||||
// get filname
|
||||
if (!m_filename) {
|
||||
wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""),
|
||||
_T("Any file (*)|*"), wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
|
||||
if (dlg.ShowModal() != wxID_OK) return false;
|
||||
m_filename = dlg.GetPath();
|
||||
}
|
||||
|
||||
// load file
|
||||
return LoadFile (m_filename);
|
||||
}
|
||||
|
||||
bool Edit::LoadFile (const wxString &filename) {
|
||||
|
||||
// load file in edit and clear undo
|
||||
if (!filename.IsEmpty()) m_filename = filename;
|
||||
// wxFile file (m_filename);
|
||||
// if (!file.IsOpened()) return false;
|
||||
ClearAll ();
|
||||
// long lng = file.Length ();
|
||||
// if (lng > 0) {
|
||||
// wxString buf;
|
||||
// wxChar *buff = buf.GetWriteBuf (lng);
|
||||
// file.Read (buff, lng);
|
||||
// buf.UngetWriteBuf ();
|
||||
// InsertText (0, buf);
|
||||
// }
|
||||
// file.Close();
|
||||
|
||||
wxStyledTextCtrl::LoadFile(m_filename);
|
||||
|
||||
EmptyUndoBuffer();
|
||||
|
||||
// determine lexer language
|
||||
wxFileName fname (m_filename);
|
||||
InitializePrefs (DeterminePrefs (fname.GetFullName()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Edit::SaveFile () {
|
||||
|
||||
// return if no change
|
||||
if (!Modified()) return true;
|
||||
|
||||
// get filname
|
||||
if (!m_filename) {
|
||||
wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"),
|
||||
wxSAVE | wxOVERWRITE_PROMPT);
|
||||
if (dlg.ShowModal() != wxID_OK) return false;
|
||||
m_filename = dlg.GetPath();
|
||||
}
|
||||
|
||||
// save file
|
||||
return SaveFile (m_filename);
|
||||
}
|
||||
|
||||
bool Edit::SaveFile (const wxString &filename) {
|
||||
|
||||
// return if no change
|
||||
if (!Modified()) return true;
|
||||
|
||||
// // save edit in file and clear undo
|
||||
// if (!filename.IsEmpty()) m_filename = filename;
|
||||
// wxFile file (m_filename, wxFile::write);
|
||||
// if (!file.IsOpened()) return false;
|
||||
// wxString buf = GetText();
|
||||
// bool okay = file.Write (buf);
|
||||
// file.Close();
|
||||
// if (!okay) return false;
|
||||
// EmptyUndoBuffer();
|
||||
// SetSavePoint();
|
||||
|
||||
// return true;
|
||||
|
||||
return wxStyledTextCtrl::SaveFile(filename);
|
||||
|
||||
}
|
||||
|
||||
bool Edit::Modified () {
|
||||
|
||||
// return modified state
|
||||
return (GetModify() && !GetReadOnly());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// EditProperties
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
EditProperties::EditProperties (Edit *edit,
|
||||
long style)
|
||||
: wxDialog (edit, -1, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
|
||||
|
||||
// sets the application title
|
||||
SetTitle (_("Properties"));
|
||||
wxString text;
|
||||
|
||||
// fullname
|
||||
wxBoxSizer *fullname = new wxBoxSizer (wxHORIZONTAL);
|
||||
fullname->Add (10, 0);
|
||||
fullname->Add (new wxStaticText (this, -1, _("Full filename"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
|
||||
fullname->Add (new wxStaticText (this, -1, edit->GetFilename()),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
// text info
|
||||
wxGridSizer *textinfo = new wxGridSizer (4, 0, 2);
|
||||
textinfo->Add (new wxStaticText (this, -1, _("Language"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
textinfo->Add (new wxStaticText (this, -1, edit->m_language->name),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
textinfo->Add (new wxStaticText (this, -1, _("Lexer-ID: "),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetLexer());
|
||||
textinfo->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
wxString EOLtype = _T("");
|
||||
switch (edit->GetEOLMode()) {
|
||||
case wxSTC_EOL_CR: {EOLtype = _T("CR (Unix)"); break; }
|
||||
case wxSTC_EOL_CRLF: {EOLtype = _T("CRLF (Windows)"); break; }
|
||||
case wxSTC_EOL_LF: {EOLtype = _T("CR (Macintosh)"); break; }
|
||||
}
|
||||
textinfo->Add (new wxStaticText (this, -1, _("Line endings"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
textinfo->Add (new wxStaticText (this, -1, EOLtype),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
|
||||
// text info box
|
||||
wxStaticBoxSizer *textinfos = new wxStaticBoxSizer (
|
||||
new wxStaticBox (this, -1, _("Informations")),
|
||||
wxVERTICAL);
|
||||
textinfos->Add (textinfo, 0, wxEXPAND);
|
||||
textinfos->Add (0, 6);
|
||||
|
||||
// statistic
|
||||
wxGridSizer *statistic = new wxGridSizer (4, 0, 2);
|
||||
statistic->Add (new wxStaticText (this, -1, _("Total lines"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetLineCount());
|
||||
statistic->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
statistic->Add (new wxStaticText (this, -1, _("Total chars"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetTextLength());
|
||||
statistic->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
statistic->Add (new wxStaticText (this, -1, _("Current line"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetCurrentLine());
|
||||
statistic->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
statistic->Add (new wxStaticText (this, -1, _("Current pos"),
|
||||
wxDefaultPosition, wxSize(80, -1)),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
|
||||
text = wxString::Format (_T("%d"), edit->GetCurrentPos());
|
||||
statistic->Add (new wxStaticText (this, -1, text),
|
||||
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
|
||||
|
||||
// char/line statistics
|
||||
wxStaticBoxSizer *statistics = new wxStaticBoxSizer (
|
||||
new wxStaticBox (this, -1, _("Statistics")),
|
||||
wxVERTICAL);
|
||||
statistics->Add (statistic, 0, wxEXPAND);
|
||||
statistics->Add (0, 6);
|
||||
|
||||
// total pane
|
||||
wxBoxSizer *totalpane = new wxBoxSizer (wxVERTICAL);
|
||||
totalpane->Add (fullname, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10);
|
||||
totalpane->Add (0, 6);
|
||||
totalpane->Add (textinfos, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||
totalpane->Add (0, 10);
|
||||
totalpane->Add (statistics, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||
totalpane->Add (0, 6);
|
||||
wxButton *okButton = new wxButton (this, wxID_OK, _("OK"));
|
||||
okButton->SetDefault();
|
||||
totalpane->Add (okButton, 0, wxALIGN_CENTER | wxALL, 10);
|
||||
|
||||
SetSizerAndFit (totalpane);
|
||||
|
||||
ShowModal();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// EditPrint
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
EditPrint::EditPrint (Edit *edit, wxChar *title)
|
||||
: wxPrintout(title) {
|
||||
m_edit = edit;
|
||||
m_printed = 0;
|
||||
|
||||
}
|
||||
|
||||
bool EditPrint::OnPrintPage (int page) {
|
||||
|
||||
wxDC *dc = GetDC();
|
||||
if (!dc) return false;
|
||||
|
||||
// scale DC
|
||||
PrintScaling (dc);
|
||||
|
||||
// print page
|
||||
if (page == 1) m_printed = 0;
|
||||
m_printed = m_edit->FormatRange (1, m_printed, m_edit->GetLength(),
|
||||
dc, dc, m_printRect, m_pageRect);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditPrint::OnBeginDocument (int startPage, int endPage) {
|
||||
|
||||
if (!wxPrintout::OnBeginDocument (startPage, endPage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditPrint::GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) {
|
||||
|
||||
// initialize values
|
||||
*minPage = 0;
|
||||
*maxPage = 0;
|
||||
*selPageFrom = 0;
|
||||
*selPageTo = 0;
|
||||
|
||||
// scale DC if possible
|
||||
wxDC *dc = GetDC();
|
||||
if (!dc) return;
|
||||
PrintScaling (dc);
|
||||
|
||||
// get print page informations and convert to printer pixels
|
||||
wxSize ppiScr;
|
||||
GetPPIScreen (&ppiScr.x, &ppiScr.y);
|
||||
wxSize page = g_pageSetupData->GetPaperSize();
|
||||
page.x = static_cast<int> (page.x * ppiScr.x / 25.4);
|
||||
page.y = static_cast<int> (page.y * ppiScr.y / 25.4);
|
||||
m_pageRect = wxRect (0,
|
||||
0,
|
||||
page.x,
|
||||
page.y);
|
||||
|
||||
// get margins informations and convert to printer pixels
|
||||
int top = 25; // default 25
|
||||
int bottom = 25; // default 25
|
||||
int left = 20; // default 20
|
||||
int right = 20; // default 20
|
||||
wxPoint (top, left) = g_pageSetupData->GetMarginTopLeft();
|
||||
wxPoint (bottom, right) = g_pageSetupData->GetMarginBottomRight();
|
||||
top = static_cast<int> (top * ppiScr.y / 25.4);
|
||||
bottom = static_cast<int> (bottom * ppiScr.y / 25.4);
|
||||
left = static_cast<int> (left * ppiScr.x / 25.4);
|
||||
right = static_cast<int> (right * ppiScr.x / 25.4);
|
||||
m_printRect = wxRect (left,
|
||||
top,
|
||||
page.x - (left + right),
|
||||
page.y - (top + bottom));
|
||||
|
||||
// count pages
|
||||
while (HasPage (*maxPage)) {
|
||||
m_printed = m_edit->FormatRange (0, m_printed, m_edit->GetLength(),
|
||||
dc, dc, m_printRect, m_pageRect);
|
||||
*maxPage += 1;
|
||||
}
|
||||
if (*maxPage > 0) *minPage = 1;
|
||||
*selPageFrom = *minPage;
|
||||
*selPageTo = *maxPage;
|
||||
}
|
||||
|
||||
bool EditPrint::HasPage (int page) {
|
||||
|
||||
return (m_printed < m_edit->GetLength());
|
||||
}
|
||||
|
||||
bool EditPrint::PrintScaling (wxDC *dc){
|
||||
|
||||
// check for dc, return if none
|
||||
if (!dc) return false;
|
||||
|
||||
// get printer and screen sizing values
|
||||
wxSize ppiScr;
|
||||
GetPPIScreen (&ppiScr.x, &ppiScr.y);
|
||||
if (ppiScr.x == 0) { // most possible guess 96 dpi
|
||||
ppiScr.x = 96;
|
||||
ppiScr.y = 96;
|
||||
}
|
||||
wxSize ppiPrt;
|
||||
GetPPIPrinter (&ppiPrt.x, &ppiPrt.y);
|
||||
if (ppiPrt.x == 0) { // scaling factor to 1
|
||||
ppiPrt.x = ppiScr.x;
|
||||
ppiPrt.y = ppiScr.y;
|
||||
}
|
||||
wxSize dcSize = dc->GetSize();
|
||||
wxSize pageSize;
|
||||
GetPageSizePixels (&pageSize.x, &pageSize.y);
|
||||
|
||||
// set user scale
|
||||
float scale_x = (float)(ppiPrt.x * dcSize.x) /
|
||||
(float)(ppiScr.x * pageSize.x);
|
||||
float scale_y = (float)(ppiPrt.y * dcSize.y) /
|
||||
(float)(ppiScr.y * pageSize.y);
|
||||
dc->SetUserScale (scale_x, scale_y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
169
samples/stc/edit.h
Normal file
169
samples/stc/edit.h
Normal file
@@ -0,0 +1,169 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: edit.h
|
||||
// Purpose: STC test module
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _EDIT_H_
|
||||
#define _EDIT_H_
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// informations
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//! wxWindows headers
|
||||
|
||||
//! wxWindows/contrib headers
|
||||
#include <wx/stc/stc.h> // styled text control
|
||||
|
||||
//! application headers
|
||||
#include "prefs.h" // preferences
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
class EditPrint;
|
||||
class EditProperties;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! Edit
|
||||
class Edit: public wxStyledTextCtrl {
|
||||
friend class EditProperties;
|
||||
friend class EditPrint;
|
||||
|
||||
public:
|
||||
//! constructor
|
||||
Edit (wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxSUNKEN_BORDER|wxVSCROLL
|
||||
);
|
||||
|
||||
//! destructor
|
||||
~Edit ();
|
||||
|
||||
// event handlers
|
||||
// common
|
||||
void OnSize( wxSizeEvent &event );
|
||||
// edit
|
||||
void OnEditRedo (wxCommandEvent &event);
|
||||
void OnEditUndo (wxCommandEvent &event);
|
||||
void OnEditClear (wxCommandEvent &event);
|
||||
void OnEditCut (wxCommandEvent &event);
|
||||
void OnEditCopy (wxCommandEvent &event);
|
||||
void OnEditPaste (wxCommandEvent &event);
|
||||
// find
|
||||
void OnFind (wxCommandEvent &event);
|
||||
void OnFindNext (wxCommandEvent &event);
|
||||
void OnReplace (wxCommandEvent &event);
|
||||
void OnReplaceNext (wxCommandEvent &event);
|
||||
void OnBraceMatch (wxCommandEvent &event);
|
||||
void OnGoto (wxCommandEvent &event);
|
||||
void OnEditIndentInc (wxCommandEvent &event);
|
||||
void OnEditIndentRed (wxCommandEvent &event);
|
||||
void OnEditSelectAll (wxCommandEvent &event);
|
||||
void OnEditSelectLine (wxCommandEvent &event);
|
||||
//! view
|
||||
void OnHilightLang (wxCommandEvent &event);
|
||||
void OnDisplayEOL (wxCommandEvent &event);
|
||||
void OnIndentGuide (wxCommandEvent &event);
|
||||
void OnLineNumber (wxCommandEvent &event);
|
||||
void OnLongLineOn (wxCommandEvent &event);
|
||||
void OnWhiteSpace (wxCommandEvent &event);
|
||||
void OnFoldToggle (wxCommandEvent &event);
|
||||
void OnSetOverType (wxCommandEvent &event);
|
||||
void OnSetReadOnly (wxCommandEvent &event);
|
||||
void OnWrapmodeOn (wxCommandEvent &event);
|
||||
void OnUseCharset (wxCommandEvent &event);
|
||||
//! extra
|
||||
void OnChangeCase (wxCommandEvent &event);
|
||||
void OnConvertEOL (wxCommandEvent &event);
|
||||
// stc
|
||||
void OnMarginClick (wxStyledTextEvent &event);
|
||||
void OnCharAdded (wxStyledTextEvent &event);
|
||||
|
||||
//! language/lexer
|
||||
wxString DeterminePrefs (const wxString &filename);
|
||||
bool InitializePrefs (const wxString &filename);
|
||||
bool UserSettings (const wxString &filename);
|
||||
LanguageInfo const* GetLanguageInfo () {return m_language;};
|
||||
|
||||
//! load/save file
|
||||
bool LoadFile ();
|
||||
bool LoadFile (const wxString &filename);
|
||||
bool SaveFile ();
|
||||
bool SaveFile (const wxString &filename);
|
||||
bool Modified ();
|
||||
wxString GetFilename () {return m_filename;};
|
||||
void SetFilename (const wxString &filename) {m_filename = filename;};
|
||||
|
||||
private:
|
||||
// file
|
||||
wxString m_filename;
|
||||
|
||||
// lanugage properties
|
||||
LanguageInfo const* m_language;
|
||||
|
||||
// margin variables
|
||||
int m_LineNrID;
|
||||
int m_LineNrMargin;
|
||||
int m_FoldingID;
|
||||
int m_FoldingMargin;
|
||||
int m_DividerID;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! EditProperties
|
||||
class EditProperties: public wxDialog {
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
EditProperties (Edit *edit, long style = 0);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! EditPrint
|
||||
class EditPrint: public wxPrintout {
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
EditPrint (Edit *edit, wxChar *title = _T(""));
|
||||
|
||||
//! event handlers
|
||||
bool OnPrintPage (int page);
|
||||
bool OnBeginDocument (int startPage, int endPage);
|
||||
|
||||
//! print functions
|
||||
bool HasPage (int page);
|
||||
void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
|
||||
|
||||
private:
|
||||
Edit *m_edit;
|
||||
int m_printed;
|
||||
wxRect m_pageRect;
|
||||
wxRect m_printRect;
|
||||
|
||||
bool PrintScaling (wxDC *dc);
|
||||
};
|
||||
|
||||
#endif // _EDIT_H_
|
||||
|
@@ -30,7 +30,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) $(__RUNTIME_LIBS_6) -I$(BCCDIR)\include \
|
||||
-I$(SETUPHDIR) -I. $(__DLLFLAG_p) -I.\..\..\..\samples -I.\..\..\include \
|
||||
$(CXXFLAGS)
|
||||
STCTEST_OBJECTS = \
|
||||
$(OBJS)\stctest_stctest.obj
|
||||
$(OBJS)\stctest_stctest.obj \
|
||||
$(OBJS)\stctest_edit.obj \
|
||||
$(OBJS)\stctest_prefs.obj
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@@ -152,7 +154,13 @@ $(OBJS):
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS)\stctest.exe data
|
||||
all: $(OBJS)\stctest.exe
|
||||
|
||||
$(OBJS)\stctest_edit.obj: .\edit.cpp
|
||||
$(CXX) -q -c -P -o$@ $(STCTEST_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stctest_prefs.obj: .\prefs.cpp
|
||||
$(CXX) -q -c -P -o$@ $(STCTEST_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stctest_sample.res: .\..\..\..\samples\sample.rc
|
||||
brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) -i.\..\..\..\include -i$(SETUPHDIR) -i. $(__DLLFLAG_p_1) -i.\..\..\..\samples $**
|
||||
@@ -170,10 +178,6 @@ clean:
|
||||
-if exist $(OBJS)\stctest.ilf del $(OBJS)\stctest.ilf
|
||||
-if exist $(OBJS)\stctest.ils del $(OBJS)\stctest.ils
|
||||
|
||||
data:
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
for %f in (stctest.cpp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
|
||||
|
||||
$(OBJS)\stctest.exe: $(STCTEST_OBJECTS) $(OBJS)\stctest_sample.res
|
||||
ilink32 -Tpe -q $(LDFLAGS) -L$(BCCDIR)\lib $(__DEBUGINFO) -L$(LIBDIRNAME) -aa @&&|
|
||||
c0w32.obj $(STCTEST_OBJECTS),$@,, wx$(PORTNAME)$(WXUNIVNAME)25$(WXUNICODEFLAG)$(WXDEBUGFLAG)_stc.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(__UNICOWS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32mt$(__RUNTIME_LIBS_7).lib,, $(OBJS)\stctest_sample.res
|
||||
|
@@ -22,7 +22,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(GCCFLAGS) \
|
||||
$(__DLLFLAG_p) -I.\..\..\..\samples -I.\..\..\include $(CXXFLAGS)
|
||||
STCTEST_OBJECTS = \
|
||||
$(OBJS)\stctest_sample_rc.o \
|
||||
$(OBJS)\stctest_stctest.o
|
||||
$(OBJS)\stctest_stctest.o \
|
||||
$(OBJS)\stctest_edit.o \
|
||||
$(OBJS)\stctest_prefs.o
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@@ -145,7 +147,13 @@ $(OBJS):
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS)\stctest.exe data
|
||||
all: $(OBJS)\stctest.exe
|
||||
|
||||
$(OBJS)\stctest_edit.o: ./edit.cpp
|
||||
$(CXX) -c -o $@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stctest_prefs.o: ./prefs.cpp
|
||||
$(CXX) -c -o $@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stctest_sample_rc.o: ./../../../samples/sample.rc
|
||||
windres --use-temp-file -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) --include-dir ./../../../include --include-dir $(SETUPHDIR) --include-dir . $(__DLLFLAG_p_1) --include-dir ./../../../samples
|
||||
@@ -157,11 +165,7 @@ clean:
|
||||
-if exist $(OBJS)\*.o del $(OBJS)\*.o
|
||||
-if exist $(OBJS)\stctest.exe del $(OBJS)\stctest.exe
|
||||
|
||||
data:
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
for %%f in (stctest.cpp) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
|
||||
|
||||
$(OBJS)\stctest.exe: $(STCTEST_OBJECTS) $(OBJS)\stctest_sample_rc.o
|
||||
$(CXX) -o $@ $(STCTEST_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) -mthreads -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows -lwx$(PORTNAME)$(WXUNIVNAME)25$(WXUNICODEFLAG)$(WXDEBUGFLAG)_stc $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(__UNICOWS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lodbc32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
|
||||
|
||||
.PHONY: all clean data
|
||||
.PHONY: all clean
|
||||
|
@@ -24,7 +24,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) /M$(__RUNTIME_LIBS_7)$(__DEBUGRUNTIME_3) \
|
||||
/I.\..\..\include $(CXXFLAGS) /GR /GX
|
||||
STCTEST_OBJECTS = \
|
||||
$(OBJS)\stctest_sample.res \
|
||||
$(OBJS)\stctest_stctest.obj
|
||||
$(OBJS)\stctest_stctest.obj \
|
||||
$(OBJS)\stctest_edit.obj \
|
||||
$(OBJS)\stctest_prefs.obj
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@@ -227,7 +229,13 @@ $(OBJS):
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS)\stctest.exe data
|
||||
all: $(OBJS)\stctest.exe
|
||||
|
||||
$(OBJS)\stctest_edit.obj: .\edit.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCTEST_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stctest_prefs.obj: .\prefs.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCTEST_CXXFLAGS) $**
|
||||
|
||||
$(OBJS)\stctest_sample.res: .\..\..\..\samples\sample.rc
|
||||
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_2_p_1) $(__NO_VC_CRTDBG_p_1) /d __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) /i .\..\..\..\include /i $(SETUPHDIR) /i . $(__DLLFLAG_p_1) /d _WINDOWS /i .\..\..\..\samples $**
|
||||
@@ -242,10 +250,6 @@ clean:
|
||||
-if exist $(OBJS)\stctest.ilk del $(OBJS)\stctest.ilk
|
||||
-if exist $(OBJS)\stctest.pdb del $(OBJS)\stctest.pdb
|
||||
|
||||
data:
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
for %f in (stctest.cpp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
|
||||
|
||||
$(OBJS)\stctest.exe: $(STCTEST_OBJECTS) $(OBJS)\stctest_sample.res
|
||||
link /NOLOGO /OUT:$@ $(LDFLAGS) $(__DEBUGINFO_1) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS @<<
|
||||
$(STCTEST_OBJECTS) wx$(PORTNAME)$(WXUNIVNAME)25$(WXUNICODEFLAG)$(WXDEBUGFLAG)_stc.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(__UNICOWS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib odbc32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib oleacc.lib
|
||||
|
@@ -169,7 +169,9 @@ STCTEST_CXXFLAGS = $(CPPFLAGS) $(__DEBUGINFO_0) $(__OPTIMIZEFLAG_2) -bm &
|
||||
$(__UNICODE_DEFINE_p) -i=.\..\..\..\include -i=$(SETUPHDIR) -i=. &
|
||||
$(__DLLFLAG_p) -i=.\..\..\..\samples -i=.\..\..\include $(CXXFLAGS)
|
||||
STCTEST_OBJECTS = &
|
||||
$(OBJS)\stctest_stctest.obj
|
||||
$(OBJS)\stctest_stctest.obj &
|
||||
$(OBJS)\stctest_edit.obj &
|
||||
$(OBJS)\stctest_prefs.obj
|
||||
|
||||
|
||||
all : $(OBJS)
|
||||
@@ -178,7 +180,13 @@ $(OBJS) :
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all : .SYMBOLIC $(OBJS)\stctest.exe data
|
||||
all : .SYMBOLIC $(OBJS)\stctest.exe
|
||||
|
||||
$(OBJS)\stctest_edit.obj : .AUTODEPEND .\edit.cpp
|
||||
$(CXX) -zq -fo=$^@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stctest_prefs.obj : .AUTODEPEND .\prefs.cpp
|
||||
$(CXX) -zq -fo=$^@ $(STCTEST_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stctest_sample.res : .AUTODEPEND .\..\..\..\samples\sample.rc
|
||||
wrc -q -ad -bt=nt -r -fo=$^@ -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__UNICODE_DEFINE_p) -i=.\..\..\..\include -i=$(SETUPHDIR) -i=. $(__DLLFLAG_p) -i=.\..\..\..\samples $<
|
||||
@@ -193,10 +201,6 @@ clean : .SYMBOLIC
|
||||
-if exist $(OBJS)\*.ilk del $(OBJS)\*.ilk
|
||||
-if exist $(OBJS)\stctest.exe del $(OBJS)\stctest.exe
|
||||
|
||||
data : .SYMBOLIC
|
||||
if not exist $(OBJS) mkdir $(OBJS)
|
||||
for %f in (stctest.cpp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
|
||||
|
||||
$(OBJS)\stctest.exe : $(STCTEST_OBJECTS) $(OBJS)\stctest_sample.res
|
||||
@%create $(OBJS)\stctest.lbc
|
||||
@%append $(OBJS)\stctest.lbc option quiet
|
||||
|
BIN
samples/stc/mondrian.ico
Normal file
BIN
samples/stc/mondrian.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
44
samples/stc/mondrian.xpm
Normal file
44
samples/stc/mondrian.xpm
Normal file
@@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char *mondrian_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 6 1",
|
||||
" c Black",
|
||||
". c Blue",
|
||||
"X c #00bf00",
|
||||
"o c Red",
|
||||
"O c Yellow",
|
||||
"+ c Gray100",
|
||||
/* pixels */
|
||||
" ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" "
|
||||
};
|
379
samples/stc/prefs.cpp
Normal file
379
samples/stc/prefs.cpp
Normal file
@@ -0,0 +1,379 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: prefs.cpp
|
||||
// Purpose: STC test Preferences initialization
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes <wx/wx.h>.
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all 'standard' wxWindows headers)
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
//! wxWindows headers
|
||||
|
||||
//! wxWindows/contrib headers
|
||||
|
||||
//! application headers
|
||||
#include "defsext.h" // Additional definitions
|
||||
#include "prefs.h" // Preferences
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! language types
|
||||
const CommonInfo g_CommonPrefs = {
|
||||
// editor functionality prefs
|
||||
true, // syntaxEnable
|
||||
true, // foldEnable
|
||||
true, // indentEnable
|
||||
// display defaults prefs
|
||||
false, // overTypeInitial
|
||||
false, // readOnlyInitial
|
||||
false, // wrapModeInitial
|
||||
false, // displayEOLEnable
|
||||
false, // IndentGuideEnable
|
||||
true, // lineNumberEnable
|
||||
false, // longLineOnEnable
|
||||
false, // whiteSpaceEnable
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// keywordlists
|
||||
// C++
|
||||
wxChar* CppWordlist1 =
|
||||
_T("asm auto bool break case catch char class const const_cast \
|
||||
continue default delete do double dynamic_cast else enum explicit \
|
||||
export extern false float for friend goto if inline int long \
|
||||
mutable namespace new operator private protected public register \
|
||||
reinterpret_cast return short signed sizeof static static_cast \
|
||||
struct switch template this throw true try typedef typeid \
|
||||
typename union unsigned using virtual void volatile wchar_t \
|
||||
while");
|
||||
wxChar* CppWordlist2 =
|
||||
_T("file");
|
||||
wxChar* CppWordlist3 =
|
||||
_T("a addindex addtogroup anchor arg attention author b brief bug c \
|
||||
class code date def defgroup deprecated dontinclude e em endcode \
|
||||
endhtmlonly endif endlatexonly endlink endverbatim enum example \
|
||||
exception f$ f[ f] file fn hideinitializer htmlinclude \
|
||||
htmlonly if image include ingroup internal invariant interface \
|
||||
latexonly li line link mainpage name namespace nosubgrouping note \
|
||||
overload p page par param post pre ref relates remarks return \
|
||||
retval sa section see showinitializer since skip skipline struct \
|
||||
subsection test throw todo typedef union until var verbatim \
|
||||
verbinclude version warning weakgroup $ @ "" & < > # { }");
|
||||
|
||||
// Python
|
||||
wxChar* PythonWordlist1 =
|
||||
_T("and assert break class continue def del elif else except exec \
|
||||
finally for from global if import in is lambda None not or pass \
|
||||
print raise return try while yield");
|
||||
wxChar* PythonWordlist2 =
|
||||
_T("ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON BEGIN \
|
||||
BITMAP BLOCK BUTTON CAPTION CHARACTERISTICS CHECKBOX CLASS \
|
||||
COMBOBOX CONTROL CTEXT CURSOR DEFPUSHBUTTON DIALOG DIALOGEX \
|
||||
DISCARDABLE EDITTEXT END EXSTYLE FONT GROUPBOX ICON LANGUAGE \
|
||||
LISTBOX LTEXT MENU MENUEX MENUITEM MESSAGETABLE POPUP PUSHBUTTON \
|
||||
RADIOBUTTON RCDATA RTEXT SCROLLBAR SEPARATOR SHIFT STATE3 \
|
||||
STRINGTABLE STYLE TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY");
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! languages
|
||||
const LanguageInfo g_LanguagePrefs [] = {
|
||||
// C++
|
||||
{_T("C++"),
|
||||
_T("*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hpp;*.hxx;*.sma"),
|
||||
wxSTC_LEX_CPP,
|
||||
{{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_COMMENT, NULL},
|
||||
{mySTC_TYPE_COMMENT_LINE, NULL},
|
||||
{mySTC_TYPE_COMMENT_DOC, NULL},
|
||||
{mySTC_TYPE_NUMBER, NULL},
|
||||
{mySTC_TYPE_WORD1, CppWordlist1}, // KEYWORDS
|
||||
{mySTC_TYPE_STRING, NULL},
|
||||
{mySTC_TYPE_CHARACTER, NULL},
|
||||
{mySTC_TYPE_UUID, NULL},
|
||||
{mySTC_TYPE_PREPROCESSOR, NULL},
|
||||
{mySTC_TYPE_OPERATOR, NULL},
|
||||
{mySTC_TYPE_IDENTIFIER, NULL},
|
||||
{mySTC_TYPE_STRING_EOL, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // VERBATIM
|
||||
{mySTC_TYPE_REGEX, NULL},
|
||||
{mySTC_TYPE_COMMENT_SPECIAL, NULL}, // DOXY
|
||||
{mySTC_TYPE_WORD2, CppWordlist2}, // EXTRA WORDS
|
||||
{mySTC_TYPE_WORD3, CppWordlist3}, // DOXY KEYWORDS
|
||||
{mySTC_TYPE_ERROR, NULL}, // KEYWORDS ERROR
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL}},
|
||||
mySTC_FOLD_COMMENT | mySTC_FOLD_COMPACT | mySTC_FOLD_PREPROC},
|
||||
// Python
|
||||
{_T("Python"),
|
||||
_T("*.py;*.pyw"),
|
||||
wxSTC_LEX_PYTHON,
|
||||
{{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_COMMENT_LINE, NULL},
|
||||
{mySTC_TYPE_NUMBER, NULL},
|
||||
{mySTC_TYPE_STRING, NULL},
|
||||
{mySTC_TYPE_CHARACTER, NULL},
|
||||
{mySTC_TYPE_WORD1, PythonWordlist1}, // KEYWORDS
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // TRIPLE
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // TRIPLEDOUBLE
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // CLASSNAME
|
||||
{mySTC_TYPE_DEFAULT, PythonWordlist2}, // DEFNAME
|
||||
{mySTC_TYPE_OPERATOR, NULL},
|
||||
{mySTC_TYPE_IDENTIFIER, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL}, // COMMENT_BLOCK
|
||||
{mySTC_TYPE_STRING_EOL, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL}},
|
||||
mySTC_FOLD_COMMENTPY | mySTC_FOLD_QUOTESPY},
|
||||
// * (any)
|
||||
{(wxChar *)DEFAULT_LANGUAGE,
|
||||
_T("*.*"),
|
||||
wxSTC_LEX_PROPERTIES,
|
||||
{{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL},
|
||||
{mySTC_TYPE_DEFAULT, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL},
|
||||
{-1, NULL}},
|
||||
0},
|
||||
};
|
||||
|
||||
const int g_LanguagePrefsSize = WXSIZEOF(g_LanguagePrefs);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! style types
|
||||
const StyleInfo g_StylePrefs [] = {
|
||||
// mySTC_TYPE_DEFAULT
|
||||
{_T("Default"),
|
||||
_T("BLACK"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD1
|
||||
{_T("Keyword1"),
|
||||
_T("BLUE"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_BOLD, 0},
|
||||
|
||||
// mySTC_TYPE_WORD2
|
||||
{_T("Keyword2"),
|
||||
_T("DARK BLUE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD3
|
||||
{_T("Keyword3"),
|
||||
_T("CORNFLOWER BLUE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD4
|
||||
{_T("Keyword4"),
|
||||
_T("CYAN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD5
|
||||
{_T("Keyword5"),
|
||||
_T("DARK GREY"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_WORD6
|
||||
{_T("Keyword6"),
|
||||
_T("GREY"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMENT
|
||||
{_T("Comment"),
|
||||
_T("FOREST GREEN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMENT_DOC
|
||||
{_T("Comment (Doc)"),
|
||||
_T("FOREST GREEN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMENT_LINE
|
||||
{_T("Comment line"),
|
||||
_T("FOREST GREEN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMENT_SPECIAL
|
||||
{_T("Special comment"),
|
||||
_T("FOREST GREEN"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_ITALIC, 0},
|
||||
|
||||
// mySTC_TYPE_CHARACTER
|
||||
{_T("Character"),
|
||||
_T("KHAKI"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_CHARACTER_EOL
|
||||
{_T("Character (EOL)"),
|
||||
_T("KHAKI"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_STRING
|
||||
{_T("String"),
|
||||
_T("BROWN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_STRING_EOL
|
||||
{_T("String (EOL)"),
|
||||
_T("BROWN"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_DELIMITER
|
||||
{_T("Delimiter"),
|
||||
_T("ORANGE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_PUNCTUATION
|
||||
{_T("Punctuation"),
|
||||
_T("ORANGE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_OPERATOR
|
||||
{_T("Operator"),
|
||||
_T("BLACK"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_BOLD, 0},
|
||||
|
||||
// mySTC_TYPE_BRACE
|
||||
{_T("Label"),
|
||||
_T("VIOLET"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_COMMAND
|
||||
{_T("Command"),
|
||||
_T("BLUE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_IDENTIFIER
|
||||
{_T("Identifier"),
|
||||
_T("BLACK"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_LABEL
|
||||
{_T("Label"),
|
||||
_T("VIOLET"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_NUMBER
|
||||
{_T("Number"),
|
||||
_T("SIENNA"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_PARAMETER
|
||||
{_T("Parameter"),
|
||||
_T("VIOLET"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_ITALIC, 0},
|
||||
|
||||
// mySTC_TYPE_REGEX
|
||||
{_T("Regular expression"),
|
||||
_T("ORCHID"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_UUID
|
||||
{_T("UUID"),
|
||||
_T("ORCHID"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_VALUE
|
||||
{_T("Value"),
|
||||
_T("ORCHID"), _T("WHITE"),
|
||||
_T(""), 10, mySTC_STYLE_ITALIC, 0},
|
||||
|
||||
// mySTC_TYPE_PREPROCESSOR
|
||||
{_T("Preprocessor"),
|
||||
_T("GREY"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_SCRIPT
|
||||
{_T("Script"),
|
||||
_T("DARK GREY"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_ERROR
|
||||
{_T("Error"),
|
||||
_T("RED"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0},
|
||||
|
||||
// mySTC_TYPE_UNDEFINED
|
||||
{_T("Undefined"),
|
||||
_T("ORANGE"), _T("WHITE"),
|
||||
_T(""), 10, 0, 0}
|
||||
|
||||
};
|
||||
|
||||
const int g_StylePrefsSize = WXSIZEOF(g_StylePrefs);
|
||||
|
153
samples/stc/prefs.h
Normal file
153
samples/stc/prefs.h
Normal file
@@ -0,0 +1,153 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: prefs.h
|
||||
// Purpose: STC test Preferences initialization
|
||||
// Maintainer: Wyo
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _PREFS_H_
|
||||
#define _PREFS_H_
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// informations
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//! wxWindows headers
|
||||
|
||||
//! wxWindows/contrib headers
|
||||
#include <wx/stc/stc.h> // styled text control
|
||||
|
||||
//! application headers
|
||||
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
//! general style types
|
||||
#define mySTC_TYPE_DEFAULT 0
|
||||
|
||||
#define mySTC_TYPE_WORD1 1
|
||||
#define mySTC_TYPE_WORD2 2
|
||||
#define mySTC_TYPE_WORD3 3
|
||||
#define mySTC_TYPE_WORD4 4
|
||||
#define mySTC_TYPE_WORD5 5
|
||||
#define mySTC_TYPE_WORD6 6
|
||||
|
||||
#define mySTC_TYPE_COMMENT 7
|
||||
#define mySTC_TYPE_COMMENT_DOC 8
|
||||
#define mySTC_TYPE_COMMENT_LINE 9
|
||||
#define mySTC_TYPE_COMMENT_SPECIAL 10
|
||||
|
||||
#define mySTC_TYPE_CHARACTER 11
|
||||
#define mySTC_TYPE_CHARACTER_EOL 12
|
||||
#define mySTC_TYPE_STRING 13
|
||||
#define mySTC_TYPE_STRING_EOL 14
|
||||
|
||||
#define mySTC_TYPE_DELIMITER 15
|
||||
|
||||
#define mySTC_TYPE_PUNCTUATION 16
|
||||
|
||||
#define mySTC_TYPE_OPERATOR 17
|
||||
|
||||
#define mySTC_TYPE_BRACE 18
|
||||
|
||||
#define mySTC_TYPE_COMMAND 19
|
||||
#define mySTC_TYPE_IDENTIFIER 20
|
||||
#define mySTC_TYPE_LABEL 21
|
||||
#define mySTC_TYPE_NUMBER 22
|
||||
#define mySTC_TYPE_PARAMETER 23
|
||||
#define mySTC_TYPE_REGEX 24
|
||||
#define mySTC_TYPE_UUID 25
|
||||
#define mySTC_TYPE_VALUE 26
|
||||
|
||||
#define mySTC_TYPE_PREPROCESSOR 27
|
||||
#define mySTC_TYPE_SCRIPT 28
|
||||
|
||||
#define mySTC_TYPE_ERROR 29
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! style bits types
|
||||
#define mySTC_STYLE_BOLD 1
|
||||
#define mySTC_STYLE_ITALIC 2
|
||||
#define mySTC_STYLE_UNDERL 4
|
||||
#define mySTC_STYLE_HIDDEN 8
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! general folding types
|
||||
#define mySTC_FOLD_COMMENT 1
|
||||
#define mySTC_FOLD_COMPACT 2
|
||||
#define mySTC_FOLD_PREPROC 4
|
||||
|
||||
#define mySTC_FOLD_HTML 16
|
||||
#define mySTC_FOLD_HTMLPREP 32
|
||||
|
||||
#define mySTC_FOLD_COMMENTPY 64
|
||||
#define mySTC_FOLD_QUOTESPY 128
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! flags
|
||||
#define mySTC_FLAG_WRAPMODE 16
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// CommonInfo
|
||||
|
||||
struct CommonInfo {
|
||||
// editor functionality prefs
|
||||
bool syntaxEnable;
|
||||
bool foldEnable;
|
||||
bool indentEnable;
|
||||
// display defaults prefs
|
||||
bool readOnlyInitial;
|
||||
bool overTypeInitial;
|
||||
bool wrapModeInitial;
|
||||
bool displayEOLEnable;
|
||||
bool indentGuideEnable;
|
||||
bool lineNumberEnable;
|
||||
bool longLineOnEnable;
|
||||
bool whiteSpaceEnable;
|
||||
};
|
||||
extern const CommonInfo g_CommonPrefs;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// LanguageInfo
|
||||
|
||||
struct LanguageInfo {
|
||||
wxChar *name;
|
||||
wxChar *filepattern;
|
||||
int lexer;
|
||||
struct {
|
||||
int type;
|
||||
const wxChar *words;
|
||||
} styles [STYLE_TYPES_COUNT];
|
||||
int folds;
|
||||
};
|
||||
|
||||
extern const LanguageInfo g_LanguagePrefs[];
|
||||
extern const int g_LanguagePrefsSize;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// StyleInfo
|
||||
struct StyleInfo {
|
||||
wxChar *name;
|
||||
wxChar *foreground;
|
||||
wxChar *background;
|
||||
wxChar *fontname;
|
||||
int fontsize;
|
||||
int fontstyle;
|
||||
int lettercase;
|
||||
};
|
||||
|
||||
extern const StyleInfo g_StylePrefs[];
|
||||
extern const int g_StylePrefsSize;
|
||||
|
||||
#endif // _PREFS_H_
|
||||
|
@@ -7,16 +7,12 @@
|
||||
<exe id="stctest" template="wx_contrib_sample" template_append="wx_append">
|
||||
<sources>
|
||||
stctest.cpp
|
||||
edit.cpp
|
||||
prefs.cpp
|
||||
</sources>
|
||||
<wx-lib>stc</wx-lib>
|
||||
<wx-lib>core</wx-lib>
|
||||
<wx-lib>base</wx-lib>
|
||||
</exe>
|
||||
|
||||
<wx-data id="data">
|
||||
<files>
|
||||
stctest.cpp
|
||||
</files>
|
||||
</wx-data>
|
||||
|
||||
|
||||
</makefile>
|
||||
|
@@ -1,254 +1,659 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: stctest.cpp
|
||||
// Purpose: sample of using wxStyledTextCtrl
|
||||
// Author: Robin Dunn
|
||||
// Modified by:
|
||||
// Created: 3-Feb-2000
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// File: app.cpp
|
||||
// Purpose: STC test application
|
||||
// Maintainer: Otto Wyss
|
||||
// Created: 2003-09-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 by Total Control Software
|
||||
// Copyright: (c) wxGuide
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma implementation "stctest.cpp"
|
||||
#pragma interface "stctest.cpp"
|
||||
#endif
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
// For compilers that support precompilation, includes <wx/wx.h>.
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
// need because it includes almost all 'standard' wxWindows headers)
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#include <wx/wfstream.h>
|
||||
//! wxWindows headers
|
||||
#include <wx/config.h> // configuration support
|
||||
#include <wx/filedlg.h> // file dialog support
|
||||
#include <wx/filename.h> // filename support
|
||||
#include <wx/notebook.h> // notebook support
|
||||
#include <wx/settings.h> // system settings
|
||||
#include <wx/string.h> // strings support
|
||||
|
||||
#include <wx/stc/stc.h>
|
||||
//! application headers
|
||||
#include "defsext.h" // Additional definitions
|
||||
#include "edit.h" // Edit module
|
||||
#include "prefs.h" // Prefs
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
//----------------------------------------------------------------------------
|
||||
// resources
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// the application icon (under Windows and OS/2 it is in resources)
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
|
||||
#include "mondrian.xpm"
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
// declarations
|
||||
//============================================================================
|
||||
|
||||
#define APP_NAME _T("STC-Test")
|
||||
#define APP_DESCR _("See http://wxguide.sourceforge.net/indexedit.html")
|
||||
|
||||
#define APP_MAINT _T("Otto Wyss")
|
||||
#define APP_VENDOR _T("wxWindows")
|
||||
#define APP_COPYRIGTH _T("(C) 2003 Otto Wyss")
|
||||
#define APP_LICENCE _T("wxWindows")
|
||||
|
||||
#define APP_VERSION _T("0.1.alpha")
|
||||
#define APP_BUILD __DATE__
|
||||
|
||||
#define APP_WEBSITE _T("http://www.wxWindows.org")
|
||||
#define APP_MAIL _T("mailto://???")
|
||||
|
||||
#define NONAME _("<untitled>")
|
||||
|
||||
class AppBook;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! global application name
|
||||
wxString *g_appname = NULL;
|
||||
|
||||
//! global print data, to remember settings during the session
|
||||
wxPrintData *g_printData = (wxPrintData*) NULL;
|
||||
wxPageSetupData *g_pageSetupData = (wxPageSetupData*) NULL;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! application APP_VENDOR-APP_NAME.
|
||||
class App: public wxApp {
|
||||
friend class AppFrame;
|
||||
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
};
|
||||
//! the main function called durning application start
|
||||
virtual bool OnInit ();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Make an editor class
|
||||
|
||||
class MySTC : public wxStyledTextCtrl
|
||||
{
|
||||
public:
|
||||
MySTC(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0);
|
||||
|
||||
void OnKeyPressed(wxKeyEvent& evt);
|
||||
//! application exit function
|
||||
virtual int OnExit ();
|
||||
|
||||
private:
|
||||
//! frame window
|
||||
AppFrame* m_frame;
|
||||
|
||||
};
|
||||
|
||||
// created dynamically by wxWindows
|
||||
DECLARE_APP (App);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! frame of the application APP_VENDOR-APP_NAME.
|
||||
class AppFrame: public wxFrame {
|
||||
friend class App;
|
||||
friend class AppBook;
|
||||
friend class AppAbout;
|
||||
|
||||
public:
|
||||
//! constructor
|
||||
AppFrame (const wxString &title);
|
||||
|
||||
//! destructor
|
||||
~AppFrame ();
|
||||
|
||||
//! event handlers
|
||||
//! common
|
||||
void OnClose (wxCloseEvent &event);
|
||||
void OnAbout (wxCommandEvent &event);
|
||||
void OnExit (wxCommandEvent &event);
|
||||
void OnTimerEvent (wxTimerEvent &event);
|
||||
//! file
|
||||
void OnFileNew (wxCommandEvent &event);
|
||||
void OnFileNewFrame (wxCommandEvent &event);
|
||||
void OnFileOpen (wxCommandEvent &event);
|
||||
void OnFileOpenFrame (wxCommandEvent &event);
|
||||
void OnFileSave (wxCommandEvent &event);
|
||||
void OnFileSaveAs (wxCommandEvent &event);
|
||||
void OnFileClose (wxCommandEvent &event);
|
||||
//! properties
|
||||
void OnProperties (wxCommandEvent &event);
|
||||
//! print
|
||||
void OnPrintSetup (wxCommandEvent &event);
|
||||
void OnPrintPreview (wxCommandEvent &event);
|
||||
void OnPrint (wxCommandEvent &event);
|
||||
//! edit events
|
||||
void OnEdit (wxCommandEvent &event);
|
||||
|
||||
private:
|
||||
// edit object
|
||||
Edit *m_edit;
|
||||
void FileOpen (wxString fname);
|
||||
|
||||
//! creates the application menu bar
|
||||
wxMenuBar *m_menuBar;
|
||||
void CreateMenu ();
|
||||
|
||||
// print preview position and size
|
||||
wxRect DeterminePrintSize ();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(MySTC, wxStyledTextCtrl)
|
||||
EVT_KEY_DOWN(MySTC::OnKeyPressed)
|
||||
END_EVENT_TABLE()
|
||||
//----------------------------------------------------------------------------
|
||||
//! about box of the application APP_VENDOR-APP_NAME
|
||||
class AppAbout: public wxDialog {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Define a new frame type: this is going to be our main frame
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
//! constructor
|
||||
AppAbout (wxWindow *parent,
|
||||
int milliseconds = 0,
|
||||
long style = 0);
|
||||
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
//! destructor
|
||||
~AppAbout ();
|
||||
|
||||
// event handlers
|
||||
void OnTimerEvent (wxTimerEvent &event);
|
||||
|
||||
private:
|
||||
MySTC* ed;
|
||||
// timer
|
||||
wxTimer *m_timer;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
// IDs for the controls and the menu commands
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
ID_Quit = 1,
|
||||
ID_About,
|
||||
ID_ED
|
||||
};
|
||||
//============================================================================
|
||||
// implementation
|
||||
//============================================================================
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU (ID_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU (ID_About, MyFrame::OnAbout)
|
||||
END_EVENT_TABLE()
|
||||
IMPLEMENT_APP (App)
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
//----------------------------------------------------------------------------
|
||||
// App
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// `Main program' equivalent: the program execution "starts" here
|
||||
bool App::OnInit () {
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
MyFrame *frame = new MyFrame(_T("Testing wxStyledTextCtrl"),
|
||||
wxPoint(5, 5), wxSize(600, 600));
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
// set application and vendor name
|
||||
SetAppName (APP_NAME);
|
||||
SetVendorName (APP_VENDOR);
|
||||
g_appname = new wxString ();
|
||||
g_appname->Append (APP_VENDOR);
|
||||
g_appname->Append (_T("-"));
|
||||
g_appname->Append (APP_NAME);
|
||||
|
||||
frame->Show(TRUE);
|
||||
return TRUE;
|
||||
// initialize print data and setup
|
||||
g_printData = new wxPrintData;
|
||||
g_pageSetupData = new wxPageSetupDialogData;
|
||||
|
||||
// create application frame
|
||||
m_frame = new AppFrame (*g_appname);
|
||||
|
||||
// open application frame
|
||||
m_frame->Layout ();
|
||||
m_frame->Show (true);
|
||||
SetTopWindow (m_frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int App::OnExit () {
|
||||
|
||||
// frame constructor
|
||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// we need this in order to allow the about menu relocation, since ABOUT is
|
||||
// not the default id of the about menu
|
||||
wxApp::s_macAboutMenuItemId = ID_About;
|
||||
#endif
|
||||
// delete global appname
|
||||
delete g_appname;
|
||||
|
||||
// delete global print data and setup
|
||||
if (g_printData) delete g_printData;
|
||||
if (g_pageSetupData) delete g_pageSetupData;
|
||||
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(ID_About, _T("&About...\tCtrl-A"), _T("Show about dialog"));
|
||||
|
||||
menuFile->Append(ID_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, _T("&File"));
|
||||
menuBar->Append(helpMenu, _T("&Help"));
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(_T("Testing wxStyledTextCtrl"));
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
// Setup the editor
|
||||
ed = new MySTC(this, ID_ED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// AppFrame
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// event handlers
|
||||
BEGIN_EVENT_TABLE (AppFrame, wxFrame)
|
||||
// common
|
||||
EVT_CLOSE ( AppFrame::OnClose)
|
||||
// file
|
||||
EVT_MENU (wxID_OPEN, AppFrame::OnFileOpen)
|
||||
EVT_MENU (wxID_SAVE, AppFrame::OnFileSave)
|
||||
EVT_MENU (wxID_SAVEAS, AppFrame::OnFileSaveAs)
|
||||
EVT_MENU (wxID_CLOSE, AppFrame::OnFileClose)
|
||||
// properties
|
||||
EVT_MENU (myID_PROPERTIES, AppFrame::OnProperties)
|
||||
// print and exit
|
||||
EVT_MENU (wxID_PRINT_SETUP, AppFrame::OnPrintSetup)
|
||||
EVT_MENU (wxID_PREVIEW, AppFrame::OnPrintPreview)
|
||||
EVT_MENU (wxID_PRINT, AppFrame::OnPrint)
|
||||
EVT_MENU (wxID_EXIT, AppFrame::OnExit)
|
||||
// edit
|
||||
EVT_MENU (wxID_CLEAR, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_CUT, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_COPY, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_PASTE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_INDENTINC, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_INDENTRED, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_SELECTALL, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_SELECTLINE, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_REDO, AppFrame::OnEdit)
|
||||
EVT_MENU (wxID_UNDO, AppFrame::OnEdit)
|
||||
// find
|
||||
EVT_MENU (wxID_FIND, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_FINDNEXT, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_REPLACE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_REPLACENEXT, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_BRACEMATCH, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_GOTO, AppFrame::OnEdit)
|
||||
// view
|
||||
EVT_MENU_RANGE (myID_HILIGHTFIRST, myID_HILIGHTLAST,
|
||||
AppFrame::OnEdit)
|
||||
EVT_MENU (myID_DISPLAYEOL, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_INDENTGUIDE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_LINENUMBER, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_LONGLINEON, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_WHITESPACE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_FOLDTOGGLE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_OVERTYPE, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_READONLY, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_WRAPMODEON, AppFrame::OnEdit)
|
||||
// extra
|
||||
EVT_MENU (myID_CHANGELOWER, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CHANGEUPPER, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CONVERTCR, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CONVERTCRLF, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CONVERTLF, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CHARSETANSI, AppFrame::OnEdit)
|
||||
EVT_MENU (myID_CHARSETMAC, AppFrame::OnEdit)
|
||||
// help
|
||||
EVT_MENU (wxID_ABOUT, AppFrame::OnAbout)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
AppFrame::AppFrame (const wxString &title)
|
||||
: wxFrame ((wxFrame *)NULL, -1, title, wxDefaultPosition, wxSize(600,400),
|
||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) {
|
||||
|
||||
// intitialize important variables
|
||||
m_edit = NULL;
|
||||
|
||||
// set icon and background
|
||||
SetTitle (*g_appname);
|
||||
SetIcon (wxICON (mondrian));
|
||||
SetBackgroundColour (_T("WHITE"));
|
||||
|
||||
// about box shown for 1 seconds
|
||||
AppAbout (this, 1000);
|
||||
|
||||
// create menu
|
||||
m_menuBar = new wxMenuBar;
|
||||
CreateMenu ();
|
||||
|
||||
// open first page
|
||||
m_edit = new Edit (this, -1);
|
||||
m_edit->SetFocus();
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// TRUE is to force the frame to close
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _T("Testing wxStyledTextCtrl...\n"));
|
||||
|
||||
wxMessageBox(msg, _T("About This Test"), wxOK | wxICON_INFORMATION, this);
|
||||
AppFrame::~AppFrame () {
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
wxChar* keywords =
|
||||
_T("asm auto bool break case catch char class const \
|
||||
const_cast continue default delete do double \
|
||||
dynamic_cast else enum explicit export extern \
|
||||
false float for friend goto if inline int long \
|
||||
mutable namespace new operator private protected \
|
||||
public register reinterpret_cast return short signed \
|
||||
sizeof static static_cast struct switch template this \
|
||||
throw true try typedef typeid typename union unsigned \
|
||||
using virtual void volatile wchar_t while");
|
||||
|
||||
|
||||
|
||||
MySTC::MySTC(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style)
|
||||
: wxStyledTextCtrl(parent, id, pos, size, style)
|
||||
{
|
||||
// Default font
|
||||
wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
StyleSetFont(wxSTC_STYLE_DEFAULT, font);
|
||||
StyleClearAll();
|
||||
|
||||
StyleSetForeground(0, wxColour(0x80, 0x80, 0x80));
|
||||
StyleSetForeground(1, wxColour(0x00, 0x7f, 0x00));
|
||||
//StyleSetForeground(2, wxColour(0x00, 0x7f, 0x00));
|
||||
StyleSetForeground(3, wxColour(0x7f, 0x7f, 0x7f));
|
||||
StyleSetForeground(4, wxColour(0x00, 0x7f, 0x7f));
|
||||
StyleSetForeground(5, wxColour(0x00, 0x00, 0x7f));
|
||||
StyleSetForeground(6, wxColour(0x7f, 0x00, 0x7f));
|
||||
StyleSetForeground(7, wxColour(0x7f, 0x00, 0x7f));
|
||||
StyleSetForeground(8, wxColour(0x00, 0x7f, 0x7f));
|
||||
StyleSetForeground(9, wxColour(0x7f, 0x7f, 0x7f));
|
||||
StyleSetForeground(10, wxColour(0x00, 0x00, 0x00));
|
||||
StyleSetForeground(11, wxColour(0x00, 0x00, 0x00));
|
||||
StyleSetBold(5, TRUE);
|
||||
StyleSetBold(10, TRUE);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
StyleSetSpec(2, _T("fore:#007f00,bold,face:Arial,size:9"));
|
||||
#else
|
||||
StyleSetSpec(2, _T("fore:#007f00,bold,face:Helvetica,size:9"));
|
||||
#endif
|
||||
|
||||
// give it some text to play with
|
||||
wxString st;
|
||||
wxFileInputStream stream(wxT("stctest.cpp"));
|
||||
size_t sz = stream.GetSize();
|
||||
char* buf = new char[sz + 1];
|
||||
stream.Read((void*) buf, stream.GetSize());
|
||||
buf[sz] = 0;
|
||||
st = wxString::FromAscii(buf);
|
||||
delete[] buf;
|
||||
|
||||
InsertText(0, st);
|
||||
EmptyUndoBuffer();
|
||||
|
||||
SetLexer(wxSTC_LEX_CPP);
|
||||
SetKeyWords(0, keywords);
|
||||
// common event handlers
|
||||
void AppFrame::OnClose (wxCloseEvent &event) {
|
||||
wxCommandEvent evt;
|
||||
OnFileClose (evt);
|
||||
if (m_edit && m_edit->Modified()) {
|
||||
if (event.CanVeto()) event.Veto (true);
|
||||
return;
|
||||
}
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void MySTC::OnKeyPressed(wxKeyEvent& evt)
|
||||
{
|
||||
if (CallTipActive())
|
||||
CallTipCancel();
|
||||
void AppFrame::OnAbout (wxCommandEvent &WXUNUSED(event)) {
|
||||
AppAbout (this);
|
||||
}
|
||||
|
||||
int key = evt.GetKeyCode();
|
||||
if ( key == WXK_SPACE && evt.ControlDown()) {
|
||||
int pos = GetCurrentPos();
|
||||
void AppFrame::OnExit (wxCommandEvent &WXUNUSED(event)) {
|
||||
Close (true);
|
||||
}
|
||||
|
||||
if (evt.ShiftDown()) {
|
||||
// show how to do CallTips
|
||||
CallTipSetBackground(wxColour(_T("YELLOW")));
|
||||
CallTipShow(pos, _T("lots of of text: blah, blah, blah\n\n\
|
||||
show some suff, maybe parameters..\n\n\
|
||||
fubar(param1, param2)"));
|
||||
}
|
||||
else {
|
||||
// show how to do AutoComplete
|
||||
AutoCompSetIgnoreCase(false);
|
||||
AutoCompShow(0, keywords); // reuse the keyword list here
|
||||
// normally you would build a string of completion texts...
|
||||
// file event handlers
|
||||
void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
wxString fname;
|
||||
wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""), _T("Any file (*)|*"),
|
||||
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
|
||||
if (dlg.ShowModal() != wxID_OK) return;
|
||||
fname = dlg.GetPath ();
|
||||
FileOpen (fname);
|
||||
}
|
||||
|
||||
void AppFrame::OnFileSave (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
if (!m_edit->Modified()) {
|
||||
wxMessageBox (_("There is nothing to save!"), _("Save file"),
|
||||
wxOK | wxICON_EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
m_edit->SaveFile ();
|
||||
}
|
||||
|
||||
void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
wxString filename = wxEmptyString;
|
||||
wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
|
||||
if (dlg.ShowModal() != wxID_OK) return;
|
||||
filename = dlg.GetPath();
|
||||
m_edit->SaveFile (filename);
|
||||
}
|
||||
|
||||
void AppFrame::OnFileClose (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
if (m_edit->Modified()) {
|
||||
if (wxMessageBox (_("Text is not saved, save before closing?"), _("Close"),
|
||||
wxYES_NO | wxICON_QUESTION) == wxYES) {
|
||||
m_edit->SaveFile();
|
||||
if (m_edit->Modified()) {
|
||||
wxMessageBox (_("Text could not be saved!"), _("Close abort"),
|
||||
wxOK | wxICON_EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
// properties event handlers
|
||||
void AppFrame::OnProperties (wxCommandEvent &WXUNUSED(event)) {
|
||||
if (!m_edit) return;
|
||||
EditProperties (m_edit, 0);
|
||||
}
|
||||
|
||||
// print event handlers
|
||||
void AppFrame::OnPrintSetup (wxCommandEvent &WXUNUSED(event)) {
|
||||
(*g_pageSetupData) = * g_printData;
|
||||
wxPageSetupDialog pageSetupDialog(this, g_pageSetupData);
|
||||
pageSetupDialog.ShowModal();
|
||||
(*g_printData) = pageSetupDialog.GetPageSetupData().GetPrintData();
|
||||
(*g_pageSetupData) = pageSetupDialog.GetPageSetupData();
|
||||
}
|
||||
|
||||
void AppFrame::OnPrintPreview (wxCommandEvent &WXUNUSED(event)) {
|
||||
wxPrintDialogData printDialogData( *g_printData);
|
||||
wxPrintPreview *preview =
|
||||
new wxPrintPreview (new EditPrint (m_edit),
|
||||
new EditPrint (m_edit),
|
||||
&printDialogData);
|
||||
if (!preview->Ok()) {
|
||||
delete preview;
|
||||
wxMessageBox (_("There was a problem with previewing.\n\
|
||||
Perhaps your current printer is not correctly?"),
|
||||
_("Previewing"), wxOK);
|
||||
return;
|
||||
}
|
||||
wxRect rect = DeterminePrintSize();
|
||||
wxPreviewFrame *frame = new wxPreviewFrame (preview, this, _("Print Preview"));
|
||||
frame->SetSize (rect);
|
||||
frame->Centre(wxBOTH);
|
||||
frame->Initialize();
|
||||
frame->Show(true);
|
||||
}
|
||||
|
||||
void AppFrame::OnPrint (wxCommandEvent &WXUNUSED(event)) {
|
||||
wxPrintDialogData printDialogData( *g_printData);
|
||||
wxPrinter printer (&printDialogData);
|
||||
EditPrint printout (m_edit);
|
||||
if (!printer.Print (this, &printout, true)) {
|
||||
if (wxPrinter::GetLastError() == wxPRINTER_ERROR) {
|
||||
wxMessageBox (_("There was a problem with printing.\n\
|
||||
Perhaps your current printer is not correctly?"),
|
||||
_("Previewing"), wxOK);
|
||||
return;
|
||||
}
|
||||
}
|
||||
(*g_printData) = printer.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
|
||||
// edit events
|
||||
void AppFrame::OnEdit (wxCommandEvent &event) {
|
||||
if (m_edit) m_edit->ProcessEvent (event);
|
||||
}
|
||||
|
||||
// private functions
|
||||
void AppFrame::CreateMenu () {
|
||||
|
||||
// File menu
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuFile->Append (wxID_OPEN, _("&Open ..\tCtrl+O"));
|
||||
menuFile->Append (wxID_SAVE, _("&Save\tCtrl+S"));
|
||||
menuFile->Append (wxID_SAVEAS, _("Save &as ..\tCtrl+Shift+S"));
|
||||
menuFile->Append (wxID_CLOSE, _("&Close\tCtrl+W"));
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append (myID_PROPERTIES, _("Proper&ties ..\tCtrl+I"));
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append (wxID_PRINT_SETUP, _("Print Set&up .."));
|
||||
menuFile->Append (wxID_PREVIEW, _("Print Pre&view\tCtrl+Shift+P"));
|
||||
menuFile->Append (wxID_PRINT, _("&Print ..\tCtrl+P"));
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append (wxID_EXIT, _("&Quit\tCtrl+Q"));
|
||||
|
||||
// Edit menu
|
||||
wxMenu *menuEdit = new wxMenu;
|
||||
menuEdit->Append (wxID_UNDO, _("&Undo\tCtrl+Z"));
|
||||
menuEdit->Append (wxID_REDO, _("&Redo\tCtrl+Shift+Z"));
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (wxID_CUT, _("Cu&t\tCtrl+X"));
|
||||
menuEdit->Append (wxID_COPY, _("&Copy\tCtrl+C"));
|
||||
menuEdit->Append (wxID_PASTE, _("&Paste\tCtrl+V"));
|
||||
menuEdit->Append (wxID_CLEAR, _("&Delete\tDel"));
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (wxID_FIND, _("&Find\tCtrl+F"));
|
||||
menuEdit->Enable (wxID_FIND, false);
|
||||
menuEdit->Append (myID_FINDNEXT, _("Find &next\tF3"));
|
||||
menuEdit->Enable (myID_FINDNEXT, false);
|
||||
menuEdit->Append (myID_REPLACE, _("&Replace\tCtrl+H"));
|
||||
menuEdit->Enable (myID_REPLACE, false);
|
||||
menuEdit->Append (myID_REPLACENEXT, _("Replace &again\tShift+F4"));
|
||||
menuEdit->Enable (myID_REPLACENEXT, false);
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (myID_BRACEMATCH, _("&Match brace\tCtrl+M"));
|
||||
menuEdit->Append (myID_GOTO, _("&Goto\tCtrl+G"));
|
||||
menuEdit->Enable (myID_GOTO, false);
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (myID_INDENTINC, _("&Indent increase\tTab"));
|
||||
menuEdit->Append (myID_INDENTRED, _("I&ndent reduce\tBksp"));
|
||||
menuEdit->AppendSeparator();
|
||||
menuEdit->Append (wxID_SELECTALL, _("&Select all\tCtrl+A"));
|
||||
menuEdit->Append (myID_SELECTLINE, _("Select &line\tCtrl+L"));
|
||||
|
||||
// hilight submenu
|
||||
wxMenu *menuHilight = new wxMenu;
|
||||
int Nr;
|
||||
for (Nr = 0; Nr < g_LanguagePrefsSize; Nr++) {
|
||||
menuHilight->Append (myID_HILIGHTFIRST + Nr,
|
||||
g_LanguagePrefs [Nr].name);
|
||||
}
|
||||
|
||||
// charset submenu
|
||||
wxMenu *menuCharset = new wxMenu;
|
||||
menuCharset->Append (myID_CHARSETANSI, _("&ANSI (Windows)"));
|
||||
menuCharset->Append (myID_CHARSETMAC, _("&MAC (Macintosh)"));
|
||||
|
||||
// View menu
|
||||
wxMenu *menuView = new wxMenu;
|
||||
menuView->Append (myID_HILIGHTLANG, _("&Hilight language .."), menuHilight);
|
||||
menuView->AppendSeparator();
|
||||
menuView->AppendCheckItem (myID_FOLDTOGGLE, _("&Toggle current fold\tCtrl+T"));
|
||||
menuView->AppendCheckItem (myID_OVERTYPE, _("&Overwrite mode\tIns"));
|
||||
menuView->AppendCheckItem (myID_WRAPMODEON, _("&Wrap mode\tCtrl+U"));
|
||||
menuView->AppendSeparator();
|
||||
menuView->AppendCheckItem (myID_DISPLAYEOL, _("Show line &endings"));
|
||||
menuView->AppendCheckItem (myID_INDENTGUIDE, _("Show &indent guides"));
|
||||
menuView->AppendCheckItem (myID_LINENUMBER, _("Show line &numbers"));
|
||||
menuView->AppendCheckItem (myID_LONGLINEON, _("Show &long line marker"));
|
||||
menuView->AppendCheckItem (myID_WHITESPACE, _("Show white&space"));
|
||||
menuView->AppendSeparator();
|
||||
menuView->Append (myID_USECHARSET, _("Use &code page of .."), menuCharset);
|
||||
|
||||
// change case submenu
|
||||
wxMenu *menuChangeCase = new wxMenu;
|
||||
menuChangeCase->Append (myID_CHANGEUPPER, _("&Upper case"));
|
||||
menuChangeCase->Append (myID_CHANGELOWER, _("&Lower case"));
|
||||
|
||||
// convert EOL submenu
|
||||
wxMenu *menuConvertEOL = new wxMenu;
|
||||
menuConvertEOL->Append (myID_CONVERTCR, _("CR (&Linux)"));
|
||||
menuConvertEOL->Append (myID_CONVERTCRLF, _("CR+LF (&Windows)"));
|
||||
menuConvertEOL->Append (myID_CONVERTLF, _("LF (&Macintosh)"));
|
||||
|
||||
// Extra menu
|
||||
wxMenu *menuExtra = new wxMenu;
|
||||
menuExtra->AppendCheckItem (myID_READONLY, _("&Readonly mode"));
|
||||
menuExtra->AppendSeparator();
|
||||
menuExtra->Append (myID_CHANGECASE, _("Change &case to .."), menuChangeCase);
|
||||
menuExtra->AppendSeparator();
|
||||
menuExtra->Append (myID_CONVERTEOL, _("Convert line &endings to .."), menuConvertEOL);
|
||||
|
||||
// Window menu
|
||||
wxMenu *menuWindow = new wxMenu;
|
||||
menuWindow->Append (myID_PAGEPREV, _("&Previous\tCtrl+Shift+Tab"));
|
||||
menuWindow->Append (myID_PAGENEXT, _("&Next\tCtrl+Tab"));
|
||||
|
||||
// Help menu
|
||||
wxMenu *menuHelp = new wxMenu;
|
||||
menuHelp->Append (wxID_ABOUT, _("&About ..\tShift+F1"));
|
||||
|
||||
// construct menu
|
||||
m_menuBar->Append (menuFile, _("&File"));
|
||||
m_menuBar->Append (menuEdit, _("&Edit"));
|
||||
m_menuBar->Append (menuView, _("&View"));
|
||||
m_menuBar->Append (menuExtra, _("E&xtra"));
|
||||
m_menuBar->Append (menuWindow, _("&Window"));
|
||||
m_menuBar->Append (menuHelp, _("&Help"));
|
||||
SetMenuBar (m_menuBar);
|
||||
|
||||
}
|
||||
|
||||
void AppFrame::FileOpen (wxString fname) {
|
||||
wxFileName w(fname); w.Normalize(); fname = w.GetFullPath();
|
||||
m_edit->LoadFile (fname);
|
||||
}
|
||||
|
||||
wxRect AppFrame::DeterminePrintSize () {
|
||||
|
||||
wxSize scr = wxGetDisplaySize();
|
||||
|
||||
// determine position and size (shifting 16 left and down)
|
||||
wxRect rect = GetRect();
|
||||
rect.x += 16;
|
||||
rect.y += 16;
|
||||
rect.width = wxMin (rect.width, (scr.x - rect.x));
|
||||
rect.height = wxMin (rect.height, (scr.x - rect.y));
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// AppAbout
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE (AppAbout, wxDialog)
|
||||
EVT_TIMER (myID_ABOUTTIMER, AppAbout::OnTimerEvent)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
AppAbout::AppAbout (wxWindow *parent,
|
||||
int milliseconds,
|
||||
long style)
|
||||
: wxDialog (parent, -1, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
|
||||
|
||||
// set timer if any
|
||||
m_timer = NULL;
|
||||
if (milliseconds > 0) {
|
||||
m_timer = new wxTimer (this, myID_ABOUTTIMER);
|
||||
m_timer->Start (milliseconds, wxTIMER_ONE_SHOT);
|
||||
}
|
||||
|
||||
// sets the application title
|
||||
SetTitle (_("About .."));
|
||||
|
||||
// about info
|
||||
wxGridSizer *aboutinfo = new wxGridSizer (2, 0, 2);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, _("Written by: ")),
|
||||
0, wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, APP_MAINT),
|
||||
1, wxEXPAND | wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, _("Version: ")),
|
||||
0, wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, APP_VERSION),
|
||||
1, wxEXPAND | wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, _("Licence type: ")),
|
||||
0, wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, APP_LICENCE),
|
||||
1, wxEXPAND | wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, _("Copyright: ")),
|
||||
0, wxALIGN_LEFT);
|
||||
aboutinfo->Add (new wxStaticText(this, -1, APP_COPYRIGTH),
|
||||
1, wxEXPAND | wxALIGN_LEFT);
|
||||
|
||||
// about icontitle//info
|
||||
wxBoxSizer *aboutpane = new wxBoxSizer (wxHORIZONTAL);
|
||||
wxBitmap bitmap = wxBitmap(wxICON (mondrian));
|
||||
aboutpane->Add (new wxStaticBitmap (this, -1, bitmap),
|
||||
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 20);
|
||||
aboutpane->Add (aboutinfo, 1, wxEXPAND);
|
||||
aboutpane->Add (60, 0);
|
||||
|
||||
// about complete
|
||||
wxBoxSizer *totalpane = new wxBoxSizer (wxVERTICAL);
|
||||
totalpane->Add (0, 20);
|
||||
wxStaticText *appname = new wxStaticText(this, -1, *g_appname);
|
||||
appname->SetFont (wxFont (24, wxDEFAULT, wxNORMAL, wxBOLD));
|
||||
totalpane->Add (appname, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 40);
|
||||
totalpane->Add (0, 10);
|
||||
totalpane->Add (aboutpane, 0, wxEXPAND | wxALL, 4);
|
||||
totalpane->Add (new wxStaticText(this, -1, APP_DESCR),
|
||||
0, wxALIGN_CENTER | wxALL, 10);
|
||||
wxButton *okButton = new wxButton (this, wxID_OK, _("OK"));
|
||||
okButton->SetDefault();
|
||||
totalpane->Add (okButton, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
||||
|
||||
SetSizerAndFit (totalpane);
|
||||
|
||||
CenterOnScreen();
|
||||
ShowModal();
|
||||
}
|
||||
|
||||
AppAbout::~AppAbout () {
|
||||
if (m_timer) {
|
||||
delete m_timer;
|
||||
m_timer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// event handlers
|
||||
void AppAbout::OnTimerEvent (wxTimerEvent &event) {
|
||||
if (m_timer) delete m_timer;
|
||||
m_timer = NULL;
|
||||
EndModal (wxID_OK);
|
||||
}
|
||||
|
||||
|
@@ -468,6 +468,14 @@ LINK32=link.exe
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\edit.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prefs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\..\..\..\samples\sample.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@@ -1 +1,5 @@
|
||||
mondrian ICON "mondrian.ico"
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
print BITMAP "bitmaps/print.bmp"
|
||||
|
||||
|
@@ -80,14 +80,18 @@ STCDLL_OBJECTS = \
|
||||
stcdll_LexLisp.o \
|
||||
stcdll_LexLout.o \
|
||||
stcdll_LexLua.o \
|
||||
stcdll_LexMMIXAL.o \
|
||||
stcdll_LexMatlab.o \
|
||||
stcdll_LexNsis.o \
|
||||
stcdll_LexOthers.o \
|
||||
stcdll_LexPOV.o \
|
||||
stcdll_LexPS.o \
|
||||
stcdll_LexPascal.o \
|
||||
stcdll_LexPerl.o \
|
||||
stcdll_LexPython.o \
|
||||
stcdll_LexRuby.o \
|
||||
stcdll_LexSQL.o \
|
||||
stcdll_LexScriptol.o \
|
||||
stcdll_LexVB.o \
|
||||
stcdll_LineMarker.o \
|
||||
stcdll_PropSet.o \
|
||||
@@ -134,14 +138,18 @@ STCLIB_OBJECTS = \
|
||||
stclib_LexLisp.o \
|
||||
stclib_LexLout.o \
|
||||
stclib_LexLua.o \
|
||||
stclib_LexMMIXAL.o \
|
||||
stclib_LexMatlab.o \
|
||||
stclib_LexNsis.o \
|
||||
stclib_LexOthers.o \
|
||||
stclib_LexPOV.o \
|
||||
stclib_LexPS.o \
|
||||
stclib_LexPascal.o \
|
||||
stclib_LexPerl.o \
|
||||
stclib_LexPython.o \
|
||||
stclib_LexRuby.o \
|
||||
stclib_LexSQL.o \
|
||||
stclib_LexScriptol.o \
|
||||
stclib_LexVB.o \
|
||||
stclib_LineMarker.o \
|
||||
stclib_PropSet.o \
|
||||
@@ -378,15 +386,24 @@ stcdll_LexLout.o: $(srcdir)/scintilla/src/LexLout.cxx
|
||||
stcdll_LexLua.o: $(srcdir)/scintilla/src/LexLua.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexMMIXAL.o: $(srcdir)/scintilla/src/LexMMIXAL.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPOV.o: $(srcdir)/scintilla/src/LexPOV.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPS.o: $(srcdir)/scintilla/src/LexPS.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -402,6 +419,9 @@ stcdll_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
|
||||
stcdll_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexVB.o: $(srcdir)/scintilla/src/LexVB.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -530,15 +550,24 @@ stclib_LexLout.o: $(srcdir)/scintilla/src/LexLout.cxx
|
||||
stclib_LexLua.o: $(srcdir)/scintilla/src/LexLua.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexMMIXAL.o: $(srcdir)/scintilla/src/LexMMIXAL.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPOV.o: $(srcdir)/scintilla/src/LexPOV.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPS.o: $(srcdir)/scintilla/src/LexPS.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
@@ -554,6 +583,9 @@ stclib_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
|
||||
stclib_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexVB.o: $(srcdir)/scintilla/src/LexVB.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
|
@@ -288,7 +288,7 @@ void SurfaceImpl::Init(SurfaceID hdc_, WindowID) {
|
||||
hdc = (wxDC*)hdc_;
|
||||
}
|
||||
|
||||
void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID) {
|
||||
void SurfaceImpl::InitPixMap(int width, int height, Surface *WXUNUSED(surface_), WindowID) {
|
||||
Release();
|
||||
hdc = new wxMemoryDC();
|
||||
hdcOwned = true;
|
||||
@@ -542,7 +542,7 @@ int SurfaceImpl::Descent(Font &font) {
|
||||
return d;
|
||||
}
|
||||
|
||||
int SurfaceImpl::InternalLeading(Font &font) {
|
||||
int SurfaceImpl::InternalLeading(Font &WXUNUSED(font)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ int SurfaceImpl::AverageCharWidth(Font &font) {
|
||||
return hdc->GetCharWidth();
|
||||
}
|
||||
|
||||
int SurfaceImpl::SetPalette(Palette *pal, bool inBackGround) {
|
||||
int SurfaceImpl::SetPalette(Palette *WXUNUSED(pal), bool WXUNUSED(inBackGround)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) {
|
||||
unicodeMode=unicodeMode_;
|
||||
}
|
||||
|
||||
void SurfaceImpl::SetDBCSMode(int codePage) {
|
||||
void SurfaceImpl::SetDBCSMode(int WXUNUSED(codePage)) {
|
||||
// dbcsMode = codePage == SC_CP_DBCS;
|
||||
}
|
||||
|
||||
@@ -969,7 +969,7 @@ int ListBoxImpl::GetSelection() {
|
||||
}
|
||||
|
||||
|
||||
int ListBoxImpl::Find(const char *prefix) {
|
||||
int ListBoxImpl::Find(const char *WXUNUSED(prefix)) {
|
||||
// No longer used
|
||||
return -1;
|
||||
}
|
||||
@@ -1063,7 +1063,7 @@ void Menu::Show(Point pt, Window &w) {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
DynamicLibrary *DynamicLibrary::Load(const char *modulePath) {
|
||||
DynamicLibrary *DynamicLibrary::Load(const char *WXUNUSED(modulePath)) {
|
||||
wxFAIL_MSG(wxT("Dynamic lexer loading not implemented yet"));
|
||||
return NULL;
|
||||
}
|
||||
@@ -1103,7 +1103,7 @@ void Platform::DebugDisplay(const char *s) {
|
||||
wxLogDebug(stc2wx(s));
|
||||
}
|
||||
|
||||
bool Platform::IsKeyDown(int key) {
|
||||
bool Platform::IsKeyDown(int WXUNUSED(key)) {
|
||||
return false; // I don't think we'll need this.
|
||||
}
|
||||
|
||||
@@ -1196,11 +1196,11 @@ int Platform::Clamp(int val, int minVal, int maxVal) {
|
||||
}
|
||||
|
||||
|
||||
bool Platform::IsDBCSLeadByte(int codePage, char ch) {
|
||||
bool Platform::IsDBCSLeadByte(int WXUNUSED(codePage), char WXUNUSED(ch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int Platform::DBCSCharLength(int codePage, const char *s) {
|
||||
int Platform::DBCSCharLength(int WXUNUSED(codePage), const char *WXUNUSED(s)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -383,7 +383,8 @@ bool ScintillaWX::CanPaste() {
|
||||
bool didOpen;
|
||||
|
||||
if (Editor::CanPaste()) {
|
||||
if ( (didOpen = !wxTheClipboard->IsOpened()) )
|
||||
didOpen = !wxTheClipboard->IsOpened();
|
||||
if ( didOpen )
|
||||
wxTheClipboard->Open();
|
||||
|
||||
if (wxTheClipboard->IsOpened()) {
|
||||
@@ -597,7 +598,7 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta,
|
||||
}
|
||||
|
||||
|
||||
void ScintillaWX::DoSize(int width, int height) {
|
||||
void ScintillaWX::DoSize(int WXUNUSED(width), int WXUNUSED(height)) {
|
||||
// PRectangle rcClient(0,0,width,height);
|
||||
// SetScrollBarsTo(rcClient);
|
||||
// DropGraphics();
|
||||
@@ -628,8 +629,8 @@ void ScintillaWX::DoLeftButtonMove(Point pt) {
|
||||
ButtonMove(pt);
|
||||
}
|
||||
|
||||
void ScintillaWX::DoMiddleButtonUp(Point pt) {
|
||||
#ifdef __WXGTK__
|
||||
void ScintillaWX::DoMiddleButtonUp(Point pt) {
|
||||
// Set the current position to the mouse click point and
|
||||
// then paste in the PRIMARY selection, if any. wxGTK only.
|
||||
int newPos = PositionFromLocation(pt);
|
||||
@@ -656,8 +657,11 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) {
|
||||
|
||||
ShowCaretAtCurrentPosition();
|
||||
EnsureCaretVisible();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void ScintillaWX::DoMiddleButtonUp(Point WXUNUSED(pt)) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void ScintillaWX::DoAddChar(int key) {
|
||||
@@ -673,9 +677,10 @@ void ScintillaWX::DoAddChar(int key) {
|
||||
}
|
||||
|
||||
|
||||
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) {
|
||||
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed) {
|
||||
#if defined(__WXGTK__) || defined(__WXMAC__)
|
||||
// Ctrl chars (A-Z) end up with the wrong keycode on wxGTK...
|
||||
// Ctrl chars (A-Z) end up with the wrong keycode on wxGTK
|
||||
// TODO: Check this, it shouldn't be true any longer.
|
||||
if (ctrl && key >= 1 && key <= 26)
|
||||
key += 'A' - 1;
|
||||
#endif
|
||||
@@ -709,6 +714,21 @@ int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* cons
|
||||
case WXK_MENU: key = 0; break;
|
||||
}
|
||||
|
||||
#ifdef __WXMAC__
|
||||
if ( meta ) {
|
||||
// check for a few common Mac Meta-key combos and remap them to Ctrl
|
||||
// for Scintilla
|
||||
switch ( key ) {
|
||||
case 'Z': // Undo
|
||||
case 'X': // Cut
|
||||
case 'C': // Copy
|
||||
case 'V': // Paste
|
||||
case 'A': // Select All
|
||||
ctrl = true;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
int rv = KeyDown(key, shift, ctrl, alt, consumed);
|
||||
|
||||
if (key)
|
||||
@@ -760,7 +780,7 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
|
||||
}
|
||||
|
||||
|
||||
wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) {
|
||||
wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def) {
|
||||
dragResult = def;
|
||||
return dragResult;
|
||||
}
|
||||
@@ -817,8 +837,8 @@ void ScintillaWX::DoScrollToColumn(int column) {
|
||||
HorizontalScrollTo(column * vs.spaceWidth);
|
||||
}
|
||||
|
||||
void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
|
||||
#ifdef __WXGTK__
|
||||
void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
|
||||
wxRegion rgn(wxRectFromPRectangle(rect));
|
||||
if (ac.Active()) {
|
||||
wxRect childRect = ((wxWindow*)ac.lb->GetID())->GetRect();
|
||||
@@ -830,9 +850,11 @@ void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
|
||||
}
|
||||
|
||||
dc.SetClippingRegion(rgn);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
void ScintillaWX::ClipChildren(wxDC& WXUNUSED(dc), PRectangle WXUNUSED(rect)) {
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
|
@@ -139,7 +139,7 @@ public:
|
||||
void DoMiddleButtonUp(Point pt);
|
||||
void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
|
||||
void DoAddChar(int key);
|
||||
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
|
||||
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed);
|
||||
void DoTick() { Tick(); }
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
@@ -547,9 +547,12 @@ methodOverrideMap = {
|
||||
|
||||
|
||||
'GrabFocus' : (None, 0, 0, 0),
|
||||
|
||||
# Rename some that woudl otherwise hid the wxWindow methods
|
||||
'SetFocus' : ('SetSTCFocus', 0, 0, 0),
|
||||
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
|
||||
|
||||
'SetCursor' : ('SetSTCCursor', 0, 0, 0),
|
||||
'GetCursor' : ('GetSTCCursor', 0, 0, 0),
|
||||
|
||||
'LoadLexerLibrary' : (None, 0,0,0),
|
||||
|
||||
|
@@ -3,4 +3,4 @@ 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.53
|
||||
The current version of the Scintilla code is 1.54
|
||||
|
@@ -25,7 +25,7 @@ protected:
|
||||
char buf[bufferSize+1];
|
||||
int startPos;
|
||||
int endPos;
|
||||
int codePage;
|
||||
int codePage;
|
||||
|
||||
virtual bool InternalIsLeadByte(char ch)=0;
|
||||
virtual void Fill(int position)=0;
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
if (position < startPos || position >= endPos) {
|
||||
Fill(position);
|
||||
if (position < startPos || position >= endPos) {
|
||||
// Position is outside range of document
|
||||
// Position is outside range of document
|
||||
return chDefault;
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler);
|
||||
|
||||
|
||||
/**
|
||||
* A LexerModule is responsible for lexing and folding a particular language.
|
||||
* The class maintains a list of LexerModules which can be searched to find a
|
||||
@@ -26,7 +26,7 @@ protected:
|
||||
|
||||
public:
|
||||
const char *languageName;
|
||||
LexerModule(int language_, LexerFunction fnLexer_,
|
||||
LexerModule(int language_, LexerFunction fnLexer_,
|
||||
const char *languageName_=0, LexerFunction fnFolder_=0,
|
||||
const char * const wordListDescriptions_[] = NULL);
|
||||
int GetLanguage() const { return language; }
|
||||
|
@@ -24,11 +24,21 @@ struct Property {
|
||||
/**
|
||||
*/
|
||||
class PropSet {
|
||||
private:
|
||||
protected:
|
||||
enum { hashRoots=31 };
|
||||
Property *props[hashRoots];
|
||||
Property *enumnext;
|
||||
int enumhash;
|
||||
static unsigned int HashString(const char *s, size_t len) {
|
||||
unsigned int ret = 0;
|
||||
while (len--) {
|
||||
ret <<= 4;
|
||||
ret ^= *s;
|
||||
s++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
static bool IncludesVar(const char *value, const char *key);
|
||||
public:
|
||||
PropSet *superPS;
|
||||
PropSet();
|
||||
|
@@ -56,6 +56,9 @@
|
||||
#define SCLEX_POV 39
|
||||
#define SCLEX_LOUT 40
|
||||
#define SCLEX_ESCRIPT 41
|
||||
#define SCLEX_PS 42
|
||||
#define SCLEX_NSIS 43
|
||||
#define SCLEX_MMIXAL 44
|
||||
#define SCLEX_AUTOMATIC 1000
|
||||
#define SCE_P_DEFAULT 0
|
||||
#define SCE_P_COMMENTLINE 1
|
||||
@@ -268,6 +271,8 @@
|
||||
#define SCE_LUA_WORD4 15
|
||||
#define SCE_LUA_WORD5 16
|
||||
#define SCE_LUA_WORD6 17
|
||||
#define SCE_LUA_WORD7 18
|
||||
#define SCE_LUA_WORD8 19
|
||||
#define SCE_ERR_DEFAULT 0
|
||||
#define SCE_ERR_PYTHON 1
|
||||
#define SCE_ERR_GCC 2
|
||||
@@ -455,14 +460,20 @@
|
||||
#define SCE_POV_DEFAULT 0
|
||||
#define SCE_POV_COMMENT 1
|
||||
#define SCE_POV_COMMENTLINE 2
|
||||
#define SCE_POV_COMMENTDOC 3
|
||||
#define SCE_POV_NUMBER 4
|
||||
#define SCE_POV_WORD 5
|
||||
#define SCE_POV_NUMBER 3
|
||||
#define SCE_POV_OPERATOR 4
|
||||
#define SCE_POV_IDENTIFIER 5
|
||||
#define SCE_POV_STRING 6
|
||||
#define SCE_POV_OPERATOR 7
|
||||
#define SCE_POV_IDENTIFIER 8
|
||||
#define SCE_POV_BRACE 9
|
||||
#define SCE_POV_STRINGEOL 7
|
||||
#define SCE_POV_DIRECTIVE 8
|
||||
#define SCE_POV_BADDIRECTIVE 9
|
||||
#define SCE_POV_WORD2 10
|
||||
#define SCE_POV_WORD3 11
|
||||
#define SCE_POV_WORD4 12
|
||||
#define SCE_POV_WORD5 13
|
||||
#define SCE_POV_WORD6 14
|
||||
#define SCE_POV_WORD7 15
|
||||
#define SCE_POV_WORD8 16
|
||||
#define SCE_LOUT_DEFAULT 0
|
||||
#define SCE_LOUT_COMMENT 1
|
||||
#define SCE_LOUT_NUMBER 2
|
||||
@@ -486,6 +497,54 @@
|
||||
#define SCE_ESCRIPT_BRACE 9
|
||||
#define SCE_ESCRIPT_WORD2 10
|
||||
#define SCE_ESCRIPT_WORD3 11
|
||||
#define SCE_PS_DEFAULT 0
|
||||
#define SCE_PS_COMMENT 1
|
||||
#define SCE_PS_DSC_COMMENT 2
|
||||
#define SCE_PS_DSC_VALUE 3
|
||||
#define SCE_PS_NUMBER 4
|
||||
#define SCE_PS_NAME 5
|
||||
#define SCE_PS_KEYWORD 6
|
||||
#define SCE_PS_LITERAL 7
|
||||
#define SCE_PS_IMMEVAL 8
|
||||
#define SCE_PS_PAREN_ARRAY 9
|
||||
#define SCE_PS_PAREN_DICT 10
|
||||
#define SCE_PS_PAREN_PROC 11
|
||||
#define SCE_PS_TEXT 12
|
||||
#define SCE_PS_HEXSTRING 13
|
||||
#define SCE_PS_BASE85STRING 14
|
||||
#define SCE_PS_BADSTRINGCHAR 15
|
||||
#define SCE_NSIS_DEFAULT 0
|
||||
#define SCE_NSIS_COMMENT 1
|
||||
#define SCE_NSIS_STRINGDQ 2
|
||||
#define SCE_NSIS_STRINGLQ 3
|
||||
#define SCE_NSIS_STRINGRQ 4
|
||||
#define SCE_NSIS_FUNCTION 5
|
||||
#define SCE_NSIS_VARIABLE 6
|
||||
#define SCE_NSIS_LABEL 7
|
||||
#define SCE_NSIS_USERDEFINED 8
|
||||
#define SCE_NSIS_SECTIONDEF 9
|
||||
#define SCE_NSIS_SUBSECTIONDEF 10
|
||||
#define SCE_NSIS_IFDEFINEDEF 11
|
||||
#define SCE_NSIS_MACRODEF 12
|
||||
#define SCE_NSIS_STRINGVAR 13
|
||||
#define SCE_MMIXAL_LEADWS 0
|
||||
#define SCE_MMIXAL_COMMENT 1
|
||||
#define SCE_MMIXAL_LABEL 2
|
||||
#define SCE_MMIXAL_OPCODE 3
|
||||
#define SCE_MMIXAL_OPCODE_PRE 4
|
||||
#define SCE_MMIXAL_OPCODE_VALID 5
|
||||
#define SCE_MMIXAL_OPCODE_UNKNOWN 6
|
||||
#define SCE_MMIXAL_OPCODE_POST 7
|
||||
#define SCE_MMIXAL_OPERANDS 8
|
||||
#define SCE_MMIXAL_NUMBER 9
|
||||
#define SCE_MMIXAL_REF 10
|
||||
#define SCE_MMIXAL_CHAR 11
|
||||
#define SCE_MMIXAL_STRING 12
|
||||
#define SCE_MMIXAL_REGISTER 13
|
||||
#define SCE_MMIXAL_HEX 14
|
||||
#define SCE_MMIXAL_OPERATOR 15
|
||||
#define SCE_MMIXAL_SYMBOL 16
|
||||
#define SCE_MMIXAL_INCLUDE 17
|
||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||
|
||||
#endif
|
||||
|
@@ -204,6 +204,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define INDIC_TT 2
|
||||
#define INDIC_DIAGONAL 3
|
||||
#define INDIC_STRIKE 4
|
||||
#define INDIC_HIDDEN 5
|
||||
#define INDIC0_MASK 0x20
|
||||
#define INDIC1_MASK 0x40
|
||||
#define INDIC2_MASK 0x80
|
||||
@@ -546,6 +547,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_GETLEXER 4002
|
||||
#define SCI_COLOURISE 4003
|
||||
#define SCI_SETPROPERTY 4004
|
||||
#define KEYWORDSET_MAX 8
|
||||
#define SCI_SETKEYWORDS 4005
|
||||
#define SCI_SETLEXERLANGUAGE 4006
|
||||
#define SCI_LOADLEXERLIBRARY 4007
|
||||
|
@@ -462,6 +462,7 @@ val INDIC_SQUIGGLE=1
|
||||
val INDIC_TT=2
|
||||
val INDIC_DIAGONAL=3
|
||||
val INDIC_STRIKE=4
|
||||
val INDIC_HIDDEN=5
|
||||
val INDIC0_MASK=0x20
|
||||
val INDIC1_MASK=0x40
|
||||
val INDIC2_MASK=0x80
|
||||
@@ -1476,6 +1477,9 @@ fun void Colourise=4003(position start, position end)
|
||||
# Set up a value that may be used by a lexer for some optional feature.
|
||||
set void SetProperty=4004(string key, string value)
|
||||
|
||||
# Maximum value of keywordSet parameter of SetKeyWords.
|
||||
val KEYWORDSET_MAX=8
|
||||
|
||||
# Set up the key words used by the lexer.
|
||||
set void SetKeyWords=4005(int keywordSet, string keyWords)
|
||||
|
||||
@@ -1584,6 +1588,9 @@ val SCLEX_CSS=38
|
||||
val SCLEX_POV=39
|
||||
val SCLEX_LOUT=40
|
||||
val SCLEX_ESCRIPT=41
|
||||
val SCLEX_PS=42
|
||||
val SCLEX_NSIS=43
|
||||
val SCLEX_MMIXAL=44
|
||||
|
||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -1835,6 +1842,8 @@ val SCE_LUA_WORD3=14
|
||||
val SCE_LUA_WORD4=15
|
||||
val SCE_LUA_WORD5=16
|
||||
val SCE_LUA_WORD6=17
|
||||
val SCE_LUA_WORD7=18
|
||||
val SCE_LUA_WORD8=19
|
||||
# Lexical states for SCLEX_ERRORLIST
|
||||
lex ErrorList=SCLEX_ERRORLIST SCE_ERR_
|
||||
val SCE_ERR_DEFAULT=0
|
||||
@@ -2058,14 +2067,20 @@ lex POV=SCLEX_POV SCE_POV_
|
||||
val SCE_POV_DEFAULT=0
|
||||
val SCE_POV_COMMENT=1
|
||||
val SCE_POV_COMMENTLINE=2
|
||||
val SCE_POV_COMMENTDOC=3
|
||||
val SCE_POV_NUMBER=4
|
||||
val SCE_POV_WORD=5
|
||||
val SCE_POV_NUMBER=3
|
||||
val SCE_POV_OPERATOR=4
|
||||
val SCE_POV_IDENTIFIER=5
|
||||
val SCE_POV_STRING=6
|
||||
val SCE_POV_OPERATOR=7
|
||||
val SCE_POV_IDENTIFIER=8
|
||||
val SCE_POV_BRACE=9
|
||||
val SCE_POV_STRINGEOL=7
|
||||
val SCE_POV_DIRECTIVE=8
|
||||
val SCE_POV_BADDIRECTIVE=9
|
||||
val SCE_POV_WORD2=10
|
||||
val SCE_POV_WORD3=11
|
||||
val SCE_POV_WORD4=12
|
||||
val SCE_POV_WORD5=13
|
||||
val SCE_POV_WORD6=14
|
||||
val SCE_POV_WORD7=15
|
||||
val SCE_POV_WORD8=16
|
||||
# Lexical states for SCLEX_LOUT
|
||||
lex LOUT=SCLEX_LOUT SCE_LOUT_
|
||||
val SCE_LOUT_DEFAULT=0
|
||||
@@ -2093,6 +2108,60 @@ val SCE_ESCRIPT_IDENTIFIER=8
|
||||
val SCE_ESCRIPT_BRACE=9
|
||||
val SCE_ESCRIPT_WORD2=10
|
||||
val SCE_ESCRIPT_WORD3=11
|
||||
# Lexical states for SCLEX_PS
|
||||
lex PS=SCLEX_PS SCE_PS_
|
||||
val SCE_PS_DEFAULT=0
|
||||
val SCE_PS_COMMENT=1
|
||||
val SCE_PS_DSC_COMMENT=2
|
||||
val SCE_PS_DSC_VALUE=3
|
||||
val SCE_PS_NUMBER=4
|
||||
val SCE_PS_NAME=5
|
||||
val SCE_PS_KEYWORD=6
|
||||
val SCE_PS_LITERAL=7
|
||||
val SCE_PS_IMMEVAL=8
|
||||
val SCE_PS_PAREN_ARRAY=9
|
||||
val SCE_PS_PAREN_DICT=10
|
||||
val SCE_PS_PAREN_PROC=11
|
||||
val SCE_PS_TEXT=12
|
||||
val SCE_PS_HEXSTRING=13
|
||||
val SCE_PS_BASE85STRING=14
|
||||
val SCE_PS_BADSTRINGCHAR=15
|
||||
# Lexical states for SCLEX_NSIS
|
||||
lex NSIS=SCLEX_NSIS SCE_NSIS_
|
||||
val SCE_NSIS_DEFAULT=0
|
||||
val SCE_NSIS_COMMENT=1
|
||||
val SCE_NSIS_STRINGDQ=2
|
||||
val SCE_NSIS_STRINGLQ=3
|
||||
val SCE_NSIS_STRINGRQ=4
|
||||
val SCE_NSIS_FUNCTION=5
|
||||
val SCE_NSIS_VARIABLE=6
|
||||
val SCE_NSIS_LABEL=7
|
||||
val SCE_NSIS_USERDEFINED=8
|
||||
val SCE_NSIS_SECTIONDEF=9
|
||||
val SCE_NSIS_SUBSECTIONDEF=10
|
||||
val SCE_NSIS_IFDEFINEDEF=11
|
||||
val SCE_NSIS_MACRODEF=12
|
||||
val SCE_NSIS_STRINGVAR=13
|
||||
# Lexical states for SCLEX_MMIXAL
|
||||
lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_
|
||||
val SCE_MMIXAL_LEADWS=0
|
||||
val SCE_MMIXAL_COMMENT=1
|
||||
val SCE_MMIXAL_LABEL=2
|
||||
val SCE_MMIXAL_OPCODE=3
|
||||
val SCE_MMIXAL_OPCODE_PRE=4
|
||||
val SCE_MMIXAL_OPCODE_VALID=5
|
||||
val SCE_MMIXAL_OPCODE_UNKNOWN=6
|
||||
val SCE_MMIXAL_OPCODE_POST=7
|
||||
val SCE_MMIXAL_OPERANDS=8
|
||||
val SCE_MMIXAL_NUMBER=9
|
||||
val SCE_MMIXAL_REF=10
|
||||
val SCE_MMIXAL_CHAR=11
|
||||
val SCE_MMIXAL_STRING=12
|
||||
val SCE_MMIXAL_REGISTER=13
|
||||
val SCE_MMIXAL_HEX=14
|
||||
val SCE_MMIXAL_OPERATOR=15
|
||||
val SCE_MMIXAL_SYMBOL=16
|
||||
val SCE_MMIXAL_INCLUDE=17
|
||||
|
||||
# Events
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user