From 0f927f65f49672c4faae52c472f39cd7651664c6 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 2 Oct 2011 03:26:06 +0200 Subject: [PATCH] updated Scintilla to 2.29 Signed-off-by: Sven Strickroth --- ext/scintilla/README | 29 +- ext/scintilla/backgroundcolors.patch | 61 +- ext/scintilla/doc/SciCoding.html | 96 +- ext/scintilla/doc/ScintillaDoc.html | 1714 ++++++-- ext/scintilla/doc/ScintillaDownload.html | 10 +- ext/scintilla/doc/ScintillaHistory.html | 1777 +++++++- ext/scintilla/doc/ScintillaRelated.html | 124 +- ext/scintilla/doc/ScintillaToDo.html | 44 +- ext/scintilla/doc/annotations.png | Bin 0 -> 33549 bytes ext/scintilla/doc/index.html | 159 +- ext/scintilla/doc/styledmargin.png | Bin 0 -> 17138 bytes ext/scintilla/gtk/Converter.h | 87 - ext/scintilla/gtk/PlatGTK.cxx | 2755 ------------ ext/scintilla/gtk/ScintillaGTK.cxx | 2714 ------------ ext/scintilla/gtk/deps.mak | 311 -- ext/scintilla/gtk/makefile | 96 - ext/scintilla/gtk/scintilla-marshal.c | 86 - ext/scintilla/gtk/scintilla-marshal.h | 21 - ext/scintilla/gtk/scintilla-marshal.list | 1 - ext/scintilla/gtk/scintilla.mak | 586 --- ext/scintilla/include/Accessor.h | 79 - ext/scintilla/include/Face.py | 43 +- ext/scintilla/include/HFacer.py | 20 +- ext/scintilla/include/ILexer.h | 69 + ext/scintilla/include/KeyWords.h | 90 - ext/scintilla/include/Platform.h | 62 +- ext/scintilla/include/PropSet.h | 104 - ext/scintilla/include/SString.h | 289 -- ext/scintilla/include/SciLexer.h | 237 +- ext/scintilla/include/Scintilla.h | 341 +- ext/scintilla/include/Scintilla.iface | 704 +++- ext/scintilla/include/ScintillaWidget.h | 18 +- ext/scintilla/include/WindowAccessor.h | 66 - ext/scintilla/lexers/LexA68k.cxx | 318 ++ ext/scintilla/{src => lexers}/LexAPDL.cxx | 15 +- ext/scintilla/{src => lexers}/LexASY.cxx | 27 +- ext/scintilla/{src => lexers}/LexAU3.cxx | 140 +- ext/scintilla/{src => lexers}/LexAVE.cxx | 19 +- ext/scintilla/{src => lexers}/LexAbaqus.cxx | 15 +- ext/scintilla/{src => lexers}/LexAda.cxx | 35 +- ext/scintilla/lexers/LexAsm.cxx | 464 ++ ext/scintilla/{src => lexers}/LexAsn1.cxx | 15 +- ext/scintilla/{src => lexers}/LexBaan.cxx | 15 +- ext/scintilla/{src => lexers}/LexBash.cxx | 284 +- ext/scintilla/{src => lexers}/LexBasic.cxx | 383 +- ext/scintilla/{src => lexers}/LexBullant.cxx | 19 +- ext/scintilla/{src => lexers}/LexCLW.cxx | 45 +- ext/scintilla/lexers/LexCOBOL.cxx | 379 ++ ext/scintilla/lexers/LexCPP.cxx | 1181 ++++++ ext/scintilla/{src => lexers}/LexCSS.cxx | 35 +- ext/scintilla/{src => lexers}/LexCaml.cxx | 185 +- ext/scintilla/{src => lexers}/LexCmake.cxx | 17 +- ext/scintilla/{src => lexers}/LexConf.cxx | 30 +- ext/scintilla/{src => lexers}/LexCrontab.cxx | 24 +- ext/scintilla/{src => lexers}/LexCsound.cxx | 24 +- ext/scintilla/lexers/LexD.cxx | 572 +++ ext/scintilla/{src => lexers}/LexEScript.cxx | 15 +- ext/scintilla/{src => lexers}/LexEiffel.cxx | 17 +- ext/scintilla/lexers/LexErlang.cxx | 623 +++ ext/scintilla/lexers/LexFlagship.cxx | 354 ++ ext/scintilla/lexers/LexForth.cxx | 179 + ext/scintilla/{src => lexers}/LexFortran.cxx | 23 +- ext/scintilla/{src => lexers}/LexGAP.cxx | 17 +- ext/scintilla/{src => lexers}/LexGui4Cli.cxx | 15 +- ext/scintilla/{src => lexers}/LexHTML.cxx | 693 ++- ext/scintilla/lexers/LexHaskell.cxx | 368 ++ ext/scintilla/{src => lexers}/LexInno.cxx | 74 +- ext/scintilla/{src => lexers}/LexKix.cxx | 15 +- ext/scintilla/{src => lexers}/LexLisp.cxx | 28 +- ext/scintilla/{src => lexers}/LexLout.cxx | 15 +- ext/scintilla/{src => lexers}/LexLua.cxx | 135 +- ext/scintilla/{src => lexers}/LexMMIXAL.cxx | 17 +- ext/scintilla/{src => lexers}/LexMPT.cxx | 46 +- ext/scintilla/{src => lexers}/LexMSSQL.cxx | 16 +- ext/scintilla/{src => lexers}/LexMagik.cxx | 19 +- ext/scintilla/lexers/LexMarkdown.cxx | 421 ++ ext/scintilla/{src => lexers}/LexMatlab.cxx | 27 +- ext/scintilla/{src => lexers}/LexMetapost.cxx | 31 +- ext/scintilla/lexers/LexModula.cxx | 743 ++++ ext/scintilla/lexers/LexMySQL.cxx | 533 +++ ext/scintilla/lexers/LexNimrod.cxx | 433 ++ ext/scintilla/{src => lexers}/LexNsis.cxx | 29 +- ext/scintilla/{src => lexers}/LexOpal.cxx | 71 +- ext/scintilla/{src => lexers}/LexOthers.cxx | 372 +- ext/scintilla/{src => lexers}/LexPB.cxx | 15 +- ext/scintilla/{src => lexers}/LexPLM.cxx | 15 +- ext/scintilla/{src => lexers}/LexPOV.cxx | 15 +- ext/scintilla/{src => lexers}/LexPS.cxx | 17 +- ext/scintilla/lexers/LexPascal.cxx | 594 +++ ext/scintilla/{src => lexers}/LexPerl.cxx | 1265 ++++-- ext/scintilla/lexers/LexPowerPro.cxx | 630 +++ ext/scintilla/{src => lexers}/LexPowerShell.cxx | 44 +- ext/scintilla/{src => lexers}/LexProgress.cxx | 44 +- ext/scintilla/{src => lexers}/LexPython.cxx | 236 +- ext/scintilla/{src => lexers}/LexR.cxx | 19 +- ext/scintilla/{src => lexers}/LexRebol.cxx | 15 +- ext/scintilla/{src => lexers}/LexRuby.cxx | 172 +- ext/scintilla/lexers/LexSML.cxx | 223 + ext/scintilla/lexers/LexSQL.cxx | 741 ++++ ext/scintilla/{src => lexers}/LexScriptol.cxx | 21 +- ext/scintilla/{src => lexers}/LexSmalltalk.cxx | 33 +- ext/scintilla/lexers/LexSorcus.cxx | 208 + ext/scintilla/{src => lexers}/LexSpecman.cxx | 13 +- ext/scintilla/{src => lexers}/LexSpice.cxx | 21 +- .../{src/LexPascal.cxx => lexers/LexTACL.cxx} | 233 +- ext/scintilla/{src => lexers}/LexTADS3.cxx | 29 +- .../{src/LexPascal.cxx => lexers/LexTAL.cxx} | 196 +- ext/scintilla/{src => lexers}/LexTCL.cxx | 29 +- ext/scintilla/{src => lexers}/LexTeX.cxx | 64 +- ext/scintilla/lexers/LexTxt2tags.cxx | 480 +++ ext/scintilla/{src => lexers}/LexVB.cxx | 49 +- ext/scintilla/{src => lexers}/LexVHDL.cxx | 62 +- ext/scintilla/{src => lexers}/LexVerilog.cxx | 76 +- ext/scintilla/{src => lexers}/LexYAML.cxx | 19 +- ext/scintilla/lexlib/Accessor.cxx | 79 + ext/scintilla/lexlib/Accessor.h | 35 + ext/scintilla/lexlib/CharacterSet.cxx | 61 + ext/scintilla/lexlib/CharacterSet.h | 148 + ext/scintilla/lexlib/LexAccessor.h | 175 + ext/scintilla/lexlib/LexerBase.cxx | 92 + ext/scintilla/lexlib/LexerBase.h | 41 + ext/scintilla/lexlib/LexerModule.cxx | 121 + ext/scintilla/lexlib/LexerModule.h | 82 + ext/scintilla/lexlib/LexerNoExceptions.cxx | 68 + ext/scintilla/lexlib/LexerNoExceptions.h | 32 + ext/scintilla/lexlib/LexerSimple.cxx | 57 + ext/scintilla/lexlib/LexerSimple.h | 30 + ext/scintilla/lexlib/OptionSet.h | 142 + ext/scintilla/lexlib/PropSetSimple.cxx | 170 + ext/scintilla/lexlib/PropSetSimple.h | 33 + ext/scintilla/lexlib/SparseState.h | 110 + ext/scintilla/{src => lexlib}/StyleContext.cxx | 9 +- ext/scintilla/{src => lexlib}/StyleContext.h | 55 +- ext/scintilla/lexlib/WordList.cxx | 219 + ext/scintilla/lexlib/WordList.h | 41 + ext/scintilla/src/AutoComplete.cxx | 15 +- ext/scintilla/src/AutoComplete.h | 6 +- ext/scintilla/src/CallTip.cxx | 15 +- ext/scintilla/src/CallTip.h | 8 +- ext/scintilla/src/{KeyWords.cxx => Catalogue.cxx} | 135 +- ext/scintilla/src/Catalogue.h | 26 + ext/scintilla/src/CellBuffer.cxx | 413 +- ext/scintilla/src/CellBuffer.h | 99 +- ext/scintilla/src/CharClassify.cxx | 5 + ext/scintilla/src/CharClassify.h | 11 +- ext/scintilla/src/CharacterSet.h | 58 - ext/scintilla/src/ContractionState.cxx | 33 +- ext/scintilla/src/ContractionState.h | 2 + ext/scintilla/src/Decoration.cxx | 6 +- ext/scintilla/src/Decoration.h | 4 +- ext/scintilla/src/Document.cxx | 896 +++- ext/scintilla/src/Document.h | 260 +- ext/scintilla/src/DocumentAccessor.cxx | 199 - ext/scintilla/src/DocumentAccessor.h | 76 - ext/scintilla/src/Editor.cxx | 4418 +++++++++++++------- ext/scintilla/src/Editor.h | 197 +- ext/scintilla/src/ExternalLexer.cxx | 124 +- ext/scintilla/src/ExternalLexer.h | 45 +- ext/scintilla/src/FontQuality.h | 12 + ext/scintilla/src/Indicator.cxx | 58 +- ext/scintilla/src/Indicator.h | 4 +- ext/scintilla/src/KeyMap.cxx | 47 +- ext/scintilla/src/KeyMap.h | 1 + ext/scintilla/src/LexAsm.cxx | 180 - ext/scintilla/src/LexCPP.cxx | 470 --- ext/scintilla/src/LexD.cxx | 358 -- ext/scintilla/src/LexErlang.cxx | 526 --- ext/scintilla/src/LexFlagship.cxx | 230 - ext/scintilla/src/LexForth.cxx | 352 -- ext/scintilla/src/LexGen.py | 124 +- ext/scintilla/src/LexHaskell.cxx | 274 -- ext/scintilla/src/LexMySQL.cxx | 367 -- ext/scintilla/src/LexSQL.cxx | 346 -- ext/scintilla/src/LineMarker.cxx | 158 +- ext/scintilla/src/LineMarker.h | 20 +- ext/scintilla/src/Partitioning.h | 9 +- ext/scintilla/src/PerLine.cxx | 491 +++ ext/scintilla/src/PerLine.h | 120 + ext/scintilla/src/PositionCache.cxx | 138 +- ext/scintilla/src/PositionCache.h | 39 +- ext/scintilla/src/PropSet.cxx | 755 ---- ext/scintilla/src/RESearch.cxx | 112 +- ext/scintilla/src/RunStyles.cxx | 38 +- ext/scintilla/src/RunStyles.h | 8 +- ext/scintilla/src/SVector.h | 34 +- ext/scintilla/src/SciTE.properties | 4 +- ext/scintilla/src/ScintillaBase.cxx | 411 +- ext/scintilla/src/ScintillaBase.h | 24 +- ext/scintilla/src/Selection.cxx | 375 ++ ext/scintilla/src/Selection.h | 188 + ext/scintilla/src/SplitVector.h | 31 +- ext/scintilla/src/Style.cxx | 139 +- ext/scintilla/src/Style.h | 64 +- ext/scintilla/src/UniConversion.cxx | 18 +- ext/scintilla/src/UniConversion.h | 3 +- ext/scintilla/src/ViewStyle.cxx | 191 +- ext/scintilla/src/ViewStyle.h | 35 +- ext/scintilla/src/WindowAccessor.cxx | 191 - ext/scintilla/src/XPM.cxx | 151 +- ext/scintilla/src/XPM.h | 66 +- ext/scintilla/tgzsrc | 4 + ext/scintilla/tortoisegit.txt | 6 + ext/scintilla/vcbuild/SciLexer.vcproj | 4326 ------------------- ext/scintilla/version.txt | 2 +- ext/scintilla/win32/Margin.cur | Bin 326 -> 0 bytes ext/scintilla/win32/PlatWin.cxx | 580 ++- ext/scintilla/win32/PlatformRes.h | 8 - ext/scintilla/win32/ScintRes.rc | 18 +- ext/scintilla/win32/ScintillaWin.cxx | 1642 +++++--- ext/scintilla/win32/deps.mak | 755 ++-- ext/scintilla/win32/makefile | 258 +- ext/scintilla/win32/scintilla.mak | 346 +- .../win32/{scintilla.mak => scintilla_vc6.mak} | 338 +- 213 files changed, 28951 insertions(+), 23286 deletions(-) create mode 100644 ext/scintilla/doc/annotations.png create mode 100644 ext/scintilla/doc/styledmargin.png delete mode 100644 ext/scintilla/gtk/Converter.h delete mode 100644 ext/scintilla/gtk/PlatGTK.cxx delete mode 100644 ext/scintilla/gtk/ScintillaGTK.cxx delete mode 100644 ext/scintilla/gtk/deps.mak delete mode 100644 ext/scintilla/gtk/makefile delete mode 100644 ext/scintilla/gtk/scintilla-marshal.c delete mode 100644 ext/scintilla/gtk/scintilla-marshal.h delete mode 100644 ext/scintilla/gtk/scintilla-marshal.list delete mode 100644 ext/scintilla/gtk/scintilla.mak delete mode 100644 ext/scintilla/include/Accessor.h create mode 100644 ext/scintilla/include/ILexer.h delete mode 100644 ext/scintilla/include/KeyWords.h delete mode 100644 ext/scintilla/include/PropSet.h delete mode 100644 ext/scintilla/include/SString.h delete mode 100644 ext/scintilla/include/WindowAccessor.h create mode 100644 ext/scintilla/lexers/LexA68k.cxx rename ext/scintilla/{src => lexers}/LexAPDL.cxx (94%) rename ext/scintilla/{src => lexers}/LexASY.cxx (94%) rename ext/scintilla/{src => lexers}/LexAU3.cxx (90%) rename ext/scintilla/{src => lexers}/LexAVE.cxx (94%) rename ext/scintilla/{src => lexers}/LexAbaqus.cxx (96%) rename ext/scintilla/{src => lexers}/LexAda.cxx (91%) create mode 100644 ext/scintilla/lexers/LexAsm.cxx rename ext/scintilla/{src => lexers}/LexAsn1.cxx (94%) rename ext/scintilla/{src => lexers}/LexBaan.cxx (94%) rename ext/scintilla/{src => lexers}/LexBash.cxx (62%) rename ext/scintilla/{src => lexers}/LexBasic.cxx (55%) rename ext/scintilla/{src => lexers}/LexBullant.cxx (93%) rename ext/scintilla/{src => lexers}/LexCLW.cxx (94%) create mode 100644 ext/scintilla/lexers/LexCOBOL.cxx create mode 100644 ext/scintilla/lexers/LexCPP.cxx rename ext/scintilla/{src => lexers}/LexCSS.cxx (91%) rename ext/scintilla/{src => lexers}/LexCaml.cxx (67%) rename ext/scintilla/{src => lexers}/LexCmake.cxx (96%) rename ext/scintilla/{src => lexers}/LexConf.cxx (85%) rename ext/scintilla/{src => lexers}/LexCrontab.cxx (91%) rename ext/scintilla/{src => lexers}/LexCsound.cxx (93%) create mode 100644 ext/scintilla/lexers/LexD.cxx rename ext/scintilla/{src => lexers}/LexEScript.cxx (95%) rename ext/scintilla/{src => lexers}/LexEiffel.cxx (95%) create mode 100644 ext/scintilla/lexers/LexErlang.cxx create mode 100644 ext/scintilla/lexers/LexFlagship.cxx create mode 100644 ext/scintilla/lexers/LexForth.cxx rename ext/scintilla/{src => lexers}/LexFortran.cxx (94%) rename ext/scintilla/{src => lexers}/LexGAP.cxx (93%) rename ext/scintilla/{src => lexers}/LexGui4Cli.cxx (95%) rename ext/scintilla/{src => lexers}/LexHTML.cxx (81%) create mode 100644 ext/scintilla/lexers/LexHaskell.cxx rename ext/scintilla/{src => lexers}/LexInno.cxx (76%) rename ext/scintilla/{src => lexers}/LexKix.cxx (92%) rename ext/scintilla/{src => lexers}/LexLisp.cxx (90%) rename ext/scintilla/{src => lexers}/LexLout.cxx (94%) rename ext/scintilla/{src => lexers}/LexLua.cxx (72%) rename ext/scintilla/{src => lexers}/LexMMIXAL.cxx (93%) rename ext/scintilla/{src => lexers}/LexMPT.cxx (81%) rename ext/scintilla/{src => lexers}/LexMSSQL.cxx (95%) rename ext/scintilla/{src => lexers}/LexMagik.cxx (94%) create mode 100644 ext/scintilla/lexers/LexMarkdown.cxx rename ext/scintilla/{src => lexers}/LexMatlab.cxx (93%) rename ext/scintilla/{src => lexers}/LexMetapost.cxx (94%) create mode 100644 ext/scintilla/lexers/LexModula.cxx create mode 100644 ext/scintilla/lexers/LexMySQL.cxx create mode 100644 ext/scintilla/lexers/LexNimrod.cxx rename ext/scintilla/{src => lexers}/LexNsis.cxx (92%) rename ext/scintilla/{src => lexers}/LexOpal.cxx (88%) rename ext/scintilla/{src => lexers}/LexOthers.cxx (78%) rename ext/scintilla/{src => lexers}/LexPB.cxx (96%) rename ext/scintilla/{src => lexers}/LexPLM.cxx (94%) rename ext/scintilla/{src => lexers}/LexPOV.cxx (95%) rename ext/scintilla/{src => lexers}/LexPS.cxx (96%) create mode 100644 ext/scintilla/lexers/LexPascal.cxx rename ext/scintilla/{src => lexers}/LexPerl.cxx (52%) create mode 100644 ext/scintilla/lexers/LexPowerPro.cxx rename ext/scintilla/{src => lexers}/LexPowerShell.cxx (79%) rename ext/scintilla/{src => lexers}/LexProgress.cxx (86%) rename ext/scintilla/{src => lexers}/LexPython.cxx (61%) rename ext/scintilla/{src => lexers}/LexR.cxx (93%) rename ext/scintilla/{src => lexers}/LexRebol.cxx (95%) rename ext/scintilla/{src => lexers}/LexRuby.cxx (92%) create mode 100644 ext/scintilla/lexers/LexSML.cxx create mode 100644 ext/scintilla/lexers/LexSQL.cxx rename ext/scintilla/{src => lexers}/LexScriptol.cxx (95%) rename ext/scintilla/{src => lexers}/LexSmalltalk.cxx (94%) create mode 100644 ext/scintilla/lexers/LexSorcus.cxx rename ext/scintilla/{src => lexers}/LexSpecman.cxx (95%) rename ext/scintilla/{src => lexers}/LexSpice.cxx (93%) copy ext/scintilla/{src/LexPascal.cxx => lexers/LexTACL.cxx} (62%) rename ext/scintilla/{src => lexers}/LexTADS3.cxx (96%) rename ext/scintilla/{src/LexPascal.cxx => lexers/LexTAL.cxx} (65%) rename ext/scintilla/{src => lexers}/LexTCL.cxx (94%) rename ext/scintilla/{src => lexers}/LexTeX.cxx (91%) create mode 100644 ext/scintilla/lexers/LexTxt2tags.cxx rename ext/scintilla/{src => lexers}/LexVB.cxx (86%) rename ext/scintilla/{src => lexers}/LexVHDL.cxx (91%) rename ext/scintilla/{src => lexers}/LexVerilog.cxx (80%) rename ext/scintilla/{src => lexers}/LexYAML.cxx (94%) create mode 100644 ext/scintilla/lexlib/Accessor.cxx create mode 100644 ext/scintilla/lexlib/Accessor.h create mode 100644 ext/scintilla/lexlib/CharacterSet.cxx create mode 100644 ext/scintilla/lexlib/CharacterSet.h create mode 100644 ext/scintilla/lexlib/LexAccessor.h create mode 100644 ext/scintilla/lexlib/LexerBase.cxx create mode 100644 ext/scintilla/lexlib/LexerBase.h create mode 100644 ext/scintilla/lexlib/LexerModule.cxx create mode 100644 ext/scintilla/lexlib/LexerModule.h create mode 100644 ext/scintilla/lexlib/LexerNoExceptions.cxx create mode 100644 ext/scintilla/lexlib/LexerNoExceptions.h create mode 100644 ext/scintilla/lexlib/LexerSimple.cxx create mode 100644 ext/scintilla/lexlib/LexerSimple.h create mode 100644 ext/scintilla/lexlib/OptionSet.h create mode 100644 ext/scintilla/lexlib/PropSetSimple.cxx create mode 100644 ext/scintilla/lexlib/PropSetSimple.h create mode 100644 ext/scintilla/lexlib/SparseState.h rename ext/scintilla/{src => lexlib}/StyleContext.cxx (87%) rename ext/scintilla/{src => lexlib}/StyleContext.h (75%) create mode 100644 ext/scintilla/lexlib/WordList.cxx create mode 100644 ext/scintilla/lexlib/WordList.h rename ext/scintilla/src/{KeyWords.cxx => Catalogue.cxx} (52%) create mode 100644 ext/scintilla/src/Catalogue.h delete mode 100644 ext/scintilla/src/CharacterSet.h delete mode 100644 ext/scintilla/src/DocumentAccessor.cxx delete mode 100644 ext/scintilla/src/DocumentAccessor.h create mode 100644 ext/scintilla/src/FontQuality.h delete mode 100644 ext/scintilla/src/LexAsm.cxx delete mode 100644 ext/scintilla/src/LexCPP.cxx delete mode 100644 ext/scintilla/src/LexD.cxx delete mode 100644 ext/scintilla/src/LexErlang.cxx delete mode 100644 ext/scintilla/src/LexFlagship.cxx delete mode 100644 ext/scintilla/src/LexForth.cxx delete mode 100644 ext/scintilla/src/LexHaskell.cxx delete mode 100644 ext/scintilla/src/LexMySQL.cxx delete mode 100644 ext/scintilla/src/LexSQL.cxx create mode 100644 ext/scintilla/src/PerLine.cxx create mode 100644 ext/scintilla/src/PerLine.h delete mode 100644 ext/scintilla/src/PropSet.cxx create mode 100644 ext/scintilla/src/Selection.cxx create mode 100644 ext/scintilla/src/Selection.h delete mode 100644 ext/scintilla/src/WindowAccessor.cxx create mode 100644 ext/scintilla/tgzsrc create mode 100644 ext/scintilla/tortoisegit.txt delete mode 100644 ext/scintilla/vcbuild/SciLexer.vcproj delete mode 100644 ext/scintilla/win32/Margin.cur delete mode 100644 ext/scintilla/win32/PlatformRes.h rewrite ext/scintilla/win32/deps.mak (92%) rewrite ext/scintilla/win32/makefile (79%) copy ext/scintilla/win32/{scintilla.mak => scintilla_vc6.mak} (53%) diff --git a/ext/scintilla/README b/ext/scintilla/README index 45bd3eff9..cada051b9 100644 --- a/ext/scintilla/README +++ b/ext/scintilla/README @@ -6,8 +6,8 @@ To build SciTE, Scintilla must first be built. *** GTK+/Linux version *** -You must first have GTK+ 1.2 or later and GCC (3.1 or better) installed. -GTK+ 1.0x will not work and when it did it was very slow. +You must first have GTK+ 2.0 or later and GCC (4.1 or better) installed. +GTK+ 1.x will not work. Other C++ compilers may work but may require tweaking the make file. To build Scintilla, use the makefile located in the scintilla/gtk directory @@ -29,10 +29,6 @@ and make install as this location is compiled into the executable. The global properties file is installed at $prefix/share/scite/SciTEGlobal.properties. The language specific properties files are also installed into this directory. -To build Scintilla for GTK+ 1 rather than the default GTK+ 2, define GTK1 on -the make command line: - make GTK1=1 - To remove SciTE make uninstall @@ -44,26 +40,31 @@ The current make file only supports static linking between SciTE and Scintilla. *** Windows version *** -A C++ compiler is required. Visual Studio .NET 2008 is the development system -used for most development although Mingw32 3.1 is also supported. -Borland did work but the command lines are now too long and the most recent -Borland version does not work. For older versions such as version 5.02, add the -l option. +A C++ compiler is required. Visual Studio .NET 2010 is the development system +used for most development although TDM Mingw32 4.4.1 is also supported. To build Scintilla, make in the scintilla/win32 directory cd scintilla\win32 GCC: mingw32-make VS .NET: nmake -f scintilla.mak -VC++ 6: nmake -f scintilla_vc6.mak -Borland: make -fscintilla.mak cd ..\.. To build SciTE, use the makefiles located in the scite/win32 directory cd scite\win32 GCC: mingw32-make VS .NET: nmake -f scite.mak -Borland: make -fscite.mak An executable SciTE will now be in scite\bin. -The Visual C++ 6.0 project (.dsp) files are no longer supported but are left +The Visual C++ 6.0 project (.dsp) and make files are no longer supported but are left in the download for people that are prepared to update them. + +*** GTK+/Windows version *** + +Mingw32 is known to work. Other compilers will probably not work. + +Only Scintilla will build with GTK+ on Windows. SciTE will not work. + +To build Scintilla, make in the scintilla/gtk directory + cd scintilla\gtk + mingw32-make diff --git a/ext/scintilla/backgroundcolors.patch b/ext/scintilla/backgroundcolors.patch index 5ab6f4248..04b7419c1 100644 --- a/ext/scintilla/backgroundcolors.patch +++ b/ext/scintilla/backgroundcolors.patch @@ -1,20 +1,22 @@ Index: include/Scintilla.h =================================================================== ---- include/Scintilla.h (revision 14337) -+++ include/Scintilla.h (working copy) -@@ -753,6 +753,7 @@ - #define SCN_AUTOCSELECTION 2022 - #define SCN_INDICATORCLICK 2023 - #define SCN_INDICATORRELEASE 2024 -+#define SCN_GETBKCOLOR 2025 +--- include/Scintilla.h (Revision 21909) ++++ include/Scintilla.h (Arbeitskopie) +@@ -923,6 +923,9 @@ #define SCN_AUTOCCANCELLED 2025 - //--Autogenerated -- end of section automatically generated from Scintilla.iface + #define SCN_AUTOCCHARDELETED 2026 + #define SCN_HOTSPOTRELEASECLICK 2027 ++ ++#define SCN_GETBKCOLOR 3000 ++ + /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ + /* These structures are defined to be exactly the same shape as the Win32 Index: src/Editor.cxx =================================================================== ---- src/Editor.cxx (revision 14337) -+++ src/Editor.cxx (working copy) -@@ -2270,6 +2270,17 @@ +--- src/Editor.cxx (Revision 21909) ++++ src/Editor.cxx (Arbeitskopie) +@@ -2804,6 +2804,17 @@ } } @@ -34,29 +36,42 @@ Index: src/Editor.cxx Index: src/Editor.h =================================================================== ---- src/Editor.h (revision 14337) -+++ src/Editor.h (working copy) -@@ -360,6 +360,7 @@ - virtual void NotifyFocus(bool focus); +--- src/Editor.h (Revision 21909) ++++ src/Editor.h (Arbeitskopie) +@@ -426,6 +426,7 @@ + virtual void SetCtrlID(int identifier); virtual int GetCtrlID() { return ctrlID; } virtual void NotifyParent(SCNotification scn) = 0; + virtual void NotifyParent(SCNotification * scn) = 0; virtual void NotifyStyleToNeeded(int endStyleNeeded); void NotifyChar(int ch); - void NotifyMove(int position); + void NotifySavePoint(bool isSavePoint); +Index: win32/scintilla.mak +=================================================================== +--- win32/scintilla.mak (Revision 21909) ++++ win32/scintilla.mak (Arbeitskopie) +@@ -21,7 +21,7 @@ + RC=rc + LD=link + +-CXXFLAGS=-Zi -TP -W4 -EHsc -Zc:forScope -Zc:wchar_t -D_CRT_SECURE_NO_DEPRECATE=1 ++CXXFLAGS=-Zi -TP -W0 -EHsc -Zc:forScope -Zc:wchar_t -D_CRT_SECURE_NO_DEPRECATE=1 + # For something scary:-Wp64 + CXXDEBUG=-Od -MTd -DDEBUG + CXXNDEBUG=-O1 -MT -DNDEBUG -GL Index: win32/ScintillaWin.cxx =================================================================== ---- win32/ScintillaWin.cxx (revision 14337) -+++ win32/ScintillaWin.cxx (working copy) -@@ -208,6 +208,7 @@ - virtual void NotifyFocus(bool focus); +--- win32/ScintillaWin.cxx (Revision 21909) ++++ win32/ScintillaWin.cxx (Arbeitskopie) +@@ -238,6 +238,7 @@ + virtual void SetCtrlID(int identifier); virtual int GetCtrlID(); virtual void NotifyParent(SCNotification scn); + virtual void NotifyParent(SCNotification * scn); virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); - virtual void Copy(); - virtual void CopyAllowLine(); -@@ -1240,6 +1241,13 @@ + virtual CaseFolder *CaseFolderForEncoding(); + virtual std::string CaseMapString(const std::string &s, int caseMapping); +@@ -1318,6 +1319,13 @@ GetCtrlID(), reinterpret_cast(&scn)); } diff --git a/ext/scintilla/doc/SciCoding.html b/ext/scintilla/doc/SciCoding.html index c7d072b86..1d45f0a73 100644 --- a/ext/scintilla/doc/SciCoding.html +++ b/ext/scintilla/doc/SciCoding.html @@ -98,55 +98,53 @@ Introduction

- The source code of Scintilla and SciTE follow my preferences. + The source code of Scintilla and SciTE follow my preferences. Some of these decisions are arbitrary and based on my sense of aesthetics but its good to have all the code look the same even if its not exactly how everyone would prefer.

Code that does not follow these conventions will be accepted, but will be modified - as time goes by to fit the conventions. Scintilla code follows the conventions more - closely than SciTE except for lexers which are relatively independent modules. + as time goes by to fit the conventions. Scintilla code follows the conventions more + closely than SciTE except for lexers which are relatively independent modules. Lexers that are maintained by others are left as they are submitted except that warnings will be fixed so the whole project can compile cleanly.

- The AStyle formatting - program with a '-tapO' argument formats code in much the right way although - there are a few bugs in AStyle. The scite/scripts/Fixer.py script will run AStyle - over a C++ source file and fix up some of those bugs. + The AStyle formatting + program with '-taOHUKk3 -M8' arguments formats code in much the right way although + there are a few bugs in AStyle.

Language features

- Design goals for Scintilla and SciTE include portability to currently available C++ + Design goals for Scintilla and SciTE include portability to currently available C++ compilers on diverse platforms with high performance and low resource usage. - Scintilla has stricter portability requirements to SciTE as it may be ported to - low capability platforms such as Windows CE or PalmOS but it is less likely - SciTE will be. + Scintilla has stricter portability requirements to SciTE as it may be ported to + low capability platforms.

- To achieve portability, only a subset of C++ features are used. Exceptions are - not available on some platforms such as Windows CE so exceptions are not used - and thus the standard C++ library can not be used. - Template support differs between compilers so is not used in Scintilla but there - are some simple uses in SciTE. - Run-time type information adds to memory use so is turned off. - Name spaces are not used. + To achieve portability, only a subset of C++ features are used. + Exceptions and templates may be used but, since Scintilla can be used from C as well as + C++, exceptions may not be thrown out of Scintilla and all exceptions should be caught + before returning from Scintilla. + Run-time type information adds to memory use so is turned off. + A 'Scintilla' name spaces is optionally used based on the SCI_NAMESPACE + definition. This helps with name clashes on OS X.

- The goto statement is not used because of bad memories from my first job - maintaining FORTRAN programs. The union feature is not used as it can lead to + The goto statement is not used because of bad memories from my first job + maintaining FORTRAN programs. The union feature is not used as it can lead to non-type-safe value access.

Casting

- Do not use old C style casts like (char *)s. Instead use the most strict form of C++ - cast possible like const_cast<char *>(s). Use static_cast and const_cast - where possible rather than reinterpret_cast. Because the code is compiled with + Do not use old C style casts like (char *)s. Instead use the most strict form of C++ + cast possible like const_cast<char *>(s). Use static_cast and const_cast + where possible rather than reinterpret_cast. Because the code is compiled with run-time type information turned off, dynamic_cast will not work.

@@ -162,26 +160,26 @@

To help ensure code is well written and portable, it is compiled with almost all - warnings turned on. This sometimes results in warnings about code that is - completely good (false positives) but changing the code to avoid the warnings - is generally fast and has little impact on readability. + warnings turned on. This sometimes results in warnings about code that is + completely good (false positives) but changing the code to avoid the warnings + is generally fast and has little impact on readability.

Initialise all variables and minimise the scope of variables. If a variable is defined just before its use then it can't be misused by code before that point. - Use loop declarations that are compatible with both the C++ standard and currently - available compilers. + Use loop declarations that are compatible with both the C++ standard and currently + available compilers.

Allocation

- As exceptions are not used, memory exhaustion can occur. - This should be checked for and handled but there is quite a lot of Scintilla and - SciTE code that doesn't yet. - Fixed length buffers are often used as these are simple and avoid the need to - worry about memory exhaustion but then require that buffer lengths are - respected. + Memory exhaustion can occur in many Scintilla methods. + This should be checked for and handled but once it has happened, it is very difficult to do + anything as Scintilla's data structures may be in an inconsistent state. + Fixed length buffers are often used as these are simple and avoid the need to + worry about memory exhaustion but then require that buffer lengths are + respected.

The C++ new and delete operators are preferred over C's malloc and free @@ -193,11 +191,11 @@

Start brackets, '{', should be located on the line of the control structure they start and end brackets, '}', should be at the indented start of a line. When there is - an else clause, this occurs on the same line as the '}'. + an else clause, this occurs on the same line as the '}'. This format uses less lines than alternatives, allowing more code to be seen on screen. - Fully bracketed control - structures are preferred because this makes it more likely that modifications will - be correct and it allows Scintilla's folder to work. No braces on returned + Fully bracketed control + structures are preferred because this makes it more likely that modifications will + be correct and it allows Scintilla's folder to work. No braces on returned expressions as return is a keyword, not a function call.

bool fn(int a) {
@@ -213,10 +211,10 @@ Spacing

- Spaces on both sides of '=' and comparison operators and no attempt to line up '='. + Spaces on both sides of '=' and comparison operators and no attempt to line up '='. No space before or after '(', when used in calls, but a space after every ','. - No spaces between tokens in short expressions but may be present in - longer expressions. Space before '{'. No space before ';'. + No spaces between tokens in short expressions but may be present in + longer expressions. Space before '{'. No space before ';'. No space after '*' when used to mean pointer and no space after '[' or ']'. One space between keywords and '('.

@@ -232,10 +230,10 @@

Identifiers use mixed case and no underscores. Class, function and method names start with an uppercase letter and use - further upper case letters to distinguish words. Variables start with a lower - case letter and use upper case letters to distinguish words. + further upper case letters to distinguish words. Variables start with a lower + case letter and use upper case letters to distinguish words. Loop counters and similar variables can have simple names like 'i'. - Function calls should be differentiated from method calls with an initial '::' + Function calls should be differentiated from method calls with an initial '::' global scope modifier.

class StorageZone {
@@ -247,5 +245,15 @@                 
}
        
}
}; +

+ Submitting a lexer +

+ +

Add a public feature request to the Feature Request Tracker.

+

Send all the modified and new files as full text (not patches) in an archive (.zip or .tgz).

+

Define all of the lexical states in a modified Scintilla.iface.

+

Ensure there are no warnings under the compiler you use. Warnings from other compilers + will be noted on the feature request.

+

sc.ch is an int: do not pass this around as a char.

diff --git a/ext/scintilla/doc/ScintillaDoc.html b/ext/scintilla/doc/ScintillaDoc.html index ea16a2e47..e70f44c28 100644 --- a/ext/scintilla/doc/ScintillaDoc.html +++ b/ext/scintilla/doc/ScintillaDoc.html @@ -9,17 +9,58 @@ - Scintilla and SciTE + Scintilla Documentation @@ -38,7 +79,7 @@

Scintilla Documentation

-

Last edited 20/June/2007 NH

+

Last edited 1/August/2011 NH

There is an overview of the internal design of Scintilla.
@@ -71,6 +112,10 @@

The GTK+ version also uses messages in a similar way to the Windows version. This is different to normal GTK+ practice but made it easier to implement rapidly.

+

Scintilla does not properly support right-to-left languages like Arabic and Hebrew. + While text in these languages may appear correct, it is not possible to interact with this text + as is normal with other editing components.

+

This documentation describes the individual messages and notifications used by Scintilla. It does not describe how to link them together to form a useful editor. For now, the best way to work out how to develop using Scintilla is to see how SciTE uses it. SciTE exercises most of @@ -174,98 +219,109 @@ o Selection and information + o Multiple Selection and Virtual Space + o Scrolling and automatic scrolling - - o White space + o White space + o Cursor o Mouse capture - - o Line endings + o Line endings + o Styling o Style definition - - o Caret, selection, and hotspot styles + o Caret, selection, and hotspot styles + o Margins + o Annotations + + + o Other settings o Brace highlighting - - o Tabs and Indentation Guides + + o Markers o Indicators + + o Autocompletion - o Autocompletion - o User lists o Call tips + + o Keyboard commands - o Keyboard commands - o Key bindings o Popup edit menu - - o Macro recording + + o Printing o Direct access - - o Multiple views + + o Folding o Line wrapping - - o Zooming + + o Long lines o Lexer + + o Lexer objects o Notifications - o GTK+ + o Images - o Deprecated messages + o GTK+ + o Deprecated messages + o Edit messages never supported by Scintilla - + o Building Scintilla + @@ -277,7 +333,7 @@

Text retrieval and modification

-

Each character in a Scintilla document is followed by an associated byte of styling +

Each byte in a Scintilla document is followed by an associated byte of styling information. The combination of a character byte and a style byte is called a cell. Style bytes are interpreted an index into an array of styles. Style bytes may be split into an index and a set of indicator bits @@ -289,9 +345,12 @@ languages, and three independent indicators so that, for example, syntax errors, deprecated names and bad indentation could all be displayed at once. The number of bits used for styles can be altered with SCI_SETSTYLEBITS up to a maximum of 7 bits. + href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS up to a maximum of 8 bits. The remaining bits can be used for indicators.

+

In this document, 'character' normally refers to a byte even when multi-byte characters are used. + Lengths measure the numbers of bytes, not the amount of characters in those bytes.

+

Positions within the Scintilla document refer to a character or the gap before that character. The first character in a document is 0, the second 1 and so on. If a document contains nLen characters, the last character is numbered nLen-1. @@ -316,7 +375,7 @@ *text)
SCI_SETREADONLY(bool readOnly)
SCI_GETREADONLY
- SCI_GETTEXTRANGE(<unused>, TextRange + SCI_GETTEXTRANGE(<unused>, Sci_TextRange *tr)
SCI_ALLOCATE(int bytes, <unused>)
SCI_ADDTEXT(int length, const char *s)
@@ -327,7 +386,7 @@ SCI_CLEARDOCUMENTSTYLE
SCI_GETCHARAT(int position)
SCI_GETSTYLEAT(int position)
- SCI_GETSTYLEDTEXT(<unused>, TextRange + SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr)
SCI_SETSTYLEBITS(int bits)
SCI_GETSTYLEBITS
@@ -398,9 +457,9 @@ href="#SCN_MODIFYATTEMPTRO">SCN_MODIFYATTEMPTRO notification.

SCI_GETTEXTRANGE(<unused>, TextRange *tr)
+ href="#Sci_TextRange">Sci_TextRange *tr)
This collects the text between the positions cpMin and cpMax and - copies it to lpstrText (see struct TextRange in + copies it to lpstrText (see struct Sci_TextRange in Scintilla.h). If cpMax is -1, text is returned to the end of the document. The text is 0 terminated, so you must supply a buffer that is at least 1 character longer than the number of characters you wish to read. The return value is the length of the @@ -413,11 +472,11 @@ href="#SCI_GETTEXT">SCI_GETTEXT

SCI_GETSTYLEDTEXT(<unused>, TextRange *tr)
+ href="#Sci_TextRange">Sci_TextRange *tr)
This collects styled text into a buffer using two bytes for each cell, with the character at the lower address of each pair and the style byte at the upper address. Characters between the positions cpMin and cpMax are copied to lpstrText (see - struct TextRange in Scintilla.h). Two 0 bytes are added to the end of + struct Sci_TextRange in Scintilla.h). Two 0 bytes are added to the end of the text, so the buffer that lpstrText points at must be at least 2*(cpMax-cpMin)+2 bytes long. No check is made for sensible values of cpMin or cpMax. Positions outside the document return character codes @@ -472,23 +531,23 @@

SCI_SETSTYLEBITS(int bits)
SCI_GETSTYLEBITS
This pair of routines sets and reads back the number of bits in each cell to use for styling, - to a maximum of 7 style bits. The remaining bits can be used as indicators. The standard + to a maximum of 8 style bits. The remaining bits can be used as indicators. The standard setting is SCI_SETSTYLEBITS(5). The number of styling bits needed by the current lexer can be found with SCI_GETSTYLEBITSNEEDED.

-

TextRange and CharacterRange
+

Sci_TextRange and Sci_CharacterRange
These structures are defined to be exactly the same shape as the Win32 TEXTRANGE and CHARRANGE, so that older code that treats Scintilla as a RichEdit will work.

-struct CharacterRange {
+struct Sci_CharacterRange {
     long cpMin;
     long cpMax;
 };
 
-struct TextRange {
-    struct CharacterRange chrg;
+struct Sci_TextRange {
+    struct Sci_CharacterRange chrg;
     char *lpstrText;
 };
 
@@ -518,9 +577,9 @@ struct TextRange { is limited and should only be used for simple cases and initial development. A different regular expression library can be integrated into Scintilla or can be called from the container using direct access to the buffer contents through - SCI_GETCHARACTERPOINTER. + SCI_GETCHARACTERPOINTER.

- SCI_FINDTEXT(int flags, TextToFind + SCI_FINDTEXT(int flags, Sci_TextToFind *ttf)
SCI_SEARCHANCHOR
SCI_SEARCHNEXT(int searchFlags, const char @@ -569,10 +628,9 @@ struct TextRange { -

If SCFIND_REGEXP is not included in the searchFlags, you can +

You can search backwards to find the previous occurrence of a search string by setting the end of the - search range before the start. If SCFIND_REGEXP is included, searches are always - from a lower position to a higher position, even if the search range is backwards.

+ search range before the start.

In a regular expression, special characters interpreted are:

@@ -666,36 +724,37 @@ struct TextRange { +

Regular expressions will only match ranges within a single line, never matching over multiple lines.

+

SCI_FINDTEXT(int searchFlags, TextToFind *ttf)
+ href="#Sci_TextToFind">Sci_TextToFind *ttf)
This message searches for text in the document. It does not use or move the current selection. The searchFlags argument controls the search type, which includes regular expression searches.

-

The TextToFind structure is defined in Scintilla.h; set +

The Sci_TextToFind structure is defined in Scintilla.h; set chrg.cpMin and chrg.cpMax with the range of positions in the document - to search. If SCFIND_REGEXP is not included in the flags, you can search backwards by - setting chrg.cpMax less than chrg.cpMin. If SCFIND_REGEXP - is included, the search is always forwards (even if chrg.cpMax is less than chrg.cpMin). - Set the lpstrText member of TextToFind to point at a zero terminated - text string holding the search pattern. If your language makes the use of TextToFind + to search. You can search backwards by + setting chrg.cpMax less than chrg.cpMin. + Set the lpstrText member of Sci_TextToFind to point at a zero terminated + text string holding the search pattern. If your language makes the use of Sci_TextToFind difficult, you should consider using SCI_SEARCHINTARGET instead.

The return value is -1 if the search fails or the position of the start of the found text if it succeeds. The chrgText.cpMin and chrgText.cpMax members of - TextToFind are filled in with the start and end positions of the found text.

+ Sci_TextToFind are filled in with the start and end positions of the found text.

See also: SCI_SEARCHINTARGET

-

TextToFind
+

Sci_TextToFind
This structure is defined to have exactly the same shape as the Win32 structure FINDTEXTEX for old code that treated Scintilla as a RichEdit control.

-struct TextToFind {
-    struct CharacterRange chrg;     // range to search
+struct Sci_TextToFind {
+    struct Sci_CharacterRange chrg;     // range to search
     char *lpstrText;                // the search pattern (zero terminated)
-    struct CharacterRange chrgText; // returned as position of matching text
+    struct Sci_CharacterRange chrgText; // returned as position of matching text
 };
 
@@ -716,9 +775,7 @@ struct TextToFind {

SCI_SEARCHNEXT and SCI_SEARCHPREV search for the next and previous occurrence of the zero terminated search string pointed at by text. The search is modified by - the searchFlags. If you request a regular - expression, SCI_SEARCHPREV finds the first occurrence of the search string in the - document, not the previous one before the anchor point.

+ the searchFlags.

The return value is -1 if nothing is found, otherwise the return value is the start position of the matching text. The selection is updated to show the matched text, but is not scrolled @@ -736,8 +793,8 @@ struct TextToFind { SCI_REPLACETARGET or SCI_REPLACETARGETRE.

Searching can be performed within the target range with SCI_SEARCHINTARGET, - which uses a counted string to allow searching for null characters. It returns the length of - range or -1 for failure, in which case the target is not moved. The flags used by + which uses a counted string to allow searching for null characters. It returns the + position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by SCI_SEARCHINTARGET such as SCFIND_MATCHCASE, SCFIND_WHOLEWORD, SCFIND_WORDSTART, and SCFIND_REGEXP can be set with SCI_SETSEARCHFLAGS. SCI_SEARCHINTARGET may be simpler @@ -757,6 +814,7 @@ struct TextToFind { *text)
SCI_REPLACETARGETRE(int length, const char *text)
+ SCI_GETTAG(int tagNumber, char *tagValue)

SCI_SETTARGETSTART(int pos)
@@ -803,6 +861,10 @@ struct TextToFind { After replacement, the target range refers to the replacement text. The return value is the length of the replacement string.

+

SCI_GETTAG(int tagNumber, char *tagValue)
+ Discover what text was matched by tagged expressions in a regular expression search. + This is useful if the application wants to interpret the replacement string itself.

+

See also: SCI_FINDTEXT

Overtype

@@ -873,8 +935,33 @@ struct TextToFind {

SCI_SETSTATUS(int status)
SCI_GETSTATUS
If an error occurs, Scintilla may set an internal error number that can be retrieved with - SCI_GETSTATUS. Not currently used but will be in the future. To clear the error - status call SCI_SETSTATUS(0).

+ SCI_GETSTATUS. + To clear the error status call SCI_SETSTATUS(0). + The currently defined statuses are: +

+ + + + + + + + + + + + + + + + + + + + + + +
SC_STATUS_OK0No failures
SC_STATUS_FAILURE1Generic failure
SC_STATUS_BADALLOC2Memory is exhausted

Undo and Redo

@@ -896,6 +983,7 @@ struct TextToFind { SCI_GETUNDOCOLLECTION
SCI_BEGINUNDOACTION
SCI_ENDUNDOACTION
+ SCI_ADDUNDOACTION(int token, int flags)

SCI_UNDO
@@ -943,6 +1031,29 @@ struct TextToFind { Alternatively, you can use these to mark a set of operations that you do not want to have combined with the preceding or following operations if they are undone.

+

SCI_ADDUNDOACTION(int token, int flags)
+ The container can add its own actions into the undo stack by calling + SCI_ADDUNDOACTION and an SCN_MODIFIED + notification will be sent to the container with the + SC_MOD_CONTAINER + flag when it is time to undo (SC_PERFORMED_UNDO) or + redo (SC_PERFORMED_REDO) the action. The token argument supplied is + returned in the token field of the notification.

+

For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then + it could call SCI_ADDUNDOACTION(line, 0) each time the command is performed. + Then when it receives a notification to undo or redo it toggles a bookmark on the line given by + the token field. If there are different types of commands or parameters that need to be stored into the undo + stack then the container should maintain a stack of its own for the document and use the current + position in that stack as the argument to SCI_ADDUNDOACTION(line). + SCI_ADDUNDOACTION commands are not combined together + into a single undo transaction unless grouped with SCI_BEGINUNDOACTION + and SCI_ENDUNDOACTION.

+ +

The flags argument can be UNDO_MAY_COALESCE (1) if the container action may be + coalesced along with any insertion and deletion actions into a single compound action, otherwise 0. + Coalescing treats coalescible container actions as transparent so will still only group together insertions that + look like typing or deletions that look like multiple uses of the Backspace or Delete keys. +

Selection and information

Scintilla maintains a selection that stretches between two points, the anchor and the @@ -954,6 +1065,7 @@ struct TextToFind { SCI_GETTEXTLENGTH
SCI_GETLENGTH
SCI_GETLINECOUNT
+ SCI_SETFIRSTVISIBLELINE(int lineDisplay)
SCI_GETFIRSTVISIBLELINE
SCI_LINESONSCREEN
SCI_GETMODIFY
@@ -968,6 +1080,7 @@ struct TextToFind { SCI_GETSELECTIONSTART
SCI_SETSELECTIONEND(int position)
SCI_GETSELECTIONEND
+ SCI_SETEMPTYSELECTION(int pos)
SCI_SELECTALL
SCI_LINEFROMPOSITION(int position)
SCI_POSITIONFROMLINE(int line)
@@ -978,6 +1091,9 @@ struct TextToFind { SCI_POSITIONFROMPOINT(int x, int y)
SCI_POSITIONFROMPOINTCLOSE(int x, int y)
+ SCI_CHARPOSITIONFROMPOINT(int x, int y)
+ SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int + y)
SCI_POINTXFROMPOSITION(<unused>, int position)
SCI_POINTYFROMPOSITION(<unused>, int @@ -1000,18 +1116,21 @@ struct TextToFind { SCI_TEXTWIDTH(int styleNumber, const char *text)
SCI_TEXTHEIGHT(int line)
SCI_CHOOSECARETX
+ SCI_MOVESELECTEDLINESUP
+ SCI_MOVESELECTEDLINESDOWN

SCI_GETTEXTLENGTH
SCI_GETLENGTH
- Both these messages return the length of the document in characters.

+ Both these messages return the length of the document in bytes.

SCI_GETLINECOUNT
This returns the number of lines in the document. An empty document contains 1 line. A document holding only an end of line sequence has 2 lines.

-

SCI_GETFIRSTVISIBLELINE
- This returns the line number of the first visible line in the Scintilla view. The first line +

SCI_SETFIRSTVISIBLELINE(int lineDisplay)
+ SCI_GETFIRSTVISIBLELINE
+ These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line in the document is numbered 0. The value is a visible line rather than a document line.

SCI_LINESONSCREEN
@@ -1114,6 +1233,9 @@ struct TextToFind { current position or the anchor position. SCI_GETSELECTIONEND returns the larger of the two values.

+

SCI_SETEMPTYSELECTION(int pos)
+ This removes any selection and sets the caret at pos. The caret is not scrolled into view.

+

SCI_SELECTALL
This selects all the text in the document. The current position is not scrolled into view.

@@ -1141,18 +1263,21 @@ struct TextToFind { the line not including any end of line characters, use SCI_GETLINEENDPOSITION(line) - SCI_POSITIONFROMLINE(line).

- SCI_GETSELTEXT(<unused>, char *text)
- This copies the currently selected text and a terminating 0 byte to the text - buffer. The buffer must be at least - SCI_GETSELECTIONEND()-SCI_GETSELECTIONSTART()+1 bytes long.
- If the text argument is 0 then the length that should be allocated - to store the entire selection is returned.
-

See also: SCI_GETCURLINE, SCI_GETLINE, SCI_GETTEXT, SCI_GETSTYLEDTEXT, SCI_GETTEXTRANGE

+

SCI_GETSELTEXT(<unused>, char *text)
+ This copies the currently selected text and a terminating 0 byte to the text + buffer. The buffer size should be determined by calling with a NULL pointer for the text argument + SCI_GETSELTEXT(0,0). + This allows for rectangular and discontiguous selections as well as simple selections. + See Multiple Selection for information on + how multiple and rectangular selections and virtual space are copied.

+ +

See also: SCI_GETCURLINE, + SCI_GETLINE, + SCI_GETTEXT, + SCI_GETSTYLEDTEXT, + SCI_GETTEXTRANGE +

SCI_GETCURLINE(int textLen, char *text)
This retrieves the text of the line containing the caret and returns the position within the @@ -1176,12 +1301,15 @@ struct TextToFind { SCI_GETSELECTIONMODE
The two functions set and get the selection mode, which can be stream (SC_SEL_STREAM=0) or - rectangular (SC_SEL_RECTANGLE=1) - or by lines (SC_SEL_LINES=2). + rectangular (SC_SEL_RECTANGLE=1) or + by lines (SC_SEL_LINES=2) + or thin rectangular (SC_SEL_THIN=3). When set in these modes, regular caret moves will extend or reduce the selection, until the mode is cancelled by a call with same value or with SCI_CANCEL. The get function returns the current mode even if the selection was made by mouse - or with regular extended moves.

+ or with regular extended moves. + SC_SEL_THIN is the mode after a rectangular selection has been typed into and ensures + that no characters are selected.

SCI_GETLINESELSTARTPOSITION(int line)
SCI_GETLINESELENDPOSITION(int line)
@@ -1314,6 +1442,13 @@ struct TextToFind { SCI_POSITIONFROMPOINTCLOSE is similar but returns -1 if the point is outside the window or not close to any characters.

+

SCI_CHARPOSITIONFROMPOINT(int x, int y)
+ SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y)
+ SCI_CHARPOSITIONFROMPOINT finds the closest character to a point and + SCI_CHARPOSITIONFROMPOINTCLOSE is similar but returns -1 if the point is outside the + window or not close to any characters. This is similar to the previous methods but finds characters rather than + inter-character positions.

+

SCI_POINTXFROMPOSITION(<unused>, int pos)
SCI_POINTYFROMPOSITION(<unused>, int pos)
These messages return the x and y display pixel location of text at position pos @@ -1330,6 +1465,230 @@ struct TextToFind { user and this value is then used when moving vertically such as by using the up and down keys. This message sets the current x position of the caret as the remembered value.

+

SCI_MOVESELECTEDLINESUP
+ Move the selected lines up one line, shifting the line above after the selection. + The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line. + If nothing was selected, the line the cursor is currently at will be selected.

+ +

SCI_MOVESELECTEDLINESDOWN
+ Move the selected lines down one line, shifting the line below before the selection. + The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line. + If nothing was selected, the line the cursor is currently at will be selected.

+ +

Multiple Selection and Virtual Space

+ + + SCI_SETMULTIPLESELECTION(bool multipleSelection)
+ SCI_GETMULTIPLESELECTION
+ SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)
+ SCI_GETADDITIONALSELECTIONTYPING
+ SCI_SETMULTIPASTE(int multiPaste)
+ SCI_GETMULTIPASTE
+ SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)
+ SCI_GETVIRTUALSPACEOPTIONS
+ SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)
+ SCI_GETRECTANGULARSELECTIONMODIFIER
+
+ + SCI_GETSELECTIONS
+ SCI_CLEARSELECTIONS
+ SCI_SETSELECTION(int caret, int anchor)
+ SCI_ADDSELECTION(int caret, int anchor)
+ SCI_SETMAINSELECTION(int selection)
+ SCI_GETMAINSELECTION
+
+ + SCI_SETSELECTIONNCARET(int selection, int pos)
+ SCI_GETSELECTIONNCARET(int selection)
+ SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)
+ SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)
+ SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)
+ SCI_GETSELECTIONNANCHOR(int selection)
+ SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)
+ SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)
+ SCI_SETSELECTIONNSTART(int selection, int pos)
+ SCI_GETSELECTIONNSTART(int selection)
+ SCI_SETSELECTIONNEND(int selection, int pos)
+ SCI_GETSELECTIONNEND(int selection)
+
+ + SCI_SETRECTANGULARSELECTIONCARET(int pos)
+ SCI_GETRECTANGULARSELECTIONCARET
+ SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)
+ SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE
+ SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)
+ SCI_GETRECTANGULARSELECTIONANCHOR
+ SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)
+ SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE
+
+ + SCI_SETADDITIONALSELALPHA(int alpha)
+ SCI_GETADDITIONALSELALPHA
+ SCI_SETADDITIONALSELFORE(int colour)
+ SCI_SETADDITIONALSELBACK(int colour)
+ SCI_SETADDITIONALCARETFORE(int colour)
+ SCI_GETADDITIONALCARETFORE
+ SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)
+ SCI_GETADDITIONALCARETSBLINK
+ SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)
+ SCI_GETADDITIONALCARETSVISIBLE
+
+ + SCI_SWAPMAINANCHORCARET
+ SCI_ROTATESELECTION
+
+ +

+ There may be multiple selections active at one time. + More selections are made by holding down the Ctrl key while dragging with the mouse. + The most recent selection is the main selection and determines which part of the document is shown automatically. + Any selection apart from the main selection is called an additional selection. + The calls in the previous section operate on the main selection. + There is always at least one selection. +

+ +

+ Rectangular selections are handled as multiple selections although the original rectangular range is remembered so that + subsequent operations may be handled differently for rectangular selections. For example, pasting a rectangular selection + places each piece in a vertical column. +

+ +

+ Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be + added to the document until there is some text typed or some other text insertion command is used. +

+ +

When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text + in order with no delimiting characters. + For rectangular selections the document's line end is added after each line's text. Rectangular selections + are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.

+ +

+ SCI_SETMULTIPLESELECTION(bool multipleSelection)
+ SCI_GETMULTIPLESELECTION
+ Enable or disable multiple selection. When multiple selection is disabled, it is not possible to select + multiple ranges by holding down the Ctrl key while dragging with the mouse.

+ +

+ SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)
+ SCI_GETADDITIONALSELECTIONTYPING
+ Whether typing, backspace, or delete works with multiple selections simultaneously.

+ +

+ SCI_SETMULTIPASTE(int multiPaste)
+ SCI_GETMULTIPASTE
+ When pasting into multiple selections, the pasted text can go into just the main selection with SC_MULTIPASTE_ONCE=0 + or into each selection with SC_MULTIPASTE_EACH=1. SC_MULTIPASTE_ONCE is the default.

+ +

+ SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)
+ SCI_GETVIRTUALSPACEOPTIONS
+ Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both. + There are two bit flags SCVS_RECTANGULARSELECTION=1 and + SCVS_USERACCESSIBLE=2 which can be set independently. + SCVS_NONE=0, the default, disables all use of virtual space.

+ +

+ SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)
+ SCI_GETRECTANGULARSELECTIONMODIFIER
+ On GTK+, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set. + The three possible values are SCMOD_CTRL=2 (default), SCMOD_ALT=4 or SCMOD_SUPER=8. + Since SCMOD_ALT is often already used by a window manager, the window manager may need configuring to allow this choice. + SCMOD_SUPER is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the + Command key on a Mac.

+ +

+ SCI_GETSELECTIONS
+ Return the number of selections currently active.

+ +

+ SCI_CLEARSELECTIONS
+ Set a single empty selection at 0 as the only selection.

+ +

+ SCI_SETSELECTION(int caret, int anchor)
+ Set a single selection from anchor to caret as the only selection.

+ +

+ SCI_ADDSELECTION(int caret, int anchor)
+ Add a new selection from anchor to caret as the main selection retaining all other + selections as additional selections. + Since there is always at least one selection, to set a list of selections, the first selection should be + added with SCI_SETSELECTION and later selections added with SCI_ADDSELECTION

+ +

+ SCI_SETMAINSELECTION(int selection)
+ SCI_GETMAINSELECTION
+ One of the selections is the main selection which is used to determine what range of text is automatically visible. + The main selection may be displayed in different colours or with a differently styled caret. + Only an already existing selection can be made main.

+ +

+ SCI_SETSELECTIONNCARET(int selection, int pos)
+ SCI_GETSELECTIONNCARET(int selection)
+ SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)
+ SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)
+ SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)
+ SCI_GETSELECTIONNANCHOR(int selection)
+ SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)
+ SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)
+ Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.

+ +

+ SCI_SETSELECTIONNSTART(int selection, int pos)
+ SCI_GETSELECTIONNSTART(int selection)
+ SCI_SETSELECTIONNEND(int selection, int pos)
+ SCI_GETSELECTIONNEND(int selection)
+ Set or query the start and end position of each already existing selection. + Mostly of use to query each range for its text.

+ +

+ SCI_SETRECTANGULARSELECTIONCARET(int pos)
+ SCI_GETRECTANGULARSELECTIONCARET
+ SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)
+ SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE
+ SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)
+ SCI_GETRECTANGULARSELECTIONANCHOR
+ SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)
+ SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE
+ Set or query the position and amount of virtual space for the caret and anchor of the rectangular selection. + After setting the rectangular selection, this is broken down into multiple selections, one for each line.

+ +

+ SCI_SETADDITIONALSELALPHA(int alpha)
+ SCI_GETADDITIONALSELALPHA
+ SCI_SETADDITIONALSELFORE(int colour)
+ SCI_SETADDITIONALSELBACK(int colour)
+ Modify the appearence of additional selections so that they can be differentiated from the main selection which has its appearence set with + SCI_SETSELALPHA, + SCI_GETSELALPHA, + SCI_SETSELFORE, and + SCI_SETSELBACK.

+ +

+ SCI_SETADDITIONALCARETFORE(int colour)
+ SCI_GETADDITIONALCARETFORE
+ SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)
+ SCI_GETADDITIONALCARETSBLINK
+ Modify the appearence of additional carets so that they can be differentiated from the main caret which has its appearence set with + SCI_SETCARETFORE, + SCI_GETCARETFORE, + SCI_SETCARETPERIOD, and + SCI_GETCARETPERIOD.

+ +

+ SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)
+ SCI_GETADDITIONALCARETSVISIBLE
+ Determine whether to show additional carets (defaults to true).

+ +

+ SCI_SWAPMAINANCHORCARET
+ SCI_ROTATESELECTION
+ These commands may be assigned to keys to make it possible to manipulate multiple selections. + SCI_SWAPMAINANCHORCARET moves the caret to the opposite end of the main selection. + SCI_ROTATESELECTION makes the next selection be the main selection. +

+

Scrolling and automatic scrolling

SCI_LINESCROLL(int column, int line)
SCI_SCROLLCARET
@@ -1677,11 +2036,18 @@ struct TextToFind { useWhitespaceForeColour, int colour)
SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int colour)
+ SCI_SETWHITESPACESIZE(int + size)
+ SCI_GETWHITESPACESIZE
+ SCI_SETEXTRAASCENT(int extraAscent)
+ SCI_GETEXTRAASCENT
+ SCI_SETEXTRADESCENT(int extraDescent)
+ SCI_GETEXTRADESCENT

SCI_SETVIEWWS(int wsMode)
SCI_GETVIEWWS
- White space can be made visible which may useful for languages in which white space is + White space can be made visible which may be useful for languages in which white space is significant, such as Python. Space characters appear as small centred dots and tab characters as light arrows pointing to the right. There are also ways to control the display of end of line characters. The two messages set and get the @@ -1728,6 +2094,25 @@ struct TextToFind { the lexer's colours with SCI_SETWHITESPACEFORE and SCI_SETWHITESPACEBACK.

+

SCI_SETWHITESPACESIZE(int size)
+ SCI_GETWHITESPACESIZE
+ SCI_SETWHITESPACESIZE sets the size of the dots used for mark space characters. + The SCI_GETWHITESPACESIZE message retrieves the current size. +

+ +

+ SCI_SETEXTRAASCENT(int extraAscent)
+ SCI_GETEXTRAASCENT
+ SCI_SETEXTRADESCENT(int extraDescent)
+ SCI_GETEXTRADESCENT
+ Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum + that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the + baseline (its 'descent'). + Space may be added to the maximum ascent (SCI_SETEXTRAASCENT) and the + maximum descent (SCI_SETEXTRADESCENT) to allow for more space between lines. + This may done to make the text easier to read or to accomodate underlines or highlights. +

+

Cursor

SCI_SETCURSOR(int curType)
@@ -2021,7 +2406,7 @@ struct TextToFind { SCI_STYLEGETFORE(int styleNumber)
SCI_STYLESETBACK(int styleNumber, int colour)
- SCI_STYLESETBACK(int styleNumber)
+ SCI_STYLEGETBACK(int styleNumber)
SCI_STYLESETEOLFILLED(int styleNumber, bool eolFilled)
SCI_STYLEGETEOLFILLED(int styleNumber)
@@ -2164,18 +2549,15 @@ struct TextToFind { it was not selected. When there is no selection, the current insertion point is marked by the text caret. This is a vertical line that is normally blinking on and off to attract the users attention.

- SCI_SETSELFORE(bool useSelectionForeColour, - int colour)
- SCI_SETSELBACK(bool useSelectionBackColour, - int colour)
+ SCI_SETSELFORE(bool useSelectionForeColour, int colour)
+ SCI_SETSELBACK(bool useSelectionBackColour, int colour)
SCI_SETSELALPHA(int alpha)
SCI_GETSELALPHA
SCI_SETSELEOLFILLED(bool filled)
SCI_GETSELEOLFILLED
SCI_SETCARETFORE(int colour)
SCI_GETCARETFORE
- SCI_SETCARETLINEVISIBLE(bool - show)
+ SCI_SETCARETLINEVISIBLE(bool show)
SCI_GETCARETLINEVISIBLE
SCI_SETCARETLINEBACK(int colour)
SCI_GETCARETLINEBACK
@@ -2187,20 +2569,17 @@ struct TextToFind { SCI_GETCARETSTYLE
SCI_SETCARETWIDTH(int pixels)
SCI_GETCARETWIDTH
- SCI_SETHOTSPOTACTIVEFORE(bool useSetting, - int colour)
+ SCI_SETHOTSPOTACTIVEFORE(bool useSetting, int colour)
SCI_GETHOTSPOTACTIVEFORE
- SCI_SETHOTSPOTACTIVEBACK(bool useSetting, - int colour)
+ SCI_SETHOTSPOTACTIVEBACK(bool useSetting, int colour)
SCI_GETHOTSPOTACTIVEBACK
SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)
SCI_GETHOTSPOTACTIVEUNDERLINE
SCI_SETHOTSPOTSINGLELINE(bool singleLine)
SCI_GETHOTSPOTSINGLELINE
- SCI_SETCONTROLCHARSYMBOL(int - symbol)
+ SCI_SETCONTROLCHARSYMBOL(int symbol)
SCI_GETCONTROLCHARSYMBOL
- SCI_SETCARETSTICKY(bool useCaretStickyBehaviour)
+ SCI_SETCARETSTICKY(int useCaretStickyBehaviour)
SCI_GETCARETSTICKY
SCI_TOGGLECARETSTICKY
@@ -2305,18 +2684,33 @@ struct TextToFind { You can read back the current symbol with the SCI_GETCONTROLCHARSYMBOL message. The default symbol value is 0.

-

SCI_SETCARETSTICKY(bool useCaretStickyBehaviour)
+

SCI_SETCARETSTICKY(int useCaretStickyBehaviour)
SCI_GETCARETSTICKY
SCI_TOGGLECARETSTICKY
- These messages set, get or toggle the caretSticky flag which controls when the last position - of the caret on the line is saved. When set to true, the position is not saved when you type - a character, a tab, paste the clipboard content or press backspace.

+ These messages set, get or toggle the caretSticky setting which controls when the last position + of the caret on the line is saved.

+ +

When set to SC_CARETSTICKY_OFF (0), the sticky flag is off; all text changes + (and all caret position changes) will remember the + caret's new horizontal position when moving to different lines. This is the default.

+ +

When set to SC_CARETSTICKY_ON (1), the sticky flag is on, and the only thing which will cause the editor to remember the + horizontal caret position is moving the caret with mouse or keyboard (left/right arrow keys, home/end keys, etc).

+ +

When set to SC_CARETSTICKY_WHITESPACE (2), the caret acts like mode 0 (sticky off) except under one + special case; when space or tab characters are inserted. (Including pasting only space/tabs -- undo, redo, + etc. do not exhibit this behavior..).

+ +

SCI_TOGGLECARETSTICKY switches from SC_CARETSTICKY_ON and SC_CARETSTICKY_WHITESPACE + to SC_CARETSTICKY_OFF and from SC_CARETSTICKY_OFF to SC_CARETSTICKY_ON.

Margins

There may be up to five margins to the left of the text display, plus a gap either side of - the text. Each margin can be set to display either symbols or line numbers with SCI_SETMARGINTYPEN. The markers + the text. Each margin can be set to display only symbols, line numbers, or text with SCI_SETMARGINTYPEN. + Textual margins may also display symbols. + The markers that can be displayed in each margin are set with SCI_SETMARGINMASKN. Any markers not associated with a visible margin will be displayed as changes in background colour in the text. A width in @@ -2330,6 +2724,10 @@ struct TextToFind { is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it is hidden. Of course, you can set the margins to be whatever you wish.

+ +

Styled text margins used to show revision and blame information:

+

Styled text margins used to show revision and blame information

+ SCI_SETMARGINTYPEN(int margin, int type)
SCI_GETMARGINTYPEN(int margin)
@@ -2343,6 +2741,10 @@ struct TextToFind { sensitive)
SCI_GETMARGINSENSITIVEN(int margin)
+ SCI_SETMARGINCURSORN(int margin, int + cursor)
+ SCI_GETMARGINCURSORN(int + margin)
SCI_SETMARGINLEFT(<unused>, int pixels)
SCI_GETMARGINLEFT
@@ -2351,6 +2753,17 @@ struct TextToFind { SCI_GETMARGINRIGHT
SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)
SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)
+ SCI_MARGINSETTEXT(int line, char *text)
+ SCI_MARGINGETTEXT(int line, char *text)
+ SCI_MARGINSETSTYLE(int line, int style)
+ SCI_MARGINGETSTYLE(int line)
+ SCI_MARGINSETSTYLES(int line, char *styles)
+ SCI_MARGINGETSTYLES(int line, char *styles)
+ SCI_MARGINTEXTCLEARALL
+ SCI_MARGINSETSTYLEOFFSET(int style)
+ SCI_MARGINGETSTYLEOFFSET
+ SCI_SETMARGINOPTIONS(int marginOptions)
+ SCI_GETMARGINOPTIONS

SCI_SETMARGINTYPEN(int margin, int iType)
@@ -2358,6 +2771,8 @@ struct TextToFind { These two routines set and get the type of a margin. The margin argument should be 0, 1, 2, 3 or 4. You can use the predefined constants SC_MARGIN_SYMBOL (0) and SC_MARGIN_NUMBER (1) to set a margin as either a line number or a symbol margin. + A margin with application defined text may use SC_MARGIN_TEXT (4) or + SC_MARGIN_RTEXT (5) to right justify the text. By convention, margin 0 is used for line numbers and the next two are used for symbols. You can also use the constants SC_MARGIN_BACK (2) and SC_MARGIN_FORE (3) for symbol margins that set their background colour to match the STYLE_DEFAULT background and @@ -2392,9 +2807,10 @@ struct TextToFind { sure that no symbol margin includes 0x400 in its mask, any line with the marker gets the background colour changed.

-

To set a non-folding margin 1 use SCI_SETMARGINMASKN(1, ~SC_MASK_FOLDERS); to - set a folding margin 2 use SCI_SETMARGINMASKN(2, SC_MASK_FOLDERS). This is the - default set by Scintilla. ~SC_MASK_FOLDERS is 0x1FFFFFF in hexadecimal or 33554431 +

To set a non-folding margin 1 use SCI_SETMARGINMASKN(1, ~SC_MASK_FOLDERS) + which is the default set by Scintilla. + To set a folding margin 2 use SCI_SETMARGINMASKN(2, SC_MASK_FOLDERS). + ~SC_MASK_FOLDERS is 0x1FFFFFF in hexadecimal or 33554431 decimal. Of course, you may need to display all 32 symbols in a margin, in which case use SCI_SETMARGINMASKN(margin, -1).

@@ -2408,6 +2824,14 @@ struct TextToFind { selection margins which make it easy to select ranges of lines. By default, all margins are insensitive.

+

SCI_SETMARGINCURSORN(int margin, int + cursor)
+ SCI_GETMARGINCURSORN(int margin)
+ A reversed arrow cursor is normally shown over all margins. This may be changed to a normal arrow with + SCI_SETMARGINCURSORN(margin, SC_CURSORARROW) or restored to a + reversed arrow with + SCI_SETMARGINCURSORN(margin, SC_CURSORREVERSEARROW).

+

SCI_SETMARGINLEFT(<unused>, int pixels)
SCI_GETMARGINLEFT
SCI_SETMARGINRIGHT(<unused>, int pixels)
@@ -2421,6 +2845,136 @@ struct TextToFind { On Windows the fold margin colour defaults to ::GetSysColor(COLOR_3DFACE) and the fold margin highlight colour to ::GetSysColor(COLOR_3DHIGHLIGHT).

+

+ SCI_MARGINSETTEXT(int line, char *text)
+ SCI_MARGINGETTEXT(int line, char *text)
+ SCI_MARGINSETSTYLE(int line, int style)
+ SCI_MARGINGETSTYLE(int line)
+ SCI_MARGINSETSTYLES(int line, char *styles)
+ SCI_MARGINGETSTYLES(int line, char *styles)
+ SCI_MARGINTEXTCLEARALL
+ Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT. + A different string may be set for each line with SCI_MARGINSETTEXT. + The whole of the text margin on a line may be displayed in a particular style with + SCI_MARGINSETSTYLE or each character may be individually styled with + SCI_MARGINSETSTYLES which uses an array of bytes with each byte setting the style + of the corresponding text byte similar to SCI_SETSTYLINGEX. + Setting a text margin will cause a + SC_MOD_CHANGEMARGIN + notification to be sent. +

+

+ SCI_MARGINSETSTYLEOFFSET(int style)
+ SCI_MARGINGETSTYLEOFFSET
+ Margin styles may be completely separated from standard text styles by setting a style offset. For example, + SCI_MARGINSETSTYLEOFFSET(256) would allow the margin styles to be numbered from + 256 upto 511 so they do not overlap styles set by lexers. Each style number set with SCI_MARGINSETSTYLE + or SCI_MARGINSETSTYLES has the offset added before looking up the style. +

+

+ SCI_SETMARGINOPTIONS(int marginOptions)
+ SCI_GETMARGINOPTIONS
+ Define margin options by enabling appropriate bit flags. At the moment, only one flag is available + SC_MARGINOPTION_SUBLINESELECT=1, which controls how wrapped lines are selected when clicking + on margin in front of them. If SC_MARGINOPTION_SUBLINESELECT is set only sub line of wrapped + line is selected, otherwise whole wrapped line is selected. Margin options are set to + SC_MARGINOPTION_NONE=0 by default. +

+ +

Annotations

+ +

Annotations are read-only lines of text underneath each line of editable text. + An annotation may consist of multiple lines separated by '\n'. + Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to + line up different versions of text in a merge tool.

+

Annotations used for inline diagnostics:

+

Annotations used for inline diagnostics

+ + + SCI_ANNOTATIONSETTEXT(int line, char *text)
+ SCI_ANNOTATIONGETTEXT(int line, char *text)
+ SCI_ANNOTATIONSETSTYLE(int line, int style)
+ SCI_ANNOTATIONGETSTYLE(int line)
+ SCI_ANNOTATIONSETSTYLES(int line, char *styles)
+ SCI_ANNOTATIONGETSTYLES(int line, char *styles)
+ SCI_ANNOTATIONGETLINES(int line)
+ SCI_ANNOTATIONCLEARALL
+ SCI_ANNOTATIONSETVISIBLE(int visible)
+ SCI_ANNOTATIONGETVISIBLE
+ SCI_ANNOTATIONSETSTYLEOFFSET(int style)
+ SCI_ANNOTATIONGETSTYLEOFFSET
+
+ +

+ SCI_ANNOTATIONSETTEXT(int line, char *text)
+ SCI_ANNOTATIONGETTEXT(int line, char *text)
+ SCI_ANNOTATIONSETSTYLE(int line, int style)
+ SCI_ANNOTATIONGETSTYLE(int line)
+ SCI_ANNOTATIONSETSTYLES(int line, char *styles)
+ SCI_ANNOTATIONGETSTYLES(int line, char *styles)
+ SCI_ANNOTATIONGETLINES(int line)
+ SCI_ANNOTATIONCLEARALL
+ A different string may be set for each line with SCI_ANNOTATIONSETTEXT. + To clear annotations call SCI_ANNOTATIONSETTEXT with a NULL pointer. + The whole of the text ANNOTATION on a line may be displayed in a particular style with + SCI_ANNOTATIONSETSTYLE or each character may be individually styled with + SCI_ANNOTATIONSETSTYLES which uses an array of bytes with each byte setting the style + of the corresponding text byte similar to SCI_SETSTYLINGEX. The text must be set first as it + specifies how long the annotation is so how many bytes of styling to read. + Setting an annotation will cause a + SC_MOD_CHANGEANNOTATION + notification to be sent. +

+

+ The number of lines annotating a line can be retrieved with SCI_ANNOTATIONGETLINES. + All the lines can be cleared of annotations with SCI_ANNOTATIONCLEARALL + which is equivalent to clearing each line (setting to 0) and then deleting other memory used for this feature. +

+

+ SCI_ANNOTATIONSETVISIBLE(int visible)
+ SCI_ANNOTATIONGETVISIBLE
+ Annotations can be made visible in a view and there is a choice of display style when visible. + The two messages set and get the annotation display mode. The visible + argument can be one of:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ANNOTATION_HIDDEN0Annotations are not displayed.
ANNOTATION_STANDARD1Annotations are drawn left justified with no adornment.
ANNOTATION_BOXED2Annotations are indented to match the text and are surrounded by a box.
+ +

+ SCI_ANNOTATIONSETSTYLEOFFSET(int style)
+ SCI_ANNOTATIONGETSTYLEOFFSET
+ Annotation styles may be completely separated from standard text styles by setting a style offset. For example, + SCI_ANNOTATIONSETSTYLEOFFSET(512) would allow the annotation styles to be numbered from + 512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256). + Each style number set with SCI_ANNOTATIONSETSTYLE + or SCI_ANNOTATIONSETSTYLES has the offset added before looking up the style. +

+

Other settings

SCI_SETUSEPALETTE(bool allowPaletteUse)
@@ -2429,6 +2983,8 @@ struct TextToFind { SCI_GETBUFFEREDDRAW
SCI_SETTWOPHASEDRAW(bool twoPhase)
SCI_GETTWOPHASEDRAW
+ SCI_SETFONTQUALITY(int fontQuality)
+ SCI_GETFONTQUALITY
SCI_SETCODEPAGE(int codePage)
SCI_GETCODEPAGE
SCI_SETKEYSUNICODE(bool keysUnicode)
@@ -2490,6 +3046,16 @@ struct TextToFind { transparent mode. Two phase drawing may flicker more than single phase unless buffered drawing is on. The default is for drawing to be two phase.

+

SCI_SETFONTQUALITY(int fontQuality)
+ SCI_GETFONTQUALITY
+ Manage font quality (antialiasing method). Currently, the following values are available on Windows: + SC_EFF_QUALITY_DEFAULT (backward compatible), + SC_EFF_QUALITY_NON_ANTIALIASED, + SC_EFF_QUALITY_ANTIALIASED, + SC_EFF_QUALITY_LCD_OPTIMIZED.

+

In case it is necessary to squeeze more options into this property, only a limited number of bits defined + by SC_EFF_QUALITY_MASK (0xf) will be used for quality.

+

SCI_SETCODEPAGE(int codePage)
SCI_GETCODEPAGE
Scintilla has some support for Japanese, Chinese and Korean DBCS. Use this message with @@ -2506,29 +3072,12 @@ struct TextToFind { normal Unicode encoding before being drawn by the OS and thus can display Hebrew, Arabic, Cyrillic, and Han characters. Languages which can use two characters stacked vertically in one horizontal space, such as Thai, will mostly work but there are some issues where the characters - are drawn separately leading to visual glitches. Bi-directional text is not supported. Characters outside the - Basic Multilingual Plane are unlikely to work.

+ are drawn separately leading to visual glitches. Bi-directional text is not supported.

-

On Windows, code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), +

Code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab) although these may require installation of language specific support.

-

On GTK+, code page SC_CP_DBCS (1) sets Scintilla into - multi byte character mode as is required for Japanese language processing with - the EUC encoding.

- -

For GTK+ 1.x, the locale should be set to a Unicode locale with a call similar to - setlocale(LC_CTYPE, "en_US.UTF-8"). Fonts with an "iso10646" registry - should be used in a font set. Font sets are a comma separated list of partial font - specifications where each partial font specification can be in the form: - foundry-fontface-charsetregistry-encoding or - fontface-charsetregistry-encoding or foundry-fontface or - fontface. An example is "misc-fixed-iso10646-1,*". - On GTK+ 2.x, Pango fonts should be used rather than font sets.

- -

Setting codePage to a non-zero value that is not SC_CP_UTF8 is - operating system dependent.

-

SCI_SETKEYSUNICODE(bool keysUnicode)
SCI_GETKEYSUNICODE
On Windows, character keys are normally handled differently depending on whether Scintilla is a wide @@ -2571,6 +3120,8 @@ struct TextToFind { SCI_BRACEHIGHLIGHT(int pos1, int pos2)
SCI_BRACEBADLIGHT(int pos1)
+ SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)
+ SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)
SCI_BRACEMATCH(int position, int maxReStyle)
@@ -2585,10 +3136,16 @@ struct TextToFind {

SCI_BRACEBADLIGHT(int pos1)
If there is no matching brace then the brace - badlighting style, style BRACE_BADLIGHT (35), can be used to show the brace + badlighting style, style STYLE_BRACEBAD (35), can be used to show the brace that is unmatched. Using a position of INVALID_POSITION (-1) removes the highlight.

+

SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)
+ Use specified indicator to highlight matching braces instead of changing their style.

+ +

SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)
+ Use specified indicator to highlight non matching brace instead of changing its style.

+

SCI_BRACEMATCH(int pos, int maxReStyle)
The SCI_BRACEMATCH message finds a corresponding matching brace given pos, the position of one brace. The brace characters handled are '(', ')', '[', @@ -2630,8 +3187,7 @@ struct TextToFind { SCI_GETLINEINDENTATION(int line)
SCI_GETLINEINDENTPOSITION(int line)
- SCI_SETINDENTATIONGUIDES(bool - view)
+ SCI_SETINDENTATIONGUIDES(int indentView)
SCI_GETINDENTATIONGUIDES
SCI_SETHIGHLIGHTGUIDE(int column)
SCI_GETHIGHLIGHTGUIDE
@@ -2687,7 +3243,7 @@ struct TextToFind {

There are 4 indentation guide views. SC_IV_NONE turns the feature off but the other 3 states determine how far the guides appear on - empty lines. + empty lines.

@@ -2715,8 +3271,8 @@ struct TextToFind { This setting is good for most languages. +
-

SCI_SETHIGHLIGHTGUIDE(int column)
SCI_GETHIGHLIGHTGUIDE
@@ -2727,7 +3283,7 @@ struct TextToFind {

Markers

-

There are 32 markers, numbered 0 to 31, and you can assign any combination of them to each +

There are 32 markers, numbered 0 to MARKER_MAX (31), and you can assign any combination of them to each line in the document. Markers appear in the selection margin to the left of the text. If the selection margin is set to zero width, the background colour of the whole line is changed instead. Marker numbers 25 to 31 are used by @@ -2752,10 +3308,19 @@ struct TextToFind { markerSymbols)
SCI_MARKERDEFINEPIXMAP(int markerNumber, const char *xpm)
+ SCI_RGBAIMAGESETWIDTH(int width)
+ SCI_RGBAIMAGESETHEIGHT(int height)
+ SCI_MARKERDEFINERGBAIMAGE(int markerNumber, + const char *pixels)
+ SCI_MARKERSYMBOLDEFINED(int markerNumber) +
SCI_MARKERSETFORE(int markerNumber, int colour)
SCI_MARKERSETBACK(int markerNumber, int colour)
+ SCI_MARKERSETBACKSELECTED(int markerNumber, int + colour)
+ SCI_MARKERENABLEHIGHLIGHT(int enabled)
SCI_MARKERSETALPHA(int markerNumber, int alpha)
SCI_MARKERADD(int line, int markerNumber)
@@ -2779,16 +3344,21 @@ struct TextToFind { SC_MARK_CIRCLE, SC_MARK_ROUNDRECT, SC_MARK_ARROW, SC_MARK_SMALLRECT, SC_MARK_SHORTARROW, SC_MARK_EMPTY, SC_MARK_ARROWDOWN, SC_MARK_MINUS, SC_MARK_PLUS, - SC_MARK_ARROWS, SC_MARK_DOTDOTDOT, SC_MARK_EMPTY, - SC_MARK_BACKGROUND, SC_MARK_LEFTRECT - and SC_MARK_FULLRECT.

+ SC_MARK_ARROWS, SC_MARK_DOTDOTDOT, + SC_MARK_BACKGROUND, SC_MARK_LEFTRECT, + SC_MARK_FULLRECT, and SC_MARK_UNDERLINE.

The SC_MARK_BACKGROUND marker changes the background colour of the line only. The SC_MARK_FULLRECT symbol mirrors this, changing only the margin background colour. + SC_MARK_UNDERLINE draws an underline across the text. The SC_MARK_EMPTY symbol is invisible, allowing client code to track the movement of lines. You would also use it if you changed the folding style and wanted one or more of the SC_FOLDERNUM_* markers to have no associated symbol.

+

Applications may use the marker symbol SC_MARK_AVAILABLE to indicate that + plugins may allocate that marker number. +

+

There are also marker symbols designed for use in the folding margin in a flattened tree style.
SC_MARK_BOXMINUS, SC_MARK_BOXMINUSCONNECTED, @@ -2922,22 +3492,39 @@ struct TextToFind {

SCI_MARKERDEFINEPIXMAP(int markerNumber, const char *xpm)
- Markers can be set to pixmaps with this message. The XPM format is used for the pixmap and it - is limited to pixmaps that use one character per pixel with no named colours. - The transparent colour may be named 'None'. - The data should be null terminated. - Pixmaps use the SC_MARK_PIXMAP marker symbol. You can find the full description of - the XPM format here.

+ Markers can be set to pixmaps with this message. The + XPM format is used for the pixmap. + Pixmaps use the SC_MARK_PIXMAP marker symbol.

+ +

+ SCI_RGBAIMAGESETWIDTH(int width)
+ SCI_RGBAIMAGESETHEIGHT(int height)
+ SCI_MARKERDEFINERGBAIMAGE(int markerNumber, const char *pixels)
+ Markers can be set to translucent pixmaps with this message. The + RGBA format is used for the pixmap. + The width and height must previously been set with the SCI_RGBAIMAGESETWIDTH and + SCI_RGBAIMAGESETHEIGHT messages. + Pixmaps use the SC_MARK_RGBAIMAGE marker symbol.

+ +

SCI_MARKERSYMBOLDEFINED(int markerNumber)
+ Returns the symbol defined for a markerNumber with SCI_MARKERDEFINE + or SC_MARK_PIXMAP if defined with SCI_MARKERDEFINEPIXMAP + or SC_MARK_RGBAIMAGE if defined with SCI_MARKERDEFINERGBAIMAGE.

SCI_MARKERSETFORE(int markerNumber, int colour)
SCI_MARKERSETBACK(int markerNumber, int colour)
- These two messages set the foreground and background colour of a marker number.

+ These two messages set the foreground and background colour of a marker number.
+ SCI_MARKERSETBACKSELECTED(int markerNumber, int colour)
+ This message sets the highlight background colour of a marker number when its folding block is selected. The default colour is #FF0000.

+

SCI_MARKERENABLEHIGHLIGHT(bool enabled)
+ This message allows to enable/disable the highlight folding block when it is selected. (i.e. block that contains the caret)

SCI_MARKERSETALPHA(int markerNumber, int alpha)
When markers are drawn in the content area, either because there is no margin for them or - they are of SC_MARK_BACKGROUND type, they may be drawn translucently by + they are of SC_MARK_BACKGROUND or SC_MARK_UNDERLINE types, they may be drawn translucently by setting an alpha value.

SCI_MARKERADD(int line, int markerNumber)
@@ -3019,6 +3606,12 @@ struct TextToFind { SCI_INDICSETFORE(int indicatorNumber, int colour)
SCI_INDICGETFORE(int indicatorNumber)
+ SCI_INDICSETALPHA(int indicatorNumber, int alpha)
+ SCI_INDICGETALPHA(int indicatorNumber)
+ SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)
+ SCI_INDICGETOUTLINEALPHA(int indicatorNumber)
+ SCI_INDICSETUNDER(int indicatorNumber, bool under)
+ SCI_INDICGETUNDER(int indicatorNumber)

SCI_INDICSETSTYLE(int indicatorNumber, int @@ -3052,7 +3645,7 @@ struct TextToFind { 1 - A squiggly underline. + A squiggly underline. Requires 3 pixels of descender space. @@ -3101,8 +3694,63 @@ struct TextToFind { 7 A rectangle with rounded corners around the text using translucent drawing with the - interior more transparent than the border. + interior usually more transparent than the border. You can use + SCI_INDICSETALPHA and + SCI_INDICSETOUTLINEALPHA + to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour. + + + INDIC_STRAIGHTBOX + + 8 + + A rectangle around the text using translucent drawing with the + interior usually more transparent than the border. You can use + SCI_INDICSETALPHA and + SCI_INDICSETOUTLINEALPHA + to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour. + + + + INDIC_DASH + + 9 + + A dashed underline. + + + + INDIC_DOTS + + 10 + + A dotted underline. + + + + INDIC_SQUIGGLELOW + + 11 + + Similar to INDIC_SQUIGGLE but only using 2 vertical pixels + so will fit under small fonts. + + + + INDIC_DOTBOX + + 12 + + A dotted rectangle around the text using translucent drawing. + Translucency alternates between the alpha and outline alpha settings with the top-left pixel using the alpha setting. + SCI_INDICSETALPHA and + SCI_INDICSETOUTLINEALPHA + control the alpha transparency values. The default values are 30 for alpha and 50 for outline alpha. + To avoid excessive memory allocation the maximum width of a dotted box is 4000 pixels. + Not available for OS X Carbon. + + @@ -3111,8 +3759,7 @@ struct TextToFind { SCI_INDICSETSTYLE(1, INDIC_TT);
SCI_INDICSETSTYLE(2, INDIC_PLAIN);

-

SCI_INDICSETFORE(int indicatorNumber, int colour)
+

SCI_INDICSETFORE(int indicatorNumber, int colour)
SCI_INDICGETFORE(int indicatorNumber)
These two messages set and get the colour used to draw an indicator. The default indicator colours are equivalent to:
@@ -3120,13 +3767,27 @@ struct TextToFind { SCI_INDICSETFORE(1, 0xff0000); (light blue)
SCI_INDICSETFORE(2, 0x0000ff); (light red)

+

SCI_INDICSETALPHA(int indicatorNumber, int alpha)
+ SCI_INDICGETALPHA(int indicatorNumber)
+ These two messages set and get the alpha transparency used for drawing the + fill colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from + 0 (completely transparent) to 255 (no transparency). +

+ +

SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)
+ SCI_INDICGETOUTLINEALPHA(int indicatorNumber)
+ These two messages set and get the alpha transparency used for drawing the + outline colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from + 0 (completely transparent) to 255 (no transparency). +

+

SCI_INDICSETUNDER(int indicatorNumber, bool under)
SCI_INDICGETUNDER(int indicatorNumber)
These two messages set and get whether an indicator is drawn under text or over(default). Drawing under text works only for modern indicators when two phase drawing is enabled.

-

Modern Indicators

+

Modern Indicators

Modern indicators are stored in a format similar to run length encoding which is efficient in both speed and storage for sparse information.

@@ -3136,8 +3797,8 @@ struct TextToFind { SCI_SETINDICATORCURRENT(int indicator)
SCI_GETINDICATORCURRENT
These two messages set and get the indicator that will be affected by calls to - SCI_INDICATORFILLRANGE and - SCI_INDICATORCLEARRANGE. + SCI_INDICATORFILLRANGE(int position, int fillLength) and + SCI_INDICATORCLEARRANGE(int position, int clearLength).

@@ -3172,7 +3833,7 @@ struct TextToFind { Can be used to iterate through the document to discover all the indicator positions.

-

Style Byte Indicators (deprecated)

+

Style Byte Indicators (deprecated)

By default, Scintilla organizes the style byte associated with each text byte as 5 bits of style information (for 32 styles) and 3 bits of indicator information for 3 independent indicators so that, for example, syntax errors, deprecated names and bad indentation could all @@ -3193,7 +3854,7 @@ struct TextToFind { when you are done.

The number of bits used for styles can be altered with SCI_SETSTYLEBITS from 0 to 7 bits. The remaining bits + href="#SCI_SETSTYLEBITS">SCI_SETSTYLEBITS from 0 to 8 bits. The remaining bits can be used for indicators, so there can be from 1 to 8 indicators. However, the INDIC*_MASK constants defined in Scintilla.h all assume 5 bits of styling information and 3 indicators. If you use a different arrangement, you must define your @@ -3234,6 +3895,8 @@ struct TextToFind { SCI_AUTOCSELECT(<unused>, const char *select)
SCI_AUTOCGETCURRENT
+ SCI_AUTOCGETCURRENTTEXT(<unused>, + char *text)
SCI_AUTOCSETCANCELATSTART(bool cancel)
SCI_AUTOCGETCANCELATSTART
@@ -3250,7 +3913,8 @@ struct TextToFind { SCI_AUTOCSETDROPRESTOFWORD(bool dropRestOfWord)
SCI_AUTOCGETDROPRESTOFWORD
- SCI_REGISTERIMAGE
+ SCI_REGISTERIMAGE(int type, const char *xpmData)
+ SCI_REGISTERRGBAIMAGE(int type, const char *pixels)
SCI_CLEARREGISTEREDIMAGES
SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)
SCI_AUTOCGETTYPESEPARATOR
@@ -3268,8 +3932,7 @@ struct TextToFind { and SCI_AUTOCGETSEPARATOR.

-

The list of words should be in sorted order. If set to ignore case mode with SCI_AUTOCSETIGNORECASE, then +

The list of words should be in sorted order. If set to ignore case mode with SCI_AUTOCSETIGNORECASE, then strings are matched after being converted to upper case. One result of this is that the list should be sorted with the punctuation characters '[', '\', ']', '^', '_', and '`' sorted after letters.

@@ -3313,12 +3976,22 @@ struct TextToFind { item is found, it is selected. If the item is not found, the autocompletion list closes if auto-hide is true (see SCI_AUTOCSETAUTOHIDE).
- The current selection can be retrieved with SCI_AUTOCGETCURRENT -

+ The current selection index can be retrieved with SCI_AUTOCGETCURRENT.

+ +

SCI_AUTOCGETCURRENTTEXT(<unused>, char *text)
+ This message retrieves the current selected text in the autocompletion list. Normally the + SCN_AUTOCSELECTION notification + is used instead.

+ +

The value is copied to the text buffer, returning the length (not including the + terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.

+ +

If the value argument is 0 then the length that should be allocated to store the value is + returned; again, the terminating 0 is not included.

SCI_AUTOCSETCANCELATSTART(bool cancel)
SCI_AUTOCGETCANCELATSTART
- The default behavior is for the list to be cancelled if the caret moves before the location it + The default behavior is for the list to be cancelled if the caret moves to the location it was at when the list was displayed. By calling this message with a false argument, the list is not cancelled until the caret moves before the first character of the word being completed.

@@ -3354,6 +4027,7 @@ struct TextToFind {

SCI_REGISTERIMAGE(int type, const char *xpmData)
+ SCI_REGISTERRGBAIMAGE(int type, const char *pixels)
SCI_CLEARREGISTEREDIMAGES
SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)
SCI_AUTOCGETTYPESEPARATOR
@@ -3361,8 +4035,11 @@ struct TextToFind { Autocompletion list items may display an image as well as text. Each image is first registered with an integer type. Then this integer is included in the text of the list separated by a '?' from the text. For example, "fclose?2 fopen" displays image 2 before the string "fclose" and no image before "fopen". - The images are in XPM format as is described for - SCI_MARKERDEFINEPIXMAP + The images are in either the XPM format (SCI_REGISTERIMAGE) or + RGBA format (SCI_REGISTERRGBAIMAGE). + For SCI_REGISTERRGBAIMAGE the width and height must previously been set with + the SCI_RGBAIMAGESETWIDTH and + SCI_RGBAIMAGESETHEIGHT messages. The set of registered images can be cleared with SCI_CLEARREGISTEREDIMAGES and the '?' separator changed with SCI_AUTOCSETTYPESEPARATOR.

@@ -3608,7 +4285,7 @@ struct TextToFind { SCI_HOMEEXTEND - [SCI_HOMERECTEXTEND] + SCI_HOMERECTEXTEND @@ -3747,6 +4424,20 @@ struct TextToFind { SCI_SELECTIONDUPLICATE + SCI_VERTICALCENTRECARET + + + + + SCI_MOVESELECTEDLINESUP + + SCI_MOVESELECTEDLINESDOWN + + + + SCI_SCROLLTOSTART + + SCI_SCROLLTOEND @@ -3760,7 +4451,7 @@ struct TextToFind { capitalisation (aCamelCaseIdentifier) or underscores (an_under_bar_ident).

The SCI_HOME* commands move the caret to the start of the line, while the - SCI_VCHOME*commands move the caret to the first non-blank character of the line + SCI_VCHOME* commands move the caret to the first non-blank character of the line (ie. just after the indentation) unless it is already there; in this case, it acts as SCI_HOME*.

The SCI_[HOME|LINEEND]DISPLAY* commands are used when in line wrap mode to @@ -3774,6 +4465,12 @@ struct TextToFind { as appropriate for SCI_[[VC]HOME|LINEEND]*.

+

The SCI_SCROLLTO[START|END] commands scroll the document to the start + or end without changing the selection. These commands match OS X platform conventions for the behaviour of the + home and end keys. Scintilla can be made to match OS X applications + by binding the home and end keys to these commands. +

+

Key bindings

There is a default binding of keys to commands that is defined in the Scintilla source in @@ -3806,7 +4503,10 @@ struct TextToFind { SCK_WIN.

The modifiers are a combination of zero or more of SCMOD_ALT, - SCMOD_CTRL, and SCMOD_SHIFT. If you are building a table, you might + SCMOD_CTRL, SCMOD_SHIFT, and SCMOD_META. + On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to + SCMOD_META. + If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers.

SCI_ASSIGNCMDKEY(int - SCI_FORMATRANGE(bool bDraw, RangeToFormat + SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)
SCI_SETPRINTMAGNIFICATION(int magnification)
@@ -3864,7 +4564,7 @@ struct TextToFind { SCI_GETPRINTWRAPMODE
-

SCI_FORMATRANGE(bool bDraw, RangeToFormat *pfr)
+

SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)
This call allows Windows users to render a range of text into a device context. If you use this for printing, you will probably want to arrange a page header and footer; Scintilla does not do this for you. See SciTEWin::Print() in SciTEWinDlg.cxx for an @@ -3875,12 +4575,14 @@ struct TextToFind { (for example, if you use this with MFC you will need to paginate in OnBeginPrinting() before you output each page.

-struct RangeToFormat {
-    SurfaceID hdc;        // The HDC (device context) we print to
-    SurfaceID hdcTarget;  // The HDC we use for measuring (may be same as hdc)
-    PRectangle rc;        // Rectangle in which to print
-    PRectangle rcPage;    // Physically printable page size
-    CharacterRange chrg;  // Range of characters to print
+struct Sci_Rectangle { int left; int top; int right; int bottom; };
+
+struct Sci_RangeToFormat {
+    Sci_SurfaceID hdc;        // The HDC (device context) we print to
+    Sci_SurfaceID hdcTarget;  // The HDC we use for measuring (may be same as hdc)
+    Sci_Rectangle rc;         // Rectangle in which to print
+    Sci_Rectangle rcPage;     // Physically printable page size
+    Sci_CharacterRange chrg;  // Range of characters to print
 };
 
@@ -4149,6 +4851,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_SETFOLDEXPANDED(int line, bool expanded)
SCI_GETFOLDEXPANDED(int line)
+ SCI_CONTRACTEDFOLDNEXT(int lineStart)
SCI_TOGGLEFOLD(int line)
SCI_ENSUREVISIBLE(int line)
SCI_ENSUREVISIBLEENFORCEPOLICY(int @@ -4213,48 +4916,53 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ - - + + - - - + + + - + + - + + - + + - + + - + + + folding. The appearance of this feature may change in the future.
ValueSymbolValue Effect
1Experimental - draw boxes if expanded1Experimental feature that has been removed.
2SC_FOLDFLAG_LINEBEFORE_EXPANDED2 Draw above if expanded
4SC_FOLDFLAG_LINEBEFORE_CONTRACTED4 Draw above if not expanded
8SC_FOLDFLAG_LINEAFTER_EXPANDED8 Draw below if expanded
16SC_FOLDFLAG_LINEAFTER_CONTRACTED16 Draw below if not expanded
64SC_FOLDFLAG_LEVELNUMBERS64 display hexadecimal fold levels in line margin to aid debugging of - folding. This feature needs to be redesigned to be sensible.
@@ -4294,6 +5002,13 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ until you had finished. See SciTEBase::FoldAll() and SciTEBase::Expand() for examples of the use of these messages.

+

SCI_CONTRACTEDFOLDNEXT(int lineStart)
+ Search efficiently for lines that are contracted fold headers. + This is useful when saving the user's folding when switching documents or saving folding with a file. + The search starts at line number lineStart and continues forwards to the end of the file. + lineStart is returned if it is a contracted fold header otherwise the next contracted + fold header is returned. If there are no more contracted fold headers then -1 is returned.

+

SCI_ENSUREVISIBLE(int line)
SCI_ENSUREVISIBLEENFORCEPOLICY(int line)
A line may be hidden because more than one of its parent lines is contracted. Both these @@ -4310,6 +5025,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
SCI_GETWRAPVISUALFLAGS
SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)
SCI_GETWRAPVISUALFLAGSLOCATION
+ SCI_SETWRAPINDENTMODE(int indentMode)
+ SCI_GETWRAPINDENTMODE
SCI_SETWRAPSTARTINDENT(int indent)
SCI_GETWRAPSTARTINDENT
SCI_SETLAYOUTCACHE(int cacheMode)
@@ -4329,7 +5046,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

For wrapped lines Scintilla can draw visual flags (little arrows) at end of a a subline of a wrapped line and at begin of the next subline. These can be enabled individually, but if Scintilla - draws the visual flag at begin of the next subline this subline will be indented by one char. + draws the visual flag at the beginning of the next subline this subline will be indented by one char. Independent from drawing a visual flag at the begin the subline can have an indention.

Much of the time used by Scintilla is spent on laying out and drawing text. The same text @@ -4365,7 +5082,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_GETWRAPVISUALFLAGS
You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in wrapVisualFlags determine which visual flags are drawn. - +

@@ -4400,8 +5117,9 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)
SCI_GETWRAPVISUALFLAGSLOCATION
- You can set wether the visual flags to indicate a line is wrapped are drawn near the border or near the text. + You can set whether the visual flags to indicate a line is wrapped are drawn near the border or near the text. Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag. +

@@ -4428,16 +5146,53 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ - +
SC_WRAPVISUALFLAGLOC_START_BY_TEXT 2Visual flag at begin of subline drawn near textVisual flag at beginning of subline drawn near text
+ +

SCI_SETWRAPINDENTMODE(int indentMode)
+ SCI_GETWRAPINDENTMODE
+ Wrapped sublines can be indented to the position of their first subline or one more indent level. + The default is SC_WRAPINDENT_FIXED. + The modes are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SymbolValueEffect
SC_WRAPINDENT_FIXED0Wrapped sublines aligned to left of window plus amount set by + SCI_SETWRAPSTARTINDENT
SC_WRAPINDENT_SAME1Wrapped sublines are aligned to first subline indent
SC_WRAPINDENT_INDENT2Wrapped sublines are aligned to first subline indent plus one more level of indentation
+

SCI_SETWRAPSTARTINDENT(int indent)
SCI_GETWRAPSTARTINDENT
SCI_SETWRAPSTARTINDENT sets the size of indentation of sublines for - wrapped lines in terms of the width of a space in + wrapped lines in terms of the average character width in STYLE_DEFAULT. There are no limits on indent sizes, but values less than 0 or large values may have undesirable effects.
@@ -4494,7 +5249,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ -

SCI_SETPOSITIONCACHE(int size)
SCI_GETPOSITIONCACHE
@@ -4618,25 +5372,32 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

Lexer

If you define the symbol SCI_LEXER when building Scintilla, (this is sometimes - called the SciLexer version of Scintilla), lexing support for a wide range programming + called the SciLexer version of Scintilla), lexing support for a wide range of programming languages is included and the messages in this section are supported. If you want to set styling and fold points for an unsupported language you can either do this in the container or better still, write your own lexer following the pattern of one of the existing ones.

-

Scintilla also supports external lexers. These are DLLs (on Windows) or .so modules (on GTK+/Linux) that export four - functions: GetLexerCount, GetLexerName, Lex and - Fold. See externalLexer.cxx for more.

+

Scintilla also supports external lexers. These are DLLs (on Windows) or .so modules (on GTK+/Linux) that export three + functions: GetLexerCount, GetLexerName, and + GetLexerFactory. See externalLexer.cxx for more.

SCI_SETLEXER(int lexer)
SCI_GETLEXER
- SCI_SETLEXERLANGUAGE(<unused>, char + SCI_SETLEXERLANGUAGE(<unused>, const char *name)
- SCI_LOADLEXERLIBRARY(<unused>, char + SCI_GETLEXERLANGUAGE(<unused>, char + *name)
+ SCI_LOADLEXERLIBRARY(<unused>, const char *path)
SCI_COLOURISE(int start, int end)
+ SCI_CHANGELEXERSTATE(int start, int end)
+ SCI_PROPERTYNAMES(<unused>, char *names)
+ SCI_PROPERTYTYPE(const char *name)
+ SCI_DESCRIBEPROPERTY(const char *name, char *description)
SCI_SETPROPERTY(const char *key, const char *value)
SCI_GETPROPERTY(const char *key, char *value)
SCI_GETPROPERTYEXPANDED(const char *key, char *value)
SCI_GETPROPERTYINT(const char *key, int default)
+ SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)
SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)
SCI_GETSTYLEBITSNEEDED @@ -4654,7 +5415,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ assigns unused lexer numbers to.

SCI_SETLEXERLANGUAGE(<unused>, const char *name)
- This message lets you select a lexer by name, and is the only method if you are using an + SCI_GETLEXERLANGUAGE(<unused>, char *name)
+ SCI_SETLEXERLANGUAGE lets you select a lexer by name, and is the only method if you are using an external lexer or if you have written a lexer module for a language of your own and do not wish to assign it an explicit lexer number. To select an existing lexer, set name to match the (case sensitive) name given to the module, for example "ada" or "python", not "Ada" @@ -4666,6 +5428,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ href="#SCI_GETLEXER">SCI_GETLEXER before and after setting the new lexer to see if the lexer number changed.

+

SCI_GETLEXERLANGUAGE retrieves the name of the lexer.

+

SCI_LOADLEXERLIBRARY(<unused>, const char *path)
Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.

@@ -4678,6 +5442,21 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ "1" and your lexer or container supports folding, fold levels are also set. This message causes a redraw.

+

SCI_CHANGELEXERSTATE(int startPos, int endPos)
+ Indicate that the internal state of a lexer has changed over a range and therefore + there may be a need to redraw.

+ +

SCI_PROPERTYNAMES(<unused>, char *names)
+ SCI_PROPERTYTYPE(const char *name)
+ SCI_DESCRIBEPROPERTY(const char *name, char *description)
+ Information may be retrieved about the properties that can be set for the current lexer. + This information is only available for newer lexers. + SCI_PROPERTYNAMES returns a string with all of the valid properties separated by "\n". + If the lexer does not support this call then an empty string is returned. + Properties may be boolean (SC_TYPE_BOOLEAN), integer (SC_TYPE_INTEGER), + or string (SC_TYPE_STRING) and this is found with SCI_PROPERTYTYPE. + A description of a property in English is returned by SCI_DESCRIBEPROPERTY.

+

SCI_SETPROPERTY(const char *key, const char *value)
You can communicate settings to lexers with keyword:value string pairs. There is no limit to the number of keyword pairs you can set, other than available memory. key is a @@ -4702,6 +5481,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Property names should start with "lexer.<lexer>." or "fold.<lexer>." when they apply to one lexer or start with "lexer." or "fold." if they apply to multiple lexers.

+

Applications may discover the set of properties used by searching the source code of lexers for lines that contain + GetProperty and a double quoted string and extract the value of the double quoted string as the property name. + The scintilla/src/LexGen.py script does this and can be used as an example. + Documentation for the property may be located above the call as a multi-line comment starting with +
// property <property-name>

+

SCI_GETPROPERTY(const char *key, char *value)
Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied buffer and return the length (not including the terminating 0). If not found, copy an empty string @@ -4754,11 +5539,281 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ There is nothing to stop you building your own keyword lists into the lexer, but this means that the lexer must be rebuilt if more keywords are added.

+

SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)
+ A description of all of the keyword sets separated by "\n" is returned by SCI_DESCRIBEKEYWORDSETS.

+

SCI_GETSTYLEBITSNEEDED
Retrieve the number of bits the current lexer needs for styling. This should normally be the argument to SCI_SETSTYLEBITS.

+

Lexer Objects

+ +

Lexers are programmed as objects that implement the ILexer interface and that interact + with the document they are lexing through the IDocument interface. + Previously lexers were defined by providing lexing and folding functions but creating an object + to handle the interaction of a lexer with a document allows the lexer to store state information that + can be used during lexing. For example a C++ lexer may store a set of preprocessor definitions + or variable declarations and style these depending on their role.

+ +

A set of helper classes allows older lexers defined by functions to be used in Scintilla.

+

ILexer

+ +
+class ILexer {
+public:
+    virtual + int SCI_METHOD + Version() +const = + 0;
+    virtual + void SCI_METHOD + Release() += 0;
+    virtual +const +char +* +SCI_METHOD PropertyNames() + = 0;
+    virtual + int SCI_METHOD PropertyType(const char *name) = 0;
+    virtual + const char * SCI_METHOD DescribeProperty(const char *name) = 0;
+    virtual + int SCI_METHOD + PropertySet(const + char + *key, + const +char *val) + = + 0;
+    virtual +const char +* SCI_METHOD DescribeWordListSets() + = +0;
+    virtual + int SCI_METHOD + WordListSet(int + n, + const +char *wl) + = + 0;
+    virtual + void SCI_METHOD + Lex(unsigned + int + startPos, + int + lengthDoc, +int initStyle, + IDocument +*pAccess) + = +0;
+    virtual + void SCI_METHOD + Fold(unsigned + int startPos, + int + lengthDoc, +int initStyle, + IDocument +*pAccess) + = +0;
+    virtual + void +* SCI_METHOD +PrivateCall(int + operation, +void +*pointer) += 0;
+};
+
+ +

+The return values from PropertySet and WordListSet are used to indicate whether the change requires +performing lexing or folding over any of the document. It is the position at which to restart lexing and folding or -1 +if the change does not require any extra work on the document. +A simple approach is to return 0 if there is any possibility that a change requires lexing the document again while an +optimisation could be to remember where a setting first affects the document and return that position. +

+ +

Release is called to destroy the lexer object.

+ +

PrivateCall allows for direct communication between the +application and a lexer. An example would be where an application +maintains a single large data structure containing symbolic information +about system headers (like Windows.h) and provides this to the lexer +where it can be applied to each document. This avoids the costs of +constructing the system header information for each document. This is +invoked with the SCI_PRIVATELEXERCALL API.

+ +

Fold is called with the exact range that needs folding. +Previously, lexers were called with a range that started one line before the range that +needs to be folded as this allowed fixing up the last line from the previous folding. +The new approach allows the lexer to decide whether to backtrack or to handle this +more efficiently.

+ +

IDocument

+ +
+class IDocument + {
+public:
+    virtual + int SCI_METHOD + Version() +const = + 0;
+    virtual + void SCI_METHOD + SetErrorStatus(int + status) + = +0;
+    virtual + int SCI_METHOD + Length() +const = + 0;
+    virtual + void SCI_METHOD + GetCharRange(char + *buffer, + int +position, +int lengthRetrieve) + const + = +0;
+    virtual + char SCI_METHOD + StyleAt(int + position) +const = + 0;
+    virtual + int SCI_METHOD + LineFromPosition(int position) + const = + 0;
+    virtual +int SCI_METHOD + LineStart(int line) + const = + 0;
+    virtual +int SCI_METHOD + GetLevel(int line) + +const = +0;
+    virtual +int SCI_METHOD + SetLevel(int + line, +int level) + = +0;
+    virtual + int SCI_METHOD + GetLineState(int + line) + const += 0 +;
+    virtual + int SCI_METHOD + SetLineState(int + line, + int state) + = + 0;
+    virtual + void SCI_METHOD + StartStyling(int + position, + char mask) + = + 0;
+    virtual bool + SCI_METHOD + SetStyleFor(int + length, + char style) + = 0 +;
+     virtual + bool SCI_METHOD + SetStyles(int + length, +const char + *styles) + = +0;
+    virtual void + SCI_METHOD + DecorationSetCurrentIndicator(int + indicator) + = + 0;
+    virtual + void SCI_METHOD + DecorationFillRange(int + position, + int value, + int fillLength) + + = +0;
+    virtual + void SCI_METHOD + ChangeLexerState(int + start, + int end) + = + 0;
+    virtual + int SCI_METHOD + CodePage() + const += 0 +;
+    virtual bool + SCI_METHOD + IsDBCSLeadByte(char + ch) + const = + 0;
+};
+
+ +

Scintilla tries to minimize the consequences of modifying text to +only relex and redraw the line of the change where possible. Lexer +objects contain their own private extra state which can affect later +lines. For example, if the C++ lexer is greying out inactive code +segments then changing the statement #define BEOS 0 to #define + BEOS 1 may require restyling and redisplaying later parts of the + document. The lexer can call ChangeLexerState to signal to + the document that it should relex and display more.

+ +

SetErrorStatus is used to notify the document of +exceptions. Exceptions should not be thrown over build boundaries as the + two sides may be built with different compilers or incompatible +exception options.

+ +

The ILexer and IDocument interfaces may be +expanded in the future with extended versions (ILexer2...). + The Version method indicates which interface is +implemented and thus which methods may be called.

+

Notifications

Notifications are sent (fired) from the Scintilla control to its container when an event has @@ -4773,27 +5828,38 @@ struct NotifyHeader { // This matches the Win32 NMHDR structure }; struct SCNotification { - struct NotifyHeader nmhdr; - int position; - // SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_DWELLSTART, - // SCN_DWELLEND, SCN_CALLTIPCLICK, - // SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK - int ch; // SCN_CHARADDED, SCN_KEY - int modifiers; // SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK - int modificationType; // SCN_MODIFIED - const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION - int length; // SCN_MODIFIED - int linesAdded; // SCN_MODIFIED - int message; // SCN_MACRORECORD - uptr_t wParam; // SCN_MACRORECORD - sptr_t lParam; // SCN_MACRORECORD - int line; // SCN_MODIFIED, SCN_DOUBLECLICK - int foldLevelNow; // SCN_MODIFIED - int foldLevelPrev; // SCN_MODIFIED - int margin; // SCN_MARGINCLICK - int listType; // SCN_USERLISTSELECTION, SCN_AUTOCSELECTION - int x; // SCN_DWELLSTART, SCN_DWELLEND - int y; // SCN_DWELLSTART, SCN_DWELLEND + struct Sci_NotifyHeader nmhdr; + int position; + /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */ + /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */ + /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */ + /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ + /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ + + int ch; /* SCN_CHARADDED, SCN_KEY */ + int modifiers; + /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */ + /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ + + int modificationType; /* SCN_MODIFIED */ + const char *text; + /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ + + int length; /* SCN_MODIFIED */ + int linesAdded; /* SCN_MODIFIED */ + int message; /* SCN_MACRORECORD */ + uptr_t wParam; /* SCN_MACRORECORD */ + sptr_t lParam; /* SCN_MACRORECORD */ + int line; /* SCN_MODIFIED */ + int foldLevelNow; /* SCN_MODIFIED */ + int foldLevelPrev; /* SCN_MODIFIED */ + int margin; /* SCN_MARGINCLICK */ + int listType; /* SCN_USERLISTSELECTION */ + int x; /* SCN_DWELLSTART, SCN_DWELLEND */ + int y; /* SCN_DWELLSTART, SCN_DWELLEND */ + int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ + int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ + int updated; /* SCN_UPDATEUI */ }; @@ -4819,19 +5885,22 @@ struct SCNotification { SCN_ZOOM
SCN_HOTSPOTCLICK
SCN_HOTSPOTDOUBLECLICK
+ SCN_HOTSPOTRELEASECLICK
SCN_INDICATORCLICK
SCN_INDICATORRELEASE
SCN_CALLTIPCLICK
SCN_AUTOCSELECTION
SCN_AUTOCCANCELLED
+ SCN_AUTOCCHARDELETED

The following SCI_* messages are associated with these notifications:

- SCI_SETMODEVENTMASK(int - eventMask)
+ SCI_SETMODEVENTMASK(int eventMask)
SCI_GETMODEVENTMASK
- SCI_SETMOUSEDWELLTIME
+ SCI_SETMOUSEDWELLTIME(int milliseconds)
SCI_GETMOUSEDWELLTIME
+ SCI_SETIDENTIFIER(int identifier)
+ SCI_GETIDENTIFIER

The following additional notifications are sent using the WM_COMMAND message on @@ -4842,6 +5911,17 @@ struct SCNotification { SCEN_KILLFOCUS
+

SCI_SETIDENTIFIER(int identifier)
+ SCI_GETIDENTIFIER
+ These two messages set and get the identifier of the Scintilla instance which is included in notifications as the + idFrom field. + When an application creates multiple Scintilla widgets, this allows the source of each notification to be found. + On Windows, this value is initialised in the CreateWindow call and stored as the + GWLP_ID attribute of the window. + The value should be small, preferrably less than 16 bits, + rather than a pointer as some of the functions will only transmit 16 or 32 bits. +

+

SCN_STYLENEEDED
If you used SCI_SETLEXER(SCLEX_CONTAINER) to make the container act as the @@ -4889,16 +5969,64 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber);

SCN_DOUBLECLICK
The mouse button was double clicked in editor. The position field is set to the text position of the - double click and the line field is set to the line of the double click.

+ double click, the line field is set to the line of the double click, and + the modifiers field is set to the key modifiers + held down in a similar manner to SCN_KEY.

SCN_UPDATEUI
- Either the text or styling of the document has changed or the selection range has changed. Now - would be a good time to update any container UI elements that depend on document or view state. - This was previously called SCN_CHECKBRACE because a common use is to check whether the - caret is next to a brace and set highlights on this brace and its corresponding matching brace. - This also replaces SCN_POSCHANGED, - which is now deprecated.

+ Either the text or styling of the document has changed or the selection range or scroll position has changed. + Now would be a good time to update any container UI elements that depend on document or view state. + The updated field is set to the bit set of things changed since the previous notification.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SymbolValueMeaning
SC_UPDATE_CONTENT0x01Contents, styling or markers have been changed.
SC_UPDATE_SELECTION0x02Selection has been changed.
SC_UPDATE_V_SCROLL0x04Scrolled vertically.
SC_UPDATE_H_SCROLL0x08Scrolled horizontally.

SCN_MODIFIED
This notification is sent when the text or styling of the document changes or is about to @@ -5140,6 +6268,36 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); + SC_MOD_LEXERSTATE + + 0x80000 + + The internal state of a lexer has changed over a range. + + position, length + + + + SC_MOD_CHANGEMARGIN + + 0x10000 + + A text margin has changed. + + line + + + + SC_MOD_CHANGEANNOTATION + + 0x20000 + + An annotation has changed. + + line + + + SC_MULTILINEUNDOREDO 0x1000 @@ -5165,9 +6323,21 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); + SC_MOD_CONTAINER + + 0x40000 + + This is set on for actions that the container stored into the undo stack with + SCI_ADDUNDOACTION. + + + token + + + SC_MODEVENTMASKALL - 0x1fff + 0x7FFFF This is a mask for all valid flags. This is the default mask state set by SCI_SETMODEVENTMASK. @@ -5330,7 +6500,7 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next - wParam + listType This is set to the listType parameter from the SCI_USERLISTSHOW message that @@ -5342,10 +6512,15 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next The text of the selection. + + + position + + The position the list was displayed at. +
-

SCN_URIDROPPED
@@ -5389,9 +6564,8 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
-
-

SCI_SETMOUSEDWELLTIME
+

SCI_SETMOUSEDWELLTIME(int milliseconds)
SCI_GETMOUSEDWELLTIME
These two messages set and get the time the mouse must sit still, in milliseconds, to generate a SCN_DWELLSTART notification. If @@ -5407,12 +6581,14 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next

SCN_HOTSPOTCLICK
SCN_HOTSPOTDOUBLECLICK
+ SCN_HOTSPOTRELEASECLICK
These notifications are generated when the user clicks or double clicks on text that is in a style with the hotspot attribute set. This notification can be used to link to variable definitions or web pages. The position field is set the text position of the click or double click and the modifiers field set to the key modifiers - held down in a similar manner to SCN_KEY.

+ held down in a similar manner to SCN_KEY. + Only the state of the Ctrl key is reported for SCN_HOTSPOTRELEASECLICK.

SCN_INDICATORCLICK
@@ -5447,7 +6623,7 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next - lParam + position The start position of the word being completed. @@ -5461,7 +6637,60 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next

SCN_AUTOCCANCELLED
The user has cancelled an autocompletion list. - There is no other information in SCNotification. + There is no other information in SCNotification.

+ +

SCN_AUTOCCHARDELETED
+ The user deleted a character while autocompletion list was active. + There is no other information in SCNotification.

+ +

Images

+ +

Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.

+ +

RGBA

+ +

The RGBA format allows translucency with an alpha + value for each pixel. It is simpler than + XPM and more capable.

+ +

The data is a sequence of 4 byte pixel values starting with the pixels for the top line, with the + leftmost pixel first, then continuing with the pixels for subsequent lines. There is no gap between + lines for alignment reasons.

+ +

Each pixel consists of, in order, a red byte, a green byte, a blue byte and an alpha byte. + The colour bytes are not premultiplied by the alpha value. That is, a fully red pixel that is + 25% opaque will be [FF, 00, 00, 3F]

+ +

Since the RGBA pixel data does not include any size information the + width and height must previously been set with the + SCI_RGBAIMAGESETWIDTH and + SCI_RGBAIMAGESETHEIGHT messages.

+ +

GUI platforms often include functions for reading image file formats like PNG into memory + in the RGBA form or a similar form. + If there is no suitable platform support, the LodePNG and picoPNG libraries are small libraries + for loading and decoding PNG files available under a BSD-style license.

+ +

RGBA format is supported on Windows, GTK+ and OS X Cocoa. + It is not supported on OS X Carbon.

+ +

XPM

+ +

The XPM format is + described here. + Scintilla is only able to handle XPM pixmaps that use one character per pixel with no named colours. + There may be a completely transparent colour named "None".

+

There are two forms of data structure used for XPM images, the first "lines form" format is well suited + to embedding an image inside C source code and the "text form" is suited to reading from a file. + In the lines form, an array of strings is used with the first string indicating the dimensions and number of colours + used. This is followed by a string for each colour and that section is followed by the image with one string per line. + The text form contains the same data as one null terminated block formatted as C source code starting + with a "/* XPM */" comment to mark the format.

+

Either format may be used with Scintilla APIs with the bytes at the location pointed to examined + to determine which format: if the bytes start with "/* XPM */" then it is treated as text form, + otherwise it is treated as lines form.

+ +

XPM format is supported on on all platforms.

GTK+

On GTK+, the following functions create a Scintilla widget, communicate with it and allow @@ -5472,15 +6701,14 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next void scintilla_release_resources()
-

GtkWidget *scintilla_new()
+

GtkWidget *scintilla_new()
Create a new Scintilla widget. The returned pointer can be added to a container and displayed in the same way as other widgets.

-

void scintilla_set_id(ScintillaObject *sci, uptr_t id)
+

void scintilla_set_id(ScintillaObject *sci, uptr_t id)
Set the control ID which will be used in the idFrom field of the NotifyHeader structure of all - notifications for this instance. When an application creates multiple Scintilla widgets, this allows - the source of each notification to be found. The value should be small, preferrably less than 16 bits, - rather than a pointer as some of the functions will only transmit 16 or 32 bits.

+ notifications for this instance. + This is equivalent to SCI_SETIDENTIFIER.

sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)
The main entry point allows sending any of the messages described in this document.

@@ -5604,11 +6832,7 @@ EM_SETTARGETDEVICE Scintilla_RegisterClasses called. STATIC_BUILD prevents compiling the DllMain function which will conflict with any DllMain defined in your code. Scintilla_RegisterClasses takes the HINSTANCE of your - application and ensures that the "Scintilla" window class is registered. To make sure that the - right pointing arrow cursor used in the margin is displayed by Scintilla add the - scintilla/win32/Margin.cur file to your application's resources with the ID - IDC_MARGIN which is defined in scintilla/win32/platfromRes.h as - 400.

+ application and ensures that the "Scintilla" window class is registered.

Ensuring lexers are linked into Scintilla

diff --git a/ext/scintilla/doc/ScintillaDownload.html b/ext/scintilla/doc/ScintillaDownload.html index ca15958a1..3ac8d51bc 100644 --- a/ext/scintilla/doc/ScintillaDownload.html +++ b/ext/scintilla/doc/ScintillaDownload.html @@ -25,9 +25,9 @@ @@ -41,7 +41,7 @@ containing very few restrictions.

- Release 1.77 + Release 2.29

Source Code @@ -49,8 +49,8 @@ The source code package contains all of the source code for Scintilla but no binary executable code and is available in
    -
  • zip format (910K) commonly used on Windows
  • -
  • tgz format (770K) commonly used on Linux and compatible operating systems
  • +
  • zip format (1200K) commonly used on Windows
  • +
  • tgz format (1080K) commonly used on Linux and compatible operating systems
Instructions for building on both Windows and Linux are included in the readme file.

diff --git a/ext/scintilla/doc/ScintillaHistory.html b/ext/scintilla/doc/ScintillaHistory.html index 7e01591a4..c3ca5d400 100644 --- a/ext/scintilla/doc/ScintillaHistory.html +++ b/ext/scintilla/doc/ScintillaHistory.html @@ -319,6 +319,71 @@

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- + Windows   - + GTK+/Linux   alexbodn Sergiu Dotenco Anders Karlssonozlooper
Marko NjezicEugen BitterChristoph BaumannChristopher Bean
Sergey KishchenkoKai LiuAndreas RumpfJames Moffatt
Yuzhou XinNic JansmaEvan JonesMike Lischke
Eric KiddmaXmoDavid SeverwrightJon Strait
Oliver KiddleEtienne GirondelHaimag RenAndrey Moskalyov
XaviToby InksterEric ForgeotColomban Wendling
NeoJordan RussellFarshid LashkariSam Rawlins
Michael MullinCarlos SSvimMartial Demolins
Tino WeinkaufJérôme LaforgeUdo LechnerMarco Falda
Dariusz KnocińskiBen FisherDon GobinJohn Yeung
AdobeElizabeth A. IrizarryMike SchroederMorten MacFly
Jaime GimenoThomas Linder PulsArtyom ZuikovGerrit
Occam's RazorBen BluemelDavid Wolfendale

@@ -331,6 +396,1704 @@

+ Release 2.29 +

+
    +
  • + Released 16 September 2011. +
  • +
  • + To automatically discover the encoding of a file when opening it, SciTE can run a program set with command.discover.properties. + Feature #3324341. +
  • +
  • + Cairo always used for drawing on GTK+. +
  • +
  • + The set of properties files imported by SciTE can be controlled with the properties imports.include and imports.exclude. + The import statement has been extended to allow "import *". + The properties files for some languages are no longer automatically loaded by default. The properties files affected are + avenue, baan, escript, lot, metapost, and mmixal. +
  • +
  • + C++ lexer fixed a bug with raw strings being recognised too easily. + Bug #3388122. +
  • +
  • + LaTeX lexer improved with more states and fixes to most outstanding bugs. + Bug #1493111. + Bug #1856356. + Bug #3081692. +
  • +
  • + Lua lexer updates for Lua 5.2 beta with goto labels and "\z" string escape. + Feature #3386330. +
  • +
  • + Perl string styling highlights interpolated variables. + Feature #3394258. + Bug #3076629. +
  • +
  • + Perl lexer updated for Perl 5.14.0 with 0X and 0B numeric literal prefixes, break keyword and "+" supported in subroutine prototypes. + Feature #3388802. +
  • +
  • + Perl bug fixed with CRLF line endings. +
  • +
  • + Markdown lexer fixed to not change state with "_" in middle of word. + Bug #3398184. +
  • +
  • + Cocoa restores compatibility with OS X 10.5. +
  • +
  • + Mouse pointer changes over selection to an arrow near start when scrolled horizontally. + Bug #3389055. +
  • +
  • + Indicators that finish at the end of the document no longer expand when text is appended. + Bug #3378718. +
  • +
  • + SparseState merge fixed to check if other range is empty. + Bug #3387053. +
  • +
  • + On Windows, autocompletion lists will scroll instead of document when mouse wheel spun. + Feature #3403600. +
  • +
  • + SciTE performs more rapid polling for command completion so will return faster and report more accurate times. +
  • +
  • + SciTE resizes panes proportionally when switched between horizontal and vertical layout. + Feature #3376784. +
  • +
  • + SciTE on GTK+ opens multiple files into a single instance more reliably. + Bug #3363754. +
  • +
+

+ Release 2.28 +

+
    +
  • + Released 1 August 2011. +
  • +
  • + GTK+ Cairo support works back to GTK+ version 2.8. Requires changing Scintilla source code to enable before GTK+ 2.22. + Bug #3322351. +
  • +
  • + Translucent images in RGBA format can be used for margin markers and in autocompletion lists. +
  • +
  • + INDIC_DOTBOX added as a translucent dotted rectangular indicator. +
  • +
  • + Asian text input using IME works for GTK+ 3.x and GTK+ 2.x with Cairo. +
  • +
  • + On GTK+, IME works for Ctrl+Shift+U Unicode input in Scintilla. For SciTE, Ctrl+Shift+U is still Make Selection Uppercase. +
  • +
  • + Key bindings for GTK+ on OS X made compatible with Cocoa port and platform conventions. +
  • +
  • + Cocoa port supports different character encodings, improves scrolling performance and drag image appearance. + The control ID is included in WM_COMMAND notifications. Text may be deleted by dragging to the trash. + ScrollToStart and ScrollToEnd key commands added to simplify implementation of standard OS X Home and End + behaviour. +
  • +
  • + SciTE on GTK+ uses a paned widget to contain the edit and output panes instead of custom code. + This allows the divider to be moved easily on GTK+ 3 and its appearance follows GTK+ conventions more closely. +
  • +
  • + SciTE builds and installs on BSD. + Bug #3324644. +
  • +
  • + Cobol supports fixed format comments. + Bug #3014850. +
  • +
  • + Mako template language block syntax extended and ## comments recognised. + Feature #3325178. + Bug #3318818. +
  • +
  • + Folding of Mako template language within HTML fixed. + Bug #3324563. +
  • +
  • + Python lexer has lexer.python.keywords2.no.sub.identifiers option to avoid highlighting second set of + keywords following '.'. + Bug #3325333. +
  • +
  • + Python folder fixes bug where fold would not extend to final line. + Bug #3349157. +
  • +
  • + SciTE treats LPEG lexers the same as script lexers by setting all 8 style bits. +
  • +
  • + For Cocoa, crashes with unsupported font variants and memory leaks for colour objects fixed. +
  • +
  • + Shift-JIS lead byte ranges modified to match Windows. +
  • +
  • + Mouse pointer changes over selection to an arrow more consistently. + Bug #3315756. +
  • +
  • + Bug fixed with annotations beyond end of document. + Bug #3347268. +
  • +
  • + Incorrect drawing fixed for combination of background colour change and translucent selection. + Bug #3377116. +
  • +
  • + Lexers initialized correctly when started at position other than start of line. + Bug #3377148. +
  • +
  • + Fold highlight drawing fixed for some situations. + Bug #3323015. + Bug #3323805. +
  • +
  • + Case insensitive search fixed for cases where folded character uses fewer bytes than base character. + Bug #3362038. +
  • +
  • + SciTE bookmark.alpha setting fixed. + Bug #3373907. +
  • +
+

+ Release 2.27 +

+
    +
  • + Released 20 June 2011. +
  • +
  • + On recent GTK+ 2.x versions when using Cairo, bug fixed where wrong colours were drawn. +
  • +
  • + SciTE on GTK+ slow performance in menu maintenance fixed. + Bug #3315233. +
  • +
  • + Cocoa platform supports 64-bit builds and uses only non-deprecated APIs. + Asian Input Method Editors are supported. + Autocompletion lists and calltips implemented. + Control identifier used in notifications. +
  • +
  • + On Cocoa, rectangular selection now uses Option/Alt key to be compatible with Apple Human + Interface Guidelines and other applications. + The Control key is reported with an SCMOD_META modifier bit. +
  • +
  • + API added for setting and retrieving the identifier number used in notifications. +
  • +
  • + SCI_SETEMPTYSELECTION added to set selection without scrolling or redrawing more than needed. + Feature #3314877. +
  • +
  • + Added new indicators. INDIC_DASH and INDIC_DOTS are variants of underlines. + INDIC_SQUIGGLELOW indicator added as shorter alternative to INDIC_SQUIGGLE for small fonts. + Bug #3314591 +
  • +
  • + Margin line selection can be changed to select display lines instead of document lines. + Bug #3312763. +
  • +
  • + On Windows, SciTE can perform reverse searches by pressing Shift+Enter + in the Find or Replace strips or dialogs. +
  • +
  • + Matlab lexer does not special case '\' in single quoted strings. + Bug #948757 + Bug #1755950 + Bug #1888738 + Bug #3316852. +
  • +
  • + Verilog lexer supports SystemVerilog folding and keywords. +
  • +
  • + Font leak fixed. + Bug #3306156. +
  • +
  • + Automatic scrolling works for long wrapped lines. + Bug #3312763. +
  • +
  • + Multiple typing works for cases where selections collapse together. + Bug #3309906. +
  • +
  • + Fold expanded when needed in word wrap mode. + Bug #3291579. +
  • +
  • + Bug fixed with edge drawn in wrong place on wrapped lines. + Bug #3314807. +
  • +
  • + Bug fixed with unnecessary scrolling for SCI_GOTOLINE. + Bug #3303406. +
  • +
  • + Bug fixed where extra step needed to undo SCI_CLEAR in virtual space. + Bug #3159691. +
  • +
  • + Regular expression search fixed for \$ on last line of search range. + Bug #3313746. +
  • +
  • + SciTE performance improved when switching to a tab with a very large file. + Bug #3311421. +
  • +
  • + On Windows, SciTE advanced search remembers the "Search only in this style" setting. + Bug #3313344. +
  • +
  • + On GTK+, SciTE opens help using "xdg-open" instead of "netscape" as "netscape" no longer commonly installed. + Bug #3314377. +
  • +
  • + SciTE script lexers can use 256 styles. +
  • +
  • + SciTE word highlight works for words containing DBCS characters. + Bug #3315173. +
  • +
  • + Compilation fixed for wxWidgets. + Bug #3306156. +
  • +
+

+ Release 2.26 +

+
    +
  • + Released 25 May 2011. +
  • +
  • + Folding margin symbols can be highlighted for the current folding block. + Feature #3147069. +
  • +
  • + Selected lines can be moved up or down together. + Feature #3304850. +
  • +
  • + SciTE can highlight all occurrences of the current word or selected text. + Feature #3291636. +
  • +
  • + Experimental GTK+ 3.0 support: build with "make GTK3=1". +
  • +
  • + INDIC_STRAIGHTBOX added. Is similar to INDIC_ROUNDBOX but without rounded corners. + Bug #3290435. +
  • +
  • + Can show brace matching and mismatching with indicators instead of text style. + Translucency of outline can be altered for INDIC_ROUNDBOX and INDIC_STRAIGHTBOX. + Feature #3290434. +
  • +
  • + SciTE can automatically indent python by examining previous line for scope-starting ':' with indent.python.colon. +
  • +
  • + Batch file lexer allows braces '(' or ')' inside variable names. +
  • +
  • + The cpp lexer only recognises Vala triple quoted strings when lexer.cpp.triplequoted.strings property is set. + Bug #3239234. +
  • +
  • + Make file lexer treats a variable with a nested variable like $(f$(qx)b) as one variable. + Bug #3298223. +
  • +
  • + Folding bug fixed for JavaScript with nested PHP. + Bug #3193530. +
  • +
  • + HTML lexer styles Django's {# #} comments. + Bug #3013798. +
  • +
  • + HTML lexer styles JavaScript regular expression correctly for /abc/i.test('abc');. + Bug #3209108. +
  • +
  • + Inno Setup Script lexer now works properly when it restarts from middle of [CODE] section. + Bug #3283880. + Bug #3129044. +
  • +
  • + Lua lexer updated for Lua 5.2 with hexadecimal floating-point numbers and '\*' whitespace escaping in strings. + Feature #3243811. +
  • +
  • + Perl folding folds "here doc"s and adds options fold.perl.at.else and fold.perl.comment.explicit. Fold structure for Perl fixed. + Feature #3112671. + Bug #3265401. +
  • +
  • + Python lexer supports cpdef keyword for Cython. + Bug #3279728. +
  • +
  • + SQL folding option lexer.sql.fold.at.else renamed to fold.sql.at.else. + Bug #3271474. +
  • +
  • + SQL lexer no longer treats ';' as terminating a comment. + Bug #3196071. +
  • +
  • + Text drawing and measurement segmented into smaller runs to avoid platform bugs. + Bug #3277449. + Bug #3165743. +
  • +
  • + SciTE on Windows adds temp.files.sync.load property to open dropped temporary files synchronously as they may + be removed before they can be opened asynchronously. + Bug #3072009. +
  • +
  • + Bug fixed with indentation guides ignoring first line in SC_IV_LOOKBOTH mode. + Bug #3291317. +
  • +
  • + Bugs fixed in backward regex search. + Bug #3292659. +
  • +
  • + Bugs with display of folding structure fixed for wrapped lines and where there is a fold header but no body. + Bug #3291579. + Bug #3265401. +
  • +
  • + SciTE on Windows cursor changes to an arrow now when over horizontal splitter near top of window. + Bug #3286620. +
  • +
  • + Fixed default widget size problem on GTK+. + Bug #3267892. +
  • +
  • + Fixed font size when using Cairo on GTK+. + Bug #3272662. +
  • +
  • + Fixed primary selection and cursor issues on GTK+ when unrealized then realized. + Bug #3256153. +
  • +
  • + Right click now cancels selection on GTK+ like on Windows. + Bug #3235190. +
  • +
  • + SciTE on GTK+ implements z-order buffer switching like on Windows. + Bug #3228384. +
  • +
  • + Improve selection position after SciTE Insert Abbreviation command when abbreviation expansion includes '|'. +
  • +
+

+ Release 2.25 +

+
    +
  • + Released 21 March 2011. +
  • +
  • + SparseState class makes it easier to write lexers which have to remember complex state between lines. +
  • +
  • + Visual Studio project (.dsp) files removed. The make files should be used instead as described in the README. +
  • +
  • + Modula 3 lexer added along with SciTE support. + Feature #3173374. +
  • +
  • + Asm, Basic, and D lexers add extra folding properties. +
  • +
  • + Raw string literals for C++0x supported in C++ lexer. +
  • +
  • + Triple-quoted strings used in Vala language supported in C++ lexer. + Feature #3177601. +
  • +
  • + The errorlist lexer used in SciTE's output pane colours lines that start with '<' as diff deletions. + Feature #3172878. +
  • +
  • + The Fortran lexer correctly folds type-bound procedures from Fortran 2003. +
  • +
  • + LPeg lexer support‎ improved in SciTE. +
  • +
  • + SciTE on Windows-64 fixes for menu localisation and Lua scripts. + Bug #3204502. +
  • +
  • + SciTE on Windows avoids locking folders when using the open or save dialogs. + Bug #1795484. +
  • +
  • + Diff lexer fixes problem where diffs of diffs producing lines that start with "----". + Bug #3197952. +
  • +
  • + Bug fixed when searching upwards in Chinese code page 936. + Bug #3176271. +
  • +
  • + On Cocoa, translucent drawing performed as on other platforms instead of 2.5 times less translucent. +
  • +
  • + Performance issue and potential bug fixed on GTK+ with caret line for long lines. +
  • +
+

+ Release 2.24 +

+
    +
  • + Released 3 February 2011. +
  • +
  • + Fixed memory leak in GTK+ Cairo code. + Feature #3157655. +
  • +
  • + Insert Abbreviation dialog added to SciTE on GTK+. +
  • +
  • + SCN_UPDATEUI notifications received when window scrolled. An 'updated' bit mask indicates which + types of update have occurred from SC_UPDATE_SELECTION, SC_UPDATE_CONTENT, SC_UPDATE_H_SCROLL + or SC_UPDATE_V_SCROLL. + Feature #3125977. +
  • +
  • + On Windows, to ensure reverse arrow cursor matches platform default, it is now generated by + reflecting the platform arrow cursor. + Feature #3143968. +
  • +
  • + Can choose mouse cursor used in margins. + Feature #3161326. +
  • +
  • + On GTK+, SciTE sets a mime type of text/plain in its .desktop file so that it will appear in the shell context menu. + Feature #3137126. +
  • +
  • + Bash folder handles here docs. + Feature #3118223. +
  • +
  • + C++ folder adds fold.cpp.syntax.based, fold.cpp.comment.multiline, fold.cpp.explicit.start, fold.cpp.explicit.end, + and fold.cpp.explicit.anywhere properties to allow more control over folding and choice of explicit fold markers. +
  • +
  • + C++ lexer fixed to always handle single quote strings continued past a line end. + Bug #3150522. +
  • +
  • + Ruby folder handles here docs. + Feature #3118224. +
  • +
  • + SQL lexer allows '.' to be part of words. + Feature #3103129. +
  • +
  • + SQL folder handles case statements in more situations. + Feature #3135027. +
  • +
  • + SQL folder adds fold points inside expressions based on bracket structure. + Feature #3165488. +
  • +
  • + SQL folder drops fold.sql.exists property as 'exists' is handled automatically. + Bug #3164194. +
  • +
  • + SciTE only forwards properties to lexers when they have been explicitly set so the defaults set by lexers are used + rather than 0. +
  • +
  • + Mouse double click word selection chooses the word around the character under the mouse rather than + the inter-character position under the mouse. This makes double clicking select what the user is pointing + at and avoids selecting adjacent non-word characters. + Bug #3111174. +
  • +
  • + Fixed mouse double click to always perform word select, not line select. + Bug #3143635. +
  • +
  • + Right click cancels autocompletion. + Bug #3144531. +
  • +
  • + Fixed multiPaste to work when additionalSelectionTyping off. + Bug #3126221. +
  • +
  • + Fixed virtual space problems when text modified at caret. + Bug #3154986. +
  • +
  • + Fixed memory leak in lexer object code. + Bug #3133672. +
  • +
  • + Fixed SciTE on GTK+ search failure when using regular expression. + Bug #3156217. +
  • +
  • + Avoid unnecessary full window redraw for SCI_GOTOPOS. + Feature #3146650. +
  • +
  • + Avoid unnecessary redraw when indicator fill range makes no real change. +
  • +
+

+ Release 2.23 +

+
    +
  • + Released 7 December 2010. +
  • +
  • + On GTK+ version 2.22 and later, drawing is performed with Cairo rather than GDK. + This is in preparation for GTK+ 3.0 which will no longer support GDK drawing. + The appearance of some elements will be different with Cairo as it is anti-aliased and uses sub-pixel positioning. + Cairo may be turned on for GTK+ versions before 2.22 by defining USE_CAIRO although this has not + been extensively tested. +
  • +
  • + New lexer a68k for Motorola 68000 assembler. + Feature #3101598. +
  • +
  • + Borland C++ is no longer supported for building Scintilla or SciTE on Windows. +
  • +
  • + Performance improved when creating large rectangular selections. +
  • +
  • + PHP folder recognizes #region and #endregion comments. + Feature #3101624. +
  • +
  • + SQL lexer has a lexer.sql.numbersign.comment option to turn off use of '#' comments + as these are a non-standard feature only available in some implementations. + Feature #3098071. +
  • +
  • + SQL folder recognizes case statements and understands the fold.at.else property. + Bug #3104091. + Bug #3107362. +
  • +
  • + SQL folder fixes bugs with end statements when fold.sql.only.begin=1. + Bug #3104091. +
  • +
  • + SciTE on Windows bug fixed with multi-line tab bar not adjusting correctly when maximizing and demaximizing. + Bug #3097517. +
  • +
  • + Crash fixed on GTK+ when Scintilla widget destroyed while it still has an outstanding style idle pending. +
  • +
  • + Bug fixed where searching backwards in DBCS text (code page 936 or similar) failed to find occurrences at the start of the line. + Bug #3103936. +
  • +
  • + SciTE on Windows supports Unicode file names when executing help applications with winhelp and htmlhelp subsystems. +
  • +
+

+ Release 2.22 +

+
    +
  • + Released 27 October 2010. +
  • +
  • + SciTE includes support for integrating with Scintillua which allows lexers to be implemented in Lua as a + Parsing Expression Grammar (PEG). +
  • +
  • + Regular expressions allow use of '?' for non-greedy matches or to match 0 or 1 instances of an item. +
  • +
  • + SCI_CONTRACTEDFOLDNEXT added to allow rapid retrieval of folding state. +
  • +
  • + SCN_HOTSPOTRELEASECLICK notification added which is similar to SCN_HOTSPOTCLICK but occurs + when the mouse is released. + Feature #3082409. +
  • +
  • + Command added for centring current line in window. + Feature #3064696. +
  • +
  • + SciTE performance improved by not examining document for line ends when switching buffers and not + storing folds when folding turned off. +
  • +
  • + Bug fixed where scrolling to ensure the caret is visible did not take into account all pixels of the line. + Bug #3081721. +
  • +
  • + Bug fixed for autocompletion list overlapping text when WS_EX_CLIENTEDGE used. + Bug #3079778. +
  • +
  • + After autocompletion, the caret's X is updated. + Bug #3079114. +
  • +
  • + On Windows, default to the system caret blink time. + Feature #3079784. +
  • +
  • + PgUp/PgDn fixed to allow virtual space. + Bug #3077452. +
  • +
  • + Crash fixed when AddMark and AddMarkSet called with negative argument. + Bug #3075074. +
  • +
  • + Dwell notifications fixed so that they do not occur when the mouse is outside Scintilla. + Bug #3073481. +
  • +
  • + Bash lexer bug fixed for here docs starting with <<-. + Bug #3063822. +
  • +
  • + C++ lexer bug fixed for // comments that are continued onto a second line by a \. + Bug #3066031. +
  • +
  • + C++ lexer fixes wrong highlighting for float literals containing +/-. + Bug #3058924. +
  • +
  • + JavaScript lexer recognize regexes following return keyword.‎ + Bug #3062287. +
  • +
  • + Ruby lexer handles % quoting better and treats range dots as operators in 1..2 and 1...2. + Ruby folder handles "if" keyword used as a modifier even when it is separated from the modified statement by an escaped new line. + Bug #2093767. + Bug #3058496. +
  • +
  • + Bug fixed where upwards search failed with DBCS code pages. + Bug #3065912. +
  • +
  • + SciTE has a default Lua startup script name distributed in SciTEGlobal.properties. + No error message is displayed if this file does not exist. +
  • +
  • + SciTE on Windows tab control height is calculated better. + Bug #2635702. +
  • +
  • + SciTE on Windows uses better themed check buttons in find and replace strips. +
  • +
  • + SciTE on Windows fixes bug with Find strip appearing along with Incremental Find strip. +
  • +
  • + SciTE setting find.close.on.find added to allow preventing the Find dialog from closing. +
  • +
  • + SciTE on Windows attempts to rerun commands that fail by prepending them with "cmd.exe /c". + This allows commands built in to the command processor like "dir" to run. +
  • +
+

+ Release 2.21 +

+
    +
  • + Released 1 September 2010. +
  • +
  • + Asian Double Byte Character Set (DBCS) support improved. + Case insensitive search works and other operations are much faster. + Bug #2999125, + Bug #2774616, + Bug #2991942, + Bug #3005688. +
  • +
  • + Scintilla on GTK+ uses only non-deprecated APIs (for GTK+ 2.20) except for GdkFont and GdkFont use can be disabled + with the preprocessor symbol DISABLE_GDK_FONT. +
  • +
  • + IDocument interface used by lexers adds BufferPointer and GetLineIndentation methods. +
  • +
  • + On Windows, clicking sets focus before processing the click or sending notifications. +
  • +
  • + Bug on OS X (macosx platform) fixed where drag/drop overwrote clipboard. + Bug #3039732. +
  • +
  • + GTK+ drawing bug when the view was horizontally scrolled more than 32000 pixels fixed. +
  • +
  • + SciTE bug fixed with invoking Complete Symbol from output pane. + Bug #3050957. +
  • +
  • + Bug fixed where it was not possible to disable folding. + Bug #3040649. +
  • +
  • + Bug fixed with pressing Enter on a folded fold header line not opening the fold. + Bug #3043419. +
  • +
  • + SciTE 'Match case' option in find and replace user interfaces changed to 'Case sensitive' to allow use of 'v' + rather than 'c' as the mnemonic. +
  • +
  • + SciTE displays stack trace for Lua when error occurs.. + Bug #3051397. +
  • +
  • + SciTE on Windows fixes bug where double clicking on error message left focus in output pane. + Bug #1264835. +
  • +
  • + SciTE on Windows uses SetDllDirectory to avoid a security problem. +
  • +
  • + C++ lexer crash fixed with preprocessor expression that looked like division by 0. + Bug #3056825. +
  • +
  • + Haskell lexer improved. + Feature #3039490. +
  • +
  • + HTML lexing fixed around Django {% %} tags. + Bug #3034853. +
  • +
  • + HTML JavaScript lexing fixed when line end escaped. + Bug #3038381. +
  • +
  • + HTML lexer stores line state produced by a line on that line rather than on the next line. +
  • +
  • + Markdown lexer fixes infinite loop. + Bug #3045386. +
  • +
  • + MySQL folding bugs with END statements fixed. + Bug #3031742. +
  • +
  • + PowerShell lexer allows '_' as a word character. + Feature #3042228. +
  • +
  • + SciTE on GTK+ abandons processing of subsequent commands if a command.go.needs command fails. +
  • +
  • + When SciTE is closed, all buffers now receive an OnClose call. + Bug #3033857. +
  • +
+

+ Release 2.20 +

+
    +
  • + Released 30 July 2010. +
  • +
  • + Lexers are implemented as objects so that they may retain extra state. + The interfaces defined for this are tentative and may change before the next release. + Compatibility classes allow current lexers compiled into Scintilla to run with few changes. + The interface to external lexers has changed and existing external lexers will need to have changes + made and be recompiled. + A single lexer object is attached to a document whereas previously lexers were attached to views + which could lead to different lexers being used for split views with confusing results. +
  • +
  • + C++ lexer understands the preprocessor enough to grey-out inactive code due to conditional compilation. +
  • +
  • + SciTE can use strips within the main window for find and replace rather than dialogs. + On Windows SciTE always uses a strip for incremental search. +
  • +
  • + Lexer added for Txt2Tags language. + Feature #3018736. +
  • +
  • + Sticky caret feature enhanced with additional SC_CARETSTICKY_WHITESPACE mode . + Feature #3027559. +
  • +
  • + Bash lexer implements basic parsing of compound commands and constructs. + Feature #3033135. +
  • +
  • + C++ folder allows disabling explicit fold comments. +
  • +
  • + Perl folder works for array blocks, adjacent package statements, nested PODs, and terminates package folding at __DATA__, ^D and ^Z. + Feature #3030887. +
  • +
  • + PowerShell lexer supports multiline <# .. #> comments and adds 2 keyword classes. + Feature #3015176. +
  • +
  • + Lexing performed incrementally when needed by wrapping to make user interface more responsive. +
  • +
  • + SciTE setting replaceselection:yes works on GTK+. +
  • +
  • + SciTE Lua scripts calling io.open or io.popen on Windows have arguments treated as UTF-8 and converted to Unicode + so that non-ASCII file paths will work. Lua files with non-ASCII paths run. + Bug #3016951. +
  • +
  • + Crash fixed when searching for empty string. + Bug #3017572. +
  • +
  • + Bugs fixed with folding and lexing when Enter pressed at start of line. + Bug #3032652. +
  • +
  • + Bug fixed with line selection mode not affecting selection range. + Bug #3021480. +
  • +
  • + Bug fixed where indicator alpha was limited to 100 rather than 255. + Bug #3021473. +
  • +
  • + Bug fixed where changing annotation did not cause automatic redraw. +
  • +
  • + Regular expression bug fixed when a character range included non-ASCII characters. +
  • +
  • + Compilation failure with recent compilers fixed on GTK+. + Bug #3022027. +
  • +
  • + Bug fixed on Windows with multiple monitors where autocomplete pop up would appear off-screen + or straddling monitors. + Bug #3017512. +
  • +
  • + SciTE on Windows bug fixed where changing directory to a Unicode path failed. + Bug #3011987. +
  • +
  • + SciTE on Windows bug fixed where combo boxes were not allowing Unicode characters. + Bug #3012986. +
  • +
  • + SciTE on GTK+ bug fixed when dragging files into SciTE on KDE. + Bug #3026555. +
  • +
  • + SciTE bug fixed where closing untitled file could lose data if attempt to name file same as another buffer. + Bug #3011680. +
  • +
  • + COBOL number masks now correctly highlighted. + Bug #3012164. +
  • +
  • + PHP comments can include <?PHP without triggering state change. + Bug #2854183. +
  • +
  • + VHDL lexer styles unclosed string correctly. + Bug #3029627. +
  • +
  • + Memory leak fixed in list boxes on GTK+. + Bug #3007669. +
  • +
+

+ Release 2.12 +

+
    +
  • + Released 1 June 2010. +
  • +
  • + Drawing optimizations improve speed and fix some visible flashing when scrolling. +
  • +
  • + Copy Path command added to File menu in SciTE. + Feature #2986745. +
  • +
  • + Optional warning displayed by SciTE when saving a file which has been modified by another process. + Feature #2975041. +
  • +
  • + Flagship lexer for xBase languages updated to follow the language much more closely. + Feature #2992689. +
  • +
  • + HTML lexer highlights Django templates in more regions. + Feature #3002874. +
  • +
  • + Dropping files on SciTE on Windows, releases the drag object earlier and opens the files asynchronously, + leading to smoother user experience. + Feature #2986724. +
  • +
  • + SciTE HTML exports take the Use Monospaced Font setting into account. +
  • +
  • + SciTE window title "[n of m]" localised. +
  • +
  • + When new line inserted at start of line, markers are moved down. + Bug #2986727. +
  • +
  • + On Windows, dropped text has its line ends converted, similar to pasting. + Bug #3005328. +
  • +
  • + Fixed bug with middle-click paste in block select mode where text was pasted next to selection rather than at cursor. + Bug #2984460. +
  • +
  • + Fixed SciTE crash where a style had a size parameter without a value. + Bug #3003834. +
  • +
  • + Debug assertions in multiple lexers fixed. + Bug #3000566. +
  • +
  • + CSS lexer fixed bug where @font-face displayed incorrectly + Bug #2994224. +
  • +
  • + CSS lexer fixed bug where open comment caused highlighting error. + Bug #1683672. +
  • +
  • + Shell file lexer fixed highlight glitch with here docs where the first line is a comment. + Bug #2830239. +
  • +
  • + Bug fixed in SciTE openpath property that caused Open Selected File to fail to open the selected file. +
  • +
  • + Bug fixed in SciTE FileExt property when file name with no extension evaluated to whole path. +
  • +
  • + Fixed SciTE on Windows printing bug where the $(CurrentTime), $(CurrentPage) variables were not expanded. + Bug #2994612. +
  • +
  • + SciTE compiles for 64-bit Windows and runs without crashing. + Bug #2986312. +
  • +
  • + Full Screen mode in Windows Vista/7 improved to hide Start button and size borders a little better. + Bug #3002813. +
  • +
+

+ Release 2.11 +

+
    +
  • + Released 9 April 2010. +
  • +
  • + Fixes compatibility of Scintilla.h with the C language. +
  • +
  • + With a rectangular selection SCI_GETSELECTIONSTART and SCI_GETSELECTIONEND return limits of the + rectangular selection rather than the limits of the main selection. +
  • +
  • + When SciTE on Windows is minimized to tray, only takes a single click to restore rather than a double click. + Feature #981917. +
  • +
+

+ Release 2.10 +

+
    +
  • + Released 4 April 2010. +
  • +
  • + Version 1.x of GTK+ is no longer supported. +
  • +
  • + SciTE is no longer supported on Windows 95, 98 or ME. +
  • +
  • + Case-insensitive search works for non-ASCII characters in UTF-8 and 8-bit encodings. + Non-regex search in DBCS encodings is always case-sensitive. +
  • +
  • + Non-ASCII characters may be changed to upper and lower case. +
  • +
  • + SciTE on Windows can access all files including those with names outside the user's preferred character encoding. +
  • +
  • + SciTE may be extended with lexers written in Lua. +
  • +
  • + When there are multiple selections, the paste command can go either to the main selection or to each + selection. This is controlled with SCI_SETMULTIPASTE. +
  • +
  • + More forms of bad UTF-8 are detected including overlong sequences, surrogates, and characters outside + the valid range. Bad UTF-8 bytes are now displayed as 2 hex digits preceded by 'x'. +
  • +
  • + SCI_GETTAG retrieves the value of captured expressions within regular expression searches. +
  • +
  • + Django template highlighting added to the HTML lexer. + Feature #2974889. +
  • +
  • + Verilog line comments can be folded. +
  • +
  • + SciTE on Windows allows specifying a filter for the Save As dialog. + Feature #2943445. +
  • +
  • + Bug fixed when multiple selection disabled where rectangular selections could be expanded into multiple selections. + Bug #2948260. +
  • +
  • + Bug fixed when document horizontally scrolled and up/down-arrow did not return to the same + column after horizontal scroll occurred. + Bug #2950799. +
  • +
  • + Bug fixed to remove hotspot highlight when mouse is moved out of the document. Windows only fix. + Bug #2951353. +
  • +
  • + R lexer now performs case-sensitive check for keywords. + Bug #2956543. +
  • +
  • + Bug fixed on GTK+ where text disappeared when a wrap occurred. + Bug #2958043. +
  • +
  • + Bug fixed where regular expression replace cannot escape the '\' character by using '\\'. + Bug #2959876. +
  • +
  • + Bug fixed on GTK+ when virtual space disabled, middle-click could still paste text beyond end of line. + Bug #2971618. +
  • +
  • + SciTE crash fixed when double clicking on a malformed error message in the output pane. + Bug #2976551. +
  • +
  • + Improved performance on GTK+ when changing parameters associated with scroll bars to the same value. + Bug #2964357. +
  • +
  • + Fixed bug with pressing Shift+Tab with a rectangular selection so that it performs an un-indent + similar to how Tab performs an indent. +
  • +
+

+ Release 2.03 +

+
    +
  • + Released 14 February 2010. +
  • +
  • + Added SCI_SETFIRSTVISIBLELINE to match SCI_GETFIRSTVISIBLELINE. +
  • +
  • + Erlang lexer extended set of numeric bases recognised; separate style for module:function_name; detects + built-in functions, known module attributes, and known preprocessor instructions; recognizes EDoc and EDoc macros; + separates types of comments. + Bug #2942448. +
  • +
  • + Python lexer extended with lexer.python.strings.over.newline option that allows non-triple-quoted strings to extend + past line ends. This allows use of the Ren'Py language. + Feature #2945550. +
  • +
  • + Fixed bugs with cursor movement after deleting a rectangular selection. + Bug #2942131. +
  • +
  • + Fixed bug where calling SCI_SETSEL when there is a rectangular selection left + the additional selections selected. + Bug #2947064. +
  • +
  • + Fixed macro recording bug where not all bytes in multi-byte character insertions were reported through + SCI_REPLACESEL. +
  • +
  • + Fixed SciTE bug where using Ctrl+Enter followed by Ctrl+Space produced an autocompletion list + with only a single line containing all the identifiers. +
  • +
  • + Fixed SciTE on GTK+ bug where running a tool made the user interface completely unresponsive. +
  • +
  • + Fixed SciTE on Windows Copy to RTF bug. + Bug #2108574. +
  • +
+

+ Release 2.02 +

+
    +
  • + Released on 25 January 2010. +
  • +
  • + Markdown lexer added. + Feature #2844081. +
  • +
  • + On GTK+, include code that understands the ranges of lead bytes for code pages 932, 936, and 950 + so that most Chinese and Japanese text can be used on systems that are not set to the corresponding locale. +
  • +
  • + Allow changing the size of dots in visible whitespace using SCI_SETWHITESPACESIZE. + Feature #2839427. +
  • +
  • + Additional carets can be hidden with SCI_SETADDITIONALCARETSVISIBLE. +
  • +
  • + Can choose anti-aliased, non-anti-aliased or lcd-optimized text using SCI_SETFONTQUALITY. +
  • +
  • + Retrieve the current selected text in the autocompletion list with SCI_AUTOCGETCURRENTTEXT. +
  • +
  • + Retrieve the name of the current lexer with SCI_GETLEXERLANGUAGE. +
  • +
  • + Progress 4GL lexer improves handling of comments in preprocessor declaration. + Feature #2902206. +
  • +
  • + HTML lexer extended to handle Mako template language. +
  • +
  • + SQL folder extended for SQL Anywhere "EXISTS" and "ENDIF" keywords. + Feature #2887524. +
  • +
  • + SciTE adds APIPath and AbbrevPath variables. +
  • +
  • + SciTE on GTK+ uses pipes instead of temporary files for running tools. This should be more secure. +
  • +
  • + Fixed crash when calling SCI_STYLEGETFONT for a style which does not have a font set. + Bug #2857425. +
  • +
  • + Fixed crash caused by not having sufficient styles allocated after choosing a lexer. + Bug #2881279. +
  • +
  • + Fixed crash in SciTE using autocomplete word when word characters includes space. + Bug #2840141. +
  • +
  • + Fixed bug with handling upper-case file extensions SciTE on GTK+. +
  • +
  • + Fixed SciTE loading files from sessions with folded folds where it would not + be scrolled to the correct location. + Bug #2882775. +
  • +
  • + Fixed SciTE loading files from sessions when file no longer exists. + Bug #2883437. +
  • +
  • + Fixed SciTE export to HTML using the wrong background colour. +
  • +
  • + Fixed crash when adding an annotation and then adding a new line after the annotation. + Bug #2929708. +
  • +
  • + Fixed crash in SciTE setting a property to nil from Lua. +
  • +
  • + SCI_GETSELTEXT fixed to return correct length. + Bug #2929441. +
  • +
  • + Fixed text positioning problems with selection in some circumstances. +
  • +
  • + Fixed text positioning problems with ligatures on GTK+. +
  • +
  • + Fixed problem pasting into rectangular selection with caret at bottom caused text to go from the caret down + rather than replacing the selection. +
  • +
  • + Fixed problem replacing in a rectangular selection where only the final line was changed. +
  • +
  • + Fixed inability to select a rectangular area using Alt+Shift+Click at both corners. + Bug #2899746. +
  • +
  • + Fixed problem moving to start/end of a rectangular selection with left/right key. + Bug #2871358. +
  • +
  • + Fixed problem with Select All when there's a rectangular selection. + Bug #2930488. +
  • +
  • + Fixed SCI_LINEDUPLICATE on a rectangular selection to not produce multiple discontinuous selections. +
  • +
  • + Virtual space removed when performing delete word left or delete line left. + Virtual space converted to real space for delete word right. + Preserve virtual space when pressing Delete key. + Bug #2882566. +
  • +
  • + Fixed problem where Shift+Alt+Down did not move through wrapped lines. + Bug #2871749. +
  • +
  • + Fixed incorrect background colour when using coloured lines with virtual space. + Bug #2914691. +
  • +
  • + Fixed failure to display wrap symbol for SC_WRAPVISUALFLAGLOC_END_BY_TEXT. + Bug #2936108. +
  • +
  • + Fixed blank background colour with EOLFilled style on last line. + Bug #2890105. +
  • +
  • + Fixed problem in VB lexer with keyword at end of file. + Bug #2901239. +
  • +
  • + Fixed SciTE bug where double clicking on a tab closed the file. +
  • +
  • + Fixed SciTE brace matching commands to only work when the caret is next to the brace, not when + it is in virtual space. + Bug #2885560. +
  • +
  • + Fixed SciTE on Windows Vista to access files in the Program Files directory rather than allow Windows + to virtualize access. + Bug #2916685. +
  • +
  • + Fixed NSIS folder to handle keywords that start with '!'. + Bug #2872157. +
  • +
  • + Changed linkage of Scintilla_LinkLexers to "C" so that it can be used by clients written in C. + Bug #2844718. +
  • +
+

+ Release 2.01 +

+
    +
  • + Released on 19 August 2009. +
  • +
  • + Fix to positioning rectangular paste when viewing line ends. +
  • +
  • + Don't insert new lines and indentation for line ends at end of rectangular paste. +
  • +
  • + When not in additional selection typing mode, cutting a rectangular selection removes all of the selected text. +
  • +
  • + Rectangular selections are copied to the clipboard in document order, not in the order of selection. +
  • +
  • + SCI_SETCURRENTPOS and SCI_SETANCHOR work in rectangular mode. +
  • +
  • + On GTK+, drag and drop to a later position in the document now drops at the position. +
  • +
  • + Fix bug where missing property did not use default value. +
  • +
+

+ Release 2.0 +

+
    +
  • + Released on 11 August 2009. +
  • +
  • + Multiple pieces of text can be selected simultaneously by holding control while dragging the mouse. + Typing, backspace and delete may affect all selections together. +
  • +
  • + Virtual space allows selecting beyond the last character on a line. +
  • +
  • + SciTE on GTK+ path bar is now optional and defaults to off. +
  • +
  • + MagikSF lexer recognises numbers correctly. +
  • +
  • + Folding of Python comments and blank lines improved. Bug #210240. +
  • +
  • + Bug fixed where background colour of last character in document leaked past that character. +
  • +
  • + Crash fixed when adding marker beyond last line in document. Bug #2830307. +
  • +
  • + Resource leak fixed in SciTE for Windows when printing fails. Bug #2816524. +
  • +
  • + Bug fixed on Windows where the system caret was destroyed during destruction when another window + was using the system caret. Bug #2830223. +
  • +
  • + Bug fixed where indentation guides were drawn over text when the indentation used a style with a different + space width to the default style. +
  • +
  • + SciTE bug fixed where box comment added a bare line feed rather than the chosen line end. Bug #2818104. +
  • +
  • + Reverted fix that led to wrapping whole document when displaying the first line of the document. +
  • +
  • + Export to LaTeX in SciTE fixed to work in more cases and not use as much space. Bug #1286548. +
  • +
  • + Bug fixed where EN_CHANGE notification was sent when performing a paste operation in a + read-only document. Bug #2825485. +
  • +
  • + Refactored code so that Scintilla exposes less of its internal implementation and uses the C++ standard + library for some basic collections. Projects that linked to Scintilla's SString or PropSet classes + should copy this code from a previous version of Scintilla or from SciTE. +
  • +
+

+ Release 1.79 +

+
    +
  • + Released on 1 July 2009. +
  • +
  • + Memory exhaustion and other exceptions handled by placing an error value into the + status property rather than crashing. + Scintilla now builds with exception handling enabled and requires exception handling to be enabled.
    + This is a major change and application developers should consider how they will deal with Scintilla exhausting + memory since Scintilla may not be in a stable state. +
  • +
  • + Deprecated APIs removed. The symbols removed are: +
      +
    • SCI_SETCARETPOLICY
    • +
    • CARET_CENTER
    • +
    • CARET_XEVEN
    • +
    • CARET_XJUMPS
    • +
    • SC_FOLDFLAG_BOX
    • +
    • SC_FOLDLEVELBOXHEADERFLAG
    • +
    • SC_FOLDLEVELBOXFOOTERFLAG
    • +
    • SC_FOLDLEVELCONTRACTED
    • +
    • SC_FOLDLEVELUNINDENT
    • +
    • SCN_POSCHANGED
    • +
    • SCN_CHECKBRACE
    • +
    • SCLEX_ASP
    • +
    • SCLEX_PHP
    • +
    +
  • +
  • + Cocoa platform added. +
  • +
  • + Names of struct types in Scintilla.h now start with "Sci_" to avoid possible clashes with platform + definitions. Currently, the old names still work but these will be phased out. +
  • +
  • + When lines are wrapped, subsequent lines may be indented to match the indent of the initial line, + or one more indentation level. Feature #2796119. +
  • +
  • + APIs added for finding the character at a point rather than an inter-character position. Feature #2646738. +
  • +
  • + A new marker SC_MARK_BACKGROUND_UNDERLINE is drawn in the text area as an underline + the full width of the window. +
  • +
  • + Batch file lexer understands variables surrounded by '!'. +
  • +
  • + CAML lexer also supports SML. +
  • +
  • + D lexer handles string and numeric literals more accurately. Feature #2793782. +
  • +
  • + Forth lexer is now case-insensitive and better supports numbers like $hex and %binary. Feature #2804894. +
  • +
  • + Lisp lexer treats '[', ']', '{', and '}' as balanced delimiters which is common usage. Feature #2794989. +
    + It treats keyword argument names as being equivalent to symbols. Feature #2794901. +
  • +
  • + Pascal lexer bug fixed to prevent hang when 'interface' near beginning of file. Bug #2802863. +
  • +
  • + Perl lexer bug fixed where previous lexical states persisted causing "/" special case styling and + subroutine prototype styling to not be correct. Bug #2809168. +
  • +
  • + XML lexer fixes bug where Unicode entities like '&—' were broken into fragments. Bug #2804760. +
  • +
  • + SciTE on GTK+ enables scrolling the tab bar on recent versions of GTK+. Feature #2061821. +
  • +
  • + SciTE on Windows allows tab bar tabs to be reordered by drag and drop. +
  • +
  • + Unit test script for Scintilla on Windows included with source code. +
  • +
  • + User defined menu items are now localised when there is a matching translation. +
  • +
  • + Width of icon column of autocompletion lists on GTK+ made more consistent. +
  • +
  • + Bug with slicing UTF-8 text into character fragments when there is a sequence of 100 or more 3 byte characters. Bug #2780566. +
  • +
  • + Folding bugs introduced in 1.78 fixed. Some of the fix was generic and there was also a specific fix for C++. +
  • +
  • + Bug fixed where a rectangular paste was not padding the line with sufficient spaces to align the pasted text. +
  • +
  • + Bug fixed with showing all text on each line of multi-line annotations when styling the whole annotation using SCI_ANNOTATIONSETSTYLE. Bug #2789430. +
  • +
+

+ Release 1.78 +

+
    +
  • + Released on 28 April 2009. +
  • +
  • + Annotation lines may be added to each line. +
  • +
  • + A text margin may be defined with different text on each line. +
  • +
  • + Application actions may be added to the undo history. +
  • +
  • + Can query the symbol defined for a marker. + An available symbol added for applications to indicate that plugins may allocate a marker. +
  • +
  • + Can increase the amount of font ascent and descent. +
  • +
  • + COBOL lexer added. Feature #2127406. +
  • +
  • + Nimrod lexer added. Feature #2642620. +
  • +
  • + PowerPro lexer added. Feature #2195308. +
  • +
  • + SML lexer added. Feature #2710950. +
  • +
  • + SORCUS Installation file lexer added. Feature #2343375. +
  • +
  • + TACL lexer added. Feature #2127406. +
  • +
  • + TAL lexer added. Feature #2127406. +
  • +
  • + Rewritten Pascal lexer with improved folding and other fixes. Feature #2190650. +
  • +
  • + INDIC_ROUNDBOX translucency level can be modified. Feature #2586290. +
  • +
  • + C++ lexer treats angle brackets in #include directives as quotes when styling.within.preprocessor. Bug #2551033. +
  • +
  • + Inno Setup lexer is sensitive to whether within the [Code] section and handles comments better. Bug #2552973. +
  • +
  • + HTML lexer does not go into script mode when script tag is self-closing. +
  • +
  • + HTML folder fixed where confused by comments when fold.html.preprocessor off. Bug #2532774. +
  • +
  • + Perl lexer fixes problem with string matching caused by line endings. Bug #2648342. +
  • +
  • + Progress lexer fixes problem with "last-event:function" phrase. Bug #2483619. +
  • +
  • + Properties file lexer extended to handle RFC2822 text when lexer.props.allow.initial.spaces on. +
  • +
  • + Python lexer adds options for Python 3 and Cython. +
  • +
  • + Shell lexer fixes heredoc problem caused by line endings. Bug #2635257. +
  • +
  • + TeX lexer handles comment at end of line correctly. Bug #2698766. +
  • +
  • + SciTE retains selection range when performing a replace selection command. Feature #2339160. +
  • +
  • + SciTE definition of word characters fixed to match documentaiton. Bug #2464531. +
  • +
  • + SciTE on GTK+ performing Search or Replace when dialog already shown now brings dialog to foreground. + Bug #2634224. +
  • +
  • + Fixed encoding bug with calltips on GTK+. +
  • +
  • + Block caret drawn in correct place on wrapped lines. Bug #2126144. +
  • +
  • + Compilation for 64 bit Windows works using MinGW. Bug #2515578. +
  • +
  • + Incorrect memory freeing fixed on OS X. + Bug #2354098, + Bug #2671749. +
  • +
  • + SciTE on GTK+ crash fixed on startup when child process exits before initialisation complete. + Bug #2716987. +
  • +
  • + Crash fixed when AutoCompleteGetCurrent called with no active autocompletion. +
  • +
  • + Flickering diminished when pressing Tab. Bug #2723006. +
  • +
  • + Namespace compilation issues with GTK+ on OS X fixed. +
  • +
  • + Increased maximum length of SciTE's Language menu on GTK+ to 100 items. Bug #2528241. +
  • +
  • + Fixed incorrect Python lexing for multi-line continued strings. Bug #2450963. +
  • +
+

Release 1.77

    @@ -342,7 +2105,7 @@ to libraries like regular expression libraries.
  • - Scintilla on Windows can interpret keys as Unicode even when a narrow character + Scintilla on Windows can interpret keys as Unicode even when a narrow character window with SCI_SETKEYSUNICODE.
  • @@ -367,7 +2130,7 @@ CSS lexer updated and works with non-ASCII.
  • - Diff lexer adds style for changed lines, handles subversion diffs better and + Diff lexer adds style for changed lines, handles subversion diffs better and fixes styling and folding for lines containing chunk dividers ("---").
  • @@ -377,7 +2140,7 @@ Haskell lexer allows hexadecimal literals.
  • - HTML lexer improves PHP and JavaScript folding. + HTML lexer improves PHP and JavaScript folding. PHP heredocs, nowdocs, strings and comments processed more accurately. Internet Explorer's non-standard >comment< tag supported. Script recognition in XML can be controlled with lexer.xml.allow.scripts property. @@ -422,7 +2185,7 @@ SciTE bug fixed where eol.mode not used for initial buffer.
  • - SciTE bug fixed where a file could be saved as the same name as another + SciTE bug fixed where a file could be saved as the same name as another buffer leading to confusing behaviour.
  • @@ -547,7 +2310,7 @@ The horizontal scroll bar may grow to match the widest line displayed.
  • - Allow autocomplete popups to appear outside client rectangle in some cases. + Allow autocomplete pop ups to appear outside client rectangle in some cases.
  • When line state changed, SC_MOD_CHANGELINESTATE modification notification sent and @@ -1652,7 +3415,7 @@ Released on 4 April 2005.
  • - Autocompletion on Windows changed to use popup window, be faster, + Autocompletion on Windows changed to use pop up window, be faster, allow choice of maximum width and height, and to highlight only the text of the selected item rather than both the text and icon if any.
  • @@ -4667,7 +6430,7 @@ C++ lexer can fold comments of /* .. */ form.
  • - Better disabling of popup menu items in Scintilla when in read-only mode. + Better disabling of pop up menu items in Scintilla when in read-only mode.
  • Starting to move to Doxygen compatible commenting. diff --git a/ext/scintilla/doc/ScintillaRelated.html b/ext/scintilla/doc/ScintillaRelated.html index e142eca7a..8a76df1b5 100644 --- a/ext/scintilla/doc/ScintillaRelated.html +++ b/ext/scintilla/doc/ScintillaRelated.html @@ -29,6 +29,18 @@ Ports and Bindings of Scintilla

    + Wx::Scintilla + is a Perl Binding for Scintilla on wxWidgets. +

    +

    + GtkScintilla + is a GTK+ widget which enables easily adding a powerful + source code editor to your applications. Harnessing the abilities + of the Scintilla editing component, GtkScintilla adds a familiar + GTK+/GObject API, making the widget comfortable to use in + these programs, using all the typical GObject conventions. +

    +

    Editawy is an ActiveX Control wrapper that support all Scintilla functions and additional high level functions.

    @@ -55,7 +67,7 @@ is an encapsulation of Scintilla for use within the .NET framework.

    - QScintilla + QScintilla is a port of Scintilla to the Qt platform. It has a similar license to Qt: GPL for use in free software and commercial for use in close-source applications.

    @@ -65,11 +77,7 @@ includes a binding of Scintilla.

    - - DolphinScintilla is a DolphinSmalltalk wrapper for Scintilla. -

    -

    - ScintillaVB + ScintillaVB is an ActiveX control written in VB that encapsulates Scintilla.

    @@ -83,7 +91,7 @@

    The wxStyledTextCtrl editor component in the - wxWindows cross platform toolkit is based on Scintilla.
    + wxWidgets cross platform toolkit is based on Scintilla.
    A Python binding for wxStyledTextCtrl is part of wxPython.

    @@ -99,30 +107,55 @@ similar to the above, but for GTK 2.x.

    - pyscintilla - is the original Python binding for Scintilla's default GTK - 1.x class. Includes some additional support, such as native printing on - Windows. The binding is hand-written rather than auto-generated from the - Scintilla.iface file. -

    -

    pygtkscintilla is a Python binding for gtk1.x scintilla that uses gtkscintilla instead of the default GTK class.

    - pyscintilla2 - is a Python binding for GTK 2.x scintilla that uses - gtkscintilla2. -

    -

    - ScintillaCtrl + ScintillaCtrl is an unmaintained ActiveX control wrapper for Scintilla.

    Projects using Scintilla

    + Padre + is a wxWidgets-based Perl IDE. +

    +

    + CoderStudio + is an IDE for Assembly programming similar to Visual Studio 6.0. +

    +

    + Enterprise Architect + is a UML 2.1 analysis and design tool. +

    +

    + The CodeAssistor Editor + is a small and simple MacOSX source code editor. +

    +

    + PBEditor + is a text editor for PowerBuilder. +

    +

    + CrypTool + is an application for applying and analyzing cryptographic algorithms. +

    +

    + FXiTe + is an advanced cross-platform text editor built with the Fox GUI toolkit + and the FXScintilla text widget. +

    +

    + Jabaco + is a simple programming language with a Visual Basic like syntax. +

    +

    + LispIDE + is a basic Lisp editor for Windows 2000, XP and Vista. +

    +

    FlexEdit is Free Text/Hex Editor for Windows.

    @@ -171,7 +204,7 @@ is a Windows GUI client for the Subversion source control software.

    - Geany + Geany is a small and fast GTK2 based IDE, which has only a few dependencies from other packages.

    @@ -225,10 +258,6 @@ run-time shader editor.

    - - Xin is an open-source XML editor for Windows. -

    -

    wyoEditor is "A nice editor with a well designed and consistent look and feel".

    @@ -253,10 +282,6 @@ is a tiny GTK2 CSS editor.

    - DIDE - is a free IDE for the D language on Windows. -

    -

    IdePS is a free Integrated Development Environment for PostScript @@ -272,19 +297,10 @@ the Visual Environment for NSIS (Nullsoft Scriptable Install System).

    - - MinGW Developer Studio - is a simple C/C++ IDE for the MinGW compiler on Windows. -

    -

    Eric3 is a Python IDE written using PyQt and QScintilla.

    - TemplateTamer - is a tool for development of template based PHP web pages. -

    -

    SciTE|Flash is a free Scintilla-based ActionScript editor for Windows.

    @@ -302,7 +318,7 @@

    wxBasic is an open source - Basic interpreter that uses the wxWindows toolkit. A small IDE is under construction. + Basic interpreter that uses the wxWidgets toolkit. A small IDE is under construction.

    FreeRIDE will be a @@ -347,7 +363,7 @@

    pyeditor and wxEditor are scriptable editors implemented in Python. pyeditor is based on GTK+ and - the pyscintilla wrapper. wxEditor is based on wxWindows, wxPython and + the pyscintilla wrapper. wxEditor is based on wxWidgets, wxPython and wxStyledTextControl.

    @@ -364,11 +380,6 @@ as an application of Mozilla.

    - titmouse - is a Lua editor/debugger for Windows. It is available as both a component - and an application. -

    -

    Filerx is a project manager for SciTE on Windows. Open source and includes an implementation of SciTE's Director interface so @@ -389,18 +400,13 @@ object-oriented language, client-server database, and user interface and reporting frameworks.

    - - BitLeaf is a new GNOME based development environment. - Currently at an early stage of development. -

    -

    Agast is an authoring system for adventure games which includes a customised version of SciTE.

    Boa Constructor is a RAD GUI - Building IDE for the wxWindows cross platform platform. Written using wxPython with the + Building IDE for the wxWidgets cross platform platform. Written using wxPython with the wxStyledTextCtrl used as its editor.

    @@ -411,7 +417,7 @@ Editing Components

    - GtkSourceView + GtkSourceView is a text widget that extends the standard GTK+ 2.x text widget and improves it by implementing syntax highlighting and other features typical of a source editor.

    @@ -496,23 +502,9 @@ regex is a public domain implementation of regular expression pattern matching used in Scintilla.

    - -

    - Inspirational coding soundscapes by David Bridie.

    -

    - Get away from hacking without any of that tedious standing up bother: Virtually There ;). -

    diff --git a/ext/scintilla/doc/ScintillaToDo.html b/ext/scintilla/doc/ScintillaToDo.html index 286444573..f0dd8888f 100644 --- a/ext/scintilla/doc/ScintillaToDo.html +++ b/ext/scintilla/doc/ScintillaToDo.html @@ -36,17 +36,8 @@ Scintilla Bugs

    - At the end of italics style runs characters can be chopped off. An example - is using Verdana 12 point italics for strings makes an ending double quote - half visible and an ending single quote invisible. This is hard to solve - completely, may be better to avoid these situations by, for example, - choosing a font like Times New Roman for strings. There is a specific kluge - for the end of line which adds some room for italics but this does not - work elsewhere. -

    -

    - Dragging over bold text in some fonts will ripple because of the difference in - size between drawing all of a string at once and drawing it in parts. + Dragging over text on some platforms (notably OS X) will ripple because Scintilla only measures text in whole pixels. + Could be improved by using floating-point coordinates.

    Automatic scrolling when text dragged near edge of window. @@ -79,37 +70,15 @@ Stream folding which could be used to fold up the contents of HTML elements.

    - Persisting view state such as current folding into a stream or blob so it is easy - to restore. -

    -

    - Move line up and move line down keys or move selected lines up / down. -

    -

    Printing of highlight lines and folding margin.

    Flow diagrams inside editor similar to - - GRASP. -

    -

    - A VCL component wrapper around Scintilla so it can be used with Delphi or - Borland C++ Builder. - There is some work - on this available. + GRASP.

    More lexers for other languages.

    -

    - Automatically calculated range for horizontal scrolling. -

    -

    - Virtual space at the end of lines so the caret can be moved beyond the end - of lines with the cursor keys. May also make rectangular operations easier - to perform. -

    SciTE To Do

    @@ -117,10 +86,6 @@ Good regular expression support through a plugin.

    - Allow tools to transform the selection, performing an operation like - indentation or sorting. -

    -

    Allow file name based selection on all properties rather than just a chosen few.

    @@ -143,9 +108,6 @@ Implementations are welcome from others though.

    - Automatically saving modified menu shortcuts on exit. -

    -

    Mouse wheel panning (press the mouse wheel and then move the mouse) on Windows.

    diff --git a/ext/scintilla/doc/annotations.png b/ext/scintilla/doc/annotations.png new file mode 100644 index 0000000000000000000000000000000000000000..9d9b247035815fcfbb4c4793b97c7ba882da127a GIT binary patch literal 33549 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

    741Nl1lZcWd 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 literal 0 HcwPel00001 diff --git a/ext/scintilla/doc/index.html b/ext/scintilla/doc/index.html index f424f25a4..71b6a43a4 100644 --- a/ext/scintilla/doc/index.html +++ b/ext/scintilla/doc/index.html @@ -9,13 +9,32 @@ - + - - Documentation   - Bugs   - - - History   Related   - - -

    - Scintilla is a free source code editing component. - It comes with complete source code and a license that + Scintilla is a free source code editing component. + It comes with complete source code and a license that permits use in any free project or commercial product.

    @@ -134,12 +109,7 @@ if (IsRemote()) { colours and multiple fonts.

    - The SinkWorld project - investigates possible future directions for Scintilla to make it more flexible, robust, perform - better and run on the .NET and Java virtual machines. -

    -

    - SciTE is a SCIntilla based Text Editor. Originally built to + SciTE is a SCIntilla based Text Editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. It is best used for jobs with simple configurations - I use it for building test and demonstration programs as well as SciTE and Scintilla, themselves. @@ -154,31 +124,30 @@ if (IsRemote()) {

    Scintilla and SciTE are currently available for Intel Win32 and Linux compatible operating - systems with GTK+. They have been run on Windows 95, NT 4.0, Windows 2000, and on Fedora 8 - with GTK+ 2.12. Here is a screenshot of + systems with GTK+. They have been run on Windows XP, Windows 7, and on Ubuntu 10.10 + with GTK+ 2.20. Here is a screenshot of SciTE.

    - You can download Scintilla. + You can download Scintilla.

    The source code can be downloaded via CVS at the Source Forge Scintilla project page.

    - Related sites. + Related sites.

    - Bugs and To Do list. + Bugs and To Do list.

    - History and contribution credits. + History and contribution credits.

    - Icons that can be used with Scintilla. + Icons that can be used with Scintilla.

    - The scintilla-interest mailing list has moved from lyra.org to Google Groups. Questions and comments about Scintilla should be directed to the scintilla-interest mailing list, @@ -192,18 +161,22 @@ if (IsRemote()) { may receive no response.

    +There is a Scintilla project page +hosted on + diff --git a/ext/scintilla/doc/styledmargin.png b/ext/scintilla/doc/styledmargin.png new file mode 100644 index 0000000000000000000000000000000000000000..3aaf35b0ad4e65a1cbbe2f10f8b8d468d531990b GIT binary patch literal 17138 zcwSVxby%Ct6E+&$p}4ygr$B)MDO$X^TW}~=9D-{pt_6xTxI4uO+TsOT+}$<7okRQn zzH`p^2NzfNnas00Gkf22?0D#mvt5qEc07yA2ypz-dgO0vo)f4x&?09W23w%HJuo^KYuYSM2I}&C}*CCU? zi!YqF`OX6Q9R{*`;^)t4=!P$T=aAyRf9HqF+|Nsq@&Vb;GL}LCm*N%6*LS?K%CBCc zN1=zjppoR8JDbWcFE1-^EBC!RUW#|BUjN;8TP`QQ;-*lWJ zR$1&It7&YeMpflSl z4z17#PYku_uW4p*>BfaynRe$kz5I; zSO9*DmnLosz5;eZS_!FBOo{IS5asBqC1D>xSf$0-&5<_av@-eQ-QbF!{ps(fm!SH9 z@dPgxoSU<2ddhh;N2mnN5ZaHJOQ(V9(CQl?%<=M%#Zs^Z9=;= zgm3$3LVqU=W#aXjV*PYP==;^w_db$>3|tY&l7!K9*6mds=%@emE$#B|x{lu@+kK64 z1Fh4)H|Jtwbmi40C8b=T|HiJHP`t3s*=}QHTHr{mVpuulNt%UXwwNJYr~b&}p#&N;;a$5FEXbhs(^Wa}+$(Z=pQtoM>MM zc$Ezs?1)#rPTH@euoF-zV}xe0;4odKH`hs@L5X;Wp((m&S+>wSZMM)Uj%YoaXxz>ez05Es9^My>B zavTL6aeOY-H+&u| zDpbOCOrM->wJOW)VMqF9B-kMW-UJ`K3f7lmmmfCJ7-k}Zb~ECn1Aq&UZtHTS-|D?! z@XSu{`Ao(!lAA6;ELZH=Am&-8>;+ugtrhqAhIQAT1|f*3dlowO%N#6gFFN;{?pY)X z1esZsg%^W@tJPVTi@D-@O5LKn*KAAy@RPNLGX3u=R&Zo!`JIxLf^BKHY`^KYYA(;? z)?;sfAQHQ*7e21-eDA^P@V>sAK7KI`-Z#oquY>C8VsdzWIM1()ySWLL@uBy7Yrc~k zqlI!qVu3Azk;w(*Q=?jx<3j-cv_@6R*XDkcfKocH0}KO}-=hdEgT7nu(ZMrKPPE{~ zj$o5V(}74Q98shYI^~7%YEz_C)6Rzl3;N2%m&UNNnURAf5k2HC4Af-Rw--doqK%Ch zlrJ#81|ReGS~w@+usNPgx0#r)UO=;cu1NjFxShy-`3DR*IU|g-r3Rkp=8c~4IDXEn z2C@6l9^OnXF;R>42mC<|1*sVKuYf|DEXT`EF<KYa)LPp6 z#g9(Z=Ozz2+da>pOeN1P8tK=&Q8~Ks=s^S&`Wpr+m~0|=K3;bu!xvV2CBKS)2YI{GSy{(VpeT!+f8Rj-x5nC`&|DxXX4uq;l%>GV_D4$XwCZM?L=L zo%+yLt`@u)??%@p)69(at7I(kF~t?nl^1XDv0Kdq3jE z7av4UtaeCmri@hx-2Pae*b?H>Tyoa51_uc()*ISjE?^ug8h~x1*H{tPsWD zOME;92`BShiCNsuRv#V0Oa0%nXLg>On24XQynAstnE1Cep5U|J=_~IoTB3v=7KFb2 z_F9GekJ%vnHqS%*z`KNm82nnWC(N;r{tf_UpkHcs!_h(}I*Ay*zU<3JQp$cC+=rz5 zIbOW(L@4el4vPH!s3TZ2-W1~#f~CMQMwi`Gg(2;{mhaV?=$QAabPw54PG|E+?vcQK z#+)c*;7j2zN@uh;WD>)558)bb4Y;up)5#A-)+6+@Pmn0R5PiuXRn#1Wk4A7- z@DA;QD-D*zHj5ZG|JTFXVT>3BK|IT-mjvUnqUhr5-}llbf5+oFo%F6_=pMCyI0^LH ztEA)HS?r7@;5#^bse}q;(WIsS=0aIQn&1hG$c7p&wC&P9+3eb94FrH}HORBJa6NKd2dxclRe4z3K%LzPFd)mO4he^GzW|K(~Z{r-ee zb?&VXAY%3yloH=@Zn6wKop|w1h;$)vr6u$Tk+KH)?rpvyedV<>!fO=hhN}38C87Mt~T@8eCSnR(M&>1C$hcN zz*@VllpWxba{)iTPT)q|Xu|PhlSQ@P*U>Dy&TF{jQq{i7DfHB=3Jgn0^HsY_d`*vb z0$V&q;;h7{KL?vwJhtMs9&}izY{m}J?WcV*X)&McEB-*!$&w=&em?JjAHIBSgum;5*g%sofS)0Jzy!D7K?2`ryS;nCks6fl z2M?m}|7yuPRJwcVXyn}*ujTazJT&Djg>vu^LuH#uaZVtRoArV^|LvXm5IsIKqy-UT zblgh-{&F;*fpWMD7C@!OT3`~6wYjNi3pak6h4rAcKQJt@oKiJI4;lqBb&P(+g;4dR zKJhyr+xYm$Hv}2fCo96{?Bz{IQ;At4=AJ~>f10H!@48K!lEkb=KCcco{8G|jI%)ZR zjKVv7^Xja@+_yd_ZFcgNTb(loV(rzv#+q}p^TxP&;XjMECQP3OwRfZq(m0jjDu+U_ zlH`R=x_9xFMd(CxsL7&S7!R!xY|D~MJkyta03BnYs-3~)-8}T0ihy%A7WAb!TTwf) zKgg$Z&3?$$*n_c2vTkjDH*F2#T|O+lEU3vPs6A9pie3#ya&T*!04YiyuT=Slu(-#8 zoh7+q+JNh%I|Zxdz*R&tOO-vbColK@)+r_%uG8WllPrAHVwGg2#n;d)Sg$7TzO0?= zD6w*IQj4%WibYEQgcCUlt!{Ar!VrjL*X8`X0DF zFz>x&kJJgfI`cX7K6a6>v-*v(41m{=I&={n;{AFgDIo4-3u0kg&dO9d^nFZIrOH96 z4aswSwGX}IESgbZZ0&{~V=+Qev!4*j{X9i69Z+dK$!McJ4}>rIm$n0nc1)8lOW6Ei zp0l$wFI!q92_QFcQ{dK_J1JN6CQ_F~jLye+2!C!HttXI|aBE1w5=F8_g=O*U)LPDu zB6mh%`$VWtKtK1oZ=#P#sN+k*KX39r2-Bv9H6Wo*BYvj&<9i;qpT2_|{TH^CUnP%S zyje@WNw&*3u*+Aij1{)J`zqM10)x*YwDm#S?GN?a`Y#qli?+IU#Ts}`a@Ql?Lf-=Y-PlX9TB=x?sR@Sr$@8K ze(XOFZXn+YMZhrizCg)d6eb+Uv;@5FimkRIfQ?d}7jBIG4B|>CB>`B=#z01}^qUw<=IAzKapT(XobneOfY|jSoX8n)Vm%Uj*KVXE`?oe9kcOoTYEf!X{wmC4HNwW*K>ur-wrp(7h=1miT(Fj76NKOHFdxY8 zz=PEISAVtd>kUWf<+qS?L zm4(;g(>8y=Z?IES-PtbFYvd2}Omt^M5M*GO)nDZWEm0COl_G5lf6)8lc6abDg?jM) zG0!4clCAm1H}FzmFH4Fq>rHo}$^5(VYQX@8?4++{k_(HDvjf_v?o3Z6I=45!-YN?# z?cdZ8mXMj%ker=!WNOM1!9v0_G~}AZ9|rmX>B&Fn{J(kG^UOBB4Xt0oyfkbzAl3Up zOc=>r8IMG~_nO=El>1dy~8l=wiFgT%Yi>gWukBqKX6S=|+Ju&QO z#J0z%8b{xP%g1Yf+bsn`;T@wlcBz$qQtE*wAYP{*No1g8k+RJ!^7c;7r<;4<3>R=u zpqwiE4UyBzS(6_T3b2xP!1M#U_f#La>{3T7t`rX#Firn9Xx*kFw^ulRXQT4#QCBGb z)ICw_lbA^jePEPQ#5f-TT{+h~!`2H|;Hwsro(AL5Cc)-ZFD zmhzb^KycYFM04&*FOm%cd{@u2OgC~IKV$GsI3>rSB1g|?j#GxV$&UT{uVYBcRxTc{hjZ(gokrxuz>U`ulvplS zsoV1EaxcQaiG*%D}#f zqDSsN6i3>d{lsX!n%-x@*@MYLHH!rEXN*BMiMnAf_}e;Ak_bPsIvN?F*2*lDnh(@( zKiY?>e?d0dG+jb_p(yN zj9i;Pm9{EXkzo$FsE#$y$m3uD=pOzR^s;55a|AD5aKsS-8L#^X$p>=D>d<3Nh+Lbd}dvpTV&>3T32?W ziCy2dT2Xodyla#ie%~m;2@BJ$j?42k@kRj}S?U6GU*X{Cm&{C=xKOV*;Y7&^t39C} zB_c--Ik5!JK(nru498ekTZHn;MtiH8Qf}pGb<=>VA~{rw$4q~W9~#=sTXyO;5gCo5 zEWKpm@`wc}hB>8NFHnHWE1Pggh439JR_SY(j6ChJhn^$+pDMvZ|++7s! zrK%pq3I|qYd?fTP11ghBB*}64F~Kzb0oCQu(^(xy&a%pe64iGesqYSHZVsEuO5dtV zvO@L}k*%&h;AH%NgST~c9U1mt`>BA|?WW2NSQdX&Hy5Mu-2GkV zPtnSD1jsOv$-|p;0FGbeo_6uz0 zJa-Bd7pR>gjZbGr6*NVbm>4Q&!R7f+`qT%ry50+98v-!v*~PCSb`h%r*g)QX3kwx* zhMlJ9bcEPLp4?Boj3WdM-lknIX1XJ7IcMJ5P?h(BtG@uiw2uwen8wkgc82HSvs1zy z8pgSXQcO=Vo#pu#6>%%CLWTSq+kKfgRu*N@&R}LY5-j(km8c_be=H+3$|cv!H^yAc z;DK*bKZ?E1oe?YG{D21WKGjI0Xle-AJ|V}JCjdn`;1Fl2M z%-ch7y0&2d(TOqTYW{O7Gy5;07>{I*lg5`JX(C|U1V8j4tx_Et|w}e=Q!j5>k8!m;bD-R2g*A939lYsu0aQzByzP zZQ9c(hE#;0bw5NCZ5h-e;mY#O0f|UeR<|{Y*MnJK(dA_rvXfKH$vURdj<)npiQ+Y zD0|08nuCIMXu(CeMv-l&>+J_fUY>q^7N>F)FFAgTfBd1Gm~BA zhNfp@(iG03@1{yyY%9C$r<%=we1kEJxxVFCc=N%4&Fqt*nD{vF#wR;LR|s^s{8;-y zt@I6Vo_lXsKWG?v+|J5zHjsx}@siw^Se(245i%sI9JM-y0y2BWUuE}rsv0=rqUSL) z$mLa8BOX?Ac`2O9i4Q~`^NPDV^PqjU^z?QjY05TsA1{qgRs8%yWAOj8A%*S)oY91% zHvHwtn-H{*7GxBYi0CvSJ6JRo)u#XMlwPfrGz%&0^bd27+o?$#Qt|T`VlAGA+BCr0 z`$2xTBh?{Yp-W_cIhw#J_(d;ad{H-!1A;^FPs1*+l9uzt{{O^49!l5R8+54mnNxQV z*R$?&z^XWzC&FFcCJ4;&FnyRgb&{sd2uiofMd?D>+`4G1?mU2h&i2KDd?k4iaQ*9~ zs_jAj70JVAV|f4^IUFCFkc_F3_URb%O#}cwJN7><6hE#jCHNZ58$v4A%+(Mlz#V|O zf`|>g`|%zf+JJSZJ)dSvtryK?a?>whJbnE0!mxRo1~9;p)b2mpn3}Ezt(tO75l$Ie zkK;Zt0m>2_KsU%dJ?gdR879S5$opOwn4T(>I3qwtQp`%!7*=_GUc>6;Pg4vNl%sGY z|E$T)JN>!pp8wGzQ-`daqyZgePv9@s@EE^}Umgt4O829UDJejVsqd3H0W^o!`K)Bl8me2CpDHc-H+cm?~W!M-K^FsT}bOr-+D)xR+ zWHvC)T`pg0i>do;;Q-sA^i}JWTXY;^>l)Bh;oIwe-*Uz9PYelg`jbV5I!6y(M|-(U z2h@dO{i|1GzMJLc7PVSo3i2sTP{k>grjHdo8SF)u4HCVYTZ-$Sy}-6H{il1Tbn>r| z_lm!?4=nIxXOwbRP|#HQ8>l|W3^@H1`*_ezim-f;Y0m)g;2cP-`33+(mF9oJvz9sd zW!K*@Yzt>*)dtC;LsmcxJ?=vTT%VTeE(0EJ)kzLERn&o<6GckYC&zBk;#pI(HRJA^ z+R)D#x67kj;rJC8z&=lT{dq|PJOSJO;{HmeU>*jIB$|-089nZWk$4DQR(%Z5pN?bP zN+VALUgw<&pRCr#xXN?%UGLZ@s&$73Bh-_bz~$kPoH)k_@azXf@E5*`^ItY`O`er) zn+$sRAv;aF5{G)HPiYNJJVx@}p+1vB3Pe$8l%Qh02(xdWzN2Bk(svt6gYuJiPoT&V zzU8I=!d90BO(%}m3D-@MkoUD&-JE!ZcBWrSm-@(Q3y7|U+_#9K%qbDDWbW;tLmFHO z&h6hWvzXr~mSk0c3tGa~+pj+#y+HPu7hK2`1b-3foRa^JtiY&H8?+%s2-QW0d`DR1 zvY^lt^1>(PaR=;iSH0O$Cn3ZRT{PBGQqEqiRtPDMn{t;-R+WP$55JZ{QlJXz(#vX| zP56T+U#7X=Q;Gr1o_0gczPDrwPtyWep&P?inKMH~X00Wo6^MZ*l^fD(gkZ(2Ga2mH zp;t)`#OM65Qye(;CVhE!n~39*okXP<0jx9<`;&3BKN zUNzc6UKbU1>^4KIwwa!NIIlgY0byW+F?chL42|7wP;uSb=%7eBdu*`cR$DW{tNt@` zJ4Jp;Pt?~V@OuLuzqoz_Rcrx)`%m)DSVc^ZI4vF zQCJT4eplQfBBu%cb^fLzqC8@7iDw#`YwiE-O?;_3+;y~uAEdl{Nha7IS{yn&b8z3- z&6(&caE7kZ?jhSdEDXlbrR@s!?XGG+l4}yXp7{OB_s_VHxbuVXA6g#7*b*?t)nb+n znv>Ujeg5TgKa<0<{z6@Oqoa`bpOY&8hNZyrqa{^DXtnPX0!otS5*fXV2gD5#%1K5ZDkF(Ha{ zQ25mvB=hWW9Cd8vHWUw=k}Pb$W0uT$LJHC(^Sm4gdMp>f8AqXPjozKD-5* z>?xFd#?kpLc4@3~QPX;0Zl+Su(`i(_r@ot`lF>noXw0Q61&WZ;7VyIlCe`hhwS_TW zWx<+I(K5A-o(t9<5dnX42^&dY_YhuE=&Tm`t=(hBCJ%o%S{9hGlX?Jt5Ed%s!vQ5y znYk5$$IqUC0R-={Q{*baP*;5DZ$b&rZjP^v4(ddzd+Lzhl;62U_wuSTKy|oAiyQN~ z2xyJU>{-#S(-T!ybXUZmZ6K(6;H6MsV&k5mgKnE*J_YLn<-gguYHmv~e! zW;6mBfmZlHkMp^LT-Z4{}9fMjUcvpQA6*!5!tNws5s$9NW}Jj^gPxYV6_ zDfSEKmoDjE4r1M0v`lueG4o^2`lriY4e}tg+m$DiqwuygF8@al;jVJC2C{2RYg5`4 z{KlV)9$PYSok|03c0h(lO=$;yDj4;V7 z0?M3Liseo@_wUw_v=Td96qgGG_60>ZXpD5`a|-m%!%wTaV)4nrOf??^Uj=etNgWi z>>zp43*Q_2w6pOSdjg=LJEkcw4l*UPNtaR!6oJgQaES%d zYvgVj=}~RBC{7pw2+k`SL2@L0fZYgtJ-*2u##meB@>j!ts&C2StyFlpp2w(7+Z@Ih zv9bDOI%rBr*&4-yK+6sh0LSIpxX5^Kq;`;A+cieXkb4U5A^MPkxshm;@@&nUOBf~P zih<+$dFK_M#y3wDS(F%fY*{*?kx`_JTt7@6%Q`xeI`ow8UTgQ{si8H_A;(ubvrBRo zvhs`I0IfWJ>gN%;3HQ#<*@N^I0=x-{#~N)YOuUODs7D5`*Yy_oGMv(sVNCDbd$BTB z6Ya63u&wfbswJ1uQhWA*CWfLIQwMpR^43v2E)&u^?ace#l6JsE@2Kp!-)z?8bHJRo zaj`Il7PvGgWYeYUM2Gu1{3d`^*Q(c(^)z&8$3Enm!`xa zj_7%70kwdc$9goB|LvS2q})k0(%c93^Yov_A#77ncz-VPba zpjj@9ZH@qM&oG(Z??FQ?IGoqZ)lzQ;1W}-TB0YJ}%GKuJb%Ge!<4cM0J!$cmf7ryy z4k81CuBfw#JWOBce700NUo^$U$Mr4^)zy*H(}E_bj5VKO^AW#9ZcGcFkv!UyTg)%@ z;e6xGcKLJKLH59gb+q3oiLcnNo$kU~I;J?1ugbQCEzBvJHedv~p;1V8Rp}4({ypQbj$a}ZCkAgy+r4Nhx_YHI!U5eh$E+_fYUbOTZ zpSrdb{9_pe#@Pe{YFZ;{+_GlH5QsV~YUi&l7BIP3^#!Vd+!fN;*suQD0kynAG$Dsm z1?_L7iOMj{-T#axKB1VvCUf(uzvyQuTnK#m;35m7srjNR*v*miHv)NXKn(dmncBcf zVaVXJvGN+x%_!XN7C3$wO4(PO6?oh=T>jS%s;#^w@)cUfmMXG&%&p&~UGC^$v_p+R zG4kO7ySK$}e629FrWkK>;)KNy0P`@rbM6Y3Wn3holjJOTZ-U zweMKaL5j~1nG(SsE$v7E-g5h!^4-||b;Vg~J)iK@D^G(-MwH~DAYIwNN&LNBVWRTk z4LCrhY&qlOksh#^?{j!>d7D&x*!^tz!ZzpeEPG~ax`f00YRWV|2{BJan-7(lCO|ci z1bQPPyK^d>vgP#WRug>PIEH|~Nmhsnc4Zj>R9D2+lz{11y{S*hz*RrW{ZykjL3F0- zlG$cyMK+u1mueFf&^+Pi zqDBenZwp9ZtcWKK@x^m52`)vI67fI5zd(zR1ul@d-G4a@)lgqs)L5twg~pQiY=3Lu zYO`DLobf!YJet>CcxakmeqcJhD`7KQ>8&;4*S%r?D%kY4(k@AuMt`jUNyXc$w;b$F!scnoOP?*Hk)GH|H{*-0|ioyM0#?`0UQL@#O}3EM*DBy;*nTWDD{0hz40ToYze@-_#xn^9-0f#?!Nd z(7^$5HO58*i<$jl93doI;*(z%t&u)1xU+w4*5o9#==a7m3R$(EUxh>Vf22ec9v$Po z(G-_)xeohnGtca1o~IY(<{E_kEwN%?GBQ~OzkYEx`K=bz6ejgC3D@gLotpGM%RF+! z0k%L+u}Y*Azu2zebFl9aEGOC+N~X;^=AcSIwjvA>3}#Z$sdAsTE*YbfS68Whe_SA1#*YkH{yy@&I7`wu{TpShTyyeGEgWAl zY~2zqrOm>Nzb}jI%i4VE4{$Hld#-mJ2w%Wve8j7}?YWMil4mEIyjG5emr8a6B&N47S zr3!kf-k&tCmR$B_@xn@F@*w#1LyCja>v6M^`p&{anT`_rl>SQKeLraRU2nO4TycA{ zHnoICp`vMA+H-8vXKsL>zu!c2jQiw!;w-gSaPPhX+3LEF))eirXmDHXc46`JRk)L% zbAIh>YYd9g?Jr|7CN3DGa$6asxIfiRdEa>jwbQOc;EB@YOq9D4f!r31umqF3<$c+( z{EKC4lxCDyUuvn`G`*(O;XPe$uPc#9!6SxK6>YRT+(=qbHP~kElNMrO*~y%E|i;yq6-V0;;_G( zGW8eSU$EX3aU+KB`{d-T3l${SIfs`Stz=z+UG&#m(xY<}1{O%N+9tx%jWDG3QG2nP z^C_s!m}%+q14Be9E5}~q5syj1e;I5pBaJLSvFl@0>v(7F40{GHzH>K|@LAAZPydUgu}MMgVP^a|COUYNt-fz9TZ z6ipcB$zR6C2a1d9PDB-3a~P3Xy3T?%5yq;~*!H3rVdP4wuNRWBN$?0AyOKZ-pj8>yFI_#Il z_$>Wk8+I3_moCp(76vI$J!2_D5L%I}xNgR$Y~6B#>dvfmQf{8KuhBIC)oP>}@#^)& z6(cB$j+>0r_R1Co_oGcwU7UkQZJy`LAqjcvk_4*xe^5i zqEUoD*kQevfe-DXQ>wzTd8+N~yt;dm?SlW4m+yKvI(bMtjKnbMOSuhx`Dvj2Wo9^0 z{K|CLDsfy#eK!`Ye}iX-pgQ)aP*2iwA8MvN=+D6L3vjPzSZpb{zEhZktNE7()qNcz zXpP!zV+8I8G1ks{)SYJ>Llsg10BgwjJCv{hYnRz2EVdYo zP7~7fB!Pp-TCgisgJ8DD7(bF3IDA{B{QKQo)!mh+gC91_HLD3f;;OpDXG2b24994+ zigG0P{?r6QgW^`{!5#?I>hJ=?KA46S{+j(bRdtnE*6>d_QFVkdZhT}t;5mAI_{4a= zHr%98C&-~HZrs#uw zA_H#T-AZj7Wn1k>BO^};fWv5DIV?hH0@W$}HiKfO}|4 z?`3UHN0#VZfk&jCR61~5M^dT|$5hey`9p~k$fEb~QaOnTueB{7ltiFdn|GD5zK_O; z)4dQJMOte^vIz8mK>{-3_kNaWkb7d*zt0!*4;o6>bS}u-iji9i<{;FU`Oq#RXF)Z5 zD_1wfhCp1s$|M7X)^{gc+u;&h!_budlsFEUV^hLc?!;^wrc#U!i0!t zdx#Ww!5`6eho9I^XzZZ+0DbVm`=I`y-`qJ$Gh?x7^Go(eeJN_j_mlVSx-Ts6HqkQP z^m728Cs?Df%3N!dSPgX6=Knt_?R4O$h~OUzf}E_G3vkq0&uoiAwr z>EK;_N7<>JGSQl^*$FQ7LiXU<%i?i1yQHp)5jHAClsx46jw(n@mJ%~dvm!MZET2?1 zP|Dt5z1$M(Qfzhc!;obOZNBWWY|Ax_IEoZ_Y2!CuC7p{ndwsQKxe!<~$mVFMEXtgT zIr^vHIRI|(&99C0=t-rhAhgag{1fZ1rL|Rh>w@Vh`m}ea$**=R#*^-`E;vjE`#V`` zyP_BQY&js6Xg+IHW>&qLEN@0hKfM?40>ZOYbr(x^J-By72Hz0Tc7l<>iqzgsGa}{J z`=mVX3R+Uu4At zf`=^uP}es-vY8umtPs>6k!7>zk7wW<)&EWm6PLa$+SF;`g9>! zT>^&$^h1v>J#`QfTGI5eru%TeA4CHYRU+4Iwks0-KD&jz=o*H?>mSKF8ZtdwmXN02#PBl0i_ctJCXUSWap#bE%JpLnzQL?DC&gC$H#{WYU z6?c|w*#Gq#94M;OXp#R3M~`gIPxSv`Vd3iFE#3b*lH=sUR}TMEi%K!YU@zaub?M~K z6ihBm$_UjlaWyw;z%k{n3}2NnZkywdbkE?ercz-6uaC_!&cEr4G%^ctK(^FoXSrYu z$YHy_)iO$BIpIf}L~-Zu>CFdB821?%ApPg(`QU)#)g+2=QJ=E$bV5?SJ`zH!c-pEz z6Eh9P(4nfRp;+f0@enhd!Eqg+VIXk7F32fNdHppdGoHzFyYaU54R_6A%d{^kn`rD; zp#MYGM;U4MjVTs(2p9O1Ti8hadddt+s^;b@Juumi8W%@JHAJPgTDhH26zyMut+)Z3 z@S@iAT#QZI>#BPrs=MvggKsQNOZ0K&X75=+d~py+KgHG@iXb|$(}r-|O*`do_iQbo zktp7K!**=ynImP>GnlO@ZQ^vPNcC2%&ynIQe>U$1Q$MX^PX)Fn)L@{oJL4jB4jj`rT>>sS~qA(PM-fF z$%mwMtG{|HDP9<~_%UoRuMzNH!qnTWYmfeyQbBq3cy4W&VA?a;kv71k^k{97K|h4$xen}M=S>lF7lQQ!TnW#b zs_(X;X*kLz0$IZ-l5aoX9A8TQ48_S!jA$$a8+oj?^jCOkXp;juIei&xrGShgC;6oE zv&x{_i{==K@bJWXayY-HDsY_^uonKUav1s+KR~Ad4 zsNF5eLkEHf=Q>A^fma=B8=@wm%R(A2SruNYQUaHm9k;!quS<0h&5{$@W zPCWQ#B37HJJsH2z&WE0^>W-WxO{ku0AywbYi!DGwE>p<80q~=vuxQ z!ns9$KB~Lq3$!&S7~(ltRUdjk!JjR>Jl}Af6m2T=_kIqc)?)Ch%f&qw*C&+ zvjp3?CD*SAhz5AGjtd-Z-=XBL_wIhfQ7{KL^B-yKfx%V5$}lOu_ysO~@=H4N>&T&wmRBs^`R&3fYLZDwHJ`(K`OuVf07YZ1(Sv*vQb` zcYPoJ-B5?B+C}jWQU#`|zO3Q6h>S3u?&gSLbciD!Ta5lT8}ui`CeFs4+xfOOE7w;} zAf3w~#6~#$9E}G*kCT7!HCV|cFb&7VK38fe>rh-Q2rgpQI$LL92mMBJ#M(j6wCJ@MVl>&s ze5AkynTBUzlIsG0QIvopzo(n|X!BKa_>gNu*Pk8A!3*TF2in!rYrLmvC-&qG$=jGYn>yfL(&+*^FBk>A`F+Y01Sgg_DD|WXL>R&$W>t*n%SHP~8p< zxVrFq`v`NZetUjcj1<1?ulc$R{ekVQW z0W&$>Ra%E`uLvtyTaQ!D)KE7dvMQ3(a=U8BdB3sX2%@!V%xW(JCGl9%=aha_B0Rl1 z@#U~Cj_iMhaohWa{w+(QVJ*Sn&kp-yd$ul7*pG>Qn=2klJEK zh{nDsWYCm*Aa17_1zp{4Q-nFiLiz;XC0Gyu{vNX4s6m-l&^ea0k2ca2>4~a)&Y*0m zyzIwaU-;Mvz@3k0Ak!F>zqjJHi2rUPzpwxK?#bX3HZ}T$%*6waOBC$qnEs;5x*Q!i ziz}H>OM|2^(EeASEP&FIi|{@$Sd3+S;7SfNAV??Y>UP!&|P-IL7f0^}EmK_{6p zL0Oqqr{7p;qh=zwQ~e;NJ{2q`{uzwVbu#uG2Gol>%kRo_ZrpQ2qAm3Q&?Zd_jT_m^ z2p;g=th3pZvd0w*;&ZtQ+Ge0bfhR{rL!<9egPy zr=}$LAm1PcfLGrY#Fb!x_3miObSz6hA64*U)FHb4o-5XJbI*b2$b#repwH3xj!6^t z6|jSX`_0FB^&kJf@pE@pJ<;NlxBI(S%O}LIGhAW*+3(1Vf_Ry{Pc|q}9fBtf=w$m< zD52=s>O11wg>ClPj;1r$n)WW7=!O6Tx+I>KW*lZzUpO(IhR=iJnq9k4(o{UPM#+z) zSEi+cClzL0B=VIgdOTCNHMP2-$`f4^_l~^}wgymqAZqSaHR^Jzu>kfgVrc^aN%goZ zpq;`Y0~Nw)k{19{PVV-#F?4*;Az0=2f@7YTG^UYDa5yX&|2K28eyafgHrv%fvBnD5 zj1#Uq13a+k<@764tb%DoY@m}6$>Ctzv#&q>)4p>cRJ{H6Am?qGg&bh%PMpDTk z_|`Be*amv>^T2rdHSDWq<(~bP_2KerWWL+wI2 zpM`LMa}7FKc$@N#TpS=R*yVBcf6F8T8_-@JEGQ$59o+PneK>Em`iy*49RY~us5yEV z#-3F#oL<*^(Fmvq925$6Y}UCM&(FZ2RRIWpUn*jab1y`WeOh#e%sKtg$3`V&`iu-ow^?U(WhI2HVrQJtB=2$^~A^ zmK5i_0{cxFCNK%easHR%=ltXSKeMSQRb_)LHDg#7zAwK;)x6;$J7`0Sq3#22xi<$u z3(YR<5Hr}rEV~G@3T+o_8e+`l5O^V46nDXg2ll||zQL5a?ZAKbg1sxWr5x^vF#v(5 LtDnm{r-UW|be~G% literal 0 HcwPel00001 diff --git a/ext/scintilla/gtk/Converter.h b/ext/scintilla/gtk/Converter.h deleted file mode 100644 index aeb5e1596..000000000 --- a/ext/scintilla/gtk/Converter.h +++ /dev/null @@ -1,87 +0,0 @@ -// Scintilla source code edit control -// Converter.h - Encapsulation of iconv -// Copyright 2004 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#if GTK_MAJOR_VERSION >= 2 - typedef GIConv ConverterHandle; -#else - typedef iconv_t ConverterHandle; -#endif -const ConverterHandle iconvhBad = (ConverterHandle)(-1); -// Since various versions of iconv can not agree on whether the src argument -// is char ** or const char ** provide a templatised adaptor. -template -size_t iconv_adaptor(size_t(*f_iconv)(ConverterHandle, T, size_t *, char **, size_t *), - ConverterHandle cd, char** src, size_t *srcleft, - char **dst, size_t *dstleft) { - return f_iconv(cd, (T)src, srcleft, dst, dstleft); -} -/** - * Encapsulate iconv safely and avoid iconv_adaptor complexity in client code. - */ -class Converter { - ConverterHandle iconvh; - void OpenHandle(const char *fullDestination, const char *charSetSource) { -#if GTK_MAJOR_VERSION >= 2 - iconvh = g_iconv_open(fullDestination, charSetSource); -#else - iconvh = iconv_open(fullDestination, charSetSource); -#endif - } - bool Succeeded() const { - return iconvh != iconvhBad; - } -public: - Converter() { - iconvh = iconvhBad; - } - Converter(const char *charSetDestination, const char *charSetSource, bool transliterations) { - iconvh = iconvhBad; - Open(charSetDestination, charSetSource, transliterations); - } - ~Converter() { - Close(); - } - operator bool() const { - return Succeeded(); - } - void Open(const char *charSetDestination, const char *charSetSource, bool transliterations=true) { - Close(); - if (*charSetSource) { - // Try allowing approximate transliterations - if (transliterations) { - char fullDest[200]; - strcpy(fullDest, charSetDestination); - strcat(fullDest, "//TRANSLIT"); - OpenHandle(fullDest, charSetSource); - } - if (!Succeeded()) { - // Transliterations failed so try basic name - OpenHandle(charSetDestination, charSetSource); - } - } - } - void Close() { - if (Succeeded()) { -#if GTK_MAJOR_VERSION >= 2 - g_iconv_close(iconvh); -#else - iconv_close(iconvh); -#endif - iconvh = iconvhBad; - } - } - size_t Convert(char** src, size_t *srcleft, char **dst, size_t *dstleft) const { - if (!Succeeded()) { - return (size_t)(-1); - } else { -#if GTK_MAJOR_VERSION >= 2 - return iconv_adaptor(g_iconv, iconvh, src, srcleft, dst, dstleft); -#else - return iconv_adaptor(iconv, iconvh, src, srcleft, dst, dstleft); -#endif - } - } -}; diff --git a/ext/scintilla/gtk/PlatGTK.cxx b/ext/scintilla/gtk/PlatGTK.cxx deleted file mode 100644 index 30aa73983..000000000 --- a/ext/scintilla/gtk/PlatGTK.cxx +++ /dev/null @@ -1,2755 +0,0 @@ -// Scintilla source code edit control -// PlatGTK.cxx - implementation of platform facilities on GTK+/Linux -// Copyright 1998-2004 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "ScintillaWidget.h" -#include "UniConversion.h" -#include "XPM.h" - -/* GLIB must be compiled with thread support, otherwise we - will bail on trying to use locks, and that could lead to - problems for someone. `glib-config --libs gthread` needs - to be used to get the glib libraries for linking, otherwise - g_thread_init will fail */ -#define USE_LOCK defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE) -/* Use fast way of getting char data on win32 to work around problems - with gdk_string_extents. */ -#define FAST_WAY - -#if GTK_MAJOR_VERSION >= 2 -#define USE_PANGO 1 -#include "Converter.h" -#endif - -#ifdef _MSC_VER -// Ignore unreferenced local functions in GTK+ headers -#pragma warning(disable: 4505) -#endif - -enum encodingType { singleByte, UTF8, dbcs}; - -struct LOGFONT { - int size; - bool bold; - bool italic; - int characterSet; - char faceName[300]; -}; - -#if USE_LOCK -static GMutex *fontMutex = NULL; - -static void InitializeGLIBThreads() { - if (!g_thread_supported()) { - g_thread_init(NULL); - } -} -#endif - -static void FontMutexAllocate() { -#if USE_LOCK - if (!fontMutex) { - InitializeGLIBThreads(); - fontMutex = g_mutex_new(); - } -#endif -} - -static void FontMutexFree() { -#if USE_LOCK - if (fontMutex) { - g_mutex_free(fontMutex); - fontMutex = NULL; - } -#endif -} - -static void FontMutexLock() { -#if USE_LOCK - g_mutex_lock(fontMutex); -#endif -} - -static void FontMutexUnlock() { -#if USE_LOCK - if (fontMutex) { - g_mutex_unlock(fontMutex); - } -#endif -} - -// On GTK+ 1.x holds a GdkFont* but on GTK+ 2.x can hold a GdkFont* or a -// PangoFontDescription*. -class FontHandle { - int width[128]; - encodingType et; -public: - int ascent; - GdkFont *pfont; -#ifdef USE_PANGO - PangoFontDescription *pfd; - int characterSet; -#endif - FontHandle(GdkFont *pfont_) { - et = singleByte; - ascent = 0; - pfont = pfont_; -#ifdef USE_PANGO - pfd = 0; - characterSet = -1; -#endif - ResetWidths(et); - } -#ifdef USE_PANGO - FontHandle(PangoFontDescription *pfd_, int characterSet_) { - et = singleByte; - ascent = 0; - pfont = 0; - pfd = pfd_; - characterSet = characterSet_; - ResetWidths(et); - } -#endif - ~FontHandle() { - if (pfont) - gdk_font_unref(pfont); - pfont = 0; -#ifdef USE_PANGO - if (pfd) - pango_font_description_free(pfd); - pfd = 0; -#endif - } - void ResetWidths(encodingType et_) { - et = et_; - for (int i=0; i<=127; i++) { - width[i] = 0; - } - } - int CharWidth(unsigned char ch, encodingType et_) { - int w = 0; - FontMutexLock(); - if ((ch <= 127) && (et == et_)) { - w = width[ch]; - } - FontMutexUnlock(); - return w; - } - void SetCharWidth(unsigned char ch, int w, encodingType et_) { - if (ch <= 127) { - FontMutexLock(); - if (et != et_) { - ResetWidths(et_); - } - width[ch] = w; - FontMutexUnlock(); - } - } -}; - -// X has a 16 bit coordinate space, so stop drawing here to avoid wrapping -static const int maxCoordinate = 32000; - -static FontHandle *PFont(Font &f) { - return reinterpret_cast(f.GetID()); -} - -static GtkWidget *PWidget(WindowID id) { - return reinterpret_cast(id); -} - -static GtkWidget *PWidget(Window &w) { - return PWidget(w.GetID()); -} - -Point Point::FromLong(long lpoint) { - return Point( - Platform::LowShortFromLong(lpoint), - Platform::HighShortFromLong(lpoint)); -} - -Palette::Palette() { - used = 0; - allowRealization = false; - allocatedPalette = 0; - allocatedLen = 0; - size = 100; - entries = new ColourPair[size]; -} - -Palette::~Palette() { - Release(); - delete []entries; - entries = 0; -} - -void Palette::Release() { - used = 0; - delete [](reinterpret_cast(allocatedPalette)); - allocatedPalette = 0; - allocatedLen = 0; - delete []entries; - size = 100; - entries = new ColourPair[size]; -} - -// This method either adds a colour to the list of wanted colours (want==true) -// or retrieves the allocated colour back to the ColourPair. -// This is one method to make it easier to keep the code for wanting and retrieving in sync. -void Palette::WantFind(ColourPair &cp, bool want) { - if (want) { - for (int i=0; i < used; i++) { - if (entries[i].desired == cp.desired) - return; - } - - if (used >= size) { - int sizeNew = size * 2; - ColourPair *entriesNew = new ColourPair[sizeNew]; - for (int j=0; j(allocatedPalette), - allocatedLen); - delete [](reinterpret_cast(allocatedPalette)); - allocatedPalette = 0; - allocatedLen = 0; - } - GdkColor *paletteNew = new GdkColor[used]; - allocatedPalette = paletteNew; - gboolean *successPalette = new gboolean[used]; - if (paletteNew) { - allocatedLen = used; - int iPal = 0; - for (iPal = 0; iPal < used; iPal++) { - paletteNew[iPal].red = entries[iPal].desired.GetRed() * (65535 / 255); - paletteNew[iPal].green = entries[iPal].desired.GetGreen() * (65535 / 255); - paletteNew[iPal].blue = entries[iPal].desired.GetBlue() * (65535 / 255); - paletteNew[iPal].pixel = entries[iPal].desired.AsLong(); - } - gdk_colormap_alloc_colors(gtk_widget_get_colormap(PWidget(w)), - paletteNew, allocatedLen, FALSE, TRUE, - successPalette); - for (iPal = 0; iPal < used; iPal++) { - entries[iPal].allocated.Set(paletteNew[iPal].pixel); - } - } - delete []successPalette; -} - -static const char *CharacterSetName(int characterSet) { - switch (characterSet) { - case SC_CHARSET_ANSI: - return "iso8859-*"; - case SC_CHARSET_DEFAULT: - return "iso8859-*"; - case SC_CHARSET_BALTIC: - return "iso8859-13"; - case SC_CHARSET_CHINESEBIG5: - return "*-*"; - case SC_CHARSET_EASTEUROPE: - return "*-2"; - case SC_CHARSET_GB2312: - return "gb2312.1980-*"; - case SC_CHARSET_GREEK: - return "*-7"; - case SC_CHARSET_HANGUL: - return "ksc5601.1987-*"; - case SC_CHARSET_MAC: - return "*-*"; - case SC_CHARSET_OEM: - return "*-*"; - case SC_CHARSET_RUSSIAN: - return "*-r"; - case SC_CHARSET_CYRILLIC: - return "*-cp1251"; - case SC_CHARSET_SHIFTJIS: - return "jisx0208.1983-*"; - case SC_CHARSET_SYMBOL: - return "*-*"; - case SC_CHARSET_TURKISH: - return "*-9"; - case SC_CHARSET_JOHAB: - return "*-*"; - case SC_CHARSET_HEBREW: - return "*-8"; - case SC_CHARSET_ARABIC: - return "*-6"; - case SC_CHARSET_VIETNAMESE: - return "*-*"; - case SC_CHARSET_THAI: - return "iso8859-11"; - case SC_CHARSET_8859_15: - return "iso8859-15"; - default: - return "*-*"; - } -} - -static bool IsDBCSCharacterSet(int characterSet) { - switch (characterSet) { - case SC_CHARSET_GB2312: - case SC_CHARSET_HANGUL: - case SC_CHARSET_SHIFTJIS: - case SC_CHARSET_CHINESEBIG5: - return true; - default: - return false; - } -} - -static void GenerateFontSpecStrings(const char *fontName, int characterSet, - char *foundary, int foundary_len, - char *faceName, int faceName_len, - char *charset, int charset_len) { - // supported font strings include: - // foundary-fontface-isoxxx-x - // fontface-isoxxx-x - // foundary-fontface - // fontface - if (strchr(fontName, '-')) { - char tmp[300]; - char *d1 = NULL, *d2 = NULL, *d3 = NULL; - strncpy(tmp, fontName, sizeof(tmp) - 1); - d1 = strchr(tmp, '-'); - // we know the first dash exists - d2 = strchr(d1 + 1, '-'); - if (d2) - d3 = strchr(d2 + 1, '-'); - if (d3) { - // foundary-fontface-isoxxx-x - *d2 = '\0'; - foundary[0] = '-'; - foundary[1] = '\0'; - strncpy(faceName, tmp, foundary_len - 1); - strncpy(charset, d2 + 1, charset_len - 1); - } else if (d2) { - // fontface-isoxxx-x - *d1 = '\0'; - strcpy(foundary, "-*-"); - strncpy(faceName, tmp, faceName_len - 1); - strncpy(charset, d1 + 1, charset_len - 1); - } else { - // foundary-fontface - foundary[0] = '-'; - foundary[1] = '\0'; - strncpy(faceName, tmp, faceName_len - 1); - strncpy(charset, CharacterSetName(characterSet), charset_len - 1); - } - } else { - strncpy(foundary, "-*-", foundary_len); - strncpy(faceName, fontName, faceName_len - 1); - strncpy(charset, CharacterSetName(characterSet), charset_len - 1); - } -} - -static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, int size, bool bold, bool italic) { - memset(&lf, 0, sizeof(lf)); - lf.size = size; - lf.bold = bold; - lf.italic = italic; - lf.characterSet = characterSet; - strncpy(lf.faceName, faceName, sizeof(lf.faceName) - 1); -} - -/** - * Create a hash from the parameters for a font to allow easy checking for identity. - * If one font is the same as another, its hash will be the same, but if the hash is the - * same then they may still be different. - */ -static int HashFont(const char *faceName, int characterSet, int size, bool bold, bool italic) { - return - size ^ - (characterSet << 10) ^ - (bold ? 0x10000000 : 0) ^ - (italic ? 0x20000000 : 0) ^ - faceName[0]; -} - -class FontCached : Font { - FontCached *next; - int usage; - LOGFONT lf; - int hash; - FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); - ~FontCached() {} - bool SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); - virtual void Release(); - static FontID CreateNewFont(const char *fontName, int characterSet, - int size, bool bold, bool italic); - static FontCached *first; -public: - static FontID FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); - static void ReleaseId(FontID id_); -}; - -FontCached *FontCached::first = 0; - -FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) : -next(0), usage(0), hash(0) { - ::SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_); - hash = HashFont(faceName_, characterSet_, size_, bold_, italic_); - id = CreateNewFont(faceName_, characterSet_, size_, bold_, italic_); - usage = 1; -} - -bool FontCached::SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) { - return - lf.size == size_ && - lf.bold == bold_ && - lf.italic == italic_ && - lf.characterSet == characterSet_ && - 0 == strcmp(lf.faceName, faceName_); -} - -void FontCached::Release() { - if (id) - delete PFont(*this); - id = 0; -} - -FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) { - FontID ret = 0; - FontMutexLock(); - int hashFind = HashFont(faceName_, characterSet_, size_, bold_, italic_); - for (FontCached *cur = first; cur; cur = cur->next) { - if ((cur->hash == hashFind) && - cur->SameAs(faceName_, characterSet_, size_, bold_, italic_)) { - cur->usage++; - ret = cur->id; - } - } - if (ret == 0) { - FontCached *fc = new FontCached(faceName_, characterSet_, size_, bold_, italic_); - if (fc) { - fc->next = first; - first = fc; - ret = fc->id; - } - } - FontMutexUnlock(); - return ret; -} - -void FontCached::ReleaseId(FontID id_) { - FontMutexLock(); - FontCached **pcur = &first; - for (FontCached *cur = first; cur; cur = cur->next) { - if (cur->id == id_) { - cur->usage--; - if (cur->usage == 0) { - *pcur = cur->next; - cur->Release(); - cur->next = 0; - delete cur; - } - break; - } - pcur = &cur->next; - } - FontMutexUnlock(); -} - -static GdkFont *LoadFontOrSet(const char *fontspec, int characterSet) { - if (IsDBCSCharacterSet(characterSet)) { - return gdk_fontset_load(fontspec); - } else { - return gdk_font_load(fontspec); - } -} - -FontID FontCached::CreateNewFont(const char *fontName, int characterSet, - int size, bool bold, bool italic) { - char fontset[1024]; - char fontspec[300]; - char foundary[50]; - char faceName[100]; - char charset[50]; - fontset[0] = '\0'; - fontspec[0] = '\0'; - foundary[0] = '\0'; - faceName[0] = '\0'; - charset[0] = '\0'; - -#ifdef USE_PANGO - if (fontName[0] == '!') { - PangoFontDescription *pfd = pango_font_description_new(); - if (pfd) { - pango_font_description_set_family(pfd, fontName+1); - pango_font_description_set_size(pfd, size * PANGO_SCALE); - pango_font_description_set_weight(pfd, bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL); - pango_font_description_set_style(pfd, italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL); - return new FontHandle(pfd, characterSet); - } - } -#endif - - GdkFont *newid = 0; - // If name of the font begins with a '-', assume, that it is - // a full fontspec. - if (fontName[0] == '-') { - if (strchr(fontName, ',') || IsDBCSCharacterSet(characterSet)) { - newid = gdk_fontset_load(fontName); - } else { - newid = gdk_font_load(fontName); - } - if (!newid) { - // Font not available so substitute a reasonable code font - // iso8859 appears to only allow western characters. - newid = LoadFontOrSet("-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-*", - characterSet); - } - return new FontHandle(newid); - } - - // it's not a full fontspec, build one. - - // This supports creating a FONT_SET - // in a method that allows us to also set size, slant and - // weight for the fontset. The expected input is multiple - // partial fontspecs seperated by comma - // eg. adobe-courier-iso10646-1,*-courier-iso10646-1,*-*-*-* - if (strchr(fontName, ',')) { - // build a fontspec and use gdk_fontset_load - int remaining = sizeof(fontset); - char fontNameCopy[1024]; - strncpy(fontNameCopy, fontName, sizeof(fontNameCopy) - 1); - char *fn = fontNameCopy; - char *fp = strchr(fn, ','); - for (;;) { - const char *spec = "%s%s%s%s-*-*-*-%0d-*-*-*-*-%s"; - if (fontset[0] != '\0') { - // if this is not the first font in the list, - // append a comma seperator - spec = ",%s%s%s%s-*-*-*-%0d-*-*-*-*-%s"; - } - - if (fp) - *fp = '\0'; // nullify the comma - GenerateFontSpecStrings(fn, characterSet, - foundary, sizeof(foundary), - faceName, sizeof(faceName), - charset, sizeof(charset)); - - g_snprintf(fontspec, - sizeof(fontspec) - 1, - spec, - foundary, faceName, - bold ? "-bold" : "-medium", - italic ? "-i" : "-r", - size * 10, - charset); - - // if this is the first font in the list, and - // we are doing italic, add an oblique font - // to the list - if (italic && fontset[0] == '\0') { - strncat(fontset, fontspec, remaining - 1); - remaining -= strlen(fontset); - - g_snprintf(fontspec, - sizeof(fontspec) - 1, - ",%s%s%s-o-*-*-*-%0d-*-*-*-*-%s", - foundary, faceName, - bold ? "-bold" : "-medium", - size * 10, - charset); - } - - strncat(fontset, fontspec, remaining - 1); - remaining -= strlen(fontset); - - if (!fp) - break; - - fn = fp + 1; - fp = strchr(fn, ','); - } - - newid = gdk_fontset_load(fontset); - if (newid) - return new FontHandle(newid); - - // if fontset load failed, fall through, we'll use - // the last font entry and continue to try and - // get something that matches - } - - // single fontspec support - - GenerateFontSpecStrings(fontName, characterSet, - foundary, sizeof(foundary), - faceName, sizeof(faceName), - charset, sizeof(charset)); - - g_snprintf(fontspec, - sizeof(fontspec) - 1, - "%s%s%s%s-*-*-*-%0d-*-*-*-*-%s", - foundary, faceName, - bold ? "-bold" : "-medium", - italic ? "-i" : "-r", - size * 10, - charset); - newid = LoadFontOrSet(fontspec, characterSet); - if (!newid) { - // some fonts have oblique, not italic - g_snprintf(fontspec, - sizeof(fontspec) - 1, - "%s%s%s%s-*-*-*-%0d-*-*-*-*-%s", - foundary, faceName, - bold ? "-bold" : "-medium", - italic ? "-o" : "-r", - size * 10, - charset); - newid = LoadFontOrSet(fontspec, characterSet); - } - if (!newid) { - g_snprintf(fontspec, - sizeof(fontspec) - 1, - "-*-*-*-*-*-*-*-%0d-*-*-*-*-%s", - size * 10, - charset); - newid = gdk_font_load(fontspec); - } - if (!newid) { - // Font not available so substitute a reasonable code font - // iso8859 appears to only allow western characters. - newid = LoadFontOrSet("-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-*", - characterSet); - } - return new FontHandle(newid); -} - -Font::Font() : id(0) {} - -Font::~Font() {} - -void Font::Create(const char *faceName, int characterSet, int size, - bool bold, bool italic, bool) { - Release(); - id = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic); -} - -void Font::Release() { - if (id) - FontCached::ReleaseId(id); - id = 0; -} - -class SurfaceImpl : public Surface { - encodingType et; - GdkDrawable *drawable; - GdkGC *gc; - GdkPixmap *ppixmap; - int x; - int y; - bool inited; - bool createdGC; -#ifdef USE_PANGO - PangoContext *pcontext; - PangoLayout *layout; - Converter conv; - int characterSet; - void SetConverter(int characterSet_); -#endif -public: - SurfaceImpl(); - virtual ~SurfaceImpl(); - - void Init(WindowID wid); - void Init(SurfaceID sid, WindowID wid); - void InitPixMap(int width, int height, Surface *surface_, WindowID wid); - - void Release(); - bool Initialised(); - void PenColour(ColourAllocated fore); - int LogPixelsY(); - int DeviceHeightFont(int points); - void MoveTo(int x_, int y_); - void LineTo(int x_, int y_); - void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back); - void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void FillRectangle(PRectangle rc, ColourAllocated back); - void FillRectangle(PRectangle rc, Surface &surfacePattern); - void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags); - void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void Copy(PRectangle rc, Point from, Surface &surfaceSource); - - void DrawTextBase(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore); - void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); - void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); - void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore); - void MeasureWidths(Font &font_, const char *s, int len, int *positions); - int WidthText(Font &font_, const char *s, int len); - int WidthChar(Font &font_, char ch); - int Ascent(Font &font_); - int Descent(Font &font_); - int InternalLeading(Font &font_); - int ExternalLeading(Font &font_); - int Height(Font &font_); - int AverageCharWidth(Font &font_); - - int SetPalette(Palette *pal, bool inBackGround); - void SetClip(PRectangle rc); - void FlushCachedState(); - - void SetUnicodeMode(bool unicodeMode_); - void SetDBCSMode(int codePage); -}; - -const char *CharacterSetID(int characterSet) { - switch (characterSet) { - case SC_CHARSET_ANSI: - return ""; - case SC_CHARSET_DEFAULT: - return "ISO-8859-1"; - case SC_CHARSET_BALTIC: - return "ISO-8859-13"; - case SC_CHARSET_CHINESEBIG5: - return "BIG-5"; - case SC_CHARSET_EASTEUROPE: - return "ISO-8859-2"; - case SC_CHARSET_GB2312: - return "GB2312"; - case SC_CHARSET_GREEK: - return "ISO-8859-7"; - case SC_CHARSET_HANGUL: - return ""; - case SC_CHARSET_MAC: - return "MACINTOSH"; - case SC_CHARSET_OEM: - return "ASCII"; - case SC_CHARSET_RUSSIAN: - return "KOI8-R"; - case SC_CHARSET_CYRILLIC: - return "CP1251"; - case SC_CHARSET_SHIFTJIS: - return "SHIFT-JIS"; - case SC_CHARSET_SYMBOL: - return ""; - case SC_CHARSET_TURKISH: - return "ISO-8859-9"; - case SC_CHARSET_JOHAB: - return "JOHAB"; - case SC_CHARSET_HEBREW: - return "ISO-8859-8"; - case SC_CHARSET_ARABIC: - return "ISO-8859-6"; - case SC_CHARSET_VIETNAMESE: - return ""; - case SC_CHARSET_THAI: - return "ISO-8859-11"; - case SC_CHARSET_8859_15: - return "ISO-8859-15"; - default: - return ""; - } -} - -#ifdef USE_PANGO - -void SurfaceImpl::SetConverter(int characterSet_) { - if (characterSet != characterSet_) { - characterSet = characterSet_; - conv.Open("UTF-8", CharacterSetID(characterSet), false); - } -} -#endif - -SurfaceImpl::SurfaceImpl() : et(singleByte), drawable(0), gc(0), ppixmap(0), -x(0), y(0), inited(false), createdGC(false) -#ifdef USE_PANGO -, pcontext(0), layout(0), characterSet(-1) -#endif -{ -} - -SurfaceImpl::~SurfaceImpl() { - Release(); -} - -void SurfaceImpl::Release() { - et = singleByte; - drawable = 0; - if (createdGC) { - createdGC = false; - gdk_gc_unref(gc); - } - gc = 0; - if (ppixmap) - gdk_pixmap_unref(ppixmap); - ppixmap = 0; -#ifdef USE_PANGO - if (layout) - g_object_unref(layout); - layout = 0; - if (pcontext) - g_object_unref(pcontext); - pcontext = 0; - conv.Close(); - characterSet = -1; -#endif - x = 0; - y = 0; - inited = false; - createdGC = false; -} - -bool SurfaceImpl::Initialised() { - return inited; -} - -// The WindowID argument is only used for Pango builds -#ifdef USE_PANGO -#define WID_NAME wid -#else -#define WID_NAME -#endif - -void SurfaceImpl::Init(WindowID WID_NAME) { - Release(); -#ifdef USE_PANGO - PLATFORM_ASSERT(wid); - pcontext = gtk_widget_create_pango_context(PWidget(wid)); - PLATFORM_ASSERT(pcontext); - layout = pango_layout_new(pcontext); - PLATFORM_ASSERT(layout); -#endif - inited = true; -} - -void SurfaceImpl::Init(SurfaceID sid, WindowID WID_NAME) { - PLATFORM_ASSERT(sid); - GdkDrawable *drawable_ = reinterpret_cast(sid); - Release(); -#ifdef USE_PANGO - PLATFORM_ASSERT(wid); - pcontext = gtk_widget_create_pango_context(PWidget(wid)); - layout = pango_layout_new(pcontext); -#endif - drawable = drawable_; - gc = gdk_gc_new(drawable_); - // Ask for lines that do not paint the last pixel so is like Win32 - gdk_gc_set_line_attributes(gc, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); - createdGC = true; - inited = true; -} - -void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID WID_NAME) { - PLATFORM_ASSERT(surface_); - Release(); - SurfaceImpl *surfImpl = static_cast(surface_); - PLATFORM_ASSERT(surfImpl->drawable); -#ifdef USE_PANGO - PLATFORM_ASSERT(wid); - pcontext = gtk_widget_create_pango_context(PWidget(wid)); - PLATFORM_ASSERT(pcontext); - layout = pango_layout_new(pcontext); - PLATFORM_ASSERT(layout); -#endif - if (height > 0 && width > 0) - ppixmap = gdk_pixmap_new(surfImpl->drawable, width, height, -1); - drawable = ppixmap; - gc = gdk_gc_new(surfImpl->drawable); - // Ask for lines that do not paint the last pixel so is like Win32 - gdk_gc_set_line_attributes(gc, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); - createdGC = true; - inited = true; -} - -void SurfaceImpl::PenColour(ColourAllocated fore) { - if (gc) { - GdkColor co; - co.pixel = fore.AsLong(); - gdk_gc_set_foreground(gc, &co); - } -} - -int SurfaceImpl::LogPixelsY() { - return 72; -} - -int SurfaceImpl::DeviceHeightFont(int points) { - int logPix = LogPixelsY(); - return (points * logPix + logPix / 2) / 72; -} - -void SurfaceImpl::MoveTo(int x_, int y_) { - x = x_; - y = y_; -} - -void SurfaceImpl::LineTo(int x_, int y_) { - if (drawable && gc) { - gdk_draw_line(drawable, gc, - x, y, - x_, y_); - } - x = x_; - y = y_; -} - -void SurfaceImpl::Polygon(Point *pts, int npts, ColourAllocated fore, - ColourAllocated back) { - GdkPoint gpts[20]; - if (npts < static_cast((sizeof(gpts) / sizeof(gpts[0])))) { - for (int i = 0;i < npts;i++) { - gpts[i].x = pts[i].x; - gpts[i].y = pts[i].y; - } - PenColour(back); - gdk_draw_polygon(drawable, gc, 1, gpts, npts); - PenColour(fore); - gdk_draw_polygon(drawable, gc, 0, gpts, npts); - } -} - -void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) { - if (gc && drawable) { - PenColour(back); - gdk_draw_rectangle(drawable, gc, 1, - rc.left + 1, rc.top + 1, - rc.right - rc.left - 2, rc.bottom - rc.top - 2); - - PenColour(fore); - // The subtraction of 1 off the width and height here shouldn't be needed but - // otherwise a different rectangle is drawn than would be done if the fill parameter == 1 - gdk_draw_rectangle(drawable, gc, 0, - rc.left, rc.top, - rc.right - rc.left - 1, rc.bottom - rc.top - 1); - } -} - -void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back) { - PenColour(back); - if (drawable && (rc.left < maxCoordinate)) { // Protect against out of range - gdk_draw_rectangle(drawable, gc, 1, - rc.left, rc.top, - rc.right - rc.left, rc.bottom - rc.top); - } -} - -void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { - if (static_cast(surfacePattern).drawable) { - // Tile pattern over rectangle - // Currently assumes 8x8 pattern - int widthPat = 8; - int heightPat = 8; - for (int xTile = rc.left; xTile < rc.right; xTile += widthPat) { - int widthx = (xTile + widthPat > rc.right) ? rc.right - xTile : widthPat; - for (int yTile = rc.top; yTile < rc.bottom; yTile += heightPat) { - int heighty = (yTile + heightPat > rc.bottom) ? rc.bottom - yTile : heightPat; - gdk_draw_pixmap(drawable, - gc, - static_cast(surfacePattern).drawable, - 0, 0, - xTile, yTile, - widthx, heighty); - } - } - } else { - // Something is wrong so try to show anyway - // Shows up black because colour not allocated - FillRectangle(rc, ColourAllocated(0)); - } -} - -void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) { - if (((rc.right - rc.left) > 4) && ((rc.bottom - rc.top) > 4)) { - // Approximate a round rect with some cut off corners - Point pts[] = { - Point(rc.left + 2, rc.top), - Point(rc.right - 2, rc.top), - Point(rc.right, rc.top + 2), - Point(rc.right, rc.bottom - 2), - Point(rc.right - 2, rc.bottom), - Point(rc.left + 2, rc.bottom), - Point(rc.left, rc.bottom - 2), - Point(rc.left, rc.top + 2), - }; - Polygon(pts, sizeof(pts) / sizeof(pts[0]), fore, back); - } else { - RectangleDraw(rc, fore, back); - } -} - -#if GTK_MAJOR_VERSION >= 2 - -// Plot a point into a guint32 buffer symetrically to all 4 qudrants -static void AllFour(guint32 *pixels, int stride, int width, int height, int x, int y, guint32 val) { - pixels[y*stride+x] = val; - pixels[y*stride+width-1-x] = val; - pixels[(height-1-y)*stride+x] = val; - pixels[(height-1-y)*stride+width-1-x] = val; -} - -static unsigned int GetRValue(unsigned int co) { - return (co >> 16) & 0xff; -} - -static unsigned int GetGValue(unsigned int co) { - return (co >> 8) & 0xff; -} - -static unsigned int GetBValue(unsigned int co) { - return co & 0xff; -} - -#endif - -#if GTK_MAJOR_VERSION < 2 -void SurfaceImpl::AlphaRectangle(PRectangle rc, int , ColourAllocated , int , ColourAllocated outline, int , int ) { - if (gc && drawable) { - // Can't use GdkPixbuf on GTK+ 1.x, so draw an outline rather than use alpha. - PenColour(outline); - gdk_draw_rectangle(drawable, gc, 0, - rc.left, rc.top, - rc.right - rc.left - 1, rc.bottom - rc.top - 1); - } -} -#else -void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags) { - if (gc && drawable && rc.Width() > 0) { - int width = rc.Width(); - int height = rc.Height(); - // Ensure not distorted too much by corners when small - cornerSize = Platform::Minimum(cornerSize, (Platform::Minimum(width, height) / 2) - 2); - // Make a 32 bit deep pixbuf with alpha - GdkPixbuf *pixalpha = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); - - guint8 pixVal[4] = {0}; - guint32 valEmpty = *(reinterpret_cast(pixVal)); - pixVal[0] = GetRValue(fill.AsLong()); - pixVal[1] = GetGValue(fill.AsLong()); - pixVal[2] = GetBValue(fill.AsLong()); - pixVal[3] = alphaFill; - guint32 valFill = *(reinterpret_cast(pixVal)); - pixVal[0] = GetRValue(outline.AsLong()); - pixVal[1] = GetGValue(outline.AsLong()); - pixVal[2] = GetBValue(outline.AsLong()); - pixVal[3] = alphaOutline; - guint32 valOutline = *(reinterpret_cast(pixVal)); - guint32 *pixels = reinterpret_cast(gdk_pixbuf_get_pixels(pixalpha)); - int stride = gdk_pixbuf_get_rowstride(pixalpha) / 4; - for (int yr=0; yr(surfaceSource).drawable) { - gdk_draw_pixmap(drawable, - gc, - static_cast(surfaceSource).drawable, - from.x, from.y, - rc.left, rc.top, - rc.right - rc.left, rc.bottom - rc.top); - } -} - -static size_t UTF8Len(char ch) { - unsigned char uch = static_cast(ch); - if (uch < 0x80) - return 1; - else if (uch < (0x80 + 0x40 + 0x20)) - return 2; - else - return 3; -} - -char *UTF8FromLatin1(const char *s, int &len) { - char *utfForm = new char[len*2+1]; - size_t lenU = 0; - for (int i=0;i(s[i]); - if (uch < 0x80) { - utfForm[lenU++] = uch; - } else { - utfForm[lenU++] = static_cast(0xC0 | (uch >> 6)); - utfForm[lenU++] = static_cast(0x80 | (uch & 0x3f)); - } - } - utfForm[lenU] = '\0'; - len = lenU; - return utfForm; -} - -#ifdef USE_PANGO -static char *UTF8FromIconv(const Converter &conv, const char *s, int &len) { - if (conv) { - char *utfForm = new char[len*3+1]; - char *pin = const_cast(s); - size_t inLeft = len; - char *pout = utfForm; - size_t outLeft = len*3+1; - size_t conversions = conv.Convert(&pin, &inLeft, &pout, &outLeft); - if (conversions != ((size_t)(-1))) { - *pout = '\0'; - len = pout - utfForm; - return utfForm; - } - delete []utfForm; - } - return 0; -} - -// Work out how many bytes are in a character by trying to convert using iconv, -// returning the first length that succeeds. -static size_t MultiByteLenFromIconv(const Converter &conv, const char *s, size_t len) { - for (size_t lenMB=1; (lenMB<4) && (lenMB <= len); lenMB++) { - char wcForm[2]; - char *pin = const_cast(s); - size_t inLeft = lenMB; - char *pout = wcForm; - size_t outLeft = 2; - size_t conversions = conv.Convert(&pin, &inLeft, &pout, &outLeft); - if (conversions != ((size_t)(-1))) { - return lenMB; - } - } - return 1; -} - -static char *UTF8FromGdkWChar(GdkWChar *wctext, int wclen) { - char *utfForm = new char[wclen*3+1]; // Maximum of 3 UTF-8 bytes per character - size_t lenU = 0; - for (int i = 0; i < wclen && wctext[i]; i++) { - unsigned int uch = wctext[i]; - if (uch < 0x80) { - utfForm[lenU++] = static_cast(uch); - } else if (uch < 0x800) { - utfForm[lenU++] = static_cast(0xC0 | (uch >> 6)); - utfForm[lenU++] = static_cast(0x80 | (uch & 0x3f)); - } else { - utfForm[lenU++] = static_cast(0xE0 | (uch >> 12)); - utfForm[lenU++] = static_cast(0x80 | ((uch >> 6) & 0x3f)); - utfForm[lenU++] = static_cast(0x80 | (uch & 0x3f)); - } - } - utfForm[lenU] = '\0'; - return utfForm; -} - -static char *UTF8FromDBCS(const char *s, int &len) { - GdkWChar *wctext = new GdkWChar[len + 1]; - GdkWChar *wcp = wctext; - int wclen = gdk_mbstowcs(wcp, s, len); - if (wclen < 1) { - // In the annoying case when non-locale chars in the line. - // e.g. latin1 chars in Japanese locale. - delete []wctext; - return 0; - } - - char *utfForm = UTF8FromGdkWChar(wctext, wclen); - delete []wctext; - len = strlen(utfForm); - return utfForm; -} - -static size_t UTF8CharLength(const char *s) { - const unsigned char *us = reinterpret_cast(s); - unsigned char ch = *us; - if (ch < 0x80) { - return 1; - } else if (ch < 0x80 + 0x40 + 0x20) { - return 2; - } else { - return 3; - } -} - -#endif - -// On GTK+, wchar_t is 4 bytes - -const int maxLengthTextRun = 10000; - -void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char *s, int len, - ColourAllocated fore) { - PenColour(fore); - if (gc && drawable) { - int xText = rc.left; -#ifdef USE_PANGO - if (PFont(font_)->pfd) { - char *utfForm = 0; - bool useGFree = false; - if (et == UTF8) { - pango_layout_set_text(layout, s, len); - } else { - if (!utfForm) { - SetConverter(PFont(font_)->characterSet); - utfForm = UTF8FromIconv(conv, s, len); - } - if (!utfForm) { // iconv failed so try DBCS if DBCS mode - if (et == dbcs) { - // Convert to utf8 - utfForm = UTF8FromDBCS(s, len); - } - } - if (!utfForm) { // iconv and DBCS failed so treat as Latin1 - utfForm = UTF8FromLatin1(s, len); - } - pango_layout_set_text(layout, utfForm, len); - } - pango_layout_set_font_description(layout, PFont(font_)->pfd); - PangoLayoutLine *pll = pango_layout_get_line(layout,0); - gdk_draw_layout_line(drawable, gc, xText, ybase, pll); - if (useGFree) { - g_free(utfForm); - } else { - delete []utfForm; - } - return; - } -#endif - // Draw text as a series of segments to avoid limitations in X servers - const int segmentLength = 1000; - bool draw8bit = true; - if (et != singleByte) { - GdkWChar wctext[maxLengthTextRun]; - if (len >= maxLengthTextRun) - len = maxLengthTextRun-1; - int wclen; - if (et == UTF8) { - wclen = UTF16FromUTF8(s, len, - static_cast(static_cast(wctext)), maxLengthTextRun - 1); - } else { // dbcs, so convert using current locale - char sMeasure[maxLengthTextRun]; - memcpy(sMeasure, s, len); - sMeasure[len] = '\0'; - wclen = gdk_mbstowcs( - wctext, sMeasure, maxLengthTextRun - 1); - } - if (wclen > 0) { - draw8bit = false; - wctext[wclen] = L'\0'; - GdkWChar *wcp = wctext; - while ((wclen > 0) && (xText < maxCoordinate)) { - int lenDraw = Platform::Minimum(wclen, segmentLength); - gdk_draw_text_wc(drawable, PFont(font_)->pfont, gc, - xText, ybase, wcp, lenDraw); - wclen -= lenDraw; - if (wclen > 0) { // Avoid next calculation if possible as may be expensive - xText += gdk_text_width_wc(PFont(font_)->pfont, - wcp, lenDraw); - } - wcp += lenDraw; - } - } - } - if (draw8bit) { - while ((len > 0) && (xText < maxCoordinate)) { - int lenDraw = Platform::Minimum(len, segmentLength); - gdk_draw_text(drawable, PFont(font_)->pfont, gc, - xText, ybase, s, lenDraw); - len -= lenDraw; - if (len > 0) { // Avoid next calculation if possible as may be expensive - xText += gdk_text_width(PFont(font_)->pfont, s, lenDraw); - } - s += lenDraw; - } - } - } -} - -void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) { - FillRectangle(rc, back); - DrawTextBase(rc, font_, ybase, s, len, fore); -} - -// On GTK+, exactly same as DrawTextNoClip -void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) { - FillRectangle(rc, back); - DrawTextBase(rc, font_, ybase, s, len, fore); -} - -void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, - ColourAllocated fore) { - // Avoid drawing spaces in transparent mode - for (int i=0;ipfd) { - if (len == 1) { - int width = PFont(font_)->CharWidth(*s, et); - if (width) { - positions[0] = width; - return; - } - } - PangoRectangle pos; - pango_layout_set_font_description(layout, PFont(font_)->pfd); - if (et == UTF8) { - // Simple and direct as UTF-8 is native Pango encoding - pango_layout_set_text(layout, s, len); - PangoLayoutIter *iter = pango_layout_get_iter(layout); - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); - int i = 0; - while (pango_layout_iter_next_cluster(iter)) { - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); - int position = PANGO_PIXELS(pos.x); - int curIndex = pango_layout_iter_get_index(iter); - int places = curIndex - i; - int distance = position - positions[i-1]; - while (i < curIndex) { - // Evenly distribute space among bytes of this cluster. - // Would be better to find number of characters and then - // divide evenly between characters with each byte of a character - // being at the same position. - positions[i] = position - (curIndex - 1 - i) * distance / places; - i++; - } - } - while (i < lenPositions) - positions[i++] = PANGO_PIXELS(pos.x + pos.width); - pango_layout_iter_free(iter); - PLATFORM_ASSERT(i == lenPositions); - } else { - int positionsCalculated = 0; - if (et == dbcs) { - SetConverter(PFont(font_)->characterSet); - char *utfForm = UTF8FromIconv(conv, s, len); - if (utfForm) { - // Convert to UTF-8 so can ask Pango for widths, then - // Loop through UTF-8 and DBCS forms, taking account of different - // character byte lengths. - Converter convMeasure("UCS-2", CharacterSetID(characterSet), false); - pango_layout_set_text(layout, utfForm, strlen(utfForm)); - int i = 0; - int utfIndex = 0; - PangoLayoutIter *iter = pango_layout_get_iter(layout); - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); - while (pango_layout_iter_next_cluster(iter)) { - pango_layout_iter_get_cluster_extents (iter, NULL, &pos); - int position = PANGO_PIXELS(pos.x); - int utfIndexNext = pango_layout_iter_get_index(iter); - while (utfIndex < utfIndexNext) { - size_t lenChar = MultiByteLenFromIconv(convMeasure, s+i, len-i); - //size_t lenChar = mblen(s+i, MB_CUR_MAX); - while (lenChar--) { - positions[i++] = position; - positionsCalculated++; - } - utfIndex += UTF8CharLength(utfForm+utfIndex); - } - } - while (i < lenPositions) - positions[i++] = PANGO_PIXELS(pos.x + pos.width); - pango_layout_iter_free(iter); - delete []utfForm; - PLATFORM_ASSERT(i == lenPositions); - } - } - if (positionsCalculated < 1 ) { - // Either Latin1 or DBCS conversion failed so treat as Latin1. - bool useGFree = false; - SetConverter(PFont(font_)->characterSet); - char *utfForm = UTF8FromIconv(conv, s, len); - if (!utfForm) { - utfForm = UTF8FromLatin1(s, len); - } - pango_layout_set_text(layout, utfForm, len); - PangoLayoutIter *iter = pango_layout_get_iter(layout); - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); - int i = 0; - int positionStart = 0; - int clusterStart = 0; - // Each Latin1 input character may take 1 or 2 bytes in UTF-8 - // and groups of up to 3 may be represented as ligatures. - while (pango_layout_iter_next_cluster(iter)) { - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); - int position = PANGO_PIXELS(pos.x); - int distance = position - positionStart; - int clusterEnd = pango_layout_iter_get_index(iter); - int ligatureLength = g_utf8_strlen(utfForm + clusterStart, clusterEnd - clusterStart); - PLATFORM_ASSERT(ligatureLength > 0 && ligatureLength <= 3); - for (int charInLig=0; charInLigSetCharWidth(*s, positions[0], et); - } - return; - } -#endif - GdkFont *gf = PFont(font_)->pfont; - bool measure8bit = true; - if (et != singleByte) { - GdkWChar wctext[maxLengthTextRun]; - if (len >= maxLengthTextRun) - len = maxLengthTextRun-1; - int wclen; - if (et == UTF8) { - wclen = UTF16FromUTF8(s, len, - static_cast(static_cast(wctext)), maxLengthTextRun - 1); - } else { // dbcsMode, so convert using current locale - char sDraw[maxLengthTextRun]; - memcpy(sDraw, s, len); - sDraw[len] = '\0'; - wclen = gdk_mbstowcs( - wctext, sDraw, maxLengthTextRun - 1); - } - if (wclen > 0) { - measure8bit = false; - wctext[wclen] = L'\0'; - // Map widths back to utf-8 or DBCS input string - int i = 0; - for (int iU = 0; iU < wclen; iU++) { - int width = gdk_char_width_wc(gf, wctext[iU]); - totalWidth += width; - int lenChar; - if (et == UTF8) { - lenChar = UTF8Len(s[i]); - } else { - lenChar = mblen(s+i, MB_CUR_MAX); - if (lenChar < 0) - lenChar = 1; - } - while (lenChar--) { - positions[i++] = totalWidth; - } - } - while (i < len) { // In case of problems with lengths - positions[i++] = totalWidth; - } - } - } - if (measure8bit) { - // Either Latin1 or conversion failed so treat as Latin1. - for (int i = 0; i < len; i++) { - int width = gdk_char_width(gf, s[i]); - totalWidth += width; - positions[i] = totalWidth; - } - } - } else { - // No font so return an ascending range of values - for (int i = 0; i < len; i++) { - positions[i] = i + 1; - } - } -} - -int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { - if (font_.GetID()) { -#ifdef USE_PANGO - if (PFont(font_)->pfd) { - char *utfForm = 0; - pango_layout_set_font_description(layout, PFont(font_)->pfd); - PangoRectangle pos; - bool useGFree = false; - if (et == UTF8) { - pango_layout_set_text(layout, s, len); - } else { - if (et == dbcs) { - // Convert to utf8 - utfForm = UTF8FromDBCS(s, len); - } - if (!utfForm) { // DBCS failed so treat as iconv - SetConverter(PFont(font_)->characterSet); - utfForm = UTF8FromIconv(conv, s, len); - } - if (!utfForm) { // g_locale_to_utf8 failed so treat as Latin1 - utfForm = UTF8FromLatin1(s, len); - } - pango_layout_set_text(layout, utfForm, len); - } - PangoLayoutLine *pangoLine = pango_layout_get_line(layout, 0); - pango_layout_line_get_extents(pangoLine, NULL, &pos); - if (useGFree) { - g_free(utfForm); - } else { - delete []utfForm; - } - return PANGO_PIXELS(pos.width); - } -#endif - if (et == UTF8) { - GdkWChar wctext[maxLengthTextRun]; - size_t wclen = UTF16FromUTF8(s, len, static_cast(static_cast(wctext)), - sizeof(wctext) / sizeof(GdkWChar) - 1); - wctext[wclen] = L'\0'; - return gdk_text_width_wc(PFont(font_)->pfont, wctext, wclen); - } else { - return gdk_text_width(PFont(font_)->pfont, s, len); - } - } else { - return 1; - } -} - -int SurfaceImpl::WidthChar(Font &font_, char ch) { - if (font_.GetID()) { -#ifdef USE_PANGO - if (PFont(font_)->pfd) { - return WidthText(font_, &ch, 1); - } -#endif - return gdk_char_width(PFont(font_)->pfont, ch); - } else { - return 1; - } -} - -// Three possible strategies for determining ascent and descent of font: -// 1) Call gdk_string_extents with string containing all letters, numbers and punctuation. -// 2) Use the ascent and descent fields of GdkFont. -// 3) Call gdk_string_extents with string as 1 but also including accented capitals. -// Smallest values given by 1 and largest by 3 with 2 in between. -// Techniques 1 and 2 sometimes chop off extreme portions of ascenders and -// descenders but are mostly OK except for accented characters like Å which are -// rarely used in code. - -// This string contains a good range of characters to test for size. -//const char largeSizeString[] = "ÂÃÅÄ `~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890" -// "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -#ifndef FAST_WAY -const char sizeString[] = "`~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890" - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -#endif - -int SurfaceImpl::Ascent(Font &font_) { - if (!(font_.GetID())) - return 1; -#ifdef FAST_WAY - FontMutexLock(); - int ascent = PFont(font_)->ascent; -#ifdef USE_PANGO - if ((ascent == 0) && (PFont(font_)->pfd)) { - PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, - PFont(font_)->pfd, pango_context_get_language(pcontext)); - PFont(font_)->ascent = - PANGO_PIXELS(pango_font_metrics_get_ascent(metrics)); - pango_font_metrics_unref(metrics); - ascent = PFont(font_)->ascent; - } -#endif - if ((ascent == 0) && (PFont(font_)->pfont)) { - ascent = PFont(font_)->pfont->ascent; - } - if (ascent == 0) { - ascent = 1; - } - FontMutexUnlock(); - return ascent; -#else - - gint lbearing; - gint rbearing; - gint width; - gint ascent; - gint descent; - - gdk_string_extents(PFont(font_)->pfont, sizeString, - &lbearing, &rbearing, &width, &ascent, &descent); - return ascent; -#endif -} - -int SurfaceImpl::Descent(Font &font_) { - if (!(font_.GetID())) - return 1; -#ifdef FAST_WAY - -#ifdef USE_PANGO - if (PFont(font_)->pfd) { - PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, - PFont(font_)->pfd, pango_context_get_language(pcontext)); - int descent = PANGO_PIXELS(pango_font_metrics_get_descent(metrics)); - pango_font_metrics_unref(metrics); - return descent; - } -#endif - return PFont(font_)->pfont->descent; -#else - - gint lbearing; - gint rbearing; - gint width; - gint ascent; - gint descent; - - gdk_string_extents(PFont(font_)->pfont, sizeString, - &lbearing, &rbearing, &width, &ascent, &descent); - return descent; -#endif -} - -int SurfaceImpl::InternalLeading(Font &) { - return 0; -} - -int SurfaceImpl::ExternalLeading(Font &) { - return 0; -} - -int SurfaceImpl::Height(Font &font_) { - return Ascent(font_) + Descent(font_); -} - -int SurfaceImpl::AverageCharWidth(Font &font_) { - return WidthChar(font_, 'n'); -} - -int SurfaceImpl::SetPalette(Palette *, bool) { - // Handled in palette allocation for GTK so this does nothing - return 0; -} - -void SurfaceImpl::SetClip(PRectangle rc) { - GdkRectangle area = {rc.left, rc.top, - rc.right - rc.left, rc.bottom - rc.top}; - gdk_gc_set_clip_rectangle(gc, &area); -} - -void SurfaceImpl::FlushCachedState() {} - -void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) { - if (unicodeMode_) - et = UTF8; -} - -void SurfaceImpl::SetDBCSMode(int codePage) { - if (codePage && (codePage != SC_CP_UTF8)) - et = dbcs; -} - -Surface *Surface::Allocate() { - return new SurfaceImpl; -} - -Window::~Window() {} - -void Window::Destroy() { - if (id) - gtk_widget_destroy(GTK_WIDGET(id)); - id = 0; -} - -bool Window::HasFocus() { - return GTK_WIDGET_HAS_FOCUS(id); -} - -PRectangle Window::GetPosition() { - // Before any size allocated pretend its 1000 wide so not scrolled - PRectangle rc(0, 0, 1000, 1000); - if (id) { - rc.left = PWidget(id)->allocation.x; - rc.top = PWidget(id)->allocation.y; - if (PWidget(id)->allocation.width > 20) { - rc.right = rc.left + PWidget(id)->allocation.width; - rc.bottom = rc.top + PWidget(id)->allocation.height; - } - } - return rc; -} - -void Window::SetPosition(PRectangle rc) { -#if 1 - //gtk_widget_set_uposition(id, rc.left, rc.top); - GtkAllocation alloc; - alloc.x = rc.left; - alloc.y = rc.top; - alloc.width = rc.Width(); - alloc.height = rc.Height(); - gtk_widget_size_allocate(PWidget(id), &alloc); -#else - - gtk_widget_set_uposition(id, rc.left, rc.top); - gtk_widget_set_usize(id, rc.right - rc.left, rc.bottom - rc.top); -#endif -} - -void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { - int ox = 0; - int oy = 0; - gdk_window_get_origin(PWidget(relativeTo.id)->window, &ox, &oy); - ox += rc.left; - if (ox < 0) - ox = 0; - oy += rc.top; - if (oy < 0) - oy = 0; - - /* do some corrections to fit into screen */ - int sizex = rc.right - rc.left; - int sizey = rc.bottom - rc.top; - int screenWidth = gdk_screen_width(); - int screenHeight = gdk_screen_height(); - if (sizex > screenWidth) - ox = 0; /* the best we can do */ - else if (ox + sizex > screenWidth) - ox = screenWidth - sizex; - if (oy + sizey > screenHeight) - oy = screenHeight - sizey; - - gtk_widget_set_uposition(PWidget(id), ox, oy); -#if 0 - - GtkAllocation alloc; - alloc.x = rc.left + ox; - alloc.y = rc.top + oy; - alloc.width = rc.right - rc.left; - alloc.height = rc.bottom - rc.top; - gtk_widget_size_allocate(id, &alloc); -#endif - gtk_widget_set_usize(PWidget(id), sizex, sizey); -} - -PRectangle Window::GetClientPosition() { - // On GTK+, the client position is the window position - return GetPosition(); -} - -void Window::Show(bool show) { - if (show) - gtk_widget_show(PWidget(id)); -} - -void Window::InvalidateAll() { - if (id) { - gtk_widget_queue_draw(PWidget(id)); - } -} - -void Window::InvalidateRectangle(PRectangle rc) { - if (id) { - gtk_widget_queue_draw_area(PWidget(id), - rc.left, rc.top, - rc.right - rc.left, rc.bottom - rc.top); - } -} - -void Window::SetFont(Font &) { - // Can not be done generically but only needed for ListBox -} - -void Window::SetCursor(Cursor curs) { - // We don't set the cursor to same value numerous times under gtk because - // it stores the cursor in the window once it's set - if (curs == cursorLast) - return; - - cursorLast = curs; - GdkCursor *gdkCurs; - switch (curs) { - case cursorText: - gdkCurs = gdk_cursor_new(GDK_XTERM); - break; - case cursorArrow: - gdkCurs = gdk_cursor_new(GDK_LEFT_PTR); - break; - case cursorUp: - gdkCurs = gdk_cursor_new(GDK_CENTER_PTR); - break; - case cursorWait: - gdkCurs = gdk_cursor_new(GDK_WATCH); - break; - case cursorHand: - gdkCurs = gdk_cursor_new(GDK_HAND2); - break; - case cursorReverseArrow: - gdkCurs = gdk_cursor_new(GDK_RIGHT_PTR); - break; - default: - gdkCurs = gdk_cursor_new(GDK_LEFT_PTR); - cursorLast = cursorArrow; - break; - } - - if (PWidget(id)->window) - gdk_window_set_cursor(PWidget(id)->window, gdkCurs); - gdk_cursor_destroy(gdkCurs); -} - -void Window::SetTitle(const char *s) { - gtk_window_set_title(GTK_WINDOW(id), s); -} - -/* Returns rectangle of monitor pt is on, both rect and pt are in Window's - gdk window coordinates */ -PRectangle Window::GetMonitorRect(Point pt) { - gint x_offset, y_offset; - pt = pt; - - gdk_window_get_origin(PWidget(id)->window, &x_offset, &y_offset); - -// gtk 2.2+ -#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 2) - { - GdkScreen* screen; - gint monitor_num; - GdkRectangle rect; - - screen = gtk_widget_get_screen(PWidget(id)); - monitor_num = gdk_screen_get_monitor_at_point(screen, pt.x + x_offset, pt.y + y_offset); - gdk_screen_get_monitor_geometry(screen, monitor_num, &rect); - rect.x -= x_offset; - rect.y -= y_offset; - return PRectangle(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height); - } -#else - return PRectangle(-x_offset, -y_offset, (-x_offset) + gdk_screen_width(), - (-y_offset) + gdk_screen_height()); -#endif -} - -struct ListImage { - const char *xpm_data; -#if GTK_MAJOR_VERSION < 2 - GdkPixmap *pixmap; - GdkBitmap *bitmap; -#else - GdkPixbuf *pixbuf; -#endif -}; - -static void list_image_free(gpointer, gpointer value, gpointer) { - ListImage *list_image = (ListImage *) value; -#if GTK_MAJOR_VERSION < 2 - if (list_image->pixmap) - gdk_pixmap_unref(list_image->pixmap); - if (list_image->bitmap) - gdk_bitmap_unref(list_image->bitmap); -#else - if (list_image->pixbuf) - gdk_pixbuf_unref (list_image->pixbuf); -#endif - g_free(list_image); -} - -ListBox::ListBox() { -} - -ListBox::~ListBox() { -} - -#if GTK_MAJOR_VERSION >= 2 -enum { - PIXBUF_COLUMN, - TEXT_COLUMN, - N_COLUMNS -}; -#endif - -class ListBoxX : public ListBox { - WindowID list; - WindowID scroller; -#if GTK_MAJOR_VERSION < 2 - int current; -#endif - void *pixhash; - int lineHeight; - XPMSet xset; - bool unicodeMode; - int desiredVisibleRows; - unsigned int maxItemCharacters; - unsigned int aveCharWidth; -public: - CallBackAction doubleClickAction; - void *doubleClickActionData; - - ListBoxX() : list(0), pixhash(NULL), desiredVisibleRows(5), maxItemCharacters(0), - doubleClickAction(NULL), doubleClickActionData(NULL) { -#if GTK_MAJOR_VERSION < 2 - current = 0; -#endif - } - virtual ~ListBoxX() { - if (pixhash) { - g_hash_table_foreach((GHashTable *) pixhash, list_image_free, NULL); - g_hash_table_destroy((GHashTable *) pixhash); - } - } - virtual void SetFont(Font &font); - virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_); - virtual void SetAverageCharWidth(int width); - virtual void SetVisibleRows(int rows); - virtual int GetVisibleRows() const; - virtual PRectangle GetDesiredRect(); - virtual int CaretFromEdge(); - virtual void Clear(); - virtual void Append(char *s, int type = -1); - virtual int Length(); - virtual void Select(int n); - virtual int GetSelection(); - virtual int Find(const char *prefix); - virtual void GetValue(int n, char *value, int len); - virtual void RegisterImage(int type, const char *xpm_data); - virtual void ClearRegisteredImages(); - virtual void SetDoubleClickAction(CallBackAction action, void *data) { - doubleClickAction = action; - doubleClickActionData = data; - } - virtual void SetList(const char *listText, char separator, char typesep); -}; - -ListBox *ListBox::Allocate() { - ListBoxX *lb = new ListBoxX(); - return lb; -} - -#if GTK_MAJOR_VERSION < 2 -static void UnselectionAC(GtkWidget *, gint, gint, - GdkEventButton *, gpointer p) { - int *pi = reinterpret_cast(p); - *pi = -1; -} -static void SelectionAC(GtkWidget *, gint row, gint, - GdkEventButton *, gpointer p) { - int *pi = reinterpret_cast(p); - *pi = row; -} -#endif - -static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) { - ListBoxX* lb = reinterpret_cast(p); - if (ev->type == GDK_2BUTTON_PRESS && lb->doubleClickAction != NULL) { - lb->doubleClickAction(lb->doubleClickActionData); - return TRUE; - } - - return FALSE; -} - -#if GTK_MAJOR_VERSION >= 2 -/* Change the active color to the selected color so the listbox uses the color -scheme that it would use if it had the focus. */ -static void StyleSet(GtkWidget *w, GtkStyle*, void*) { - GtkStyle* style; - - g_return_if_fail(w != NULL); - - /* Copy the selected color to active. Note that the modify calls will cause - recursive calls to this function after the value is updated and w->style to - be set to a new object */ - style = gtk_widget_get_style(w); - if (style == NULL) - return; - if (!gdk_color_equal(&style->base[GTK_STATE_SELECTED], &style->base[GTK_STATE_ACTIVE])) - gtk_widget_modify_base(w, GTK_STATE_ACTIVE, &style->base[GTK_STATE_SELECTED]); - - style = gtk_widget_get_style(w); - if (style == NULL) - return; - if (!gdk_color_equal(&style->text[GTK_STATE_SELECTED], &style->text[GTK_STATE_ACTIVE])) - gtk_widget_modify_text(w, GTK_STATE_ACTIVE, &style->text[GTK_STATE_SELECTED]); -} -#endif - -void ListBoxX::Create(Window &, int, Point, int, bool) { - id = gtk_window_new(GTK_WINDOW_POPUP); - - GtkWidget *frame = gtk_frame_new(NULL); - gtk_widget_show(frame); - gtk_container_add(GTK_CONTAINER(GetID()), frame); - gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); - gtk_container_set_border_width(GTK_CONTAINER(frame), 0); - - scroller = gtk_scrolled_window_new(NULL, NULL); - gtk_container_set_border_width(GTK_CONTAINER(scroller), 0); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(frame), PWidget(scroller)); - gtk_widget_show(PWidget(scroller)); - -#if GTK_MAJOR_VERSION < 2 - list = gtk_clist_new(1); - GtkWidget *wid = PWidget(list); // No code inside the GTK_OBJECT macro - gtk_widget_show(wid); - gtk_container_add(GTK_CONTAINER(PWidget(scroller)), wid); - gtk_clist_set_column_auto_resize(GTK_CLIST(wid), 0, TRUE); - gtk_clist_set_selection_mode(GTK_CLIST(wid), GTK_SELECTION_BROWSE); - gtk_signal_connect(GTK_OBJECT(wid), "unselect_row", - GTK_SIGNAL_FUNC(UnselectionAC), ¤t); - gtk_signal_connect(GTK_OBJECT(wid), "select_row", - GTK_SIGNAL_FUNC(SelectionAC), ¤t); - gtk_signal_connect(GTK_OBJECT(wid), "button_press_event", - GTK_SIGNAL_FUNC(ButtonPress), this); - gtk_clist_set_shadow_type(GTK_CLIST(wid), GTK_SHADOW_NONE); -#else - /* Tree and its model */ - GtkListStore *store = - gtk_list_store_new(N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING); - - list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - g_signal_connect(G_OBJECT(list), "style-set", G_CALLBACK(StyleSet), NULL); - - GtkTreeSelection *selection = - gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); - gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); - gtk_tree_view_set_reorderable(GTK_TREE_VIEW(list), FALSE); - - /* Columns */ - GtkTreeViewColumn *column = gtk_tree_view_column_new(); - gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); - gtk_tree_view_column_set_title(column, "Autocomplete"); - - GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new(); - gtk_tree_view_column_pack_start(column, renderer, FALSE); - gtk_tree_view_column_add_attribute(column, renderer, - "pixbuf", PIXBUF_COLUMN); - - renderer = gtk_cell_renderer_text_new(); - gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), 1); - gtk_tree_view_column_pack_start(column, renderer, TRUE); - gtk_tree_view_column_add_attribute(column, renderer, - "text", TEXT_COLUMN); - - gtk_tree_view_append_column(GTK_TREE_VIEW(list), column); - if (g_object_class_find_property(G_OBJECT_GET_CLASS(list), "fixed-height-mode")) - g_object_set(G_OBJECT(list), "fixed-height-mode", TRUE, NULL); - - GtkWidget *wid = PWidget(list); // No code inside the G_OBJECT macro - gtk_container_add(GTK_CONTAINER(PWidget(scroller)), wid); - gtk_widget_show(wid); - g_signal_connect(G_OBJECT(wid), "button_press_event", - G_CALLBACK(ButtonPress), this); -#endif - gtk_widget_realize(PWidget(id)); -} - -void ListBoxX::SetFont(Font &scint_font) { -#if GTK_MAJOR_VERSION < 2 - GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(PWidget(list))); - if (!gdk_font_equal(style->font, PFont(scint_font)->pfont)) { - style = gtk_style_copy(style); - gdk_font_unref(style->font); - style->font = PFont(scint_font)->pfont; - gdk_font_ref(style->font); - gtk_widget_set_style(GTK_WIDGET(PWidget(list)), style); - gtk_style_unref(style); - } -#else - // Only do for Pango font as there have been crashes for GDK fonts - if (Created() && PFont(scint_font)->pfd) { - // Current font is Pango font - gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd); - } -#endif -} - -void ListBoxX::SetAverageCharWidth(int width) { - aveCharWidth = width; -} - -void ListBoxX::SetVisibleRows(int rows) { - desiredVisibleRows = rows; -} - -int ListBoxX::GetVisibleRows() const { - return desiredVisibleRows; -} - -PRectangle ListBoxX::GetDesiredRect() { - // Before any size allocated pretend its 100 wide so not scrolled - PRectangle rc(0, 0, 100, 100); - if (id) { - int rows = Length(); - if ((rows == 0) || (rows > desiredVisibleRows)) - rows = desiredVisibleRows; - - GtkRequisition req; - int height; - - // First calculate height of the clist for our desired visible - // row count otherwise it tries to expand to the total # of rows -#if GTK_MAJOR_VERSION < 2 - int ythickness = PWidget(list)->style->klass->ythickness; - height = (rows * GTK_CLIST(list)->row_height - + rows + 1 - + 2 * (ythickness - + GTK_CONTAINER(PWidget(list))->border_width)); -#else - // Get cell height - int row_width=0; - int row_height=0; - GtkTreeViewColumn * column = - gtk_tree_view_get_column(GTK_TREE_VIEW(list), 0); - gtk_tree_view_column_cell_get_size(column, NULL, - NULL, NULL, &row_width, &row_height); - int ythickness = PWidget(list)->style->ythickness; - height = (rows * row_height - + 2 * (ythickness - + GTK_CONTAINER(PWidget(list))->border_width + 1)); -#endif - gtk_widget_set_usize(GTK_WIDGET(PWidget(list)), -1, height); - - // Get the size of the scroller because we set usize on the window - gtk_widget_size_request(GTK_WIDGET(scroller), &req); - rc.right = req.width; - rc.bottom = req.height; - - gtk_widget_set_usize(GTK_WIDGET(list), -1, -1); - int width = maxItemCharacters; - if (width < 12) - width = 12; - rc.right = width * (aveCharWidth + aveCharWidth / 3); - if (Length() > rows) - rc.right = rc.right + 16; - } - return rc; -} - -int ListBoxX::CaretFromEdge() { - return 4 + xset.GetWidth(); -} - -void ListBoxX::Clear() { -#if GTK_MAJOR_VERSION < 2 - gtk_clist_clear(GTK_CLIST(list)); -#else - GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); - gtk_list_store_clear(GTK_LIST_STORE(model)); -#endif - maxItemCharacters = 0; -} - -#if GTK_MAJOR_VERSION < 2 -static void init_pixmap(ListImage *list_image, GtkWidget *window) { -#else -static void init_pixmap(ListImage *list_image) { -#endif - const char *textForm = list_image->xpm_data; - const char * const * xpm_lineform = reinterpret_cast(textForm); - const char **xpm_lineformfromtext = 0; - // The XPM data can be either in atext form as will be read from a file - // or in a line form (array of char *) as will be used for images defined in code. - // Test for text form and convert to line form - if ((0 == memcmp(textForm, "/* X", 4)) && (0 == memcmp(textForm, "/* XPM */", 9))) { - // Test done is two parts to avoid possibility of overstepping the memory - // if memcmp implemented strangely. Must be 4 bytes at least at destination. - xpm_lineformfromtext = XPM::LinesFormFromTextForm(textForm); - xpm_lineform = xpm_lineformfromtext; - } - - // Drop any existing pixmap/bitmap as data may have changed -#if GTK_MAJOR_VERSION < 2 - if (list_image->pixmap) - gdk_pixmap_unref(list_image->pixmap); - list_image->pixmap = NULL; - if (list_image->bitmap) - gdk_bitmap_unref(list_image->bitmap); - list_image->bitmap = NULL; - - list_image->pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL - , gtk_widget_get_colormap(window), &(list_image->bitmap), NULL - , (gchar **) xpm_lineform); - if (NULL == list_image->pixmap) { - if (list_image->bitmap) - gdk_bitmap_unref(list_image->bitmap); - list_image->bitmap = NULL; - } -#else - if (list_image->pixbuf) - gdk_pixbuf_unref(list_image->pixbuf); - list_image->pixbuf = - gdk_pixbuf_new_from_xpm_data((const gchar**)xpm_lineform); -#endif - delete []xpm_lineformfromtext; -} - -#define SPACING 5 - -void ListBoxX::Append(char *s, int type) { - ListImage *list_image = NULL; - if ((type >= 0) && pixhash) { - list_image = (ListImage *) g_hash_table_lookup((GHashTable *) pixhash - , (gconstpointer) GINT_TO_POINTER(type)); - } -#if GTK_MAJOR_VERSION < 2 - char * szs[] = { s, NULL }; - int rownum = gtk_clist_append(GTK_CLIST(list), szs); - if (list_image) { - if (NULL == list_image->pixmap) - init_pixmap(list_image, (GtkWidget *) list); - gtk_clist_set_pixtext(GTK_CLIST(list), rownum, 0, s, SPACING - , list_image->pixmap, list_image->bitmap); - } -#else - GtkTreeIter iter; - GtkListStore *store = - GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list))); - gtk_list_store_append(GTK_LIST_STORE(store), &iter); - if (list_image) { - if (NULL == list_image->pixbuf) - init_pixmap(list_image); - if (list_image->pixbuf) { - gtk_list_store_set(GTK_LIST_STORE(store), &iter, - PIXBUF_COLUMN, list_image->pixbuf, - TEXT_COLUMN, s, -1); - } else { - gtk_list_store_set(GTK_LIST_STORE(store), &iter, - TEXT_COLUMN, s, -1); - } - } else { - gtk_list_store_set(GTK_LIST_STORE(store), &iter, - TEXT_COLUMN, s, -1); - } -#endif - size_t len = strlen(s); - if (maxItemCharacters < len) - maxItemCharacters = len; -} - -int ListBoxX::Length() { - if (id) -#if GTK_MAJOR_VERSION < 2 - return GTK_CLIST(list)->rows; -#else - return gtk_tree_model_iter_n_children(gtk_tree_view_get_model - (GTK_TREE_VIEW(list)), NULL); -#endif - return 0; -} - -void ListBoxX::Select(int n) { -#if GTK_MAJOR_VERSION < 2 - if (n == -1) { - gtk_clist_unselect_row(GTK_CLIST(list), current, 0); - } else { - gtk_clist_select_row(GTK_CLIST(list), n, 0); - gtk_clist_moveto(GTK_CLIST(list), n, 0, 0.5, 0.5); - } -#else - GtkTreeIter iter; - GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); - GtkTreeSelection *selection = - gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); - - if (n < 0) { - gtk_tree_selection_unselect_all(selection); - return; - } - - bool valid = gtk_tree_model_iter_nth_child(model, &iter, NULL, n) != FALSE; - if (valid) { - gtk_tree_selection_select_iter(selection, &iter); - - // Move the scrollbar to show the selection. - int total = Length(); - GtkAdjustment *adj = - gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(list)); - gfloat value = ((gfloat)n / total) * (adj->upper - adj->lower) - + adj->lower - adj->page_size / 2; - - // Get cell height - int row_width; - int row_height; - GtkTreeViewColumn * column = - gtk_tree_view_get_column(GTK_TREE_VIEW(list), 0); - gtk_tree_view_column_cell_get_size(column, NULL, NULL, - NULL, &row_width, &row_height); - - int rows = Length(); - if ((rows == 0) || (rows > desiredVisibleRows)) - rows = desiredVisibleRows; - if (rows & 0x1) { - // Odd rows to display -- We are now in the middle. - // Align it so that we don't chop off rows. - value += (gfloat)row_height / 2.0; - } - // Clamp it. - value = (value < 0)? 0 : value; - value = (value > (adj->upper - adj->page_size))? - (adj->upper - adj->page_size) : value; - - // Set it. - gtk_adjustment_set_value(adj, value); - } else { - gtk_tree_selection_unselect_all(selection); - } -#endif -} - -int ListBoxX::GetSelection() { -#if GTK_MAJOR_VERSION < 2 - return current; -#else - GtkTreeIter iter; - GtkTreeModel *model; - GtkTreeSelection *selection; - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); - if (gtk_tree_selection_get_selected(selection, &model, &iter)) { - GtkTreePath *path = gtk_tree_model_get_path(model, &iter); - int *indices = gtk_tree_path_get_indices(path); - // Don't free indices. - if (indices) - return indices[0]; - } - return -1; -#endif -} - -int ListBoxX::Find(const char *prefix) { -#if GTK_MAJOR_VERSION < 2 - int count = Length(); - for (int i = 0; i < count; i++) { - char *s = 0; - gtk_clist_get_text(GTK_CLIST(list), i, 0, &s); - if (s && (0 == strncmp(prefix, s, strlen(prefix)))) { - return i; - } - } -#else - GtkTreeIter iter; - GtkTreeModel *model = - gtk_tree_view_get_model(GTK_TREE_VIEW(list)); - bool valid = gtk_tree_model_get_iter_first(model, &iter) != FALSE; - int i = 0; - while(valid) { - gchar *s; - gtk_tree_model_get(model, &iter, TEXT_COLUMN, &s, -1); - if (s && (0 == strncmp(prefix, s, strlen(prefix)))) { - return i; - } - valid = gtk_tree_model_iter_next(model, &iter) != FALSE; - i++; - } -#endif - return -1; -} - -void ListBoxX::GetValue(int n, char *value, int len) { - char *text = NULL; -#if GTK_MAJOR_VERSION < 2 - GtkCellType type = gtk_clist_get_cell_type(GTK_CLIST(list), n, 0); - switch (type) { - case GTK_CELL_TEXT: - gtk_clist_get_text(GTK_CLIST(list), n, 0, &text); - break; - case GTK_CELL_PIXTEXT: - gtk_clist_get_pixtext(GTK_CLIST(list), n, 0, &text, NULL, NULL, NULL); - break; - default: - break; - } -#else - GtkTreeIter iter; - GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); - bool valid = gtk_tree_model_iter_nth_child(model, &iter, NULL, n) != FALSE; - if (valid) { - gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1); - } -#endif - if (text && len > 0) { - strncpy(value, text, len); - value[len - 1] = '\0'; - } else { - value[0] = '\0'; - } -} - -// g_return_if_fail causes unnecessary compiler warning in release compile. -#ifdef _MSC_VER -#pragma warning(disable: 4127) -#endif - -void ListBoxX::RegisterImage(int type, const char *xpm_data) { - g_return_if_fail(xpm_data); - - // Saved and use the saved copy so caller's copy can disappear. - xset.Add(type, xpm_data); - XPM *pxpm = xset.Get(type); - xpm_data = reinterpret_cast(pxpm->InLinesForm()); - - if (!pixhash) { - pixhash = g_hash_table_new(g_direct_hash, g_direct_equal); - } - ListImage *list_image = (ListImage *) g_hash_table_lookup((GHashTable *) pixhash, - (gconstpointer) GINT_TO_POINTER(type)); - if (list_image) { - // Drop icon already registered -#if GTK_MAJOR_VERSION < 2 - if (list_image->pixmap) - gdk_pixmap_unref(list_image->pixmap); - list_image->pixmap = 0; - if (list_image->bitmap) - gdk_bitmap_unref(list_image->bitmap); - list_image->bitmap = 0; -#else - if (list_image->pixbuf) - gdk_pixbuf_unref(list_image->pixbuf); - list_image->pixbuf = NULL; -#endif - list_image->xpm_data = xpm_data; - } else { - list_image = g_new0(ListImage, 1); - list_image->xpm_data = xpm_data; - g_hash_table_insert((GHashTable *) pixhash, GINT_TO_POINTER(type), - (gpointer) list_image); - } -} - -void ListBoxX::ClearRegisteredImages() { - xset.Clear(); -} - -void ListBoxX::SetList(const char *listText, char separator, char typesep) { - Clear(); - int count = strlen(listText) + 1; - char *words = new char[count]; - if (words) { - memcpy(words, listText, count); - char *startword = words; - char *numword = NULL; - int i = 0; - for (; words[i]; i++) { - if (words[i] == separator) { - words[i] = '\0'; - if (numword) - *numword = '\0'; - Append(startword, numword?atoi(numword + 1):-1); - startword = words + i + 1; - numword = NULL; - } else if (words[i] == typesep) { - numword = words + i; - } - } - if (startword) { - if (numword) - *numword = '\0'; - Append(startword, numword?atoi(numword + 1):-1); - } - delete []words; - } -} - -Menu::Menu() : id(0) {} - -void Menu::CreatePopUp() { - Destroy(); - id = gtk_item_factory_new(GTK_TYPE_MENU, "
    ", NULL); -} - -void Menu::Destroy() { - if (id) -#if GTK_MAJOR_VERSION < 2 - gtk_object_unref(GTK_OBJECT(id)); -#else - g_object_unref(G_OBJECT(id)); -#endif - id = 0; -} - -void Menu::Show(Point pt, Window &) { - int screenHeight = gdk_screen_height(); - int screenWidth = gdk_screen_width(); - GtkItemFactory *factory = reinterpret_cast(id); - GtkWidget *widget = gtk_item_factory_get_widget(factory, "
    "); - gtk_widget_show_all(widget); - GtkRequisition requisition; - gtk_widget_size_request(widget, &requisition); - if ((pt.x + requisition.width) > screenWidth) { - pt.x = screenWidth - requisition.width; - } - if ((pt.y + requisition.height) > screenHeight) { - pt.y = screenHeight - requisition.height; - } -#if GTK_MAJOR_VERSION >= 2 - gtk_item_factory_popup(factory, pt.x - 4, pt.y - 4, 3, - gtk_get_current_event_time()); -#else - gtk_item_factory_popup(factory, pt.x - 4, pt.y - 4, 3, 0); -#endif -} - -ElapsedTime::ElapsedTime() { - GTimeVal curTime; - g_get_current_time(&curTime); - bigBit = curTime.tv_sec; - littleBit = curTime.tv_usec; -} - -class DynamicLibraryImpl : public DynamicLibrary { -protected: - GModule* m; -public: - DynamicLibraryImpl(const char *modulePath) { - m = g_module_open(modulePath, G_MODULE_BIND_LAZY); - } - - virtual ~DynamicLibraryImpl() { - if (m != NULL) - g_module_close(m); - } - - // Use g_module_symbol to get a pointer to the relevant function. - virtual Function FindFunction(const char *name) { - if (m != NULL) { - gpointer fn_address = NULL; - gboolean status = g_module_symbol(m, name, &fn_address); - if (status) - return static_cast(fn_address); - else - return NULL; - } else - return NULL; - } - - virtual bool IsValid() { - return m != NULL; - } -}; - -DynamicLibrary *DynamicLibrary::Load(const char *modulePath) { - return static_cast( new DynamicLibraryImpl(modulePath) ); -} - -double ElapsedTime::Duration(bool reset) { - GTimeVal curTime; - g_get_current_time(&curTime); - long endBigBit = curTime.tv_sec; - long endLittleBit = curTime.tv_usec; - double result = 1000000.0 * (endBigBit - bigBit); - result += endLittleBit - littleBit; - result /= 1000000.0; - if (reset) { - bigBit = endBigBit; - littleBit = endLittleBit; - } - return result; -} - -ColourDesired Platform::Chrome() { - return ColourDesired(0xe0, 0xe0, 0xe0); -} - -ColourDesired Platform::ChromeHighlight() { - return ColourDesired(0xff, 0xff, 0xff); -} - -const char *Platform::DefaultFont() { -#ifdef G_OS_WIN32 - return "Lucida Console"; -#else -#ifdef USE_PANGO - return "!Sans"; -#else - return "lucidatypewriter"; -#endif -#endif -} - -int Platform::DefaultFontSize() { -#ifdef G_OS_WIN32 - return 10; -#else - return 12; -#endif -} - -unsigned int Platform::DoubleClickTime() { - return 500; // Half a second -} - -bool Platform::MouseButtonBounce() { - return true; -} - -void Platform::DebugDisplay(const char *s) { - fprintf(stderr, "%s", s); -} - -bool Platform::IsKeyDown(int) { - // TODO: discover state of keys in GTK+/X - return false; -} - -long Platform::SendScintilla( - WindowID w, unsigned int msg, unsigned long wParam, long lParam) { - return scintilla_send_message(SCINTILLA(w), msg, wParam, lParam); -} - -long Platform::SendScintillaPointer( - WindowID w, unsigned int msg, unsigned long wParam, void *lParam) { - return scintilla_send_message(SCINTILLA(w), msg, wParam, - reinterpret_cast(lParam)); -} - -bool Platform::IsDBCSLeadByte(int /* codePage */, char /* ch */) { - return false; -} - -int Platform::DBCSCharLength(int, const char *s) { - int bytes = mblen(s, MB_CUR_MAX); - if (bytes >= 1) - return bytes; - else - return 1; -} - -int Platform::DBCSCharMaxLength() { - return MB_CUR_MAX; - //return 2; -} - -// These are utility functions not really tied to a platform - -int Platform::Minimum(int a, int b) { - if (a < b) - return a; - else - return b; -} - -int Platform::Maximum(int a, int b) { - if (a > b) - return a; - else - return b; -} - -//#define TRACE - -#ifdef TRACE -void Platform::DebugPrintf(const char *format, ...) { - char buffer[2000]; - va_list pArguments; - va_start(pArguments, format); - vsprintf(buffer, format, pArguments); - va_end(pArguments); - Platform::DebugDisplay(buffer); -} -#else -void Platform::DebugPrintf(const char *, ...) {} - -#endif - -// Not supported for GTK+ -static bool assertionPopUps = true; - -bool Platform::ShowAssertionPopUps(bool assertionPopUps_) { - bool ret = assertionPopUps; - assertionPopUps = assertionPopUps_; - return ret; -} - -void Platform::Assert(const char *c, const char *file, int line) { - char buffer[2000]; - sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line); - strcat(buffer, "\r\n"); - Platform::DebugDisplay(buffer); - abort(); -} - -int Platform::Clamp(int val, int minVal, int maxVal) { - if (val > maxVal) - val = maxVal; - if (val < minVal) - val = minVal; - return val; -} - -void Platform_Initialise() { - FontMutexAllocate(); -} - -void Platform_Finalise() { - FontMutexFree(); -} diff --git a/ext/scintilla/gtk/ScintillaGTK.cxx b/ext/scintilla/gtk/ScintillaGTK.cxx deleted file mode 100644 index 9332a8fba..000000000 --- a/ext/scintilla/gtk/ScintillaGTK.cxx +++ /dev/null @@ -1,2714 +0,0 @@ -// Scintilla source code edit control -// ScintillaGTK.cxx - GTK+ specific subclass of ScintillaBase -// Copyright 1998-2004 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include -#include - -#include "Platform.h" - -#if PLAT_GTK_WIN32 -#include "windows.h" -#endif - -#include "Scintilla.h" -#include "ScintillaWidget.h" -#ifdef SCI_LEXER -#include "SciLexer.h" -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" -#endif -#include "SVector.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "CallTip.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "AutoComplete.h" -#include "ViewStyle.h" -#include "Decoration.h" -#include "CharClassify.h" -#include "Document.h" -#include "PositionCache.h" -#include "Editor.h" -#include "SString.h" -#include "ScintillaBase.h" -#include "UniConversion.h" - -#include "gtk/gtksignal.h" -#include "gtk/gtkmarshal.h" -#if GLIB_MAJOR_VERSION >= 2 -#include "scintilla-marshal.h" -#endif - -#ifdef SCI_LEXER -#include -#include -#include "ExternalLexer.h" -#endif - -#define INTERNATIONAL_INPUT - -#if !PLAT_GTK_WIN32 || GTK_MAJOR_VERSION >= 2 -#define USE_CONVERTER -#endif - -#ifdef USE_CONVERTER -#include "Converter.h" -#endif - -#ifdef _MSC_VER -// Constant conditional expressions are because of GTK+ headers -#pragma warning(disable: 4127) -// Ignore unreferenced local functions in GTK+ headers -#pragma warning(disable: 4505) -#endif - -#if GTK_CHECK_VERSION(2,6,0) -#define USE_GTK_CLIPBOARD -#endif - -#if GLIB_MAJOR_VERSION < 2 -#define OBJECT_CLASS GtkObjectClass -#else -#define OBJECT_CLASS GObjectClass -#endif - -extern char *UTF8FromLatin1(const char *s, int &len); - -class ScintillaGTK : public ScintillaBase { - _ScintillaObject *sci; - Window wText; - Window scrollbarv; - Window scrollbarh; - GtkObject *adjustmentv; - GtkObject *adjustmenth; - int scrollBarWidth; - int scrollBarHeight; - - // Because clipboard access is asynchronous, copyText is created by Copy -#ifndef USE_GTK_CLIPBOARD - SelectionText copyText; -#endif - - SelectionText primary; - - GdkEventButton evbtn; - bool capturedMouse; - bool dragWasDropped; - int lastKey; - - GtkWidgetClass *parentClass; - - static GdkAtom atomClipboard; - static GdkAtom atomUTF8; - static GdkAtom atomString; - static GdkAtom atomUriList; - static GdkAtom atomDROPFILES_DND; - GdkAtom atomSought; - -#if PLAT_GTK_WIN32 - CLIPFORMAT cfColumnSelect; -#endif - -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - // Input context used for supporting internationalized key entry - GdkIC *ic; - GdkICAttr *ic_attr; -#else - Window wPreedit; - Window wPreeditDraw; - GtkIMContext *im_context; -#endif -#endif - - // Wheel mouse support - unsigned int linesPerScroll; - GTimeVal lastWheelMouseTime; - gint lastWheelMouseDirection; - gint wheelMouseIntensity; - - GdkRegion *rgnUpdate; - - // Private so ScintillaGTK objects can not be copied - ScintillaGTK(const ScintillaGTK &) : ScintillaBase() {} - ScintillaGTK &operator=(const ScintillaGTK &) { return * this; } - -public: - ScintillaGTK(_ScintillaObject *sci_); - virtual ~ScintillaGTK(); - static void ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class); -private: - virtual void Initialise(); - virtual void Finalise(); - virtual void DisplayCursor(Window::Cursor c); - virtual bool DragThreshold(Point ptStart, Point ptNow); - virtual void StartDrag(); - int TargetAsUTF8(char *text); - int EncodedFromUTF8(char *utf8, char *encoded); - virtual bool ValidCodePage(int codePage) const; -public: // Public for scintilla_send_message - virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); -private: - virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - virtual void SetTicking(bool on); - virtual bool SetIdle(bool on); - virtual void SetMouseCapture(bool on); - virtual bool HaveMouseCapture(); - virtual bool PaintContains(PRectangle rc); - void FullPaint(); - virtual PRectangle GetClientRectangle(); - void SyncPaint(PRectangle rc); - virtual void ScrollText(int linesToMove); - virtual void SetVerticalScrollPos(); - virtual void SetHorizontalScrollPos(); - virtual bool ModifyScrollBars(int nMax, int nPage); - void ReconfigureScrollBars(); - virtual void NotifyChange(); - virtual void NotifyFocus(bool focus); - virtual void NotifyParent(SCNotification scn); - void NotifyKey(int key, int modifiers); - void NotifyURIDropped(const char *list); - const char *CharacterSetID() const; - virtual int KeyDefault(int key, int modifiers); - virtual void CopyToClipboard(const SelectionText &selectedText); - virtual void Copy(); - virtual void Paste(); - virtual void CreateCallTipWindow(PRectangle rc); - virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); - bool OwnPrimarySelection(); - virtual void ClaimSelection(); - void GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText); - void ReceivedSelection(GtkSelectionData *selection_data); - void ReceivedDrop(GtkSelectionData *selection_data); - static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *selected); -#ifdef USE_GTK_CLIPBOARD - void StoreOnClipboard(SelectionText *clipText); - static void ClipboardGetSelection(GtkClipboard* clip, GtkSelectionData *selection_data, guint info, void *data); - static void ClipboardClearSelection(GtkClipboard* clip, void *data); -#endif - - void UnclaimSelection(GdkEventSelection *selection_event); - void Resize(int width, int height); - - // Callback functions - void RealizeThis(GtkWidget *widget); - static void Realize(GtkWidget *widget); - void UnRealizeThis(GtkWidget *widget); - static void UnRealize(GtkWidget *widget); - void MapThis(); - static void Map(GtkWidget *widget); - void UnMapThis(); - static void UnMap(GtkWidget *widget); - static gint CursorMoved(GtkWidget *widget, int xoffset, int yoffset, ScintillaGTK *sciThis); - static gint FocusIn(GtkWidget *widget, GdkEventFocus *event); - static gint FocusOut(GtkWidget *widget, GdkEventFocus *event); - static void SizeRequest(GtkWidget *widget, GtkRequisition *requisition); - static void SizeAllocate(GtkWidget *widget, GtkAllocation *allocation); - gint Expose(GtkWidget *widget, GdkEventExpose *ose); - static gint ExposeMain(GtkWidget *widget, GdkEventExpose *ose); - static void Draw(GtkWidget *widget, GdkRectangle *area); - void ForAll(GtkCallback callback, gpointer callback_data); - static void MainForAll(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); - - static void ScrollSignal(GtkAdjustment *adj, ScintillaGTK *sciThis); - static void ScrollHSignal(GtkAdjustment *adj, ScintillaGTK *sciThis); - gint PressThis(GdkEventButton *event); - static gint Press(GtkWidget *widget, GdkEventButton *event); - static gint MouseRelease(GtkWidget *widget, GdkEventButton *event); -#if PLAT_GTK_WIN32 || (GTK_MAJOR_VERSION >= 2) - static gint ScrollEvent(GtkWidget *widget, GdkEventScroll *event); -#endif - static gint Motion(GtkWidget *widget, GdkEventMotion *event); - gboolean KeyThis(GdkEventKey *event); - static gboolean KeyPress(GtkWidget *widget, GdkEventKey *event); - static gboolean KeyRelease(GtkWidget *widget, GdkEventKey *event); -#if GTK_MAJOR_VERSION >= 2 - static gboolean ExposePreedit(GtkWidget *widget, GdkEventExpose *ose, ScintillaGTK *sciThis); - gboolean ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose); - static void Commit(GtkIMContext *context, char *str, ScintillaGTK *sciThis); - void CommitThis(char *str); - static void PreeditChanged(GtkIMContext *context, ScintillaGTK *sciThis); - void PreeditChangedThis(); -#endif - static gint StyleSetText(GtkWidget *widget, GtkStyle *previous, void*); - static gint RealizeText(GtkWidget *widget, void*); -#if GLIB_MAJOR_VERSION < 2 - static void Destroy(GtkObject *object); -#else - static void Destroy(GObject *object); -#endif - static void SelectionReceived(GtkWidget *widget, GtkSelectionData *selection_data, - guint time); - static void SelectionGet(GtkWidget *widget, GtkSelectionData *selection_data, - guint info, guint time); - static gint SelectionClear(GtkWidget *widget, GdkEventSelection *selection_event); -#if GTK_MAJOR_VERSION < 2 - static gint SelectionNotify(GtkWidget *widget, GdkEventSelection *selection_event); -#endif - static void DragBegin(GtkWidget *widget, GdkDragContext *context); - gboolean DragMotionThis(GdkDragContext *context, gint x, gint y, guint dragtime); - static gboolean DragMotion(GtkWidget *widget, GdkDragContext *context, - gint x, gint y, guint dragtime); - static void DragLeave(GtkWidget *widget, GdkDragContext *context, - guint time); - static void DragEnd(GtkWidget *widget, GdkDragContext *context); - static gboolean Drop(GtkWidget *widget, GdkDragContext *context, - gint x, gint y, guint time); - static void DragDataReceived(GtkWidget *widget, GdkDragContext *context, - gint x, gint y, GtkSelectionData *selection_data, guint info, guint time); - static void DragDataGet(GtkWidget *widget, GdkDragContext *context, - GtkSelectionData *selection_data, guint info, guint time); - static gint TimeOut(ScintillaGTK *sciThis); - static gint IdleCallback(ScintillaGTK *sciThis); - static void PopUpCB(ScintillaGTK *sciThis, guint action, GtkWidget *widget); - - gint ExposeTextThis(GtkWidget *widget, GdkEventExpose *ose); - static gint ExposeText(GtkWidget *widget, GdkEventExpose *ose, ScintillaGTK *sciThis); - - static gint ExposeCT(GtkWidget *widget, GdkEventExpose *ose, CallTip *ct); - static gint PressCT(GtkWidget *widget, GdkEventButton *event, ScintillaGTK *sciThis); - - static sptr_t DirectFunction(ScintillaGTK *sciThis, - unsigned int iMessage, uptr_t wParam, sptr_t lParam); -}; - -enum { - COMMAND_SIGNAL, - NOTIFY_SIGNAL, - LAST_SIGNAL -}; - -static gint scintilla_signals[LAST_SIGNAL] = { 0 }; -#if GLIB_MAJOR_VERSION < 2 -static GtkWidgetClass *parent_class = NULL; -#endif - -enum { - TARGET_STRING, - TARGET_TEXT, - TARGET_COMPOUND_TEXT, - TARGET_UTF8_STRING, - TARGET_URI -}; - -GdkAtom ScintillaGTK::atomClipboard = 0; -GdkAtom ScintillaGTK::atomUTF8 = 0; -GdkAtom ScintillaGTK::atomString = 0; -GdkAtom ScintillaGTK::atomUriList = 0; -GdkAtom ScintillaGTK::atomDROPFILES_DND = 0; - -static const GtkTargetEntry clipboardCopyTargets[] = { - { (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING }, - { (gchar *) "STRING", 0, TARGET_STRING }, -}; -static const gint nClipboardCopyTargets = sizeof(clipboardCopyTargets) / sizeof(clipboardCopyTargets[0]); - -static const GtkTargetEntry clipboardPasteTargets[] = { - { (gchar *) "text/uri-list", 0, TARGET_URI }, - { (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING }, - { (gchar *) "STRING", 0, TARGET_STRING }, -}; -static const gint nClipboardPasteTargets = sizeof(clipboardPasteTargets) / sizeof(clipboardPasteTargets[0]); - -static GtkWidget *PWidget(Window &w) { - return reinterpret_cast(w.GetID()); -} - -static ScintillaGTK *ScintillaFromWidget(GtkWidget *widget) { - ScintillaObject *scio = reinterpret_cast(widget); - return reinterpret_cast(scio->pscin); -} - -ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : - adjustmentv(0), adjustmenth(0), - scrollBarWidth(30), scrollBarHeight(30), - capturedMouse(false), dragWasDropped(false), - lastKey(0), parentClass(0), -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - ic(NULL), - ic_attr(NULL), -#else - im_context(NULL), -#endif -#endif - lastWheelMouseDirection(0), - wheelMouseIntensity(0), - rgnUpdate(0) { - sci = sci_; - wMain = GTK_WIDGET(sci); - -#if PLAT_GTK_WIN32 - // There does not seem to be a real standard for indicating that the clipboard - // contains a rectangular selection, so copy Developer Studio. - cfColumnSelect = static_cast( - ::RegisterClipboardFormat("MSDEVColumnSelect")); - - // Get intellimouse parameters when running on win32; otherwise use - // reasonable default -#ifndef SPI_GETWHEELSCROLLLINES -#define SPI_GETWHEELSCROLLLINES 104 -#endif - ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &linesPerScroll, 0); -#else - linesPerScroll = 4; -#endif - lastWheelMouseTime.tv_sec = 0; - lastWheelMouseTime.tv_usec = 0; - - Initialise(); -} - -ScintillaGTK::~ScintillaGTK() { -} - -void ScintillaGTK::RealizeThis(GtkWidget *widget) { - //Platform::DebugPrintf("ScintillaGTK::realize this\n"); - GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); - GdkWindowAttr attrs; - attrs.window_type = GDK_WINDOW_CHILD; - attrs.x = widget->allocation.x; - attrs.y = widget->allocation.y; - attrs.width = widget->allocation.width; - attrs.height = widget->allocation.height; - attrs.wclass = GDK_INPUT_OUTPUT; - attrs.visual = gtk_widget_get_visual(widget); - attrs.colormap = gtk_widget_get_colormap(widget); - attrs.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; - GdkCursor *cursor = gdk_cursor_new(GDK_XTERM); - attrs.cursor = cursor; - widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), &attrs, - GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_CURSOR); - gdk_window_set_user_data(widget->window, widget); - gdk_window_set_background(widget->window, &widget->style->bg[GTK_STATE_NORMAL]); - gdk_window_show(widget->window); - gdk_cursor_destroy(cursor); - widget->style = gtk_style_attach(widget->style, widget->window); -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - if (gdk_im_ready() && (ic_attr = gdk_ic_attr_new()) != NULL) { - gint width, height; - GdkColormap *colormap; - GdkEventMask mask; - GdkICAttr *attr = ic_attr; - GdkICAttributesType attrmask = GDK_IC_ALL_REQ; - GdkIMStyle style; - GdkIMStyle supported_style = (GdkIMStyle) (GDK_IM_PREEDIT_NONE | - GDK_IM_PREEDIT_NOTHING | - GDK_IM_PREEDIT_POSITION | - GDK_IM_STATUS_NONE | - GDK_IM_STATUS_NOTHING); - - if (widget->style && widget->style->font->type != GDK_FONT_FONTSET) - supported_style = (GdkIMStyle) ((int) supported_style & ~GDK_IM_PREEDIT_POSITION); - - attr->style = style = gdk_im_decide_style(supported_style); - attr->client_window = widget->window; - - if ((colormap = gtk_widget_get_colormap (widget)) != gtk_widget_get_default_colormap ()) { - attrmask = (GdkICAttributesType) ((int) attrmask | GDK_IC_PREEDIT_COLORMAP); - attr->preedit_colormap = colormap; - } - - switch (style & GDK_IM_PREEDIT_MASK) { - case GDK_IM_PREEDIT_POSITION: - if (widget->style && widget->style->font->type != GDK_FONT_FONTSET) { - g_warning("over-the-spot style requires fontset"); - break; - } - - attrmask = (GdkICAttributesType) ((int) attrmask | GDK_IC_PREEDIT_POSITION_REQ); - gdk_window_get_size(widget->window, &width, &height); - attr->spot_location.x = 0; - attr->spot_location.y = height; - attr->preedit_area.x = 0; - attr->preedit_area.y = 0; - attr->preedit_area.width = width; - attr->preedit_area.height = height; - attr->preedit_fontset = widget->style->font; - - break; - } - ic = gdk_ic_new(attr, attrmask); - - if (ic == NULL) { - g_warning("Can't create input context."); - } else { - mask = gdk_window_get_events(widget->window); - mask = (GdkEventMask) ((int) mask | gdk_ic_get_events(ic)); - gdk_window_set_events(widget->window, mask); - - if (GTK_WIDGET_HAS_FOCUS(widget)) - gdk_im_begin(ic, widget->window); - } - } -#else - wPreedit = gtk_window_new(GTK_WINDOW_POPUP); - wPreeditDraw = gtk_drawing_area_new(); - GtkWidget *predrw = PWidget(wPreeditDraw); // No code inside the G_OBJECT macro - g_signal_connect(G_OBJECT(predrw), "expose_event", - G_CALLBACK(ExposePreedit), this); - gtk_container_add(GTK_CONTAINER(PWidget(wPreedit)), predrw); - gtk_widget_realize(PWidget(wPreedit)); - gtk_widget_realize(predrw); - gtk_widget_show(predrw); - - im_context = gtk_im_multicontext_new(); - g_signal_connect(G_OBJECT(im_context), "commit", - G_CALLBACK(Commit), this); - g_signal_connect(G_OBJECT(im_context), "preedit_changed", - G_CALLBACK(PreeditChanged), this); - gtk_im_context_set_client_window(im_context, widget->window); -#endif -#endif - GtkWidget *widtxt = PWidget(wText); // // No code inside the G_OBJECT macro -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect_after(GTK_OBJECT(widtxt), "style_set", - GtkSignalFunc(ScintillaGTK::StyleSetText), NULL); - gtk_signal_connect_after(GTK_OBJECT(widtxt), "realize", - GtkSignalFunc(ScintillaGTK::RealizeText), NULL); -#else - g_signal_connect_after(G_OBJECT(widtxt), "style_set", - G_CALLBACK(ScintillaGTK::StyleSetText), NULL); - g_signal_connect_after(G_OBJECT(widtxt), "realize", - G_CALLBACK(ScintillaGTK::RealizeText), NULL); -#endif - gtk_widget_realize(widtxt); - gtk_widget_realize(PWidget(scrollbarv)); - gtk_widget_realize(PWidget(scrollbarh)); -} - -void ScintillaGTK::Realize(GtkWidget *widget) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - sciThis->RealizeThis(widget); -} - -void ScintillaGTK::UnRealizeThis(GtkWidget *widget) { - if (GTK_WIDGET_MAPPED(widget)) { - gtk_widget_unmap(widget); - } - GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED); - gtk_widget_unrealize(PWidget(wText)); - gtk_widget_unrealize(PWidget(scrollbarv)); - gtk_widget_unrealize(PWidget(scrollbarh)); -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - if (ic) { - gdk_ic_destroy(ic); - ic = NULL; - } - if (ic_attr) { - gdk_ic_attr_destroy(ic_attr); - ic_attr = NULL; - } -#else - gtk_widget_unrealize(PWidget(wPreedit)); - gtk_widget_unrealize(PWidget(wPreeditDraw)); - g_object_unref(im_context); - im_context = NULL; -#endif -#endif - if (GTK_WIDGET_CLASS(parentClass)->unrealize) - GTK_WIDGET_CLASS(parentClass)->unrealize(widget); - - Finalise(); -} - -void ScintillaGTK::UnRealize(GtkWidget *widget) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - sciThis->UnRealizeThis(widget); -} - -static void MapWidget(GtkWidget *widget) { - if (widget && - GTK_WIDGET_VISIBLE(widget) && - !GTK_WIDGET_MAPPED(widget)) { - gtk_widget_map(widget); - } -} - -void ScintillaGTK::MapThis() { - //Platform::DebugPrintf("ScintillaGTK::map this\n"); - GTK_WIDGET_SET_FLAGS(PWidget(wMain), GTK_MAPPED); - MapWidget(PWidget(wText)); - MapWidget(PWidget(scrollbarh)); - MapWidget(PWidget(scrollbarv)); - wMain.SetCursor(Window::cursorArrow); - scrollbarv.SetCursor(Window::cursorArrow); - scrollbarh.SetCursor(Window::cursorArrow); - ChangeSize(); - gdk_window_show(PWidget(wMain)->window); -} - -void ScintillaGTK::Map(GtkWidget *widget) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - sciThis->MapThis(); -} - -void ScintillaGTK::UnMapThis() { - //Platform::DebugPrintf("ScintillaGTK::unmap this\n"); - GTK_WIDGET_UNSET_FLAGS(PWidget(wMain), GTK_MAPPED); - DropGraphics(); - gdk_window_hide(PWidget(wMain)->window); - gtk_widget_unmap(PWidget(wText)); - gtk_widget_unmap(PWidget(scrollbarh)); - gtk_widget_unmap(PWidget(scrollbarv)); -} - -void ScintillaGTK::UnMap(GtkWidget *widget) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - sciThis->UnMapThis(); -} - -void ScintillaGTK::ForAll(GtkCallback callback, gpointer callback_data) { - (*callback) (PWidget(wText), callback_data); - (*callback) (PWidget(scrollbarv), callback_data); - (*callback) (PWidget(scrollbarh), callback_data); -} - -void ScintillaGTK::MainForAll(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) { - ScintillaGTK *sciThis = ScintillaFromWidget((GtkWidget *)container); - - if (callback != NULL && include_internals) { - sciThis->ForAll(callback, callback_data); - } -} - -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 -gint ScintillaGTK::CursorMoved(GtkWidget *widget, int xoffset, int yoffset, ScintillaGTK *sciThis) { - if (GTK_WIDGET_HAS_FOCUS(widget) && gdk_im_ready() && sciThis->ic && - (gdk_ic_get_style(sciThis->ic) & GDK_IM_PREEDIT_POSITION)) { - sciThis->ic_attr->spot_location.x = xoffset; - sciThis->ic_attr->spot_location.y = yoffset; - gdk_ic_set_attr(sciThis->ic, sciThis->ic_attr, GDK_IC_SPOT_LOCATION); - } - return FALSE; -} -#else -gint ScintillaGTK::CursorMoved(GtkWidget *, int xoffset, int yoffset, ScintillaGTK *sciThis) { - GdkRectangle area; - area.x = xoffset; - area.y = yoffset; - area.width = 1; - area.height = 1; - gtk_im_context_set_cursor_location(sciThis->im_context, &area); - return FALSE; -} -#endif -#else -gint ScintillaGTK::CursorMoved(GtkWidget *, int, int, ScintillaGTK *) { - return FALSE; -} -#endif - -gint ScintillaGTK::FocusIn(GtkWidget *widget, GdkEventFocus * /*event*/) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("ScintillaGTK::focus in %x\n", sciThis); - GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); - sciThis->SetFocusState(true); - -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - if (sciThis->ic) - gdk_im_begin(sciThis->ic, widget->window); -#else - if (sciThis->im_context != NULL) { - gchar *str = NULL; - gint cursor_pos; - - gtk_im_context_get_preedit_string(sciThis->im_context, &str, NULL, &cursor_pos); - if (PWidget(sciThis->wPreedit) != NULL) { - if (strlen(str) > 0) { - gtk_widget_show(PWidget(sciThis->wPreedit)); - } else { - gtk_widget_hide(PWidget(sciThis->wPreedit)); - } - } - g_free(str); - gtk_im_context_focus_in(sciThis->im_context); - } -#endif -#endif - - return FALSE; -} - -gint ScintillaGTK::FocusOut(GtkWidget *widget, GdkEventFocus * /*event*/) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("ScintillaGTK::focus out %x\n", sciThis); - GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); - sciThis->SetFocusState(false); - -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - gdk_im_end(); -#else - if (PWidget(sciThis->wPreedit) != NULL) - gtk_widget_hide(PWidget(sciThis->wPreedit)); - if (sciThis->im_context != NULL) - gtk_im_context_focus_out(sciThis->im_context); -#endif -#endif - - return FALSE; -} - -void ScintillaGTK::SizeRequest(GtkWidget *widget, GtkRequisition *requisition) { - requisition->width = 600; - requisition->height = gdk_screen_height(); - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - GtkRequisition child_requisition; - gtk_widget_size_request(PWidget(sciThis->scrollbarh), &child_requisition); - gtk_widget_size_request(PWidget(sciThis->scrollbarv), &child_requisition); -} - -void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { - widget->allocation = *allocation; - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - if (GTK_WIDGET_REALIZED(widget)) - gdk_window_move_resize(widget->window, - widget->allocation.x, - widget->allocation.y, - widget->allocation.width, - widget->allocation.height); - - sciThis->Resize(allocation->width, allocation->height); - -#ifdef INTERNATIONAL_INPUT -#if GTK_MAJOR_VERSION < 2 - if (sciThis->ic && (gdk_ic_get_style(sciThis->ic) & GDK_IM_PREEDIT_POSITION)) { - gint width, height; - - gdk_window_get_size(widget->window, &width, &height); - sciThis->ic_attr->preedit_area.width = width; - sciThis->ic_attr->preedit_area.height = height; - - gdk_ic_set_attr(sciThis->ic, sciThis->ic_attr, GDK_IC_PREEDIT_AREA); - } -#endif -#endif -} - -void ScintillaGTK::Initialise() { - //Platform::DebugPrintf("ScintillaGTK::Initialise\n"); - parentClass = reinterpret_cast( - gtk_type_class(gtk_container_get_type())); - - GTK_WIDGET_SET_FLAGS(PWidget(wMain), GTK_CAN_FOCUS); - GTK_WIDGET_SET_FLAGS(GTK_WIDGET(PWidget(wMain)), GTK_SENSITIVE); - gtk_widget_set_events(PWidget(wMain), - GDK_EXPOSURE_MASK - | GDK_STRUCTURE_MASK - | GDK_KEY_PRESS_MASK - | GDK_KEY_RELEASE_MASK - | GDK_FOCUS_CHANGE_MASK - | GDK_LEAVE_NOTIFY_MASK - | GDK_BUTTON_PRESS_MASK - | GDK_BUTTON_RELEASE_MASK - | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK); - - wText = gtk_drawing_area_new(); - gtk_widget_set_parent(PWidget(wText), PWidget(wMain)); - GtkWidget *widtxt = PWidget(wText); // No code inside the G_OBJECT macro - gtk_widget_show(widtxt); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect(GTK_OBJECT(widtxt), "expose_event", - GtkSignalFunc(ScintillaGTK::ExposeText), this); -#else - g_signal_connect(G_OBJECT(widtxt), "expose_event", - G_CALLBACK(ScintillaGTK::ExposeText), this); -#endif - gtk_widget_set_events(widtxt, GDK_EXPOSURE_MASK); -#if GTK_MAJOR_VERSION >= 2 - // Avoid background drawing flash - gtk_widget_set_double_buffered(widtxt, FALSE); -#endif - gtk_drawing_area_size(GTK_DRAWING_AREA(widtxt), - 100,100); - adjustmentv = gtk_adjustment_new(0.0, 0.0, 201.0, 1.0, 20.0, 20.0); - scrollbarv = gtk_vscrollbar_new(GTK_ADJUSTMENT(adjustmentv)); - GTK_WIDGET_UNSET_FLAGS(PWidget(scrollbarv), GTK_CAN_FOCUS); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect(adjustmentv, "value_changed", - GtkSignalFunc(ScrollSignal), this); -#else - g_signal_connect(G_OBJECT(adjustmentv), "value_changed", - G_CALLBACK(ScrollSignal), this); -#endif - gtk_widget_set_parent(PWidget(scrollbarv), PWidget(wMain)); - gtk_widget_show(PWidget(scrollbarv)); - - adjustmenth = gtk_adjustment_new(0.0, 0.0, 101.0, 1.0, 20.0, 20.0); - scrollbarh = gtk_hscrollbar_new(GTK_ADJUSTMENT(adjustmenth)); - GTK_WIDGET_UNSET_FLAGS(PWidget(scrollbarh), GTK_CAN_FOCUS); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect(adjustmenth, "value_changed", - GtkSignalFunc(ScrollHSignal), this); -#else - g_signal_connect(G_OBJECT(adjustmenth), "value_changed", - G_CALLBACK(ScrollHSignal), this); -#endif - gtk_widget_set_parent(PWidget(scrollbarh), PWidget(wMain)); - gtk_widget_show(PWidget(scrollbarh)); - - gtk_widget_grab_focus(PWidget(wMain)); - - gtk_selection_add_targets(GTK_WIDGET(PWidget(wMain)), GDK_SELECTION_PRIMARY, - clipboardCopyTargets, nClipboardCopyTargets); - -#ifndef USE_GTK_CLIPBOARD - gtk_selection_add_targets(GTK_WIDGET(PWidget(wMain)), atomClipboard, - clipboardPasteTargets, nClipboardPasteTargets); -#endif - - gtk_drag_dest_set(GTK_WIDGET(PWidget(wMain)), - GTK_DEST_DEFAULT_ALL, clipboardPasteTargets, nClipboardPasteTargets, - static_cast(GDK_ACTION_COPY | GDK_ACTION_MOVE)); - -#if GLIB_MAJOR_VERSION >= 2 - // Set caret period based on GTK settings - gboolean blinkOn = false; - if (g_object_class_find_property(G_OBJECT_GET_CLASS( - G_OBJECT(gtk_settings_get_default())), "gtk-cursor-blink")) { - g_object_get(G_OBJECT( - gtk_settings_get_default()), "gtk-cursor-blink", &blinkOn, NULL); - } - if (blinkOn && - g_object_class_find_property(G_OBJECT_GET_CLASS( - G_OBJECT(gtk_settings_get_default())), "gtk-cursor-blink-time")) { - gint value; - g_object_get(G_OBJECT( - gtk_settings_get_default()), "gtk-cursor-blink-time", &value, NULL); - caret.period = gint(value / 1.75); - } else { - caret.period = 0; - } -#endif - - SetTicking(true); -} - -void ScintillaGTK::Finalise() { - SetTicking(false); - ScintillaBase::Finalise(); -} - -void ScintillaGTK::DisplayCursor(Window::Cursor c) { - if (cursorMode == SC_CURSORNORMAL) - wText.SetCursor(c); - else - wText.SetCursor(static_cast(cursorMode)); -} - -bool ScintillaGTK::DragThreshold(Point ptStart, Point ptNow) { -#if GTK_MAJOR_VERSION < 2 - return Editor::DragThreshold(ptStart, ptNow); -#else - return gtk_drag_check_threshold(GTK_WIDGET(PWidget(wMain)), - ptStart.x, ptStart.y, ptNow.x, ptNow.y); -#endif -} - -void ScintillaGTK::StartDrag() { - dragWasDropped = false; - inDragDrop = ddDragging; - GtkTargetList *tl = gtk_target_list_new(clipboardCopyTargets, nClipboardCopyTargets); - gtk_drag_begin(GTK_WIDGET(PWidget(wMain)), - tl, - static_cast(GDK_ACTION_COPY | GDK_ACTION_MOVE), - evbtn.button, - reinterpret_cast(&evbtn)); -} - -#ifdef USE_CONVERTER -static char *ConvertText(int *lenResult, char *s, size_t len, const char *charSetDest, - const char *charSetSource, bool transliterations) { - *lenResult = 0; - char *destForm = 0; - Converter conv(charSetDest, charSetSource, transliterations); - if (conv) { - destForm = new char[len*3+1]; - char *pin = s; - size_t inLeft = len; - char *pout = destForm; - size_t outLeft = len*3+1; - size_t conversions = conv.Convert(&pin, &inLeft, &pout, &outLeft); - if (conversions == ((size_t)(-1))) { -fprintf(stderr, "iconv %s->%s failed for %s\n", charSetSource, charSetDest, static_cast(s)); - delete []destForm; - destForm = 0; - } else { -//fprintf(stderr, "iconv OK %s %d\n", destForm, pout - destForm); - *pout = '\0'; - *lenResult = pout - destForm; - } - } else { -fprintf(stderr, "Can not iconv %s %s\n", charSetDest, charSetSource); - } - if (!destForm) { - destForm = new char[1]; - destForm[0] = '\0'; - *lenResult = 0; - } - return destForm; -} -#endif - -// Returns the target converted to UTF8. -// Return the length in bytes. -int ScintillaGTK::TargetAsUTF8(char *text) { - int targetLength = targetEnd - targetStart; - if (IsUnicodeMode()) { - if (text) { - pdoc->GetCharRange(text, targetStart, targetLength); - } - } else { - // Need to convert -#ifdef USE_CONVERTER - const char *charSetBuffer = CharacterSetID(); - if (*charSetBuffer) { -//~ fprintf(stderr, "AsUTF8 %s %d %0d-%0d\n", charSetBuffer, targetLength, targetStart, targetEnd); - char *s = new char[targetLength]; - if (s) { - pdoc->GetCharRange(s, targetStart, targetLength); -//~ fprintf(stderr, " \"%s\"\n", s); - if (text) { - char *tmputf = ConvertText(&targetLength, s, targetLength, "UTF-8", charSetBuffer, false); - memcpy(text, tmputf, targetLength); - delete []tmputf; -//~ fprintf(stderr, " \"%s\"\n", text); - } - delete []s; - } - } else { - if (text) { - pdoc->GetCharRange(text, targetStart, targetLength); - } - } -#else - // Fail - return 0; -#endif - } -//~ fprintf(stderr, "Length = %d bytes\n", targetLength); - return targetLength; -} - -// Translates a nul terminated UTF8 string into the document encoding. -// Return the length of the result in bytes. -int ScintillaGTK::EncodedFromUTF8(char *utf8, char *encoded) { - int inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); - if (IsUnicodeMode()) { - if (encoded) { - memcpy(encoded, utf8, inputLength); - } - return inputLength; - } else { - // Need to convert -#ifdef USE_CONVERTER - const char *charSetBuffer = CharacterSetID(); - if (*charSetBuffer) { -//~ fprintf(stderr, "Encode %s %d\n", charSetBuffer, inputLength); - int outLength = 0; - char *tmpEncoded = ConvertText(&outLength, utf8, inputLength, charSetBuffer, "UTF-8", true); - if (tmpEncoded) { -//~ fprintf(stderr, " \"%s\"\n", tmpEncoded); - if (encoded) { - memcpy(encoded, tmpEncoded, outLength); - } - delete []tmpEncoded; - } - return outLength; - } else { - if (encoded) { - memcpy(encoded, utf8, inputLength); - } - return inputLength; - } -#endif - } - // Fail - return 0; -} - -bool ScintillaGTK::ValidCodePage(int codePage) const { - return codePage == 0 || codePage == SC_CP_UTF8 || codePage == SC_CP_DBCS; -} - -sptr_t ScintillaGTK::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - switch (iMessage) { - - case SCI_GRABFOCUS: - gtk_widget_grab_focus(PWidget(wMain)); - break; - - case SCI_GETDIRECTFUNCTION: - return reinterpret_cast(DirectFunction); - - case SCI_GETDIRECTPOINTER: - return reinterpret_cast(this); - -#ifdef SCI_LEXER - case SCI_LOADLEXERLIBRARY: - LexerManager::GetInstance()->Load(reinterpret_cast(wParam)); - break; -#endif - case SCI_TARGETASUTF8: - return TargetAsUTF8(reinterpret_cast(lParam)); - - case SCI_ENCODEDFROMUTF8: - return EncodedFromUTF8(reinterpret_cast(wParam), - reinterpret_cast(lParam)); - - default: - return ScintillaBase::WndProc(iMessage, wParam, lParam); - } - return 0l; -} - -sptr_t ScintillaGTK::DefWndProc(unsigned int, uptr_t, sptr_t) { - return 0; -} - -void ScintillaGTK::SetTicking(bool on) { - if (timer.ticking != on) { - timer.ticking = on; - if (timer.ticking) { - timer.tickerID = reinterpret_cast(gtk_timeout_add(timer.tickSize, (GtkFunction)TimeOut, this)); - } else { - gtk_timeout_remove(GPOINTER_TO_UINT(timer.tickerID)); - } - } - timer.ticksToWait = caret.period; -} - -bool ScintillaGTK::SetIdle(bool on) { - if (on) { - // Start idler, if it's not running. - if (idler.state == false) { - idler.state = true; - idler.idlerID = reinterpret_cast - (gtk_idle_add((GtkFunction)IdleCallback, this)); - } - } else { - // Stop idler, if it's running - if (idler.state == true) { - idler.state = false; - gtk_idle_remove(GPOINTER_TO_UINT(idler.idlerID)); - } - } - return true; -} - -void ScintillaGTK::SetMouseCapture(bool on) { - if (mouseDownCaptures) { - if (on) { - gtk_grab_add(GTK_WIDGET(PWidget(wMain))); - } else { - gtk_grab_remove(GTK_WIDGET(PWidget(wMain))); - } - } - capturedMouse = on; -} - -bool ScintillaGTK::HaveMouseCapture() { - return capturedMouse; -} - -bool ScintillaGTK::PaintContains(PRectangle rc) { - bool contains = true; - if (paintState == painting) { - if (!rcPaint.Contains(rc)) { - contains = false; - } else if (rgnUpdate) { - GdkRectangle grc = {rc.left, rc.top, - rc.right - rc.left, rc.bottom - rc.top}; - if (gdk_region_rect_in(rgnUpdate, &grc) != GDK_OVERLAP_RECTANGLE_IN) { - contains = false; - } - } - } - return contains; -} - -// Redraw all of text area. This paint will not be abandoned. -void ScintillaGTK::FullPaint() { -#if GTK_MAJOR_VERSION < 2 - paintState = painting; - rcPaint = GetClientRectangle(); - //Platform::DebugPrintf("ScintillaGTK::FullPaint %0d,%0d %0d,%0d\n", - // rcPaint.left, rcPaint.top, rcPaint.right, rcPaint.bottom); - paintingAllText = true; - if ((PWidget(wText))->window) { - Surface *sw = Surface::Allocate(); - if (sw) { - sw->Init(PWidget(wText)->window, PWidget(wText)); - Paint(sw, rcPaint); - sw->Release(); - delete sw; - } - } - paintState = notPainting; -#else - wText.InvalidateAll(); -#endif -} - -PRectangle ScintillaGTK::GetClientRectangle() { - PRectangle rc = wMain.GetClientPosition(); - if (verticalScrollBarVisible) - rc.right -= scrollBarWidth; - if (horizontalScrollBarVisible && (wrapState == eWrapNone)) - rc.bottom -= scrollBarHeight; - // Move to origin - rc.right -= rc.left; - rc.bottom -= rc.top; - rc.left = 0; - rc.top = 0; - return rc; -} - -// Synchronously paint a rectangle of the window. -void ScintillaGTK::SyncPaint(PRectangle rc) { - paintState = painting; - rcPaint = rc; - PRectangle rcClient = GetClientRectangle(); - paintingAllText = rcPaint.Contains(rcClient); - if ((PWidget(wText))->window) { - Surface *sw = Surface::Allocate(); - if (sw) { - sw->Init(PWidget(wText)->window, PWidget(wText)); - Paint(sw, rc); - sw->Release(); - delete sw; - } - } - if (paintState == paintAbandoned) { - // Painting area was insufficient to cover new styling or brace highlight positions - FullPaint(); - } - paintState = notPainting; -} - -void ScintillaGTK::ScrollText(int linesToMove) { - int diff = vs.lineHeight * -linesToMove; - //Platform::DebugPrintf("ScintillaGTK::ScrollText %d %d %0d,%0d %0d,%0d\n", linesToMove, diff, - // rc.left, rc.top, rc.right, rc.bottom); - GtkWidget *wi = PWidget(wText); - -#if GTK_MAJOR_VERSION < 2 - PRectangle rc = GetClientRectangle(); - GdkGC *gc = gdk_gc_new(wi->window); - - // Set up gc so we get GraphicsExposures from gdk_draw_pixmap - // which calls XCopyArea - gdk_gc_set_exposures(gc, TRUE); - - // Redraw exposed bit : scrolling upwards - if (diff > 0) { - gdk_draw_pixmap(wi->window, - gc, wi->window, - 0, diff, - 0, 0, - rc.Width()-1, rc.Height() - diff); - SyncPaint(PRectangle(0, rc.Height() - diff, - rc.Width(), rc.Height()+1)); - - // Redraw exposed bit : scrolling downwards - } else { - gdk_draw_pixmap(wi->window, - gc, wi->window, - 0, 0, - 0, -diff, - rc.Width()-1, rc.Height() + diff); - SyncPaint(PRectangle(0, 0, rc.Width(), -diff)); - } - - // Look for any graphics expose - GdkEvent* event; - while ((event = gdk_event_get_graphics_expose(wi->window)) != NULL) { - gtk_widget_event(wi, event); - if (event->expose.count == 0) { - gdk_event_free(event); - break; - } - gdk_event_free(event); - } - - gdk_gc_unref(gc); -#else - gdk_window_scroll(wi->window, 0, -diff); - gdk_window_process_updates(wi->window, FALSE); -#endif -} - -void ScintillaGTK::SetVerticalScrollPos() { - DwellEnd(true); - gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmentv), topLine); -} - -void ScintillaGTK::SetHorizontalScrollPos() { - DwellEnd(true); - gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmenth), xOffset / 2); -} - -bool ScintillaGTK::ModifyScrollBars(int nMax, int nPage) { - bool modified = false; - int pageScroll = LinesToScroll(); - - if (GTK_ADJUSTMENT(adjustmentv)->upper != (nMax + 1) || - GTK_ADJUSTMENT(adjustmentv)->page_size != nPage || - GTK_ADJUSTMENT(adjustmentv)->page_increment != pageScroll) { - GTK_ADJUSTMENT(adjustmentv)->upper = nMax + 1; - GTK_ADJUSTMENT(adjustmentv)->page_size = nPage; - GTK_ADJUSTMENT(adjustmentv)->page_increment = pageScroll; - gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmentv)); - modified = true; - } - - PRectangle rcText = GetTextRectangle(); - int horizEndPreferred = scrollWidth; - if (horizEndPreferred < 0) - horizEndPreferred = 0; - unsigned int pageWidth = rcText.Width(); - unsigned int pageIncrement = pageWidth / 3; - unsigned int charWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; - if (GTK_ADJUSTMENT(adjustmenth)->upper != horizEndPreferred || - GTK_ADJUSTMENT(adjustmenth)->page_size != pageWidth || - GTK_ADJUSTMENT(adjustmenth)->page_increment != pageIncrement || - GTK_ADJUSTMENT(adjustmenth)->step_increment != charWidth) { - GTK_ADJUSTMENT(adjustmenth)->upper = horizEndPreferred; - GTK_ADJUSTMENT(adjustmenth)->step_increment = charWidth; - GTK_ADJUSTMENT(adjustmenth)->page_size = pageWidth; - GTK_ADJUSTMENT(adjustmenth)->page_increment = pageIncrement; - gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmenth)); - modified = true; - } - return modified; -} - -void ScintillaGTK::ReconfigureScrollBars() { - PRectangle rc = wMain.GetClientPosition(); - Resize(rc.Width(), rc.Height()); -} - -void ScintillaGTK::NotifyChange() { -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_emit(GTK_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], - Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), PWidget(wMain)); -#else - g_signal_emit(G_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], 0, - Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), PWidget(wMain)); -#endif -} - -void ScintillaGTK::NotifyFocus(bool focus) { -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_emit(GTK_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], - Platform::LongFromTwoShorts - (GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), PWidget(wMain)); -#else - g_signal_emit(G_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], 0, - Platform::LongFromTwoShorts - (GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), PWidget(wMain)); -#endif -} - -void ScintillaGTK::NotifyParent(SCNotification scn) { - scn.nmhdr.hwndFrom = PWidget(wMain); - scn.nmhdr.idFrom = GetCtrlID(); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_emit(GTK_OBJECT(sci), scintilla_signals[NOTIFY_SIGNAL], - GetCtrlID(), &scn); -#else - g_signal_emit(G_OBJECT(sci), scintilla_signals[NOTIFY_SIGNAL], 0, - GetCtrlID(), &scn); -#endif -} - -void ScintillaGTK::NotifyKey(int key, int modifiers) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_KEY; - scn.ch = key; - scn.modifiers = modifiers; - - NotifyParent(scn); -} - -void ScintillaGTK::NotifyURIDropped(const char *list) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_URIDROPPED; - scn.text = list; - - NotifyParent(scn); -} - -const char *CharacterSetID(int characterSet); - -const char *ScintillaGTK::CharacterSetID() const { - return ::CharacterSetID(vs.styles[STYLE_DEFAULT].characterSet); -} - -int ScintillaGTK::KeyDefault(int key, int modifiers) { - if (!(modifiers & SCI_CTRL) && !(modifiers & SCI_ALT)) { - if (key < 256) { - NotifyKey(key, modifiers); - return 0; - } else { - // Pass up to container in case it is an accelerator - NotifyKey(key, modifiers); - return 0; - } - } else { - // Pass up to container in case it is an accelerator - NotifyKey(key, modifiers); - return 0; - } - //Platform::DebugPrintf("SK-key: %d %x %x\n",key, modifiers); -} - -void ScintillaGTK::CopyToClipboard(const SelectionText &selectedText) { -#ifndef USE_GTK_CLIPBOARD - copyText.Copy(selectedText); - gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)), - atomClipboard, - GDK_CURRENT_TIME); -#else - SelectionText *clipText = new SelectionText(); - clipText->Copy(selectedText); - StoreOnClipboard(clipText); -#endif -} - -void ScintillaGTK::Copy() { - if (currentPos != anchor) { -#ifndef USE_GTK_CLIPBOARD - CopySelectionRange(©Text); - gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)), - atomClipboard, - GDK_CURRENT_TIME); -#else - SelectionText *clipText = new SelectionText(); - CopySelectionRange(clipText); - StoreOnClipboard(clipText); -#endif -#if PLAT_GTK_WIN32 - if (selType == selRectangle) { - ::OpenClipboard(NULL); - ::SetClipboardData(cfColumnSelect, 0); - ::CloseClipboard(); - } -#endif - } -} - -void ScintillaGTK::Paste() { - atomSought = atomUTF8; - gtk_selection_convert(GTK_WIDGET(PWidget(wMain)), - atomClipboard, atomSought, GDK_CURRENT_TIME); -} - -void ScintillaGTK::CreateCallTipWindow(PRectangle rc) { - if (!ct.wCallTip.Created()) { - ct.wCallTip = gtk_window_new(GTK_WINDOW_POPUP); - ct.wDraw = gtk_drawing_area_new(); - GtkWidget *widcdrw = PWidget(ct.wDraw); // // No code inside the G_OBJECT macro - gtk_container_add(GTK_CONTAINER(PWidget(ct.wCallTip)), widcdrw); -#if GLIB_MAJOR_VERSION < 2 - gtk_signal_connect(GTK_OBJECT(widcdrw), "expose_event", - GtkSignalFunc(ScintillaGTK::ExposeCT), &ct); - gtk_signal_connect(GTK_OBJECT(widcdrw), "button_press_event", - GtkSignalFunc(ScintillaGTK::PressCT), static_cast(this)); -#else - g_signal_connect(G_OBJECT(widcdrw), "expose_event", - G_CALLBACK(ScintillaGTK::ExposeCT), &ct); - g_signal_connect(G_OBJECT(widcdrw), "button_press_event", - G_CALLBACK(ScintillaGTK::PressCT), static_cast(this)); -#endif - gtk_widget_set_events(widcdrw, - GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK); - } - gtk_drawing_area_size(GTK_DRAWING_AREA(PWidget(ct.wDraw)), - rc.Width(), rc.Height()); - ct.wDraw.Show(); - if (PWidget(ct.wCallTip)->window) { - gdk_window_resize(PWidget(ct.wCallTip)->window, rc.Width(), rc.Height()); - } -} - -void ScintillaGTK::AddToPopUp(const char *label, int cmd, bool enabled) { - char fulllabel[200]; - strcpy(fulllabel, "/"); - strcat(fulllabel, label); - GtkItemFactoryCallback menuSig = GtkItemFactoryCallback(PopUpCB); - GtkItemFactoryEntry itemEntry = { - fulllabel, NULL, - menuSig, - cmd, - const_cast(label[0] ? "" : ""), -#if GTK_MAJOR_VERSION >= 2 - NULL -#endif - }; - gtk_item_factory_create_item(GTK_ITEM_FACTORY(popup.GetID()), - &itemEntry, this, 1); - if (cmd) { - GtkWidget *item = gtk_item_factory_get_widget_by_action( - reinterpret_cast(popup.GetID()), cmd); - if (item) - gtk_widget_set_sensitive(item, enabled); - } -} - -bool ScintillaGTK::OwnPrimarySelection() { - return ((gdk_selection_owner_get(GDK_SELECTION_PRIMARY) - == GTK_WIDGET(PWidget(wMain))->window) && - (GTK_WIDGET(PWidget(wMain))->window != NULL)); -} - -void ScintillaGTK::ClaimSelection() { - // X Windows has a 'primary selection' as well as the clipboard. - // Whenever the user selects some text, we become the primary selection - if (currentPos != anchor && GTK_WIDGET_REALIZED(GTK_WIDGET(PWidget(wMain)))) { - primarySelection = true; - gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)), - GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME); - primary.Free(); - } else if (OwnPrimarySelection()) { - primarySelection = true; - if (primary.s == NULL) - gtk_selection_owner_set(NULL, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME); - } else { - primarySelection = false; - primary.Free(); - } -} - -// Detect rectangular text, convert line ends to current mode, convert from or to UTF-8 -void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText) { - char *data = reinterpret_cast(selectionData->data); - int len = selectionData->length; - GdkAtom selectionTypeData = selectionData->type; - - // Return empty string if selection is not a string - if ((selectionTypeData != GDK_TARGET_STRING) && (selectionTypeData != atomUTF8)) { - char *empty = new char[1]; - empty[0] = '\0'; - selText.Set(empty, 0, SC_CP_UTF8, 0, false, false); - return; - } - - // Check for "\n\0" ending to string indicating that selection is rectangular - bool isRectangular; -#if PLAT_GTK_WIN32 - isRectangular = ::IsClipboardFormatAvailable(cfColumnSelect) != 0; -#else - isRectangular = ((len > 2) && (data[len - 1] == 0 && data[len - 2] == '\n')); -#endif - - char *dest; - if (selectionTypeData == GDK_TARGET_STRING) { - dest = Document::TransformLineEnds(&len, data, len, pdoc->eolMode); - if (IsUnicodeMode()) { - // Unknown encoding so assume in Latin1 - char *destPrevious = dest; - dest = UTF8FromLatin1(dest, len); - selText.Set(dest, len, SC_CP_UTF8, 0, selText.rectangular, false); - delete []destPrevious; - } else { - // Assume buffer is in same encoding as selection - selText.Set(dest, len, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet, isRectangular, false); - } - } else { // UTF-8 - dest = Document::TransformLineEnds(&len, data, len, pdoc->eolMode); - selText.Set(dest, len, SC_CP_UTF8, 0, isRectangular, false); -#ifdef USE_CONVERTER - const char *charSetBuffer = CharacterSetID(); - if (!IsUnicodeMode() && *charSetBuffer) { -//fprintf(stderr, "Convert to locale %s\n", CharacterSetID()); - // Convert to locale - dest = ConvertText(&len, selText.s, selText.len, charSetBuffer, "UTF-8", true); - selText.Set(dest, len, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet, selText.rectangular, false); - } -#endif - } -} - -void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) { - if ((selection_data->selection == atomClipboard) || - (selection_data->selection == GDK_SELECTION_PRIMARY)) { - if ((atomSought == atomUTF8) && (selection_data->length <= 0)) { - atomSought = atomString; - gtk_selection_convert(GTK_WIDGET(PWidget(wMain)), - selection_data->selection, atomSought, GDK_CURRENT_TIME); - } else if ((selection_data->length > 0) && - ((selection_data->type == GDK_TARGET_STRING) || (selection_data->type == atomUTF8))) { - SelectionText selText; - GetGtkSelectionText(selection_data, selText); - - pdoc->BeginUndoAction(); - if (selection_data->selection != GDK_SELECTION_PRIMARY) { - ClearSelection(); - } - int selStart = SelectionStart(); - - if (selText.rectangular) { - PasteRectangular(selStart, selText.s, selText.len); - } else { - pdoc->InsertString(currentPos, selText.s, selText.len); - SetEmptySelection(currentPos + selText.len); - } - pdoc->EndUndoAction(); - EnsureCaretVisible(); - } - } -// else fprintf(stderr, "Target non string %d %d\n", (int)(selection_data->type), -// (int)(atomUTF8)); - Redraw(); -} - -void ScintillaGTK::ReceivedDrop(GtkSelectionData *selection_data) { - dragWasDropped = true; - if (selection_data->type == atomUriList || selection_data->type == atomDROPFILES_DND) { - char *ptr = new char[selection_data->length + 1]; - ptr[selection_data->length] = '\0'; - memcpy(ptr, selection_data->data, selection_data->length); - NotifyURIDropped(ptr); - delete []ptr; - } else if ((selection_data->type == GDK_TARGET_STRING) || (selection_data->type == atomUTF8)) { - if (selection_data->length > 0) { - SelectionText selText; - GetGtkSelectionText(selection_data, selText); - DropAt(posDrop, selText.s, false, selText.rectangular); - } - } else if (selection_data->length > 0) { - //~ fprintf(stderr, "ReceivedDrop other %p\n", static_cast(selection_data->type)); - } - Redraw(); -} - - - -void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *text) { -#if PLAT_GTK_WIN32 - // GDK on Win32 expands any \n into \r\n, so make a copy of - // the clip text now with newlines converted to \n. Use { } to hide symbols - // from code below - SelectionText *newline_normalized = NULL; - { - int tmpstr_len; - char *tmpstr = Document::TransformLineEnds(&tmpstr_len, text->s, text->len, SC_EOL_LF); - newline_normalized = new SelectionText(); - newline_normalized->Set(tmpstr, tmpstr_len, SC_CP_UTF8, 0, text->rectangular, false); - text = newline_normalized; - } -#endif - -#if GTK_MAJOR_VERSION >= 2 - // Convert text to utf8 if it isn't already - SelectionText *converted = 0; - if ((text->codePage != SC_CP_UTF8) && (info == TARGET_UTF8_STRING)) { - const char *charSet = ::CharacterSetID(text->characterSet); - if (*charSet) { - int new_len; - char* tmputf = ConvertText(&new_len, text->s, text->len, "UTF-8", charSet, false); - converted = new SelectionText(); - converted->Set(tmputf, new_len, SC_CP_UTF8, 0, text->rectangular, false); - text = converted; - } - } - - // Here is a somewhat evil kludge. - // As I can not work out how to store data on the clipboard in multiple formats - // and need some way to mark the clipping as being stream or rectangular, - // the terminating \0 is included in the length for rectangular clippings. - // All other tested aplications behave benignly by ignoring the \0. - // The #if is here because on Windows cfColumnSelect clip entry is used - // instead as standard indicator of rectangularness (so no need to kludge) - int len = strlen(text->s); -#if PLAT_GTK_WIN32 == 0 - if (text->rectangular) - len++; -#endif - - if (info == TARGET_UTF8_STRING) { - gtk_selection_data_set_text(selection_data, text->s, len); - } else { - gtk_selection_data_set(selection_data, - static_cast(GDK_SELECTION_TYPE_STRING), - 8, reinterpret_cast(text->s), len); - } - delete converted; - -#else /* Gtk 1 */ - char *selBuffer = text->s; - - char *tmputf = 0; - if ((info == TARGET_UTF8_STRING) || (info == TARGET_STRING)) { - int len = strlen(selBuffer); -#ifdef USE_CONVERTER - // Possible character set conversion - const char *charSetBuffer = ::CharacterSetID(text->characterSet); - if (info == TARGET_UTF8_STRING) { - //fprintf(stderr, "Copy to clipboard as UTF-8\n"); - if (text->codePage != SC_CP_UTF8) { - // Convert to UTF-8 - //fprintf(stderr, "Convert to UTF-8 from %s\n", charSetBuffer); - tmputf = ConvertText(&len, selBuffer, len, "UTF-8", charSetBuffer, false); - selBuffer = tmputf; - } - } else if (info == TARGET_STRING) { - if (text->codePage == SC_CP_UTF8) { - //fprintf(stderr, "Convert to locale %s\n", charSetBuffer); - // Convert to locale - tmputf = ConvertText(&len, selBuffer, len, charSetBuffer, "UTF-8", true); - selBuffer = tmputf; - } - } -#endif - - // Here is a somewhat evil kludge. - // As I can not work out how to store data on the clipboard in multiple formats - // and need some way to mark the clipping as being stream or rectangular, - // the terminating \0 is included in the length for rectangular clippings. - // All other tested aplications behave benignly by ignoring the \0. - // The #if is here because on Windows cfColumnSelect clip entry is used - // instead as standard indicator of rectangularness (so no need to kludge) -#if PLAT_GTK_WIN32 == 0 - if (text->rectangular) - len++; -#endif - gtk_selection_data_set(selection_data, - (info == TARGET_STRING) ? - static_cast(GDK_SELECTION_TYPE_STRING) : atomUTF8, - 8, reinterpret_cast(selBuffer), - len); - } else if ((info == TARGET_TEXT) || (info == TARGET_COMPOUND_TEXT)) { - guchar *text; - GdkAtom encoding; - gint format; - gint new_length; - - gdk_string_to_compound_text(reinterpret_cast(selBuffer), - &encoding, &format, &text, &new_length); - gtk_selection_data_set(selection_data, encoding, format, text, new_length); - gdk_free_compound_text(text); - } - - delete []tmputf; -#endif /* Gtk >= 2 */ - -#if PLAT_GTK_WIN32 - delete newline_normalized; -#endif -} - -#ifdef USE_GTK_CLIPBOARD -void ScintillaGTK::StoreOnClipboard(SelectionText *clipText) { - GtkClipboard *clipBoard = - gtk_widget_get_clipboard(GTK_WIDGET(PWidget(wMain)), atomClipboard); - if (clipBoard == NULL) // Occurs if widget isn't in a toplevel - return; - - if (gtk_clipboard_set_with_data(clipBoard, clipboardCopyTargets, nClipboardCopyTargets, - ClipboardGetSelection, ClipboardClearSelection, clipText)) { - gtk_clipboard_set_can_store(clipBoard, clipboardCopyTargets, nClipboardCopyTargets); - } -} - -void ScintillaGTK::ClipboardGetSelection(GtkClipboard *, GtkSelectionData *selection_data, guint info, void *data) { - GetSelection(selection_data, info, static_cast(data)); -} - -void ScintillaGTK::ClipboardClearSelection(GtkClipboard *, void *data) { - SelectionText *obj = static_cast(data); - delete obj; -} -#endif - -void ScintillaGTK::UnclaimSelection(GdkEventSelection *selection_event) { - //Platform::DebugPrintf("UnclaimSelection\n"); - if (selection_event->selection == GDK_SELECTION_PRIMARY) { - //Platform::DebugPrintf("UnclaimPrimarySelection\n"); - if (!OwnPrimarySelection()) { - primary.Free(); - primarySelection = false; - FullPaint(); - } - } -} - -void ScintillaGTK::Resize(int width, int height) { - //Platform::DebugPrintf("Resize %d %d\n", width, height); - //printf("Resize %d %d\n", width, height); - - // Not always needed, but some themes can have different sizes of scrollbars - scrollBarWidth = GTK_WIDGET(PWidget(scrollbarv))->requisition.width; - scrollBarHeight = GTK_WIDGET(PWidget(scrollbarh))->requisition.height; - - // These allocations should never produce negative sizes as they would wrap around to huge - // unsigned numbers inside GTK+ causing warnings. - bool showSBHorizontal = horizontalScrollBarVisible && (wrapState == eWrapNone); - int horizontalScrollBarHeight = scrollBarHeight; - if (!showSBHorizontal) - horizontalScrollBarHeight = 0; - int verticalScrollBarHeight = scrollBarWidth; - if (!verticalScrollBarVisible) - verticalScrollBarHeight = 0; - - GtkAllocation alloc; - if (showSBHorizontal) { - gtk_widget_show(GTK_WIDGET(PWidget(scrollbarh))); - alloc.x = 0; - alloc.y = height - scrollBarHeight; - alloc.width = Platform::Maximum(1, width - scrollBarWidth) + 1; - alloc.height = horizontalScrollBarHeight; - gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarh)), &alloc); - } else { - gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarh))); - } - - if (verticalScrollBarVisible) { - gtk_widget_show(GTK_WIDGET(PWidget(scrollbarv))); - alloc.x = width - scrollBarWidth; - alloc.y = 0; - alloc.width = scrollBarWidth; - alloc.height = Platform::Maximum(1, height - scrollBarHeight) + 1; - if (!showSBHorizontal) - alloc.height += scrollBarWidth-1; - gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarv)), &alloc); - } else { - gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarv))); - } - if (GTK_WIDGET_MAPPED(PWidget(wMain))) { - ChangeSize(); - } - - alloc.x = 0; - alloc.y = 0; - alloc.width = Platform::Maximum(1, width - scrollBarWidth); - alloc.height = Platform::Maximum(1, height - scrollBarHeight); - if (!showSBHorizontal) - alloc.height += scrollBarHeight; - if (!verticalScrollBarVisible) - alloc.width += scrollBarWidth; - gtk_widget_size_allocate(GTK_WIDGET(PWidget(wText)), &alloc); -} - -static void SetAdjustmentValue(GtkObject *object, int value) { - GtkAdjustment *adjustment = GTK_ADJUSTMENT(object); - int maxValue = static_cast( - adjustment->upper - adjustment->page_size); - if (value > maxValue) - value = maxValue; - if (value < 0) - value = 0; - gtk_adjustment_set_value(adjustment, value); -} - -gint ScintillaGTK::PressThis(GdkEventButton *event) { - //Platform::DebugPrintf("Press %x time=%d state = %x button = %x\n",this,event->time, event->state, event->button); - // Do not use GTK+ double click events as Scintilla has its own double click detection - if (event->type != GDK_BUTTON_PRESS) - return FALSE; - - evbtn = *event; - Point pt; - pt.x = int(event->x); - pt.y = int(event->y); - PRectangle rcClient = GetClientRectangle(); - //Platform::DebugPrintf("Press %0d,%0d in %0d,%0d %0d,%0d\n", - // pt.x, pt.y, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); - if ((pt.x > rcClient.right) || (pt.y > rcClient.bottom)) { - Platform::DebugPrintf("Bad location\n"); - return FALSE; - } - - bool ctrl = (event->state & GDK_CONTROL_MASK) != 0; - - gtk_widget_grab_focus(PWidget(wMain)); - if (event->button == 1) { - // On X, instead of sending literal modifiers use control instead of alt - // This is because most X window managers grab alt + click for moving -#if !PLAT_GTK_WIN32 - ButtonDown(pt, event->time, - (event->state & GDK_SHIFT_MASK) != 0, - (event->state & GDK_CONTROL_MASK) != 0, - (event->state & GDK_CONTROL_MASK) != 0); -#else - ButtonDown(pt, event->time, - (event->state & GDK_SHIFT_MASK) != 0, - (event->state & GDK_CONTROL_MASK) != 0, - (event->state & GDK_MOD1_MASK) != 0); -#endif - } else if (event->button == 2) { - // Grab the primary selection if it exists - Position pos = PositionFromLocation(pt); - if (OwnPrimarySelection() && primary.s == NULL) - CopySelectionRange(&primary); - - SetSelection(pos, pos); - atomSought = atomUTF8; - gtk_selection_convert(GTK_WIDGET(PWidget(wMain)), GDK_SELECTION_PRIMARY, - atomSought, event->time); - } else if (event->button == 3) { - if (displayPopupMenu) { - // PopUp menu - // Convert to screen - int ox = 0; - int oy = 0; - gdk_window_get_origin(PWidget(wMain)->window, &ox, &oy); - ContextMenu(Point(pt.x + ox, pt.y + oy)); - } else { - return FALSE; - } - } else if (event->button == 4) { - // Wheel scrolling up (only GTK 1.x does it this way) - if (ctrl) - SetAdjustmentValue(adjustmenth, (xOffset / 2) - 6); - else - SetAdjustmentValue(adjustmentv, topLine - 3); - } else if (event->button == 5) { - // Wheel scrolling down (only GTK 1.x does it this way) - if (ctrl) - SetAdjustmentValue(adjustmenth, (xOffset / 2) + 6); - else - SetAdjustmentValue(adjustmentv, topLine + 3); - } -#if GTK_MAJOR_VERSION >= 2 - return TRUE; -#else - return FALSE; -#endif -} - -gint ScintillaGTK::Press(GtkWidget *widget, GdkEventButton *event) { - if (event->window != widget->window) - return FALSE; - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - return sciThis->PressThis(event); -} - -gint ScintillaGTK::MouseRelease(GtkWidget *widget, GdkEventButton *event) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("Release %x %d %d\n",sciThis,event->time,event->state); - if (!sciThis->HaveMouseCapture()) - return FALSE; - if (event->button == 1) { - Point pt; - pt.x = int(event->x); - pt.y = int(event->y); - //Platform::DebugPrintf("Up %x %x %d %d %d\n", - // sciThis,event->window,event->time, pt.x, pt.y); - if (event->window != PWidget(sciThis->wMain)->window) - // If mouse released on scroll bar then the position is relative to the - // scrollbar, not the drawing window so just repeat the most recent point. - pt = sciThis->ptMouseLast; - sciThis->ButtonUp(pt, event->time, (event->state & 4) != 0); - } - return FALSE; -} - -// win32gtk and GTK >= 2 use SCROLL_* events instead of passing the -// button4/5/6/7 events to the GTK app -#if PLAT_GTK_WIN32 || (GTK_MAJOR_VERSION >= 2) -gint ScintillaGTK::ScrollEvent(GtkWidget *widget, - GdkEventScroll *event) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - - if (widget == NULL || event == NULL) - return FALSE; - - // Compute amount and direction to scroll (even tho on win32 there is - // intensity of scrolling info in the native message, gtk doesn't - // support this so we simulate similarly adaptive scrolling) - // Note that this is disabled on OS X (Darwin) where the X11 server already has - // and adaptive scrolling algorithm that fights with this one - int cLineScroll; -#if defined(__MWERKS__) || defined(__APPLE_CPP__) || defined(__APPLE_CC__) - cLineScroll = sciThis->linesPerScroll; - if (cLineScroll == 0) - cLineScroll = 4; - sciThis->wheelMouseIntensity = cLineScroll; -#else - int timeDelta = 1000000; - GTimeVal curTime; - g_get_current_time(&curTime); - if (curTime.tv_sec == sciThis->lastWheelMouseTime.tv_sec) - timeDelta = curTime.tv_usec - sciThis->lastWheelMouseTime.tv_usec; - else if (curTime.tv_sec == sciThis->lastWheelMouseTime.tv_sec + 1) - timeDelta = 1000000 + (curTime.tv_usec - sciThis->lastWheelMouseTime.tv_usec); - if ((event->direction == sciThis->lastWheelMouseDirection) && (timeDelta < 250000)) { - if (sciThis->wheelMouseIntensity < 12) - sciThis->wheelMouseIntensity++; - cLineScroll = sciThis->wheelMouseIntensity; - } else { - cLineScroll = sciThis->linesPerScroll; - if (cLineScroll == 0) - cLineScroll = 4; - sciThis->wheelMouseIntensity = cLineScroll; - } -#endif - if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_LEFT) { - cLineScroll *= -1; - } - g_get_current_time(&sciThis->lastWheelMouseTime); - sciThis->lastWheelMouseDirection = event->direction; - - // Note: Unpatched versions of win32gtk don't set the 'state' value so - // only regular scrolling is supported there. Also, unpatched win32gtk - // issues spurious button 2 mouse events during wheeling, which can cause - // problems (a patch for both was submitted by archaeopteryx.com on 13Jun2001) - - // Data zoom not supported - if (event->state & GDK_SHIFT_MASK) { - return FALSE; - } - - // Horizontal scrolling - if (event->direction == GDK_SCROLL_LEFT || event->direction == GDK_SCROLL_RIGHT) { - sciThis->HorizontalScrollTo(sciThis->xOffset + cLineScroll); - - // Text font size zoom - } else if (event->state & GDK_CONTROL_MASK) { - if (cLineScroll < 0) { - sciThis->KeyCommand(SCI_ZOOMIN); - } else { - sciThis->KeyCommand(SCI_ZOOMOUT); - } - - // Regular scrolling - } else { - sciThis->ScrollTo(sciThis->topLine + cLineScroll); - } - return TRUE; -} -#endif - -gint ScintillaGTK::Motion(GtkWidget *widget, GdkEventMotion *event) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("Motion %x %d\n",sciThis,event->time); - if (event->window != widget->window) - return FALSE; - int x = 0; - int y = 0; - GdkModifierType state; - if (event->is_hint) { - gdk_window_get_pointer(event->window, &x, &y, &state); - } else { - x = static_cast(event->x); - y = static_cast(event->y); - state = static_cast(event->state); - } - //Platform::DebugPrintf("Move %x %x %d %c %d %d\n", - // sciThis,event->window,event->time,event->is_hint? 'h' :'.', x, y); - Point pt(x, y); - sciThis->ButtonMove(pt); - return FALSE; -} - -// Map the keypad keys to their equivalent functions -static int KeyTranslate(int keyIn) { - switch (keyIn) { - case GDK_ISO_Left_Tab: - return SCK_TAB; - case GDK_KP_Down: - return SCK_DOWN; - case GDK_KP_Up: - return SCK_UP; - case GDK_KP_Left: - return SCK_LEFT; - case GDK_KP_Right: - return SCK_RIGHT; - case GDK_KP_Home: - return SCK_HOME; - case GDK_KP_End: - return SCK_END; - case GDK_KP_Page_Up: - return SCK_PRIOR; - case GDK_KP_Page_Down: - return SCK_NEXT; - case GDK_KP_Delete: - return SCK_DELETE; - case GDK_KP_Insert: - return SCK_INSERT; - case GDK_KP_Enter: - return SCK_RETURN; - - case GDK_Down: - return SCK_DOWN; - case GDK_Up: - return SCK_UP; - case GDK_Left: - return SCK_LEFT; - case GDK_Right: - return SCK_RIGHT; - case GDK_Home: - return SCK_HOME; - case GDK_End: - return SCK_END; - case GDK_Page_Up: - return SCK_PRIOR; - case GDK_Page_Down: - return SCK_NEXT; - case GDK_Delete: - return SCK_DELETE; - case GDK_Insert: - return SCK_INSERT; - case GDK_Escape: - return SCK_ESCAPE; - case GDK_BackSpace: - return SCK_BACK; - case GDK_Tab: - return SCK_TAB; - case GDK_Return: - return SCK_RETURN; - case GDK_KP_Add: - return SCK_ADD; - case GDK_KP_Subtract: - return SCK_SUBTRACT; - case GDK_KP_Divide: - return SCK_DIVIDE; - case GDK_Super_L: - return SCK_WIN; - case GDK_Super_R: - return SCK_RWIN; - case GDK_Menu: - return SCK_MENU; - default: - return keyIn; - } -} - -gboolean ScintillaGTK::KeyThis(GdkEventKey *event) { - //fprintf(stderr, "SC-key: %d %x [%s]\n", - // event->keyval, event->state, (event->length > 0) ? event->string : "empty"); -#if GTK_MAJOR_VERSION >= 2 - if (gtk_im_context_filter_keypress(im_context, event)) { - return 1; - } -#endif - if (!event->keyval) { - return true; - } - - bool shift = (event->state & GDK_SHIFT_MASK) != 0; - bool ctrl = (event->state & GDK_CONTROL_MASK) != 0; - bool alt = (event->state & GDK_MOD1_MASK) != 0; - guint key = event->keyval; - if (ctrl && (key < 128)) - key = toupper(key); - else if (!ctrl && (key >= GDK_KP_Multiply && key <= GDK_KP_9)) - key &= 0x7F; - // Hack for keys over 256 and below command keys but makes Hungarian work. - // This will have to change for Unicode - else if (key >= 0xFE00) - key = KeyTranslate(key); -#if GTK_MAJOR_VERSION < 2 - else if (!IsUnicodeMode() && (key >= 0x100) && (key < 0x1000)) - key &= 0xff; -#endif - - bool consumed = false; - bool added = KeyDown(key, shift, ctrl, alt, &consumed) != 0; - if (!consumed) - consumed = added; - //fprintf(stderr, "SK-key: %d %x %x\n",event->keyval, event->state, consumed); - if (event->keyval == 0xffffff && event->length > 0) { - ClearSelection(); - if (pdoc->InsertCString(CurrentPosition(), event->string)) { - MovePositionTo(CurrentPosition() + event->length); - } - } - return consumed; -} - -gboolean ScintillaGTK::KeyPress(GtkWidget *widget, GdkEventKey *event) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - return sciThis->KeyThis(event); -} - -gboolean ScintillaGTK::KeyRelease(GtkWidget *, GdkEventKey * /*event*/) { - //Platform::DebugPrintf("SC-keyrel: %d %x %3s\n",event->keyval, event->state, event->string); - return FALSE; -} - -#if GTK_MAJOR_VERSION >= 2 -gboolean ScintillaGTK::ExposePreedit(GtkWidget *widget, GdkEventExpose *ose, ScintillaGTK *sciThis) { - return sciThis->ExposePreeditThis(widget, ose); -} - -gboolean ScintillaGTK::ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose) { - gchar *str; - gint cursor_pos; - PangoAttrList *attrs; - - gtk_im_context_get_preedit_string(im_context, &str, &attrs, &cursor_pos); - PangoLayout *layout = gtk_widget_create_pango_layout(PWidget(wText), str); - pango_layout_set_attributes(layout, attrs); - - GdkGC *gc = gdk_gc_new(widget->window); - GdkColor color[2] = { {0, 0x0000, 0x0000, 0x0000}, - {0, 0xffff, 0xffff, 0xffff}}; - gdk_color_alloc(gdk_colormap_get_system(), color); - gdk_color_alloc(gdk_colormap_get_system(), color + 1); - - gdk_gc_set_foreground(gc, color + 1); - gdk_draw_rectangle(widget->window, gc, TRUE, ose->area.x, ose->area.y, - ose->area.width, ose->area.height); - - gdk_gc_set_foreground(gc, color); - gdk_gc_set_background(gc, color + 1); - gdk_draw_layout(widget->window, gc, 0, 0, layout); - - gdk_gc_unref(gc); - g_free(str); - pango_attr_list_unref(attrs); - g_object_unref(layout); - return TRUE; -} - -void ScintillaGTK::Commit(GtkIMContext *, char *str, ScintillaGTK *sciThis) { - sciThis->CommitThis(str); -} - -void ScintillaGTK::CommitThis(char *utfVal) { - //~ fprintf(stderr, "Commit '%s'\n", utfVal); - if (IsUnicodeMode()) { - AddCharUTF(utfVal,strlen(utfVal)); - } else { - const char *source = CharacterSetID(); - if (*source) { - Converter conv(source, "UTF-8", true); - if (conv) { - char localeVal[4]="\0\0\0"; - char *pin = utfVal; - size_t inLeft = strlen(utfVal); - char *pout = localeVal; - size_t outLeft = sizeof(localeVal); - size_t conversions = conv.Convert(&pin, &inLeft, &pout, &outLeft); - if (conversions != ((size_t)(-1))) { - *pout = '\0'; - for (int i=0; localeVal[i]; i++) { - AddChar(localeVal[i]); - } - } else { - fprintf(stderr, "Conversion failed '%s'\n", utfVal); - } - } - } - } -} - -void ScintillaGTK::PreeditChanged(GtkIMContext *, ScintillaGTK *sciThis) { - sciThis->PreeditChangedThis(); -} - -void ScintillaGTK::PreeditChangedThis() { - gchar *str; - PangoAttrList *attrs; - gint cursor_pos; - gtk_im_context_get_preedit_string(im_context, &str, &attrs, &cursor_pos); - if (strlen(str) > 0){ - PangoLayout *layout = gtk_widget_create_pango_layout(PWidget(wText), str); - pango_layout_set_attributes(layout, attrs); - - gint w, h; - pango_layout_get_pixel_size(layout, &w, &h); - g_object_unref(layout); - - gint x, y; - gdk_window_get_origin((PWidget(wText))->window, &x, &y); - - Point pt = LocationFromPosition(currentPos); - if (pt.x < 0) - pt.x = 0; - if (pt.y < 0) - pt.y = 0; - - gtk_window_move(GTK_WINDOW(PWidget(wPreedit)), x+pt.x, y+pt.y); - gtk_window_resize(GTK_WINDOW(PWidget(wPreedit)), w, h); - gtk_widget_show(PWidget(wPreedit)); - gtk_widget_queue_draw_area(PWidget(wPreeditDraw), 0, 0, w, h); - } else { - gtk_widget_hide(PWidget(wPreedit)); - } - g_free(str); - pango_attr_list_unref(attrs); -} -#endif - -gint ScintillaGTK::StyleSetText(GtkWidget *widget, GtkStyle *, void*) { - if (widget->window != NULL) - gdk_window_set_back_pixmap(widget->window, NULL, FALSE); - return FALSE; -} - -gint ScintillaGTK::RealizeText(GtkWidget *widget, void*) { - if (widget->window != NULL) - gdk_window_set_back_pixmap(widget->window, NULL, FALSE); - return FALSE; -} - -#if GLIB_MAJOR_VERSION < 2 -void ScintillaGTK::Destroy(GtkObject *object) -#else -void ScintillaGTK::Destroy(GObject *object) -#endif -{ - ScintillaObject *scio = reinterpret_cast(object); - // This avoids a double destruction - if (!scio->pscin) - return; - ScintillaGTK *sciThis = reinterpret_cast(scio->pscin); - //Platform::DebugPrintf("Destroying %x %x\n", sciThis, object); - sciThis->Finalise(); - -#if GLIB_MAJOR_VERSION < 2 - if (GTK_OBJECT_CLASS(parent_class)->destroy) - (* GTK_OBJECT_CLASS(parent_class)->destroy)(object); -#else - // IS ANYTHING NEEDED ? -#endif - - delete sciThis; - scio->pscin = 0; -} - -static void DrawChild(GtkWidget *widget, GdkRectangle *area) { - GdkRectangle areaIntersect; - if (widget && - GTK_WIDGET_DRAWABLE(widget) && - gtk_widget_intersect(widget, area, &areaIntersect)) { - gtk_widget_draw(widget, &areaIntersect); - } -} - -void ScintillaGTK::Draw(GtkWidget *widget, GdkRectangle *area) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("Draw %p %0d,%0d %0d,%0d\n", widget, area->x, area->y, area->width, area->height); - PRectangle rcPaint(area->x, area->y, area->x + area->width, area->y + area->height); - sciThis->SyncPaint(rcPaint); - if (GTK_WIDGET_DRAWABLE(PWidget(sciThis->wMain))) { - DrawChild(PWidget(sciThis->scrollbarh), area); - DrawChild(PWidget(sciThis->scrollbarv), area); - } - -#ifdef INTERNATIONAL_INPUT - Point pt = sciThis->LocationFromPosition(sciThis->currentPos); - pt.y += sciThis->vs.lineHeight - 2; - if (pt.x < 0) pt.x = 0; - if (pt.y < 0) pt.y = 0; - CursorMoved(widget, pt.x, pt.y, sciThis); -#endif -} - -gint ScintillaGTK::ExposeTextThis(GtkWidget * /*widget*/, GdkEventExpose *ose) { - paintState = painting; - - rcPaint.left = ose->area.x; - rcPaint.top = ose->area.y; - rcPaint.right = ose->area.x + ose->area.width; - rcPaint.bottom = ose->area.y + ose->area.height; - - PLATFORM_ASSERT(rgnUpdate == NULL); -#if GTK_MAJOR_VERSION >= 2 - rgnUpdate = gdk_region_copy(ose->region); -#endif - PRectangle rcClient = GetClientRectangle(); - paintingAllText = rcPaint.Contains(rcClient); - Surface *surfaceWindow = Surface::Allocate(); - if (surfaceWindow) { - surfaceWindow->Init(PWidget(wText)->window, PWidget(wText)); - Paint(surfaceWindow, rcPaint); - surfaceWindow->Release(); - delete surfaceWindow; - } - if (paintState == paintAbandoned) { - // Painting area was insufficient to cover new styling or brace highlight positions - FullPaint(); - } - paintState = notPainting; - - if (rgnUpdate) { - gdk_region_destroy(rgnUpdate); - } - rgnUpdate = 0; - - return FALSE; -} - -gint ScintillaGTK::ExposeText(GtkWidget *widget, GdkEventExpose *ose, ScintillaGTK *sciThis) { - return sciThis->ExposeTextThis(widget, ose); -} - -gint ScintillaGTK::ExposeMain(GtkWidget *widget, GdkEventExpose *ose) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("Expose Main %0d,%0d %0d,%0d\n", - //ose->area.x, ose->area.y, ose->area.width, ose->area.height); - return sciThis->Expose(widget, ose); -} - -gint ScintillaGTK::Expose(GtkWidget *, GdkEventExpose *ose) { - //fprintf(stderr, "Expose %0d,%0d %0d,%0d\n", - //ose->area.x, ose->area.y, ose->area.width, ose->area.height); - -#if GTK_MAJOR_VERSION < 2 - - paintState = painting; - - rcPaint.left = ose->area.x; - rcPaint.top = ose->area.y; - rcPaint.right = ose->area.x + ose->area.width; - rcPaint.bottom = ose->area.y + ose->area.height; - - PRectangle rcClient = GetClientRectangle(); - paintingAllText = rcPaint.Contains(rcClient); - Surface *surfaceWindow = Surface::Allocate(); - if (surfaceWindow) { - surfaceWindow->Init(PWidget(wMain)->window, PWidget(wMain)); - - // Fill the corner between the scrollbars - if (verticalScrollBarVisible) { - if (horizontalScrollBarVisible && (wrapState == eWrapNone)) { - PRectangle rcCorner = wMain.GetClientPosition(); - rcCorner.left = rcCorner.right - scrollBarWidth + 1; - rcCorner.top = rcCorner.bottom - scrollBarHeight + 1; - //fprintf(stderr, "Corner %0d,%0d %0d,%0d\n", - //rcCorner.left, rcCorner.top, rcCorner.right, rcCorner.bottom); - surfaceWindow->FillRectangle(rcCorner, - vs.styles[STYLE_LINENUMBER].back.allocated); - } - } - - //Paint(surfaceWindow, rcPaint); - surfaceWindow->Release(); - delete surfaceWindow; - } - if (paintState == paintAbandoned) { - // Painting area was insufficient to cover new styling or brace highlight positions - FullPaint(); - } - paintState = notPainting; - -#else - // For GTK+ 2, the text is painted in ExposeText - gtk_container_propagate_expose( - GTK_CONTAINER(PWidget(wMain)), PWidget(scrollbarh), ose); - gtk_container_propagate_expose( - GTK_CONTAINER(PWidget(wMain)), PWidget(scrollbarv), ose); -#endif - - return FALSE; -} - -void ScintillaGTK::ScrollSignal(GtkAdjustment *adj, ScintillaGTK *sciThis) { - sciThis->ScrollTo(static_cast(adj->value), false); -} - -void ScintillaGTK::ScrollHSignal(GtkAdjustment *adj, ScintillaGTK *sciThis) { - sciThis->HorizontalScrollTo(static_cast(adj->value * 2)); -} - -void ScintillaGTK::SelectionReceived(GtkWidget *widget, - GtkSelectionData *selection_data, guint) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("Selection received\n"); - sciThis->ReceivedSelection(selection_data); -} - -void ScintillaGTK::SelectionGet(GtkWidget *widget, - GtkSelectionData *selection_data, guint info, guint) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("Selection get\n"); - if (selection_data->selection == GDK_SELECTION_PRIMARY) { - if (sciThis->primary.s == NULL) { - sciThis->CopySelectionRange(&sciThis->primary); - } - sciThis->GetSelection(selection_data, info, &sciThis->primary); - } -#ifndef USE_GTK_CLIPBOARD - else { - sciThis->GetSelection(selection_data, info, &sciThis->copyText); - } -#endif -} - -gint ScintillaGTK::SelectionClear(GtkWidget *widget, GdkEventSelection *selection_event) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("Selection clear\n"); - sciThis->UnclaimSelection(selection_event); - return gtk_selection_clear(widget, selection_event); -} - -#if GTK_MAJOR_VERSION < 2 -gint ScintillaGTK::SelectionNotify(GtkWidget *widget, GdkEventSelection *selection_event) { - //Platform::DebugPrintf("Selection notify\n"); - return gtk_selection_notify(widget, selection_event); -} -#endif - -void ScintillaGTK::DragBegin(GtkWidget *, GdkDragContext *) { - //Platform::DebugPrintf("DragBegin\n"); -} - -gboolean ScintillaGTK::DragMotionThis(GdkDragContext *context, - gint x, gint y, guint dragtime) { - Point npt(x, y); - SetDragPosition(PositionFromLocation(npt)); - GdkDragAction preferredAction = context->suggested_action; - int pos = PositionFromLocation(npt); - if ((inDragDrop == ddDragging) && (0 == PositionInSelection(pos))) { - // Avoid dragging selection onto itself as that produces a move - // with no real effect but which creates undo actions. - preferredAction = static_cast(0); - } else if (context->actions == static_cast - (GDK_ACTION_COPY | GDK_ACTION_MOVE)) { - preferredAction = GDK_ACTION_MOVE; - } - gdk_drag_status(context, preferredAction, dragtime); - return FALSE; -} - -gboolean ScintillaGTK::DragMotion(GtkWidget *widget, GdkDragContext *context, - gint x, gint y, guint dragtime) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - return sciThis->DragMotionThis(context, x, y, dragtime); -} - -void ScintillaGTK::DragLeave(GtkWidget *widget, GdkDragContext * /*context*/, guint) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - sciThis->SetDragPosition(invalidPosition); - //Platform::DebugPrintf("DragLeave %x\n", sciThis); -} - -void ScintillaGTK::DragEnd(GtkWidget *widget, GdkDragContext * /*context*/) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - // If drag did not result in drop here or elsewhere - if (!sciThis->dragWasDropped) - sciThis->SetEmptySelection(sciThis->posDrag); - sciThis->SetDragPosition(invalidPosition); - //Platform::DebugPrintf("DragEnd %x %d\n", sciThis, sciThis->dragWasDropped); - sciThis->inDragDrop = ddNone; -} - -gboolean ScintillaGTK::Drop(GtkWidget *widget, GdkDragContext * /*context*/, - gint, gint, guint) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - //Platform::DebugPrintf("Drop %x\n", sciThis); - sciThis->SetDragPosition(invalidPosition); - return FALSE; -} - -void ScintillaGTK::DragDataReceived(GtkWidget *widget, GdkDragContext * /*context*/, - gint, gint, GtkSelectionData *selection_data, guint /*info*/, guint) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - sciThis->ReceivedDrop(selection_data); - sciThis->SetDragPosition(invalidPosition); -} - -void ScintillaGTK::DragDataGet(GtkWidget *widget, GdkDragContext *context, - GtkSelectionData *selection_data, guint info, guint) { - ScintillaGTK *sciThis = ScintillaFromWidget(widget); - sciThis->dragWasDropped = true; - if (sciThis->currentPos != sciThis->anchor) { - sciThis->GetSelection(selection_data, info, &sciThis->drag); - } - if (context->action == GDK_ACTION_MOVE) { - int selStart = sciThis->SelectionStart(); - int selEnd = sciThis->SelectionEnd(); - if (sciThis->posDrop > selStart) { - if (sciThis->posDrop > selEnd) - sciThis->posDrop = sciThis->posDrop - (selEnd - selStart); - else - sciThis->posDrop = selStart; - sciThis->posDrop = sciThis->pdoc->ClampPositionIntoDocument(sciThis->posDrop); - } - sciThis->ClearSelection(); - } - sciThis->SetDragPosition(invalidPosition); -} - -int ScintillaGTK::TimeOut(ScintillaGTK *sciThis) { - sciThis->Tick(); - return 1; -} - -int ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) { - // Idler will be automatically stoped, if there is nothing - // to do while idle. - bool ret = sciThis->Idle(); - if (ret == false) { - // FIXME: This will remove the idler from GTK, we don't want to - // remove it as it is removed automatically when this function - // returns false (although, it should be harmless). - sciThis->SetIdle(false); - } - return ret; -} - -void ScintillaGTK::PopUpCB(ScintillaGTK *sciThis, guint action, GtkWidget *) { - if (action) { - sciThis->Command(action); - } -} - -gint ScintillaGTK::PressCT(GtkWidget *widget, GdkEventButton *event, ScintillaGTK *sciThis) { - if (event->window != widget->window) - return FALSE; - if (event->type != GDK_BUTTON_PRESS) - return FALSE; - Point pt; - pt.x = int(event->x); - pt.y = int(event->y); - sciThis->ct.MouseClick(pt); - sciThis->CallTipClick(); -#if GTK_MAJOR_VERSION >= 2 - return TRUE; -#else - return FALSE; -#endif -} - -gint ScintillaGTK::ExposeCT(GtkWidget *widget, GdkEventExpose * /*ose*/, CallTip *ctip) { - Surface *surfaceWindow = Surface::Allocate(); - if (surfaceWindow) { - surfaceWindow->Init(widget->window, widget); - ctip->PaintCT(surfaceWindow); - surfaceWindow->Release(); - delete surfaceWindow; - } - return TRUE; -} - -sptr_t ScintillaGTK::DirectFunction( - ScintillaGTK *sciThis, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - return sciThis->WndProc(iMessage, wParam, lParam); -} - -sptr_t scintilla_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - ScintillaGTK *psci = reinterpret_cast(sci->pscin); - return psci->WndProc(iMessage, wParam, lParam); -} - -static void scintilla_class_init(ScintillaClass *klass); -static void scintilla_init(ScintillaObject *sci); - -extern void Platform_Initialise(); -extern void Platform_Finalise(); - -#if GLIB_MAJOR_VERSION < 2 -GtkType scintilla_get_type() { - static GtkType scintilla_type = 0; - - if (!scintilla_type) { - Platform_Initialise(); - static GtkTypeInfo scintilla_info = { - "Scintilla", - sizeof (ScintillaObject), - sizeof (ScintillaClass), - (GtkClassInitFunc) scintilla_class_init, - (GtkObjectInitFunc) scintilla_init, - (gpointer) NULL, - (gpointer) NULL, - 0 - }; - - scintilla_type = gtk_type_unique(gtk_container_get_type(), &scintilla_info); - } - - return scintilla_type; -} -#else -GType scintilla_get_type() { - static GType scintilla_type = 0; - - if (!scintilla_type) { - scintilla_type = g_type_from_name("Scintilla"); - if (!scintilla_type) { - static GTypeInfo scintilla_info = { - (guint16) sizeof (ScintillaClass), - NULL, //(GBaseInitFunc) - NULL, //(GBaseFinalizeFunc) - (GClassInitFunc) scintilla_class_init, - NULL, //(GClassFinalizeFunc) - NULL, //gconstpointer data - (guint16) sizeof (ScintillaObject), - 0, //n_preallocs - (GInstanceInitFunc) scintilla_init, - NULL //(GTypeValueTable*) - }; - - scintilla_type = g_type_register_static( - GTK_TYPE_CONTAINER, "Scintilla", &scintilla_info, (GTypeFlags) 0); - } - } - - return scintilla_type; -} -#endif - -void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class) { -#if GLIB_MAJOR_VERSION >= 2 - Platform_Initialise(); -#endif - atomClipboard = gdk_atom_intern("CLIPBOARD", FALSE); - atomUTF8 = gdk_atom_intern("UTF8_STRING", FALSE); - atomString = GDK_SELECTION_TYPE_STRING; - atomUriList = gdk_atom_intern("text/uri-list", FALSE); - atomDROPFILES_DND = gdk_atom_intern("DROPFILES_DND", FALSE); - - // Define default signal handlers for the class: Could move more - // of the signal handlers here (those that currently attached to wDraw - // in Initialise() may require coordinate translation?) - -#if GLIB_MAJOR_VERSION < 2 - object_class->destroy = Destroy; -#else - object_class->finalize = Destroy; -#endif - widget_class->size_request = SizeRequest; - widget_class->size_allocate = SizeAllocate; - widget_class->expose_event = ExposeMain; -#if GTK_MAJOR_VERSION < 2 - widget_class->draw = Draw; -#endif - widget_class->motion_notify_event = Motion; - widget_class->button_press_event = Press; - widget_class->button_release_event = MouseRelease; -#if PLAT_GTK_WIN32 || (GTK_MAJOR_VERSION >= 2) - widget_class->scroll_event = ScrollEvent; -#endif - widget_class->key_press_event = KeyPress; - widget_class->key_release_event = KeyRelease; - widget_class->focus_in_event = FocusIn; - widget_class->focus_out_event = FocusOut; - widget_class->selection_received = SelectionReceived; - widget_class->selection_get = SelectionGet; - widget_class->selection_clear_event = SelectionClear; -#if GTK_MAJOR_VERSION < 2 - widget_class->selection_notify_event = SelectionNotify; -#endif - - widget_class->drag_data_received = DragDataReceived; - widget_class->drag_motion = DragMotion; - widget_class->drag_leave = DragLeave; - widget_class->drag_end = DragEnd; - widget_class->drag_drop = Drop; - widget_class->drag_data_get = DragDataGet; - - widget_class->realize = Realize; - widget_class->unrealize = UnRealize; - widget_class->map = Map; - widget_class->unmap = UnMap; - - container_class->forall = MainForAll; -} - -#if GLIB_MAJOR_VERSION < 2 -#define GTK_CLASS_TYPE(c) (c->type) -#define SIG_MARSHAL gtk_marshal_NONE__INT_POINTER -#define MARSHAL_ARGUMENTS GTK_TYPE_INT, GTK_TYPE_POINTER -#else -#define SIG_MARSHAL scintilla_marshal_NONE__INT_POINTER -#define MARSHAL_ARGUMENTS G_TYPE_INT, G_TYPE_POINTER -#endif - -static void scintilla_class_init(ScintillaClass *klass) { - OBJECT_CLASS *object_class = (OBJECT_CLASS*) klass; - GtkWidgetClass *widget_class = (GtkWidgetClass*) klass; - GtkContainerClass *container_class = (GtkContainerClass*) klass; - -#if GLIB_MAJOR_VERSION < 2 - parent_class = (GtkWidgetClass*) gtk_type_class(gtk_container_get_type()); - - scintilla_signals[COMMAND_SIGNAL] = gtk_signal_new( - "command", - GTK_RUN_LAST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(ScintillaClass, command), - SIG_MARSHAL, - GTK_TYPE_NONE, - 2, MARSHAL_ARGUMENTS); - - scintilla_signals[NOTIFY_SIGNAL] = gtk_signal_new( - SCINTILLA_NOTIFY, - GTK_RUN_LAST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(ScintillaClass, notify), - SIG_MARSHAL, - GTK_TYPE_NONE, - 2, MARSHAL_ARGUMENTS); - gtk_object_class_add_signals(object_class, - reinterpret_cast(scintilla_signals), LAST_SIGNAL); -#else - GSignalFlags sigflags = GSignalFlags(G_SIGNAL_ACTION | G_SIGNAL_RUN_LAST); - scintilla_signals[COMMAND_SIGNAL] = g_signal_new( - "command", - G_TYPE_FROM_CLASS(object_class), - sigflags, - G_STRUCT_OFFSET(ScintillaClass, command), - NULL, //(GSignalAccumulator) - NULL, //(gpointer) - SIG_MARSHAL, - G_TYPE_NONE, - 2, MARSHAL_ARGUMENTS); - - scintilla_signals[NOTIFY_SIGNAL] = g_signal_new( - SCINTILLA_NOTIFY, - G_TYPE_FROM_CLASS(object_class), - sigflags, - G_STRUCT_OFFSET(ScintillaClass, notify), - NULL, - NULL, - SIG_MARSHAL, - G_TYPE_NONE, - 2, MARSHAL_ARGUMENTS); -#endif - klass->command = NULL; - klass->notify = NULL; - - ScintillaGTK::ClassInit(object_class, widget_class, container_class); -} - -static void scintilla_init(ScintillaObject *sci) { - GTK_WIDGET_SET_FLAGS(sci, GTK_CAN_FOCUS); - sci->pscin = new ScintillaGTK(sci); -} - -GtkWidget* scintilla_new() { -#if GLIB_MAJOR_VERSION < 2 - return GTK_WIDGET(gtk_type_new(scintilla_get_type())); -#else - return GTK_WIDGET(g_object_new(scintilla_get_type(), NULL)); -#endif -} - -void scintilla_set_id(ScintillaObject *sci, uptr_t id) { - ScintillaGTK *psci = reinterpret_cast(sci->pscin); - psci->ctrlID = id; -} - -void scintilla_release_resources(void) { - Platform_Finalise(); -} diff --git a/ext/scintilla/gtk/deps.mak b/ext/scintilla/gtk/deps.mak deleted file mode 100644 index 13569be79..000000000 --- a/ext/scintilla/gtk/deps.mak +++ /dev/null @@ -1,311 +0,0 @@ -PlatGTK.o: PlatGTK.cxx \ - ../include/Scintilla.h ../include/ScintillaWidget.h \ - ../src/UniConversion.h ../src/XPM.h Converter.h -ScintillaGTK.o: ScintillaGTK.cxx \ - ../include/Scintilla.h ../include/ScintillaWidget.h \ - ../include/SciLexer.h ../include/PropSet.h ../include/SString.h \ - ../include/Accessor.h ../include/KeyWords.h ../src/ContractionState.h \ - ../src/SVector.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h \ - ../src/XPM.h ../src/LineMarker.h ../src/Style.h ../src/AutoComplete.h \ - ../src/ViewStyle.h ../src/RunStyles.h ../src/Decoration.h \ - ../src/CharClassify.h ../src/Document.h ../src/PositionCache.h \ - ../src/Editor.h ../include/SString.h ../src/ScintillaBase.h \ - ../src/UniConversion.h scintilla-marshal.h ../src/ExternalLexer.h \ - Converter.h -AutoComplete.o: ../src/AutoComplete.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../src/AutoComplete.h -CallTip.o: ../src/CallTip.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/CallTip.h -CellBuffer.o: ../src/CellBuffer.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/CellBuffer.h -CharClassify.o: ../src/CharClassify.cxx ../src/CharClassify.h -ContractionState.o: ../src/ContractionState.cxx ../include/Platform.h \ - ../src/ContractionState.h -Decoration.o: ../src/Decoration.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/Decoration.h -DocumentAccessor.o: ../src/DocumentAccessor.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../src/SVector.h \ - ../include/Accessor.h ../src/DocumentAccessor.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \ - ../include/Scintilla.h ../src/CharClassify.h ../src/Decoration.h \ - ../src/Document.h -Document.o: ../src/Document.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \ - ../src/CharClassify.h ../src/Decoration.h ../src/Document.h \ - ../src/RESearch.h -Editor.o: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/CellBuffer.h ../src/KeyMap.h \ - ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ - ../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \ - ../src/Decoration.h ../src/Document.h ../src/PositionCache.h \ - ../src/Editor.h -ExternalLexer.o: ../src/ExternalLexer.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/SciLexer.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/DocumentAccessor.h \ - ../include/KeyWords.h ../src/ExternalLexer.h -Indicator.o: ../src/Indicator.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/Indicator.h -KeyMap.o: ../src/KeyMap.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/KeyMap.h -KeyWords.o: ../src/KeyWords.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexAda.o: ../src/LexAda.cxx ../include/Platform.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/PropSet.h ../include/SString.h \ - ../include/KeyWords.h ../include/SciLexer.h ../include/SString.h -LexAPDL.o: ../src/LexAPDL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexAsm.o: ../src/LexAsm.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexAsn1.o: ../src/LexAsn1.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexAU3.o: ../src/LexAU3.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexAVE.o: ../src/LexAVE.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexBaan.o: ../src/LexBaan.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexBash.o: ../src/LexBash.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h -LexBasic.o: ../src/LexBasic.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexBullant.o: ../src/LexBullant.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexCaml.o: ../src/LexCaml.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexCLW.o: ../src/LexCLW.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexCmake.o: ../src/LexCmake.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexConf.o: ../src/LexConf.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h -LexCPP.o: ../src/LexCPP.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \ - ../src/CharacterSet.h -LexCrontab.o: ../src/LexCrontab.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexCsound.o: ../src/LexCsound.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexCSS.o: ../src/LexCSS.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexD.o: ../src/LexD.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexEiffel.o: ../src/LexEiffel.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexErlang.o: ../src/LexErlang.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexEScript.o: ../src/LexEScript.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexFlagship.o: ../src/LexFlagship.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexForth.o: ../src/LexForth.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexFortran.o: ../src/LexFortran.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexGAP.o: ../src/LexGAP.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexGui4Cli.o: ../src/LexGui4Cli.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexHaskell.o: ../src/LexHaskell.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexHTML.o: ../src/LexHTML.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \ - ../src/CharacterSet.h -LexInno.o: ../src/LexInno.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexKix.o: ../src/LexKix.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexLisp.o: ../src/LexLisp.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h -LexLout.o: ../src/LexLout.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexLua.o: ../src/LexLua.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexMatlab.o: ../src/LexMatlab.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexMetapost.o: ../src/LexMetapost.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \ - ../src/StyleContext.h -LexMMIXAL.o: ../src/LexMMIXAL.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexMPT.o: ../src/LexMPT.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../include/SString.h -LexMSSQL.o: ../src/LexMSSQL.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexNsis.o: ../src/LexNsis.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h -LexOpal.o: ../src/LexOpal.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h -LexOthers.o: ../src/LexOthers.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexPascal.o: ../src/LexPascal.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \ - ../src/StyleContext.h -LexPB.o: ../src/LexPB.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexPerl.o: ../src/LexPerl.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h -LexPLM.o: ../src/LexPLM.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h -LexPOV.o: ../src/LexPOV.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexProgress.o: ../src/LexProgress.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexPS.o: ../src/LexPS.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexPython.o: ../src/LexPython.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexRebol.o: ../src/LexRebol.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \ - ../src/StyleContext.h -LexRuby.o: ../src/LexRuby.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h -LexScriptol.o: ../src/LexScriptol.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexSmalltalk.o: ../src/LexSmalltalk.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexSpecman.o: ../src/LexSpecman.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexSpice.o: ../src/LexSpice.cxx ../include/Platform.h \ - ../include/Accessor.h ../src/StyleContext.h ../include/PropSet.h \ - ../include/SString.h ../include/KeyWords.h ../include/SciLexer.h \ - ../include/SString.h -LexSQL.o: ../src/LexSQL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexTADS3.o: ../src/LexTADS3.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexTCL.o: ../src/LexTCL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexTeX.o: ../src/LexTeX.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../include/KeyWords.h \ - ../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h -LexVB.o: ../src/LexVB.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexVerilog.o: ../src/LexVerilog.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \ - ../include/SciLexer.h -LexVHDL.o: ../src/LexVHDL.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LexYAML.o: ../src/LexYAML.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/StyleContext.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h -LineMarker.o: ../src/LineMarker.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/XPM.h ../src/LineMarker.h -PositionCache.o: ../src/PositionCache.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/ContractionState.h ../src/SVector.h \ - ../src/SplitVector.h ../src/Partitioning.h ../src/CellBuffer.h \ - ../src/KeyMap.h ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h \ - ../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \ - ../src/CharClassify.h ../src/Decoration.h ../src/Document.h \ - ../src/PositionCache.h -PropSet.o: ../src/PropSet.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h -RESearch.o: ../src/RESearch.cxx ../src/CharClassify.h ../src/RESearch.h -RunStyles.o: ../src/RunStyles.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h -ScintillaBase.o: ../src/ScintillaBase.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/PropSet.h ../include/SString.h \ - ../include/SciLexer.h ../include/Accessor.h ../src/DocumentAccessor.h \ - ../include/KeyWords.h ../src/ContractionState.h ../src/SVector.h \ - ../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \ - ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h \ - ../src/XPM.h ../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \ - ../src/AutoComplete.h ../src/CharClassify.h ../src/Decoration.h \ - ../src/Document.h ../src/PositionCache.h ../src/Editor.h \ - ../src/ScintillaBase.h -StyleContext.o: ../src/StyleContext.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h -Style.o: ../src/Style.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/Style.h -UniConversion.o: ../src/UniConversion.cxx ../src/UniConversion.h -ViewStyle.o: ../src/ViewStyle.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ - ../src/Style.h ../src/ViewStyle.h -WindowAccessor.o: ../src/WindowAccessor.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/WindowAccessor.h ../include/Scintilla.h -XPM.o: ../src/XPM.cxx ../include/Platform.h ../src/XPM.h diff --git a/ext/scintilla/gtk/makefile b/ext/scintilla/gtk/makefile deleted file mode 100644 index f3e0aad4e..000000000 --- a/ext/scintilla/gtk/makefile +++ /dev/null @@ -1,96 +0,0 @@ -# Make file for Scintilla on Linux or compatible OS -# Copyright 1998-2001 by Neil Hodgson -# The License.txt file describes the conditions under which this software may be distributed. -# This makefile assumes GCC 3.1 is used and changes will be needed to use other compilers. -# GNU make does not like \r\n line endings so should be saved to CVS in binary form. -# Builds for GTK+ 2 if available else GTK+ 1. -# To force GTK+ 2 build, define GTK2 on the make command line. -# To force GTK+ 1 build, define GTK1 on the make command line. - -.SUFFIXES: .cxx .c .o .h .a -CC = g++ -CCOMP = gcc -AR = ar -RANLIB = touch - -ifeq ($(shell uname),Darwin) -RANLIB = ranlib -endif - -COMPLIB=../bin/scintilla.a - -vpath %.h ../src ../include -vpath %.cxx ../src - -INCLUDEDIRS=-I ../include -I ../src -CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -Os -DGTK -DSCI_LEXER $(INCLUDEDIRS) - -ifdef NOTHREADS -THREADFLAGS=-DG_THREADS_IMPL_NONE -else -THREADFLAGS= -endif - -ifdef DEBUG -CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS) -else -CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS) -endif - -# If explicit setting of GTK1 or GTK2 then use that else look for -# pkg-config which is an OK indication that GTK2 is available -ifdef GTK2 -CONFIGFLAGS=$(shell pkg-config --cflags gtk+-2.0) -MARSHALLER=scintilla-marshal.o -else -ifdef GTK1 -CONFIGFLAGS=$(shell gtk-config --cflags) -else -ifneq (,$(findstring /,$(shell whereis pkg-config))) -CONFIGFLAGS=$(shell pkg-config --cflags gtk+-2.0) -MARSHALLER=scintilla-marshal.o -else -CONFIGFLAGS=$(shell gtk-config --cflags) -endif -endif -endif - -.cxx.o: - $(CC) $(CONFIGFLAGS) $(CXXFLAGS) -c $< -.c.o: - $(CCOMP) $(CONFIGFLAGS) $(CXXFLAGS) -w -c $< - -#++Autogenerated -- run src/LexGen.py to regenerate -#**LEXOBJS=\\\n\(\*.o \) -LEXOBJS=\ -LexAbaqus.o LexAda.o LexAPDL.o LexAsm.o LexAsn1.o LexASY.o LexAU3.o LexAVE.o \ -LexBaan.o LexBash.o LexBasic.o LexBullant.o LexCaml.o LexCLW.o LexCmake.o \ -LexConf.o LexCPP.o LexCrontab.o LexCsound.o LexCSS.o LexD.o LexEiffel.o \ -LexErlang.o LexEScript.o LexFlagship.o LexForth.o LexFortran.o LexGAP.o \ -LexGui4Cli.o LexHaskell.o LexHTML.o LexInno.o LexKix.o LexLisp.o LexLout.o \ -LexLua.o LexMagik.o LexMatlab.o LexMetapost.o LexMMIXAL.o LexMPT.o LexMSSQL.o \ -LexMySQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \ -LexPLM.o LexPOV.o LexPowerShell.o LexProgress.o LexPS.o LexPython.o LexR.o \ -LexRebol.o LexRuby.o LexScriptol.o LexSmalltalk.o LexSpecman.o LexSpice.o \ -LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o -#--Autogenerated -- end of automatically generated section - -all: $(COMPLIB) - -clean: - rm -f *.o $(COMPLIB) - -deps: - $(CC) -MM $(CONFIGFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak - -$(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o \ - CharClassify.o Decoration.o Document.o CallTip.o \ - ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.o \ - KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o ViewStyle.o \ - RESearch.o RunStyles.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \ - $(MARSHALLER) $(LEXOBJS) - $(AR) rc $@ $^ - $(RANLIB) $@ - -# Automatically generate header dependencies with "make deps" -include deps.mak diff --git a/ext/scintilla/gtk/scintilla-marshal.c b/ext/scintilla/gtk/scintilla-marshal.c deleted file mode 100644 index 02da18439..000000000 --- a/ext/scintilla/gtk/scintilla-marshal.c +++ /dev/null @@ -1,86 +0,0 @@ - -#include - - -#ifdef G_ENABLE_DEBUG -#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) -#define g_marshal_value_peek_char(v) g_value_get_char (v) -#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) -#define g_marshal_value_peek_int(v) g_value_get_int (v) -#define g_marshal_value_peek_uint(v) g_value_get_uint (v) -#define g_marshal_value_peek_long(v) g_value_get_long (v) -#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) -#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) -#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) -#define g_marshal_value_peek_enum(v) g_value_get_enum (v) -#define g_marshal_value_peek_flags(v) g_value_get_flags (v) -#define g_marshal_value_peek_float(v) g_value_get_float (v) -#define g_marshal_value_peek_double(v) g_value_get_double (v) -#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) -#define g_marshal_value_peek_param(v) g_value_get_param (v) -#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) -#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) -#define g_marshal_value_peek_object(v) g_value_get_object (v) -#else /* !G_ENABLE_DEBUG */ -/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. - * Do not access GValues directly in your code. Instead, use the - * g_value_get_*() functions - */ -#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int -#define g_marshal_value_peek_char(v) (v)->data[0].v_int -#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint -#define g_marshal_value_peek_int(v) (v)->data[0].v_int -#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint -#define g_marshal_value_peek_long(v) (v)->data[0].v_long -#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 -#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 -#define g_marshal_value_peek_enum(v) (v)->data[0].v_int -#define g_marshal_value_peek_flags(v) (v)->data[0].v_uint -#define g_marshal_value_peek_float(v) (v)->data[0].v_float -#define g_marshal_value_peek_double(v) (v)->data[0].v_double -#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer -#endif /* !G_ENABLE_DEBUG */ - - -/* NONE:INT,POINTER (scintilla-marshal.list:1) */ -void -scintilla_marshal_VOID__INT_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__INT_POINTER) (gpointer data1, - gint arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_VOID__INT_POINTER callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__INT_POINTER) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_int (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - data2); -} - diff --git a/ext/scintilla/gtk/scintilla-marshal.h b/ext/scintilla/gtk/scintilla-marshal.h deleted file mode 100644 index 28e94ccc2..000000000 --- a/ext/scintilla/gtk/scintilla-marshal.h +++ /dev/null @@ -1,21 +0,0 @@ - -#ifndef __scintilla_marshal_MARSHAL_H__ -#define __scintilla_marshal_MARSHAL_H__ - -#include - -G_BEGIN_DECLS - -/* NONE:INT,POINTER (scintilla-marshal.list:1) */ -extern void scintilla_marshal_VOID__INT_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -#define scintilla_marshal_NONE__INT_POINTER scintilla_marshal_VOID__INT_POINTER - -G_END_DECLS - -#endif /* __scintilla_marshal_MARSHAL_H__ */ - diff --git a/ext/scintilla/gtk/scintilla-marshal.list b/ext/scintilla/gtk/scintilla-marshal.list deleted file mode 100644 index b3cd2aa8b..000000000 --- a/ext/scintilla/gtk/scintilla-marshal.list +++ /dev/null @@ -1 +0,0 @@ -NONE:INT,POINTER diff --git a/ext/scintilla/gtk/scintilla.mak b/ext/scintilla/gtk/scintilla.mak deleted file mode 100644 index e3bdda82f..000000000 --- a/ext/scintilla/gtk/scintilla.mak +++ /dev/null @@ -1,586 +0,0 @@ -# Make file for GTK+/Scintilla on Windows Visual C++ -# Borland C++ does not work -# Copyright 1998-2000 by Neil Hodgson -# The License.txt file describes the conditions under which this software may be distributed. -# This makefile is for using Visual C++ with nmake or Borland C++ with make depending on -# the setting of the VENDOR macro. If no VENDOR is defined n the command line then -# the tool used is automatically detected. -# Usage for Microsoft: -# nmake -f scintilla.mak -# Usage for Borland: -# make -f scintilla.mak -# For debug versions define DEBUG on the command line, for Borland: -# make DEBUG=1 -f scintilla.mak -# The main makefile uses mingw32 gcc and may be more current than this file. - -.SUFFIXES: .cxx - -DIR_O=. -DIR_BIN=..\bin - -COMPONENT=$(DIR_BIN)\Scintilla.dll -LEXCOMPONENT=$(DIR_BIN)\SciLexer.dll -STATIC_LIB=$(DIR_BIN)\Scintilla-static.lib - -!IFNDEF VENDOR -!IFDEF _NMAKE_VER -#Microsoft nmake so make default VENDOR MICROSOFT -VENDOR=MICROSOFT -!ELSE -VENDOR=BORLAND -!ENDIF -!ENDIF - -!IF "$(VENDOR)"=="MICROSOFT" - -CC=cl -RC=rc -LD=link - -!IFDEF USE_GTK2 -MARSHALLER=$(DIR_O)\scintilla-marshal.obj -GTK_TOP= ../../gtk2 -TOP = $(GTK_TOP) -!INCLUDE $(TOP)/glib/build/win32/make.msc - -GTK_INCLUDES= -I$(GTK_TOP)/gtk+ \ - -I$(GTK_TOP)/gtk+/gdk \ - -I$(GTK_TOP)/glib/glib \ - -I$(GTK_TOP)/glib/gmodule \ - -I$(GTK_TOP)/glib \ - -I$(GTK_TOP)\libiconv\include \ - -I$(GTK_TOP)\pango \ - -I$(GTK_TOP)\atk -ALL_GTK_LIBS=$(GTK2_LIBS) $(GLIB_LIBS) $(LIBICONV_LIBS) -!ELSE -GTK_TOP= ../../win32gtk -GTK_INCLUDES= -I $(GTK_TOP)/gtk+ -I $(GTK_TOP)/gtk+/gdk -I $(GTK_TOP)/glib -I $(GTK_TOP)/glib/gmodule -ALL_GTK_LIBS=$(GTK_TOP)/gtk+/gtk/gtk-1.3.lib \ - $(GTK_TOP)/gtk+/gdk/gdk-1.3.lib \ - $(GTK_TOP)/glib/gmodule/gmodule-1.3.lib \ - $(GTK_TOP)/glib/glib-1.3.lib -!ENDIF - -INCLUDEDIRS=-I ../include -I ../src $(GTK_INCLUDES) -CXXFLAGS=/TP /W4 -DGTK -D_CRT_SECURE_NO_DEPRECATE=1 -CFLAGS=/W4 -DGTK -# For something scary:/Wp64 -CXXDEBUG=/Zi /Od /MDd -DDEBUG -CXXNDEBUG=/Ox /MD -DNDEBUG -NAMEFLAG=-Fo -LDFLAGS=/opt:nowin98 -LDDEBUG=/DEBUG -#LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB -LIBS=$(ALL_GTK_LIBS) - -!IFDEF QUIET -CC=@$(CC) -CXXDEBUG=$(CXXDEBUG) /nologo -CXXNDEBUG=$(CXXNDEBUG) /nologo -LDFLAGS=$(LDFLAGS) /nologo -!ENDIF - -!ELSE -# BORLAND -!error Borland C++ not supported - -CC=bcc32 -RC=brcc32 -r -LD=ilink32 - -INCLUDEDIRS=-I../include -I../src -CXXFLAGS = -v -CXXFLAGS=-P -tWM -w -w-prc -w-inl -RT- -x- -# Above turns off warnings for clarfying parentheses and inlines with for not expanded -CXXDEBUG=-v -DDEBUG -CXXNDEBUG=-O1 -DNDEBUG -NAMEFLAG=-o -LDFLAGS= -LDDEBUG=-v -LIBS=import32 cw32mt - -!ENDIF - -!IFDEF DEBUG -CXXFLAGS=$(CXXFLAGS) $(CXXDEBUG) -LDFLAGS=$(LDDEBUG) $(LDFLAGS) -!ELSE -CXXFLAGS=$(CXXFLAGS) $(CXXNDEBUG) -!ENDIF - -#ALL: $(STATIC_LIB) $(COMPONENT) $(LEXCOMPONENT) $(DIR_O)\ScintillaGTKS.obj $(DIR_O)\WindowAccessor.obj -ALL: $(STATIC_LIB) $(DIR_O)\ScintillaGTKS.obj $(DIR_O)\WindowAccessor.obj - -clean:: - -del /q $(DIR_O)\*.obj $(DIR_O)\*.pdb $(COMPONENT) $(LEXCOMPONENT) $(DIR_O)\*.res $(DIR_BIN)\*.map - -SOBJS=\ - $(DIR_O)\AutoComplete.obj \ - $(DIR_O)\CallTip.obj \ - $(DIR_O)\CellBuffer.obj \ - $(DIR_O)\ContractionState.obj \ - $(DIR_O)\CharClassify.obj \ - $(DIR_O)\Decoration.obj \ - $(DIR_O)\Document.obj \ - $(DIR_O)\Editor.obj \ - $(DIR_O)\ExternalLexer.obj \ - $(DIR_O)\Indicator.obj \ - $(DIR_O)\KeyMap.obj \ - $(DIR_O)\LineMarker.obj \ - $(DIR_O)\PlatGTK.obj \ - $(DIR_O)\PositionCache.obj \ - $(MARSHALLER) \ - $(DIR_O)\RESearch.obj \ - $(DIR_O)\RunStyles.obj \ - $(DIR_O)\PropSet.obj \ - $(DIR_O)\ScintillaBase.obj \ - $(DIR_O)\ScintillaGTK.obj \ - $(DIR_O)\Style.obj \ - $(DIR_O)\UniConversion.obj \ - $(DIR_O)\ViewStyle.obj \ - $(DIR_O)\XPM.obj - -#++Autogenerated -- run src/LexGen.py to regenerate -#**LEXOBJS=\\\n\(\t$(DIR_O)\\\*.obj \\\n\) -LEXOBJS=\ - $(DIR_O)\LexAbaqus.obj \ - $(DIR_O)\LexAda.obj \ - $(DIR_O)\LexAPDL.obj \ - $(DIR_O)\LexAsm.obj \ - $(DIR_O)\LexAsn1.obj \ - $(DIR_O)\LexASY.obj \ - $(DIR_O)\LexAU3.obj \ - $(DIR_O)\LexAVE.obj \ - $(DIR_O)\LexBaan.obj \ - $(DIR_O)\LexBash.obj \ - $(DIR_O)\LexBasic.obj \ - $(DIR_O)\LexBullant.obj \ - $(DIR_O)\LexCaml.obj \ - $(DIR_O)\LexCLW.obj \ - $(DIR_O)\LexCmake.obj \ - $(DIR_O)\LexConf.obj \ - $(DIR_O)\LexCPP.obj \ - $(DIR_O)\LexCrontab.obj \ - $(DIR_O)\LexCsound.obj \ - $(DIR_O)\LexCSS.obj \ - $(DIR_O)\LexD.obj \ - $(DIR_O)\LexEiffel.obj \ - $(DIR_O)\LexErlang.obj \ - $(DIR_O)\LexEScript.obj \ - $(DIR_O)\LexFlagship.obj \ - $(DIR_O)\LexForth.obj \ - $(DIR_O)\LexFortran.obj \ - $(DIR_O)\LexGAP.obj \ - $(DIR_O)\LexGui4Cli.obj \ - $(DIR_O)\LexHaskell.obj \ - $(DIR_O)\LexHTML.obj \ - $(DIR_O)\LexInno.obj \ - $(DIR_O)\LexKix.obj \ - $(DIR_O)\LexLisp.obj \ - $(DIR_O)\LexLout.obj \ - $(DIR_O)\LexLua.obj \ - $(DIR_O)\LexMagik.obj \ - $(DIR_O)\LexMatlab.obj \ - $(DIR_O)\LexMetapost.obj \ - $(DIR_O)\LexMMIXAL.obj \ - $(DIR_O)\LexMPT.obj \ - $(DIR_O)\LexMSSQL.obj \ - $(DIR_O)\LexMySQL.obj \ - $(DIR_O)\LexNsis.obj \ - $(DIR_O)\LexOpal.obj \ - $(DIR_O)\LexOthers.obj \ - $(DIR_O)\LexPascal.obj \ - $(DIR_O)\LexPB.obj \ - $(DIR_O)\LexPerl.obj \ - $(DIR_O)\LexPLM.obj \ - $(DIR_O)\LexPOV.obj \ - $(DIR_O)\LexPowerShell.obj \ - $(DIR_O)\LexProgress.obj \ - $(DIR_O)\LexPS.obj \ - $(DIR_O)\LexPython.obj \ - $(DIR_O)\LexR.obj \ - $(DIR_O)\LexRebol.obj \ - $(DIR_O)\LexRuby.obj \ - $(DIR_O)\LexScriptol.obj \ - $(DIR_O)\LexSmalltalk.obj \ - $(DIR_O)\LexSpecman.obj \ - $(DIR_O)\LexSpice.obj \ - $(DIR_O)\LexSQL.obj \ - $(DIR_O)\LexTADS3.obj \ - $(DIR_O)\LexTCL.obj \ - $(DIR_O)\LexTeX.obj \ - $(DIR_O)\LexVB.obj \ - $(DIR_O)\LexVerilog.obj \ - $(DIR_O)\LexVHDL.obj \ - $(DIR_O)\LexYAML.obj \ - -#--Autogenerated -- end of automatically generated section - -LOBJS=\ - $(DIR_O)\AutoComplete.obj \ - $(DIR_O)\CallTip.obj \ - $(DIR_O)\CellBuffer.obj \ - $(DIR_O)\ContractionState.obj \ - $(DIR_O)\CharClassify.obj \ - $(DIR_O)\Decoration.obj \ - $(DIR_O)\Document.obj \ - $(DIR_O)\DocumentAccessor.obj \ - $(DIR_O)\Editor.obj \ - $(DIR_O)\Indicator.obj \ - $(DIR_O)\KeyMap.obj \ - $(DIR_O)\KeyWords.obj \ - $(DIR_O)\LineMarker.obj \ - $(DIR_O)\PlatGTK.obj \ - $(DIR_O)\PositionCache.obj \ - $(MARSHALLER) \ - $(DIR_O)\RESearch.obj \ - $(DIR_O)\RunStyles.obj \ - $(DIR_O)\PropSet.obj \ - $(DIR_O)\ScintillaBaseL.obj \ - $(DIR_O)\ScintillaGTKL.obj \ - $(DIR_O)\Style.obj \ - $(DIR_O)\StyleContext.obj \ - $(DIR_O)\UniConversion.obj \ - $(DIR_O)\ViewStyle.obj \ - $(DIR_O)\XPM.obj \ - $(DIR_O)\ExternalLexer.obj \ - $(LEXOBJS) - -!IF "$(VENDOR)"=="MICROSOFT" - -$(STATIC_LIB): $(LOBJS) #$(DIR_O)\ScintRes.res - lib.exe /OUT:$@ $(LOBJS) $(LIBS) - -$(COMPONENT): $(SOBJS) #$(DIR_O)\ScintRes.res - $(LD) $(LDFLAGS) /DLL /OUT:$@ $(SOBJS) $(LIBS) - -$(DIR_O)\ScintRes.res : ScintRes.rc - $(RC) /fo$@ $(*B).rc - -$(LEXCOMPONENT): $(LOBJS) #$(DIR_O)\ScintRes.res - $(LD) $(LDFLAGS) /DLL /OUT:$@ $(LOBJS) $(LIBS) - -!ELSE - -$(STATIC_LIB): $(LOBJS) #$(DIR_O)\ScintRes.res - $(LD) /OUT:$@ $(LOBJS) $(LIBS) - -$(COMPONENT): $(SOBJS) ScintRes.res - $(LD) $(LDFLAGS) -Tpd -c c0d32 $(SOBJS), $@, , $(LIBS), , ScintRes.res - -$(DIR_O)\ScintRes.res: ScintRes.rc - $(RC) $*.rc - -$(LEXCOMPONENT): $(LOBJS) - $(LD) $(LDFLAGS) -Tpd -c c0d32 $(LOBJS), $@, , $(LIBS), , ScintRes.res - -!ENDIF - -# Define how to build all the objects and what they depend on - -# Most of the source is in ..\src with a couple in this directory -{..\src}.cxx{$(DIR_O)}.obj: - $(CC) $(INCLUDEDIRS) $(CXXFLAGS) -c $(NAMEFLAG)$@ $< -{.}.cxx{$(DIR_O)}.obj: - $(CC) $(INCLUDEDIRS) $(CXXFLAGS) -c $(NAMEFLAG)$@ $< -{.}.c{$(DIR_O)}.obj: - $(CC) $(INCLUDEDIRS) $(CFLAGS) -c $(NAMEFLAG)$@ $< - -# Some source files are compiled into more than one object because of different conditional compilation -$(DIR_O)\ScintillaBaseL.obj: ..\src\ScintillaBase.cxx - $(CC) $(INCLUDEDIRS) $(CXXFLAGS) -DSCI_LEXER -c $(NAMEFLAG)$@ ..\src\ScintillaBase.cxx - -$(DIR_O)\ScintillaGTKL.obj: ScintillaGTK.cxx - $(CC) $(INCLUDEDIRS) $(CXXFLAGS) -DSCI_LEXER -c $(NAMEFLAG)$@ ScintillaGTK.cxx - -$(DIR_O)\ScintillaGTKS.obj: ScintillaGTK.cxx - $(CC) $(INCLUDEDIRS) $(CXXFLAGS) -DSTATIC_BUILD -c $(NAMEFLAG)$@ ScintillaGTK.cxx - -# Dependencies - -# All lexers depend on this set of headers -LEX_HEADERS=..\include\Platform.h ..\include\PropSet.h \ - ..\include\SString.h ..\include\Accessor.h ..\include\KeyWords.h \ - ..\include\Scintilla.h ..\include\SciLexer.h ..\src\StyleContext.h - -$(DIR_O)\AutoComplete.obj: ../src/AutoComplete.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../src/AutoComplete.h - -$(DIR_O)\CallTip.obj: ../src/CallTip.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/CallTip.h - -$(DIR_O)\CellBuffer.obj: ../src/CellBuffer.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/CellBuffer.h - -$(DIR_O)\CharClassify.obj: ../src/CharClassify.cxx ../src/CharClassify.h - -$(DIR_O)\ContractionState.obj: ../src/ContractionState.cxx ../include/Platform.h \ - ../src/ContractionState.h - -$(DIR_O)\Document.obj: ../src/Document.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/CellBuffer.h ../src/CharClassify.h \ - ../src/Document.h ../src/RESearch.h - -$(DIR_O)\DocumentAccessor.obj: ../src/DocumentAccessor.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../src/SVector.h \ - ../include/Accessor.h ../src/DocumentAccessor.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/CellBuffer.h ../include/Scintilla.h \ - ../src/CharClassify.h ../src/Document.h - -$(DIR_O)\Editor.obj: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/CellBuffer.h ../src/KeyMap.h \ - ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ - ../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \ - ../src/Document.h ../src/Editor.h ../src/PositionCache.h - -$(DIR_O)\ExternalLexer.obj: ../src/ExternalLexer.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/SciLexer.h ../include/PropSet.h \ - ../include/SString.h ../include/Accessor.h ../src/DocumentAccessor.h \ - ../include/KeyWords.h ../src/ExternalLexer.h - -$(DIR_O)\Indicator.obj: ../src/Indicator.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/Indicator.h - -$(DIR_O)\KeyMap.obj: ../src/KeyMap.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/KeyMap.h - -$(DIR_O)\KeyWords.obj: ../src/KeyWords.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h - -#++Autogenerated -- run src/LexGen.py to regenerate -#**\n\($(DIR_O)\\\*.obj: ..\\src\\\*.cxx $(LEX_HEADERS)\n\n\) - -$(DIR_O)\LexAbaqus.obj: ..\src\LexAbaqus.cxx $(LEX_HEADERS) - -$(DIR_O)\LexAda.obj: ..\src\LexAda.cxx $(LEX_HEADERS) - -$(DIR_O)\LexAPDL.obj: ..\src\LexAPDL.cxx $(LEX_HEADERS) - -$(DIR_O)\LexAsm.obj: ..\src\LexAsm.cxx $(LEX_HEADERS) - -$(DIR_O)\LexAsn1.obj: ..\src\LexAsn1.cxx $(LEX_HEADERS) - -$(DIR_O)\LexASY.obj: ..\src\LexASY.cxx $(LEX_HEADERS) - -$(DIR_O)\LexAU3.obj: ..\src\LexAU3.cxx $(LEX_HEADERS) - -$(DIR_O)\LexAVE.obj: ..\src\LexAVE.cxx $(LEX_HEADERS) - -$(DIR_O)\LexBaan.obj: ..\src\LexBaan.cxx $(LEX_HEADERS) - -$(DIR_O)\LexBash.obj: ..\src\LexBash.cxx $(LEX_HEADERS) - -$(DIR_O)\LexBasic.obj: ..\src\LexBasic.cxx $(LEX_HEADERS) - -$(DIR_O)\LexBullant.obj: ..\src\LexBullant.cxx $(LEX_HEADERS) - -$(DIR_O)\LexCaml.obj: ..\src\LexCaml.cxx $(LEX_HEADERS) - -$(DIR_O)\LexCLW.obj: ..\src\LexCLW.cxx $(LEX_HEADERS) - -$(DIR_O)\LexCmake.obj: ..\src\LexCmake.cxx $(LEX_HEADERS) - -$(DIR_O)\LexConf.obj: ..\src\LexConf.cxx $(LEX_HEADERS) - -$(DIR_O)\LexCPP.obj: ..\src\LexCPP.cxx $(LEX_HEADERS) - -$(DIR_O)\LexCrontab.obj: ..\src\LexCrontab.cxx $(LEX_HEADERS) - -$(DIR_O)\LexCsound.obj: ..\src\LexCsound.cxx $(LEX_HEADERS) - -$(DIR_O)\LexCSS.obj: ..\src\LexCSS.cxx $(LEX_HEADERS) - -$(DIR_O)\LexD.obj: ..\src\LexD.cxx $(LEX_HEADERS) - -$(DIR_O)\LexEiffel.obj: ..\src\LexEiffel.cxx $(LEX_HEADERS) - -$(DIR_O)\LexErlang.obj: ..\src\LexErlang.cxx $(LEX_HEADERS) - -$(DIR_O)\LexEScript.obj: ..\src\LexEScript.cxx $(LEX_HEADERS) - -$(DIR_O)\LexFlagship.obj: ..\src\LexFlagship.cxx $(LEX_HEADERS) - -$(DIR_O)\LexForth.obj: ..\src\LexForth.cxx $(LEX_HEADERS) - -$(DIR_O)\LexFortran.obj: ..\src\LexFortran.cxx $(LEX_HEADERS) - -$(DIR_O)\LexGAP.obj: ..\src\LexGAP.cxx $(LEX_HEADERS) - -$(DIR_O)\LexGui4Cli.obj: ..\src\LexGui4Cli.cxx $(LEX_HEADERS) - -$(DIR_O)\LexHaskell.obj: ..\src\LexHaskell.cxx $(LEX_HEADERS) - -$(DIR_O)\LexHTML.obj: ..\src\LexHTML.cxx $(LEX_HEADERS) - -$(DIR_O)\LexInno.obj: ..\src\LexInno.cxx $(LEX_HEADERS) - -$(DIR_O)\LexKix.obj: ..\src\LexKix.cxx $(LEX_HEADERS) - -$(DIR_O)\LexLisp.obj: ..\src\LexLisp.cxx $(LEX_HEADERS) - -$(DIR_O)\LexLout.obj: ..\src\LexLout.cxx $(LEX_HEADERS) - -$(DIR_O)\LexLua.obj: ..\src\LexLua.cxx $(LEX_HEADERS) - -$(DIR_O)\LexMagik.obj: ..\src\LexMagik.cxx $(LEX_HEADERS) - -$(DIR_O)\LexMatlab.obj: ..\src\LexMatlab.cxx $(LEX_HEADERS) - -$(DIR_O)\LexMetapost.obj: ..\src\LexMetapost.cxx $(LEX_HEADERS) - -$(DIR_O)\LexMMIXAL.obj: ..\src\LexMMIXAL.cxx $(LEX_HEADERS) - -$(DIR_O)\LexMPT.obj: ..\src\LexMPT.cxx $(LEX_HEADERS) - -$(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS) - -$(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS) - -$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS) - -$(DIR_O)\LexOpal.obj: ..\src\LexOpal.cxx $(LEX_HEADERS) - -$(DIR_O)\LexOthers.obj: ..\src\LexOthers.cxx $(LEX_HEADERS) - -$(DIR_O)\LexPascal.obj: ..\src\LexPascal.cxx $(LEX_HEADERS) - -$(DIR_O)\LexPB.obj: ..\src\LexPB.cxx $(LEX_HEADERS) - -$(DIR_O)\LexPerl.obj: ..\src\LexPerl.cxx $(LEX_HEADERS) - -$(DIR_O)\LexPLM.obj: ..\src\LexPLM.cxx $(LEX_HEADERS) - -$(DIR_O)\LexPOV.obj: ..\src\LexPOV.cxx $(LEX_HEADERS) - -$(DIR_O)\LexPowerShell.obj: ..\src\LexPowerShell.cxx $(LEX_HEADERS) - -$(DIR_O)\LexProgress.obj: ..\src\LexProgress.cxx $(LEX_HEADERS) - -$(DIR_O)\LexPS.obj: ..\src\LexPS.cxx $(LEX_HEADERS) - -$(DIR_O)\LexPython.obj: ..\src\LexPython.cxx $(LEX_HEADERS) - -$(DIR_O)\LexR.obj: ..\src\LexR.cxx $(LEX_HEADERS) - -$(DIR_O)\LexRebol.obj: ..\src\LexRebol.cxx $(LEX_HEADERS) - -$(DIR_O)\LexRuby.obj: ..\src\LexRuby.cxx $(LEX_HEADERS) - -$(DIR_O)\LexScriptol.obj: ..\src\LexScriptol.cxx $(LEX_HEADERS) - -$(DIR_O)\LexSmalltalk.obj: ..\src\LexSmalltalk.cxx $(LEX_HEADERS) - -$(DIR_O)\LexSpecman.obj: ..\src\LexSpecman.cxx $(LEX_HEADERS) - -$(DIR_O)\LexSpice.obj: ..\src\LexSpice.cxx $(LEX_HEADERS) - -$(DIR_O)\LexSQL.obj: ..\src\LexSQL.cxx $(LEX_HEADERS) - -$(DIR_O)\LexTADS3.obj: ..\src\LexTADS3.cxx $(LEX_HEADERS) - -$(DIR_O)\LexTCL.obj: ..\src\LexTCL.cxx $(LEX_HEADERS) - -$(DIR_O)\LexTeX.obj: ..\src\LexTeX.cxx $(LEX_HEADERS) - -$(DIR_O)\LexVB.obj: ..\src\LexVB.cxx $(LEX_HEADERS) - -$(DIR_O)\LexVerilog.obj: ..\src\LexVerilog.cxx $(LEX_HEADERS) - -$(DIR_O)\LexVHDL.obj: ..\src\LexVHDL.cxx $(LEX_HEADERS) - -$(DIR_O)\LexYAML.obj: ..\src\LexYAML.cxx $(LEX_HEADERS) - - -#--Autogenerated -- end of automatically generated section - -$(DIR_O)\LineMarker.obj: ../src/LineMarker.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/XPM.h ../src/LineMarker.h - -$(DIR_O)\PlatGTK.obj: PlatGTK.cxx ../include/Platform.h \ - ../src/UniConversion.h ../src/XPM.h - -$(DIR_O)\PositionCache.obj: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/CellBuffer.h ../src/KeyMap.h \ - ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ - ../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \ - ../src/Decoration.h ../src/Document.h ../src/Editor.h ../src/PositionCache.h - -$(DIR_O)\PropSet.obj: ../src/PropSet.cxx ../include/Platform.h ../include/PropSet.h \ - ../include/SString.h - -$(DIR_O)\RESearch.obj: ../src/RESearch.cxx ../src/CharClassify.h ../src/RESearch.h - -$(DIR_O)\RunStyles.obj: ../src/RunStyles.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h - -$(DIR_O)\ScintillaBase.obj: ../src/ScintillaBase.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/PropSet.h ../include/SString.h \ - ../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \ - ../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \ - ../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \ - ../src/AutoComplete.h ../src/CharClassify.h ../src/Document.h \ - ../src/Editor.h ../src/ScintillaBase.h - -$(DIR_O)\ScintillaBaseL.obj: ../src/ScintillaBase.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/PropSet.h ../include/SString.h \ - ../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \ - ../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \ - ../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \ - ../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \ - ../src/AutoComplete.h ../src/CharClassify.h ../src/Document.h \ - ../src/Editor.h ../src/ScintillaBase.h - -$(DIR_O)\ScintillaGTK.obj: ScintillaGTK.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \ - ../src/SVector.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h \ - ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \ - ../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \ - ../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \ - ../src/UniConversion.h - -$(DIR_O)\ScintillaGTKL.obj: ScintillaGTK.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \ - ../src/SVector.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h \ - ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \ - ../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \ - ../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \ - ../src/UniConversion.h - -$(DIR_O)\ScintillaGTKS.obj: ScintillaGTK.cxx ../include/Platform.h \ - ../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \ - ../src/SVector.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h \ - ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \ - ../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \ - ../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \ - ../src/UniConversion.h - -$(DIR_O)\Style.obj: ../src/Style.cxx ../include/Platform.h ../include/Scintilla.h \ - ../src/Style.h - -$(DIR_O)\StyleContext.obj: ../src/StyleContext.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../src/StyleContext.h - -$(DIR_O)\UniConversion.obj: ../src/UniConversion.cxx ../src/UniConversion.h - -$(DIR_O)\ViewStyle.obj: ../src/ViewStyle.cxx ../include/Platform.h \ - ../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \ - ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \ - ../src/Style.h ../src/ViewStyle.h - -$(DIR_O)\WindowAccessor.obj: ../src/WindowAccessor.cxx ../include/Platform.h \ - ../include/PropSet.h ../include/SString.h ../include/Accessor.h \ - ../include/WindowAccessor.h ../include/Scintilla.h - -$(DIR_O)\XPM.obj: ../src/XPM.cxx ../include/Platform.h ../src/XPM.h diff --git a/ext/scintilla/include/Accessor.h b/ext/scintilla/include/Accessor.h deleted file mode 100644 index bfe4d4dcd..000000000 --- a/ext/scintilla/include/Accessor.h +++ /dev/null @@ -1,79 +0,0 @@ -// Scintilla source code edit control -/** @file Accessor.h - ** Rapid easy access to contents of a Scintilla. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8}; - -class Accessor; - -typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len); - -/** - * Interface to data in a Scintilla. - */ -class Accessor { -protected: - enum {extremePosition=0x7FFFFFFF}; - /** @a bufferSize is a trade off between time taken to copy the characters - * and retrieval overhead. - * @a slopSize positions the buffer before the desired position - * in case there is some backtracking. */ - enum {bufferSize=4000, slopSize=bufferSize/8}; - char buf[bufferSize+1]; - int startPos; - int endPos; - int codePage; - - virtual bool InternalIsLeadByte(char ch)=0; - virtual void Fill(int position)=0; - -public: - Accessor() : startPos(extremePosition), endPos(0), codePage(0) {} - virtual ~Accessor() {} - char operator[](int position) { - if (position < startPos || position >= endPos) { - Fill(position); - } - return buf[position - startPos]; - } - /** Safe version of operator[], returning a defined value for invalid position. */ - char SafeGetCharAt(int position, char chDefault=' ') { - if (position < startPos || position >= endPos) { - Fill(position); - if (position < startPos || position >= endPos) { - // Position is outside range of document - return chDefault; - } - } - return buf[position - startPos]; - } - bool IsLeadByte(char ch) { - return codePage && InternalIsLeadByte(ch); - } - void SetCodePage(int codePage_) { codePage = codePage_; } - - virtual bool Match(int pos, const char *s)=0; - virtual char StyleAt(int position)=0; - virtual int GetLine(int position)=0; - virtual int LineStart(int line)=0; - virtual int LevelAt(int line)=0; - virtual int Length()=0; - virtual void Flush()=0; - virtual int GetLineState(int line)=0; - virtual int SetLineState(int line, int state)=0; - virtual int GetPropertyInt(const char *key, int defaultValue=0)=0; - virtual char *GetProperties()=0; - - // Style setting - virtual void StartAt(unsigned int start, char chMask=31)=0; - virtual void SetFlags(char chFlags_, char chWhile_)=0; - virtual unsigned int GetStartSegment()=0; - virtual void StartSegment(unsigned int pos)=0; - virtual void ColourTo(unsigned int pos, int chAttr)=0; - virtual void SetLevel(int line, int level)=0; - virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0; - virtual void IndicatorFill(int start, int end, int indicator, int value)=0; -}; diff --git a/ext/scintilla/include/Face.py b/ext/scintilla/include/Face.py index 59ada3dce..9a92bb034 100644 --- a/ext/scintilla/include/Face.py +++ b/ext/scintilla/include/Face.py @@ -1,36 +1,35 @@ # Module for reading and parsing Scintilla.iface file -import string def sanitiseLine(line): if line[-1:] == '\n': line = line[:-1] - if string.find(line, "##") != -1: - line = line[:string.find(line, "##")] - line = string.strip(line) + if line.find("##") != -1: + line = line[:line.find("##")] + line = line.strip() return line def decodeFunction(featureVal): - retType, rest = string.split(featureVal, " ", 1) - nameIdent, params = string.split(rest, "(") - name, value = string.split(nameIdent, "=") - params, rest = string.split(params, ")") - param1, param2 = string.split(params, ",")[0:2] + retType, rest = featureVal.split(" ", 1) + nameIdent, params = rest.split("(") + name, value = nameIdent.split("=") + params, rest = params.split(")") + param1, param2 = params.split(",")[0:2] return retType, name, value, param1, param2 def decodeEvent(featureVal): - retType, rest = string.split(featureVal, " ", 1) - nameIdent, params = string.split(rest, "(") - name, value = string.split(nameIdent, "=") + retType, rest = featureVal.split(" ", 1) + nameIdent, params = rest.split("(") + name, value = nameIdent.split("=") return retType, name, value def decodeParam(p): - param = string.strip(p) + param = p.strip() type = "" name = "" value = "" if " " in param: - type, nv = string.split(param, " ") + type, nv = param.split(" ") if "=" in nv: - name, value = string.split(nv, "=") + name, value = nv.split("=") else: name = nv return type, name, value @@ -59,7 +58,7 @@ class Face: currentComment.append(line[2:]) else: currentCommentFinished = 1 - featureType, featureVal = string.split(line, " ", 1) + featureType, featureVal = line.split(" ", 1) if featureType in ["fun", "get", "set"]: retType, name, value, param1, param2 = decodeFunction(featureVal) p1 = decodeParam(param1) @@ -72,7 +71,7 @@ class Face: "Param2Type": p2[0], "Param2Name": p2[1], "Param2Value": p2[2], "Category": currentCategory, "Comment": currentComment } - if self.values.has_key(value): + if value in self.values: raise "Duplicate value " + value + " " + name self.values[value] = 1 self.order.append(name) @@ -84,21 +83,25 @@ class Face: "Value": value, "Category": currentCategory, "Comment": currentComment } - if self.events.has_key(value): + if value in self.events: raise "Duplicate event " + value + " " + name self.events[value] = 1 self.order.append(name) elif featureType == "cat": currentCategory = featureVal elif featureType == "val": - name, value = string.split(featureVal, "=", 1) + try: + name, value = featureVal.split("=", 1) + except ValueError: + print("Failure %s" % featureVal) + raise self.features[name] = { "FeatureType": featureType, "Category": currentCategory, "Value": value } self.order.append(name) elif featureType == "enu" or featureType == "lex": - name, value = string.split(featureVal, "=", 1) + name, value = featureVal.split("=", 1) self.features[name] = { "FeatureType": featureType, "Category": currentCategory, diff --git a/ext/scintilla/include/HFacer.py b/ext/scintilla/include/HFacer.py index eacffe563..1dc25beda 100644 --- a/ext/scintilla/include/HFacer.py +++ b/ext/scintilla/include/HFacer.py @@ -1,16 +1,16 @@ +#!/usr/bin/env python # HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface # definition file. -# The header files are copied to a temporary file apart from the section between a //++Autogenerated -# comment and a //--Autogenerated comment which is generated by the printHFile and printLexHFile +# The header files are copied to a temporary file apart from the section between a /* ++Autogenerated*/ +# comment and a /* --Autogenerated*/ comment which is generated by the printHFile and printLexHFile # functions. After the temporary file is created, it is copied back to the original file name. -import string import sys import os import Face def Contains(s,sub): - return string.find(s, sub) != -1 + return s.find(sub) != -1 def printLexHFile(f,out): for name in f.order: @@ -24,10 +24,10 @@ def printHFile(f,out): v = f.features[name] if v["Category"] != "Deprecated": if v["FeatureType"] in ["fun", "get", "set"]: - featureDefineName = "SCI_" + string.upper(name) + featureDefineName = "SCI_" + name.upper() out.write("#define " + featureDefineName + " " + v["Value"] + "\n") elif v["FeatureType"] in ["evt"]: - featureDefineName = "SCN_" + string.upper(name) + featureDefineName = "SCN_" + name.upper() out.write("#define " + featureDefineName + " " + v["Value"] + "\n") elif v["FeatureType"] in ["val"]: if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): @@ -38,15 +38,15 @@ def CopyWithInsertion(input, output, genfn, definition): for line in input.readlines(): if copying: output.write(line) - if Contains(line, "//++Autogenerated"): + if Contains(line, "/* ++Autogenerated"): copying = 0 genfn(definition, output) - if Contains(line, "//--Autogenerated"): + if Contains(line, "/* --Autogenerated"): copying = 1 output.write(line) def contents(filename): - f = file(filename) + f = open(filename) t = f.read() f.close() return t @@ -71,6 +71,6 @@ try: f.ReadFromFile("Scintilla.iface") Regenerate("Scintilla.h", printHFile, f) Regenerate("SciLexer.h", printLexHFile, f) - print "Maximum ID is", max([x for x in f.values if int(x) < 3000]) + print("Maximum ID is %s" % max([x for x in f.values if int(x) < 3000])) except: raise diff --git a/ext/scintilla/include/ILexer.h b/ext/scintilla/include/ILexer.h new file mode 100644 index 000000000..15d2c9963 --- /dev/null +++ b/ext/scintilla/include/ILexer.h @@ -0,0 +1,69 @@ +// Scintilla source code edit control +/** @file ILexer.h + ** Interface between Scintilla and lexers. + **/ +// Copyright 1998-2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef ILEXER_H +#define ILEXER_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +#ifdef _WIN32 + #define SCI_METHOD __stdcall +#else + #define SCI_METHOD +#endif + +enum { dvOriginal=0 }; + +class IDocument { +public: + virtual int SCI_METHOD Version() const = 0; + virtual void SCI_METHOD SetErrorStatus(int status) = 0; + virtual int SCI_METHOD Length() const = 0; + virtual void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const = 0; + virtual char SCI_METHOD StyleAt(int position) const = 0; + virtual int SCI_METHOD LineFromPosition(int position) const = 0; + virtual int SCI_METHOD LineStart(int line) const = 0; + virtual int SCI_METHOD GetLevel(int line) const = 0; + virtual int SCI_METHOD SetLevel(int line, int level) = 0; + virtual int SCI_METHOD GetLineState(int line) const = 0; + virtual int SCI_METHOD SetLineState(int line, int state) = 0; + virtual void SCI_METHOD StartStyling(int position, char mask) = 0; + virtual bool SCI_METHOD SetStyleFor(int length, char style) = 0; + virtual bool SCI_METHOD SetStyles(int length, const char *styles) = 0; + virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0; + virtual void SCI_METHOD DecorationFillRange(int position, int value, int fillLength) = 0; + virtual void SCI_METHOD ChangeLexerState(int start, int end) = 0; + virtual int SCI_METHOD CodePage() const = 0; + virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0; + virtual const char * SCI_METHOD BufferPointer() = 0; + virtual int SCI_METHOD GetLineIndentation(int line) = 0; +}; + +enum { lvOriginal=0 }; + +class ILexer { +public: + virtual int SCI_METHOD Version() const = 0; + virtual void SCI_METHOD Release() = 0; + virtual const char * SCI_METHOD PropertyNames() = 0; + virtual int SCI_METHOD PropertyType(const char *name) = 0; + virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0; + virtual int SCI_METHOD PropertySet(const char *key, const char *val) = 0; + virtual const char * SCI_METHOD DescribeWordListSets() = 0; + virtual int SCI_METHOD WordListSet(int n, const char *wl) = 0; + virtual void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; + virtual void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; + virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/ext/scintilla/include/KeyWords.h b/ext/scintilla/include/KeyWords.h deleted file mode 100644 index b9f88ac0b..000000000 --- a/ext/scintilla/include/KeyWords.h +++ /dev/null @@ -1,90 +0,0 @@ -// Scintilla source code edit control -/** @file KeyWords.h - ** Colourise for particular languages. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -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 - * module appropriate to a particular language. - */ -class LexerModule { -protected: - const LexerModule *next; - int language; - LexerFunction fnLexer; - LexerFunction fnFolder; - const char * const * wordListDescriptions; - int styleBits; - - static const LexerModule *base; - static int nextLanguage; - -public: - const char *languageName; - LexerModule(int language_, - LexerFunction fnLexer_, - const char *languageName_=0, - LexerFunction fnFolder_=0, - const char * const wordListDescriptions_[] = NULL, - int styleBits_=5); - virtual ~LexerModule() { - } - int GetLanguage() const { return language; } - - // -1 is returned if no WordList information is available - int GetNumWordLists() const; - const char *GetWordListDescription(int index) const; - - int GetStyleBitsNeeded() const; - - virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - static const LexerModule *Find(int language); - static const LexerModule *Find(const char *languageName); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -/** - * Check if a character is a space. - * This is ASCII specific but is safe with chars >= 0x80. - */ -inline bool isspacechar(unsigned char ch) { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -inline bool iswordchar(char ch) { - return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_'); -} - -inline bool iswordstart(char ch) { - return isascii(ch) && (isalnum(ch) || ch == '_'); -} - -inline bool isoperator(char ch) { - if (isascii(ch) && isalnum(ch)) - return false; - // '.' left out as it is used to make up numbers - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} diff --git a/ext/scintilla/include/Platform.h b/ext/scintilla/include/Platform.h index bfac74b6b..99a23027a 100644 --- a/ext/scintilla/include/Platform.h +++ b/ext/scintilla/include/Platform.h @@ -3,7 +3,7 @@ ** Interface to platform facilities. Also includes some basic utilities. ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows. **/ -// Copyright 1998-2003 by Neil Hodgson +// Copyright 1998-2009 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef PLATFORM_H @@ -16,6 +16,7 @@ #define PLAT_GTK 0 #define PLAT_GTK_WIN32 0 +#define PLAT_GTK_MACOSX 0 #define PLAT_MACOSX 0 #define PLAT_WIN 0 #define PLAT_WX 0 @@ -38,7 +39,13 @@ #define PLAT_GTK_WIN32 1 #endif -#elif defined(MACOSX) +#if defined(__APPLE__) +#undef PLAT_GTK_MACOSX +#define PLAT_GTK_MACOSX 1 +#endif + +#elif defined(__APPLE__) + #undef PLAT_MACOSX #define PLAT_MACOSX 1 @@ -254,8 +261,8 @@ class Palette { int allocatedLen; #endif // Private so Palette objects can not be copied - Palette(const Palette &) {} - Palette &operator=(const Palette &) { return *this; } + Palette(const Palette &); + Palette &operator=(const Palette &); public: #if PLAT_WIN void *hpal; @@ -282,26 +289,29 @@ public: */ class Font { protected: - FontID id; + FontID fid; #if PLAT_WX int ascent; #endif // Private so Font objects can not be copied - Font(const Font &) {} - Font &operator=(const Font &) { id=0; return *this; } + Font(const Font &); + Font &operator=(const Font &); public: Font(); virtual ~Font(); virtual void Create(const char *faceName, int characterSet, int size, - bool bold, bool italic, bool extraFontFlag=false); + bool bold, bool italic, int extraFontFlag=0); virtual void Release(); - FontID GetID() { return id; } + FontID GetID() { return fid; } // Alias another font - caller guarantees not to Release - void SetID(FontID id_) { id = id_; } + void SetID(FontID fid_) { fid = fid_; } +#if PLAT_WX + void SetAscent(int ascent_) { ascent = ascent_; } +#endif friend class Surface; - friend class SurfaceImpl; + friend class SurfaceImpl; }; /** @@ -313,8 +323,8 @@ private: Surface(const Surface &) {} Surface &operator=(const Surface &) { return *this; } public: - Surface() {}; - virtual ~Surface() {}; + Surface() {} + virtual ~Surface() {} static Surface *Allocate(); virtual void Init(WindowID wid)=0; @@ -335,6 +345,7 @@ public: virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, ColourAllocated outline, int alphaOutline, int flags)=0; + virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0; virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; @@ -370,31 +381,31 @@ typedef void (*CallBackAction)(void*); */ class Window { protected: - WindowID id; + WindowID wid; #if PLAT_MACOSX void *windowRef; void *control; #endif public: - Window() : id(0), cursorLast(cursorInvalid) { + Window() : wid(0), cursorLast(cursorInvalid) { #if PLAT_MACOSX windowRef = 0; control = 0; #endif } - Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) { + Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) { #if PLAT_MACOSX windowRef = 0; control = 0; #endif } virtual ~Window(); - Window &operator=(WindowID id_) { - id = id_; + Window &operator=(WindowID wid_) { + wid = wid_; return *this; } - WindowID GetID() const { return id; } - bool Created() const { return id != 0; } + WindowID GetID() const { return wid; } + bool Created() const { return wid != 0; } void Destroy(); bool HasFocus(); PRectangle GetPosition(); @@ -410,8 +421,8 @@ public: void SetTitle(const char *s); PRectangle GetMonitorRect(Point pt); #if PLAT_MACOSX - void SetWindow(void *ref) { windowRef = ref; }; - void SetControl(void *_control) { control = _control; }; + void SetWindow(void *ref) { windowRef = ref; } + void SetControl(void *_control) { control = _control; } #endif private: Cursor cursorLast; @@ -442,6 +453,7 @@ public: virtual int Find(const char *prefix)=0; virtual void GetValue(int n, char *value, int len)=0; virtual void RegisterImage(int type, const char *xpm_data)=0; + virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) = 0; virtual void ClearRegisteredImages()=0; virtual void SetDoubleClickAction(CallBackAction, void *)=0; virtual void SetList(const char* list, char separator, char typesep)=0; @@ -451,10 +463,10 @@ public: * Menu management. */ class Menu { - MenuID id; + MenuID mid; public: Menu(); - MenuID GetID() { return id; } + MenuID GetID() { return mid; } void CreatePopUp(); void Destroy(); void Show(Point pt, Window &w); @@ -473,7 +485,7 @@ public: */ class DynamicLibrary { public: - virtual ~DynamicLibrary() {}; + virtual ~DynamicLibrary() {} /// @return Pointer to function "name", or NULL on failure. virtual Function FindFunction(const char *name) = 0; diff --git a/ext/scintilla/include/PropSet.h b/ext/scintilla/include/PropSet.h deleted file mode 100644 index 488d3bbfe..000000000 --- a/ext/scintilla/include/PropSet.h +++ /dev/null @@ -1,104 +0,0 @@ -// Scintilla source code edit control -/** @file PropSet.h - ** A Java style properties file module. - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef PROPSET_H -#define PROPSET_H -#include "SString.h" - -bool EqualCaseInsensitive(const char *a, const char *b); - -bool isprefix(const char *target, const char *prefix); - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -struct Property { - unsigned int hash; - char *key; - char *val; - Property *next; - Property() : hash(0), key(0), val(0), next(0) {} -}; - -/** - */ -class PropSet { -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; - } - -public: - PropSet *superPS; - PropSet(); - ~PropSet(); - void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1); - void Set(const char *keyVal); - void Unset(const char *key, int lenKey=-1); - void SetMultiple(const char *s); - SString Get(const char *key) const; - SString GetExpanded(const char *key) const; - SString Expand(const char *withVars, int maxExpands=100) const; - int GetInt(const char *key, int defaultValue=0) const; - void Clear(); - char *ToString() const; // Caller must delete[] the return value - -private: - // copy-value semantics not implemented - PropSet(const PropSet ©); - void operator=(const PropSet &assign); -}; - -/** - */ -class WordList { -public: - // Each word contains at least one character - a empty word acts as sentinel at the end. - char **words; - char *list; - int len; - bool onlyLineEnds; ///< Delimited by any white space or only line ends - bool sorted; - int starts[256]; - WordList(bool onlyLineEnds_ = false) : - words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), - sorted(false) - {} - ~WordList() { Clear(); } - operator bool() { return len ? true : false; } - void Clear(); - void Set(const char *s); - bool InList(const char *s); - bool InListAbbreviated(const char *s, const char marker); -}; - -inline bool IsAlphabetic(unsigned int ch) { - return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z')); -} - -#ifdef SCI_NAMESPACE -} -#endif - -#ifdef _MSC_VER -// Visual C++ doesn't like the private copy idiom for disabling -// the default copy constructor and operator=, but it's fine. -#pragma warning(disable: 4511 4512) -#endif - -#endif diff --git a/ext/scintilla/include/SString.h b/ext/scintilla/include/SString.h deleted file mode 100644 index e376f59c1..000000000 --- a/ext/scintilla/include/SString.h +++ /dev/null @@ -1,289 +0,0 @@ -// SciTE - Scintilla based Text Editor -/** @file SString.h - ** A simple string class. - **/ -// Copyright 1998-2004 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SSTRING_H -#define SSTRING_H - - -// These functions are implemented because each platform calls them something different. -int CompareCaseInsensitive(const char *a, const char *b); -int CompareNCaseInsensitive(const char *a, const char *b, size_t len); -bool EqualCaseInsensitive(const char *a, const char *b); - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// Define another string class. -// While it would be 'better' to use std::string, that doubles the executable size. -// An SString may contain embedded nul characters. - -/** - * Base class from which the two other classes (SBuffer & SString) - * are derived. - */ -class SContainer { -public: - /** Type of string lengths (sizes) and positions (indexes). */ - typedef size_t lenpos_t; - /** Out of bounds value indicating that the string argument should be measured. */ - enum { measure_length=0xffffffffU}; - -protected: - char *s; ///< The C string - lenpos_t sSize; ///< The size of the buffer, less 1: ie. the maximum size of the string - - SContainer() : s(0), sSize(0) {} - ~SContainer() { - delete []s; // Suppose it was allocated using StringAllocate - s = 0; - sSize = 0; - } - /** Size of buffer. */ - lenpos_t size() const { - if (s) { - return sSize; - } else { - return 0; - } - } -public: - /** - * Allocate uninitialized memory big enough to fit a string of the given length. - * @return the pointer to the new string - */ - static char *StringAllocate(lenpos_t len); - /** - * Duplicate a buffer/C string. - * Allocate memory of the given size, or big enough to fit the string if length isn't given; - * then copy the given string in the allocated memory. - * @return the pointer to the new string - */ - static char *StringAllocate( - const char *s, ///< The string to duplicate - lenpos_t len=measure_length); ///< The length of memory to allocate. Optional. -}; - - -/** - * @brief A string buffer class. - * - * Main use is to ask an API the length of a string it can provide, - * then to allocate a buffer of the given size, and to provide this buffer - * to the API to put the string. - * This class is intended to be shortlived, to be transformed as SString - * as soon as it holds the string, so it has little members. - * Note: we assume the buffer is filled by the API. If the length can be shorter, - * we should set sLen to strlen(sb.ptr()) in related SString constructor and assignment. - */ -class SBuffer : protected SContainer { -public: - SBuffer(lenpos_t len) { - s = StringAllocate(len); - if (s) { - *s = '\0'; - sSize = len; - } else { - sSize = 0; - } - } -private: - /// Copy constructor - // Here only to be on the safe size, user should avoid returning SBuffer values. - SBuffer(const SBuffer &source) : SContainer() { - s = StringAllocate(source.s, source.sSize); - sSize = (s) ? source.sSize : 0; - } - /// Default assignment operator - // Same here, shouldn't be used - SBuffer &operator=(const SBuffer &source) { - if (this != &source) { - delete []s; - s = StringAllocate(source.s, source.sSize); - sSize = (s) ? source.sSize : 0; - } - return *this; - } -public: - /** Provide direct read/write access to buffer. */ - char *ptr() { - return s; - } - /** Ownership of the buffer have been taken, so release it. */ - void reset() { - s = 0; - sSize = 0; - } - /** Size of buffer. */ - lenpos_t size() const { - return SContainer::size(); - } -}; - - -/** - * @brief A simple string class. - * - * Hold the length of the string for quick operations, - * can have a buffer bigger than the string to avoid too many memory allocations and copies. - * May have embedded zeroes as a result of @a substitute, but relies too heavily on C string - * functions to allow reliable manipulations of these strings, other than simple appends, etc. - */ -class SString : protected SContainer { - lenpos_t sLen; ///< The size of the string in s - lenpos_t sizeGrowth; ///< Minimum growth size when appending strings - enum { sizeGrowthDefault = 64 }; - - bool grow(lenpos_t lenNew); - SString &assign(const char *sOther, lenpos_t sSize_=measure_length); - -public: - SString() : sLen(0), sizeGrowth(sizeGrowthDefault) {} - SString(const SString &source) : SContainer(), sizeGrowth(sizeGrowthDefault) { - s = StringAllocate(source.s, source.sLen); - sSize = sLen = (s) ? source.sLen : 0; - } - SString(const char *s_) : sizeGrowth(sizeGrowthDefault) { - s = StringAllocate(s_); - sSize = sLen = (s) ? strlen(s) : 0; - } - SString(SBuffer &buf) : sizeGrowth(sizeGrowthDefault) { - s = buf.ptr(); - sSize = sLen = buf.size(); - // Consumes the given buffer! - buf.reset(); - } - SString(const char *s_, lenpos_t first, lenpos_t last) : sizeGrowth(sizeGrowthDefault) { - // note: expects the "last" argument to point one beyond the range end (a la STL iterators) - s = StringAllocate(s_ + first, last - first); - sSize = sLen = (s) ? last - first : 0; - } - SString(int i); - SString(double d, int precision); - ~SString() { - sLen = 0; - } - void clear() { - if (s) { - *s = '\0'; - } - sLen = 0; - } - /** Size of buffer. */ - lenpos_t size() const { - return SContainer::size(); - } - /** Size of string in buffer. */ - lenpos_t length() const { - return sLen; - } - /** Read access to a character of the string. */ - char operator[](lenpos_t i) const { - return (s && i < sSize) ? s[i] : '\0'; - } - SString &operator=(const char *source) { - return assign(source); - } - SString &operator=(const SString &source) { - if (this != &source) { - assign(source.s, source.sLen); - } - return *this; - } - bool operator==(const SString &sOther) const; - bool operator!=(const SString &sOther) const { - return !operator==(sOther); - } - bool operator==(const char *sOther) const; - bool operator!=(const char *sOther) const { - return !operator==(sOther); - } - bool contains(char ch) const { - return (s && *s) ? strchr(s, ch) != 0 : false; - } - void setsizegrowth(lenpos_t sizeGrowth_) { - sizeGrowth = sizeGrowth_; - } - const char *c_str() const { - return s ? s : ""; - } - /** Give ownership of buffer to caller which must use delete[] to free buffer. */ - char *detach() { - char *sRet = s; - s = 0; - sSize = 0; - sLen = 0; - return sRet; - } - SString substr(lenpos_t subPos, lenpos_t subLen=measure_length) const; - SString &lowercase(lenpos_t subPos = 0, lenpos_t subLen=measure_length); - SString &uppercase(lenpos_t subPos = 0, lenpos_t subLen=measure_length); - SString &append(const char *sOther, lenpos_t sLenOther=measure_length, char sep = '\0'); - SString &operator+=(const char *sOther) { - return append(sOther, static_cast(measure_length)); - } - SString &operator+=(const SString &sOther) { - return append(sOther.s, sOther.sLen); - } - SString &operator+=(char ch) { - return append(&ch, 1); - } - SString &appendwithseparator(const char *sOther, char sep) { - return append(sOther, strlen(sOther), sep); - } - SString &insert(lenpos_t pos, const char *sOther, lenpos_t sLenOther=measure_length); - - /** - * Remove @a len characters from the @a pos position, included. - * Characters at pos + len and beyond replace characters at pos. - * If @a len is 0, or greater than the length of the string - * starting at @a pos, the string is just truncated at @a pos. - */ - void remove(lenpos_t pos, lenpos_t len); - - SString &change(lenpos_t pos, char ch) { - if (pos < sLen) { // character changed must be in string bounds - *(s + pos) = ch; - } - return *this; - } - /** Read an integral numeric value from the string. */ - int value() const { - return s ? atoi(s) : 0; - } - bool startswith(const char *prefix); - bool endswith(const char *suffix); - int search(const char *sFind, lenpos_t start=0) const; - bool contains(const char *sFind) const { - return search(sFind) >= 0; - } - int substitute(char chFind, char chReplace); - int substitute(const char *sFind, const char *sReplace); - int remove(const char *sFind) { - return substitute(sFind, ""); - } -}; - - -/** - * Duplicate a C string. - * Allocate memory of the given size, or big enough to fit the string if length isn't given; - * then copy the given string in the allocated memory. - * @return the pointer to the new string - */ -inline char *StringDup( - const char *s, ///< The string to duplicate - SContainer::lenpos_t len=SContainer::measure_length) ///< The length of memory to allocate. Optional. -{ - return SContainer::StringAllocate(s, len); -} - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/ext/scintilla/include/SciLexer.h b/ext/scintilla/include/SciLexer.h index a900be6db..5f6c9bda1 100644 --- a/ext/scintilla/include/SciLexer.h +++ b/ext/scintilla/include/SciLexer.h @@ -1,19 +1,19 @@ -// Scintilla source code edit control +/* Scintilla source code edit control */ /** @file SciLexer.h ** Interface to the added lexer functions in the SciLexer version of the edit control. **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. +/* Copyright 1998-2002 by Neil Hodgson + * The License.txt file describes the conditions under which this software may be distributed. */ -// Most of this file is automatically generated from the Scintilla.iface interface definition -// file which contains any comments about the definitions. HFacer.py does the generation. +/* Most of this file is automatically generated from the Scintilla.iface interface definition + * file which contains any comments about the definitions. HFacer.py does the generation. */ #ifndef SCILEXER_H #define SCILEXER_H -// SciLexer features - not in standard Scintilla +/* SciLexer features - not in standard Scintilla */ -//++Autogenerated -- start of section automatically generated from Scintilla.iface +/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ #define SCLEX_CONTAINER 0 #define SCLEX_NULL 1 #define SCLEX_PYTHON 2 @@ -103,6 +103,17 @@ #define SCLEX_POWERSHELL 88 #define SCLEX_MYSQL 89 #define SCLEX_PO 90 +#define SCLEX_TAL 91 +#define SCLEX_COBOL 92 +#define SCLEX_TACL 93 +#define SCLEX_SORCUS 94 +#define SCLEX_POWERPRO 95 +#define SCLEX_NIMROD 96 +#define SCLEX_SML 97 +#define SCLEX_MARKDOWN 98 +#define SCLEX_TXT2TAGS 99 +#define SCLEX_A68K 100 +#define SCLEX_MODULA 101 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 @@ -140,6 +151,8 @@ #define SCE_C_COMMENTDOCKEYWORD 17 #define SCE_C_COMMENTDOCKEYWORDERROR 18 #define SCE_C_GLOBALCLASS 19 +#define SCE_C_STRINGRAW 20 +#define SCE_C_TRIPLEVERBATIM 21 #define SCE_D_DEFAULT 0 #define SCE_D_COMMENT 1 #define SCE_D_COMMENTLINE 2 @@ -158,6 +171,11 @@ #define SCE_D_COMMENTLINEDOC 15 #define SCE_D_COMMENTDOCKEYWORD 16 #define SCE_D_COMMENTDOCKEYWORDERROR 17 +#define SCE_D_STRINGB 18 +#define SCE_D_STRINGR 19 +#define SCE_D_WORD5 20 +#define SCE_D_WORD6 21 +#define SCE_D_WORD7 22 #define SCE_TCL_DEFAULT 0 #define SCE_TCL_COMMENT 1 #define SCE_TCL_COMMENTLINE 2 @@ -326,6 +344,16 @@ #define SCE_PL_SUB_PROTOTYPE 40 #define SCE_PL_FORMAT_IDENT 41 #define SCE_PL_FORMAT 42 +#define SCE_PL_STRING_VAR 43 +#define SCE_PL_XLAT 44 +#define SCE_PL_REGEX_VAR 54 +#define SCE_PL_REGSUBST_VAR 55 +#define SCE_PL_BACKTICKS_VAR 57 +#define SCE_PL_HERE_QQ_VAR 61 +#define SCE_PL_HERE_QX_VAR 62 +#define SCE_PL_STRING_QQ_VAR 64 +#define SCE_PL_STRING_QX_VAR 65 +#define SCE_PL_STRING_QR_VAR 66 #define SCE_RB_DEFAULT 0 #define SCE_RB_ERROR 1 #define SCE_RB_COMMENTLINE 2 @@ -390,6 +418,14 @@ #define SCE_L_TAG 2 #define SCE_L_MATH 3 #define SCE_L_COMMENT 4 +#define SCE_L_TAG2 5 +#define SCE_L_MATH2 6 +#define SCE_L_COMMENT2 7 +#define SCE_L_VERBATIM 8 +#define SCE_L_SHORTCMD 9 +#define SCE_L_SPECIAL 10 +#define SCE_L_CMDOPT 11 +#define SCE_L_ERROR 12 #define SCE_LUA_DEFAULT 0 #define SCE_LUA_COMMENT 1 #define SCE_LUA_COMMENTLINE 2 @@ -410,6 +446,7 @@ #define SCE_LUA_WORD6 17 #define SCE_LUA_WORD7 18 #define SCE_LUA_WORD8 19 +#define SCE_LUA_LABEL 20 #define SCE_ERR_DEFAULT 0 #define SCE_ERR_PYTHON 1 #define SCE_ERR_GCC 2 @@ -587,6 +624,7 @@ #define SCE_ASM_CHARACTER 12 #define SCE_ASM_STRINGEOL 13 #define SCE_ASM_EXTINSTRUCTION 14 +#define SCE_ASM_COMMENTDIRECTIVE 15 #define SCE_F_DEFAULT 0 #define SCE_F_COMMENT 1 #define SCE_F_NUMBER 2 @@ -624,6 +662,7 @@ #define SCE_CSS_EXTENDED_IDENTIFIER 19 #define SCE_CSS_EXTENDED_PSEUDOCLASS 20 #define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 +#define SCE_CSS_MEDIA 22 #define SCE_POV_DEFAULT 0 #define SCE_POV_COMMENT 1 #define SCE_POV_COMMENTLINE 2 @@ -776,8 +815,19 @@ #define SCE_ERLANG_CHARACTER 9 #define SCE_ERLANG_MACRO 10 #define SCE_ERLANG_RECORD 11 -#define SCE_ERLANG_SEPARATOR 12 +#define SCE_ERLANG_PREPROC 12 #define SCE_ERLANG_NODE_NAME 13 +#define SCE_ERLANG_COMMENT_FUNCTION 14 +#define SCE_ERLANG_COMMENT_MODULE 15 +#define SCE_ERLANG_COMMENT_DOC 16 +#define SCE_ERLANG_COMMENT_DOC_MACRO 17 +#define SCE_ERLANG_ATOM_QUOTED 18 +#define SCE_ERLANG_MACRO_QUOTED 19 +#define SCE_ERLANG_RECORD_QUOTED 20 +#define SCE_ERLANG_NODE_NAME_QUOTED 21 +#define SCE_ERLANG_BIFS 22 +#define SCE_ERLANG_MODULES 23 +#define SCE_ERLANG_MODULES_ATT 24 #define SCE_ERLANG_UNKNOWN 31 #define SCE_MSSQL_DEFAULT 0 #define SCE_MSSQL_COMMENT 1 @@ -926,6 +976,7 @@ #define SCE_CAML_OPERATOR 7 #define SCE_CAML_NUMBER 8 #define SCE_CAML_CHAR 9 +#define SCE_CAML_WHITE 10 #define SCE_CAML_STRING 11 #define SCE_CAML_COMMENT 12 #define SCE_CAML_COMMENT1 13 @@ -1056,11 +1107,19 @@ #define SCE_FS_DATE 16 #define SCE_FS_STRINGEOL 17 #define SCE_FS_CONSTANT 18 -#define SCE_FS_ASM 19 -#define SCE_FS_LABEL 20 -#define SCE_FS_ERROR 21 -#define SCE_FS_HEXNUMBER 22 -#define SCE_FS_BINNUMBER 23 +#define SCE_FS_WORDOPERATOR 19 +#define SCE_FS_DISABLEDCODE 20 +#define SCE_FS_DEFAULT_C 21 +#define SCE_FS_COMMENTDOC_C 22 +#define SCE_FS_COMMENTLINEDOC_C 23 +#define SCE_FS_KEYWORD_C 24 +#define SCE_FS_KEYWORD2_C 25 +#define SCE_FS_NUMBER_C 26 +#define SCE_FS_STRING_C 27 +#define SCE_FS_PREPROCESSOR_C 28 +#define SCE_FS_OPERATOR_C 29 +#define SCE_FS_IDENTIFIER_C 30 +#define SCE_FS_STRINGEOL_C 31 #define SCE_CSOUND_DEFAULT 0 #define SCE_CSOUND_COMMENT 1 #define SCE_CSOUND_NUMBER 2 @@ -1083,7 +1142,7 @@ #define SCE_INNO_PARAMETER 3 #define SCE_INNO_SECTION 4 #define SCE_INNO_PREPROC 5 -#define SCE_INNO_PREPROC_INLINE 6 +#define SCE_INNO_INLINE_EXPANSION 6 #define SCE_INNO_COMMENT_PASCAL 7 #define SCE_INNO_KEYWORD_PASCAL 8 #define SCE_INNO_KEYWORD_USER 9 @@ -1241,6 +1300,9 @@ #define SCE_POWERSHELL_KEYWORD 8 #define SCE_POWERSHELL_CMDLET 9 #define SCE_POWERSHELL_ALIAS 10 +#define SCE_POWERSHELL_FUNCTION 11 +#define SCE_POWERSHELL_USER1 12 +#define SCE_POWERSHELL_COMMENTSTREAM 13 #define SCE_MYSQL_DEFAULT 0 #define SCE_MYSQL_COMMENT 1 #define SCE_MYSQL_COMMENTLINE 2 @@ -1262,6 +1324,7 @@ #define SCE_MYSQL_USER1 18 #define SCE_MYSQL_USER2 19 #define SCE_MYSQL_USER3 20 +#define SCE_MYSQL_HIDDENCOMMAND 21 #define SCE_PO_DEFAULT 0 #define SCE_PO_COMMENT 1 #define SCE_PO_MSGID 2 @@ -1271,8 +1334,148 @@ #define SCE_PO_MSGCTXT 6 #define SCE_PO_MSGCTXT_TEXT 7 #define SCE_PO_FUZZY 8 -#define SCLEX_ASP 29 -#define SCLEX_PHP 30 -//--Autogenerated -- end of section automatically generated from Scintilla.iface +#define SCE_PAS_DEFAULT 0 +#define SCE_PAS_IDENTIFIER 1 +#define SCE_PAS_COMMENT 2 +#define SCE_PAS_COMMENT2 3 +#define SCE_PAS_COMMENTLINE 4 +#define SCE_PAS_PREPROCESSOR 5 +#define SCE_PAS_PREPROCESSOR2 6 +#define SCE_PAS_NUMBER 7 +#define SCE_PAS_HEXNUMBER 8 +#define SCE_PAS_WORD 9 +#define SCE_PAS_STRING 10 +#define SCE_PAS_STRINGEOL 11 +#define SCE_PAS_CHARACTER 12 +#define SCE_PAS_OPERATOR 13 +#define SCE_PAS_ASM 14 +#define SCE_SORCUS_DEFAULT 0 +#define SCE_SORCUS_COMMAND 1 +#define SCE_SORCUS_PARAMETER 2 +#define SCE_SORCUS_COMMENTLINE 3 +#define SCE_SORCUS_STRING 4 +#define SCE_SORCUS_STRINGEOL 5 +#define SCE_SORCUS_IDENTIFIER 6 +#define SCE_SORCUS_OPERATOR 7 +#define SCE_SORCUS_NUMBER 8 +#define SCE_SORCUS_CONSTANT 9 +#define SCE_POWERPRO_DEFAULT 0 +#define SCE_POWERPRO_COMMENTBLOCK 1 +#define SCE_POWERPRO_COMMENTLINE 2 +#define SCE_POWERPRO_NUMBER 3 +#define SCE_POWERPRO_WORD 4 +#define SCE_POWERPRO_WORD2 5 +#define SCE_POWERPRO_WORD3 6 +#define SCE_POWERPRO_WORD4 7 +#define SCE_POWERPRO_DOUBLEQUOTEDSTRING 8 +#define SCE_POWERPRO_SINGLEQUOTEDSTRING 9 +#define SCE_POWERPRO_LINECONTINUE 10 +#define SCE_POWERPRO_OPERATOR 11 +#define SCE_POWERPRO_IDENTIFIER 12 +#define SCE_POWERPRO_STRINGEOL 13 +#define SCE_POWERPRO_VERBATIM 14 +#define SCE_POWERPRO_ALTQUOTE 15 +#define SCE_POWERPRO_FUNCTION 16 +#define SCE_SML_DEFAULT 0 +#define SCE_SML_IDENTIFIER 1 +#define SCE_SML_TAGNAME 2 +#define SCE_SML_KEYWORD 3 +#define SCE_SML_KEYWORD2 4 +#define SCE_SML_KEYWORD3 5 +#define SCE_SML_LINENUM 6 +#define SCE_SML_OPERATOR 7 +#define SCE_SML_NUMBER 8 +#define SCE_SML_CHAR 9 +#define SCE_SML_STRING 11 +#define SCE_SML_COMMENT 12 +#define SCE_SML_COMMENT1 13 +#define SCE_SML_COMMENT2 14 +#define SCE_SML_COMMENT3 15 +#define SCE_MARKDOWN_DEFAULT 0 +#define SCE_MARKDOWN_LINE_BEGIN 1 +#define SCE_MARKDOWN_STRONG1 2 +#define SCE_MARKDOWN_STRONG2 3 +#define SCE_MARKDOWN_EM1 4 +#define SCE_MARKDOWN_EM2 5 +#define SCE_MARKDOWN_HEADER1 6 +#define SCE_MARKDOWN_HEADER2 7 +#define SCE_MARKDOWN_HEADER3 8 +#define SCE_MARKDOWN_HEADER4 9 +#define SCE_MARKDOWN_HEADER5 10 +#define SCE_MARKDOWN_HEADER6 11 +#define SCE_MARKDOWN_PRECHAR 12 +#define SCE_MARKDOWN_ULIST_ITEM 13 +#define SCE_MARKDOWN_OLIST_ITEM 14 +#define SCE_MARKDOWN_BLOCKQUOTE 15 +#define SCE_MARKDOWN_STRIKEOUT 16 +#define SCE_MARKDOWN_HRULE 17 +#define SCE_MARKDOWN_LINK 18 +#define SCE_MARKDOWN_CODE 19 +#define SCE_MARKDOWN_CODE2 20 +#define SCE_MARKDOWN_CODEBK 21 +#define SCE_TXT2TAGS_DEFAULT 0 +#define SCE_TXT2TAGS_LINE_BEGIN 1 +#define SCE_TXT2TAGS_STRONG1 2 +#define SCE_TXT2TAGS_STRONG2 3 +#define SCE_TXT2TAGS_EM1 4 +#define SCE_TXT2TAGS_EM2 5 +#define SCE_TXT2TAGS_HEADER1 6 +#define SCE_TXT2TAGS_HEADER2 7 +#define SCE_TXT2TAGS_HEADER3 8 +#define SCE_TXT2TAGS_HEADER4 9 +#define SCE_TXT2TAGS_HEADER5 10 +#define SCE_TXT2TAGS_HEADER6 11 +#define SCE_TXT2TAGS_PRECHAR 12 +#define SCE_TXT2TAGS_ULIST_ITEM 13 +#define SCE_TXT2TAGS_OLIST_ITEM 14 +#define SCE_TXT2TAGS_BLOCKQUOTE 15 +#define SCE_TXT2TAGS_STRIKEOUT 16 +#define SCE_TXT2TAGS_HRULE 17 +#define SCE_TXT2TAGS_LINK 18 +#define SCE_TXT2TAGS_CODE 19 +#define SCE_TXT2TAGS_CODE2 20 +#define SCE_TXT2TAGS_CODEBK 21 +#define SCE_TXT2TAGS_COMMENT 22 +#define SCE_TXT2TAGS_OPTION 23 +#define SCE_TXT2TAGS_PREPROC 24 +#define SCE_TXT2TAGS_POSTPROC 25 +#define SCE_A68K_DEFAULT 0 +#define SCE_A68K_COMMENT 1 +#define SCE_A68K_NUMBER_DEC 2 +#define SCE_A68K_NUMBER_BIN 3 +#define SCE_A68K_NUMBER_HEX 4 +#define SCE_A68K_STRING1 5 +#define SCE_A68K_OPERATOR 6 +#define SCE_A68K_CPUINSTRUCTION 7 +#define SCE_A68K_EXTINSTRUCTION 8 +#define SCE_A68K_REGISTER 9 +#define SCE_A68K_DIRECTIVE 10 +#define SCE_A68K_MACRO_ARG 11 +#define SCE_A68K_LABEL 12 +#define SCE_A68K_STRING2 13 +#define SCE_A68K_IDENTIFIER 14 +#define SCE_A68K_MACRO_DECLARATION 15 +#define SCE_A68K_COMMENT_WORD 16 +#define SCE_A68K_COMMENT_SPECIAL 17 +#define SCE_A68K_COMMENT_DOXYGEN 18 +#define SCE_MODULA_DEFAULT 0 +#define SCE_MODULA_COMMENT 1 +#define SCE_MODULA_DOXYCOMM 2 +#define SCE_MODULA_DOXYKEY 3 +#define SCE_MODULA_KEYWORD 4 +#define SCE_MODULA_RESERVED 5 +#define SCE_MODULA_NUMBER 6 +#define SCE_MODULA_BASENUM 7 +#define SCE_MODULA_FLOAT 8 +#define SCE_MODULA_STRING 9 +#define SCE_MODULA_STRSPEC 10 +#define SCE_MODULA_CHAR 11 +#define SCE_MODULA_CHARSPEC 12 +#define SCE_MODULA_PROC 13 +#define SCE_MODULA_PRAGMA 14 +#define SCE_MODULA_PRGKEY 15 +#define SCE_MODULA_OPERATOR 16 +#define SCE_MODULA_BADSTR 17 +/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ #endif diff --git a/ext/scintilla/include/Scintilla.h b/ext/scintilla/include/Scintilla.h index 1e0e28757..a5a9aadc3 100644 --- a/ext/scintilla/include/Scintilla.h +++ b/ext/scintilla/include/Scintilla.h @@ -1,32 +1,36 @@ -// Scintilla source code edit control +/* Scintilla source code edit control */ /** @file Scintilla.h ** Interface to the edit control. **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. +/* Copyright 1998-2003 by Neil Hodgson + * The License.txt file describes the conditions under which this software may be distributed. */ -// Most of this file is automatically generated from the Scintilla.iface interface definition -// file which contains any comments about the definitions. HFacer.py does the generation. +/* Most of this file is automatically generated from the Scintilla.iface interface definition + * file which contains any comments about the definitions. HFacer.py does the generation. */ #ifndef SCINTILLA_H #define SCINTILLA_H -#if LCCWIN -typedef BOOL bool; +#ifdef __cplusplus +extern "C" { #endif -#if PLAT_WIN -// Return false on failure: -bool Scintilla_RegisterClasses(void *hInstance); -bool Scintilla_ReleaseResources(); +#if defined(_WIN32) +/* Return false on failure: */ +int Scintilla_RegisterClasses(void *hInstance); +int Scintilla_ReleaseResources(); #endif int Scintilla_LinkLexers(); -// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to -// hold a pointer and sptr_t, a signed integer large enough to hold a pointer. -// May need to be changed for 64 bit platforms. -#if _MSC_VER >= 1300 -#include +#ifdef __cplusplus +} +#endif + +/* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to + * hold a pointer and sptr_t, a signed integer large enough to hold a pointer. + * May need to be changed for 64 bit platforms. */ +#if defined(_WIN32) +#include #endif #ifdef MAXULONG_PTR typedef ULONG_PTR uptr_t; @@ -38,7 +42,7 @@ typedef long sptr_t; typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); -//++Autogenerated -- start of section automatically generated from Scintilla.iface +/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ #define INVALID_POSITION -1 #define SCI_START 2000 #define SCI_OPTIONAL_START 3000 @@ -87,7 +91,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETTABWIDTH 2036 #define SCI_GETTABWIDTH 2121 #define SC_CP_UTF8 65001 -#define SC_CP_DBCS 1 #define SCI_SETCODEPAGE 2037 #define SCI_SETUSEPALETTE 2039 #define MARKER_MAX 31 @@ -119,6 +122,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MARK_PIXMAP 25 #define SC_MARK_FULLRECT 26 #define SC_MARK_LEFTRECT 27 +#define SC_MARK_AVAILABLE 28 +#define SC_MARK_UNDERLINE 29 +#define SC_MARK_RGBAIMAGE 30 #define SC_MARK_CHARACTER 10000 #define SC_MARKNUM_FOLDEREND 25 #define SC_MARKNUM_FOLDEROPENMID 26 @@ -131,6 +137,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_MARKERDEFINE 2040 #define SCI_MARKERSETFORE 2041 #define SCI_MARKERSETBACK 2042 +#define SCI_MARKERSETBACKSELECTED 2292 +#define SCI_MARKERENABLEHIGHLIGHT 2293 #define SCI_MARKERADD 2043 #define SCI_MARKERDELETE 2044 #define SCI_MARKERDELETEALL 2045 @@ -144,6 +152,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MARGIN_NUMBER 1 #define SC_MARGIN_BACK 2 #define SC_MARGIN_FORE 3 +#define SC_MARGIN_TEXT 4 +#define SC_MARGIN_RTEXT 5 #define SCI_SETMARGINTYPEN 2240 #define SCI_GETMARGINTYPEN 2241 #define SCI_SETMARGINWIDTHN 2242 @@ -152,6 +162,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETMARGINMASKN 2245 #define SCI_SETMARGINSENSITIVEN 2246 #define SCI_GETMARGINSENSITIVEN 2247 +#define SCI_SETMARGINCURSORN 2248 +#define SCI_GETMARGINCURSORN 2249 #define STYLE_DEFAULT 32 #define STYLE_LINENUMBER 33 #define STYLE_BRACELIGHT 34 @@ -236,6 +248,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define INDIC_HIDDEN 5 #define INDIC_BOX 6 #define INDIC_ROUNDBOX 7 +#define INDIC_STRAIGHTBOX 8 +#define INDIC_DASH 9 +#define INDIC_DOTS 10 +#define INDIC_SQUIGGLELOW 11 +#define INDIC_DOTBOX 12 #define INDIC_MAX 31 #define INDIC_CONTAINER 8 #define INDIC0_MASK 0x20 @@ -250,6 +267,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_INDICGETUNDER 2511 #define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEBACK 2085 +#define SCI_SETWHITESPACESIZE 2086 +#define SCI_GETWHITESPACESIZE 2087 #define SCI_SETSTYLEBITS 2090 #define SCI_GETSTYLEBITS 2091 #define SCI_SETLINESTATE 2092 @@ -317,6 +336,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETSELECTIONSTART 2143 #define SCI_SETSELECTIONEND 2144 #define SCI_GETSELECTIONEND 2145 +#define SCI_SETEMPTYSELECTION 2556 #define SCI_SETPRINTMAGNIFICATION 2146 #define SCI_GETPRINTMAGNIFICATION 2147 #define SC_PRINT_NORMAL 0 @@ -395,10 +415,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_FOLDLEVELBASE 0x400 #define SC_FOLDLEVELWHITEFLAG 0x1000 #define SC_FOLDLEVELHEADERFLAG 0x2000 -#define SC_FOLDLEVELBOXHEADERFLAG 0x4000 -#define SC_FOLDLEVELBOXFOOTERFLAG 0x8000 -#define SC_FOLDLEVELCONTRACTED 0x10000 -#define SC_FOLDLEVELUNINDENT 0x20000 #define SC_FOLDLEVELNUMBERMASK 0x0FFF #define SCI_SETFOLDLEVEL 2222 #define SCI_GETFOLDLEVEL 2223 @@ -416,7 +432,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define SC_FOLDFLAG_LEVELNUMBERS 0x0040 -#define SC_FOLDFLAG_BOX 0x0001 #define SCI_SETFOLDFLAGS 2233 #define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 #define SCI_SETTABINDENTS 2260 @@ -445,6 +460,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETWRAPVISUALFLAGSLOCATION 2463 #define SCI_SETWRAPSTARTINDENT 2464 #define SCI_GETWRAPSTARTINDENT 2465 +#define SC_WRAPINDENT_FIXED 0 +#define SC_WRAPINDENT_SAME 1 +#define SC_WRAPINDENT_INDENT 2 +#define SCI_SETWRAPINDENTMODE 2472 +#define SCI_GETWRAPINDENTMODE 2473 #define SC_CACHE_NONE 0 #define SC_CACHE_CARET 1 #define SC_CACHE_PAGE 2 @@ -464,6 +484,19 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_APPENDTEXT 2282 #define SCI_GETTWOPHASEDRAW 2283 #define SCI_SETTWOPHASEDRAW 2284 +#define SC_EFF_QUALITY_MASK 0xF +#define SC_EFF_QUALITY_DEFAULT 0 +#define SC_EFF_QUALITY_NON_ANTIALIASED 1 +#define SC_EFF_QUALITY_ANTIALIASED 2 +#define SC_EFF_QUALITY_LCD_OPTIMIZED 3 +#define SCI_SETFONTQUALITY 2611 +#define SCI_GETFONTQUALITY 2612 +#define SCI_SETFIRSTVISIBLELINE 2613 +#define SC_MULTIPASTE_ONCE 0 +#define SC_MULTIPASTE_EACH 1 +#define SCI_SETMULTIPASTE 2614 +#define SCI_GETMULTIPASTE 2615 +#define SCI_GETTAG 2616 #define SCI_TARGETFROMSELECTION 2287 #define SCI_LINESJOIN 2288 #define SCI_LINESSPLIT 2289 @@ -530,7 +563,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_MOVECARETINSIDEVIEW 2401 #define SCI_LINELENGTH 2350 #define SCI_BRACEHIGHLIGHT 2351 +#define SCI_BRACEHIGHLIGHTINDICATOR 2498 #define SCI_BRACEBADLIGHT 2352 +#define SCI_BRACEBADLIGHTINDICATOR 2499 #define SCI_BRACEMATCH 2353 #define SCI_GETVIEWEOL 2355 #define SCI_SETVIEWEOL 2356 @@ -560,12 +595,17 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETMODEVENTMASK 2378 #define SCI_SETFOCUS 2380 #define SCI_GETFOCUS 2381 +#define SC_STATUS_OK 0 +#define SC_STATUS_FAILURE 1 +#define SC_STATUS_BADALLOC 2 #define SCI_SETSTATUS 2382 #define SCI_GETSTATUS 2383 #define SCI_SETMOUSEDOWNCAPTURES 2384 #define SCI_GETMOUSEDOWNCAPTURES 2385 #define SC_CURSORNORMAL -1 +#define SC_CURSORARROW 2 #define SC_CURSORWAIT 4 +#define SC_CURSORREVERSEARROW 7 #define SCI_SETCURSOR 2386 #define SCI_GETCURSOR 2387 #define SCI_SETCONTROLCHARSYMBOL 2388 @@ -610,6 +650,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_SEL_STREAM 0 #define SC_SEL_RECTANGLE 1 #define SC_SEL_LINES 2 +#define SC_SEL_THIN 3 #define SCI_SETSELECTIONMODE 2422 #define SCI_GETSELECTIONMODE 2423 #define SCI_GETLINESELSTARTPOSITION 2424 @@ -634,6 +675,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETWHITESPACECHARS 2443 #define SCI_SETCHARSDEFAULT 2444 #define SCI_AUTOCGETCURRENT 2445 +#define SCI_AUTOCGETCURRENTTEXT 2610 #define SCI_ALLOCATE 2446 #define SCI_TARGETASUTF8 2447 #define SCI_SETLENGTHFORENCODE 2448 @@ -641,6 +683,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_FINDCOLUMN 2456 #define SCI_GETCARETSTICKY 2457 #define SCI_SETCARETSTICKY 2458 +#define SC_CARETSTICKY_OFF 0 +#define SC_CARETSTICKY_ON 1 +#define SC_CARETSTICKY_WHITESPACE 2 #define SCI_TOGGLECARETSTICKY 2459 #define SCI_SETPASTECONVERTENDINGS 2467 #define SCI_GETPASTECONVERTENDINGS 2468 @@ -671,6 +716,109 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETCHARACTERPOINTER 2520 #define SCI_SETKEYSUNICODE 2521 #define SCI_GETKEYSUNICODE 2522 +#define SCI_INDICSETALPHA 2523 +#define SCI_INDICGETALPHA 2524 +#define SCI_INDICSETOUTLINEALPHA 2558 +#define SCI_INDICGETOUTLINEALPHA 2559 +#define SCI_SETEXTRAASCENT 2525 +#define SCI_GETEXTRAASCENT 2526 +#define SCI_SETEXTRADESCENT 2527 +#define SCI_GETEXTRADESCENT 2528 +#define SCI_MARKERSYMBOLDEFINED 2529 +#define SCI_MARGINSETTEXT 2530 +#define SCI_MARGINGETTEXT 2531 +#define SCI_MARGINSETSTYLE 2532 +#define SCI_MARGINGETSTYLE 2533 +#define SCI_MARGINSETSTYLES 2534 +#define SCI_MARGINGETSTYLES 2535 +#define SCI_MARGINTEXTCLEARALL 2536 +#define SCI_MARGINSETSTYLEOFFSET 2537 +#define SCI_MARGINGETSTYLEOFFSET 2538 +#define SC_MARGINOPTION_NONE 0 +#define SC_MARGINOPTION_SUBLINESELECT 1 +#define SCI_SETMARGINOPTIONS 2539 +#define SCI_GETMARGINOPTIONS 2557 +#define SCI_ANNOTATIONSETTEXT 2540 +#define SCI_ANNOTATIONGETTEXT 2541 +#define SCI_ANNOTATIONSETSTYLE 2542 +#define SCI_ANNOTATIONGETSTYLE 2543 +#define SCI_ANNOTATIONSETSTYLES 2544 +#define SCI_ANNOTATIONGETSTYLES 2545 +#define SCI_ANNOTATIONGETLINES 2546 +#define SCI_ANNOTATIONCLEARALL 2547 +#define ANNOTATION_HIDDEN 0 +#define ANNOTATION_STANDARD 1 +#define ANNOTATION_BOXED 2 +#define SCI_ANNOTATIONSETVISIBLE 2548 +#define SCI_ANNOTATIONGETVISIBLE 2549 +#define SCI_ANNOTATIONSETSTYLEOFFSET 2550 +#define SCI_ANNOTATIONGETSTYLEOFFSET 2551 +#define UNDO_MAY_COALESCE 1 +#define SCI_ADDUNDOACTION 2560 +#define SCI_CHARPOSITIONFROMPOINT 2561 +#define SCI_CHARPOSITIONFROMPOINTCLOSE 2562 +#define SCI_SETMULTIPLESELECTION 2563 +#define SCI_GETMULTIPLESELECTION 2564 +#define SCI_SETADDITIONALSELECTIONTYPING 2565 +#define SCI_GETADDITIONALSELECTIONTYPING 2566 +#define SCI_SETADDITIONALCARETSBLINK 2567 +#define SCI_GETADDITIONALCARETSBLINK 2568 +#define SCI_SETADDITIONALCARETSVISIBLE 2608 +#define SCI_GETADDITIONALCARETSVISIBLE 2609 +#define SCI_GETSELECTIONS 2570 +#define SCI_CLEARSELECTIONS 2571 +#define SCI_SETSELECTION 2572 +#define SCI_ADDSELECTION 2573 +#define SCI_SETMAINSELECTION 2574 +#define SCI_GETMAINSELECTION 2575 +#define SCI_SETSELECTIONNCARET 2576 +#define SCI_GETSELECTIONNCARET 2577 +#define SCI_SETSELECTIONNANCHOR 2578 +#define SCI_GETSELECTIONNANCHOR 2579 +#define SCI_SETSELECTIONNCARETVIRTUALSPACE 2580 +#define SCI_GETSELECTIONNCARETVIRTUALSPACE 2581 +#define SCI_SETSELECTIONNANCHORVIRTUALSPACE 2582 +#define SCI_GETSELECTIONNANCHORVIRTUALSPACE 2583 +#define SCI_SETSELECTIONNSTART 2584 +#define SCI_GETSELECTIONNSTART 2585 +#define SCI_SETSELECTIONNEND 2586 +#define SCI_GETSELECTIONNEND 2587 +#define SCI_SETRECTANGULARSELECTIONCARET 2588 +#define SCI_GETRECTANGULARSELECTIONCARET 2589 +#define SCI_SETRECTANGULARSELECTIONANCHOR 2590 +#define SCI_GETRECTANGULARSELECTIONANCHOR 2591 +#define SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE 2592 +#define SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE 2593 +#define SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2594 +#define SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2595 +#define SCVS_NONE 0 +#define SCVS_RECTANGULARSELECTION 1 +#define SCVS_USERACCESSIBLE 2 +#define SCI_SETVIRTUALSPACEOPTIONS 2596 +#define SCI_GETVIRTUALSPACEOPTIONS 2597 +#define SCI_SETRECTANGULARSELECTIONMODIFIER 2598 +#define SCI_GETRECTANGULARSELECTIONMODIFIER 2599 +#define SCI_SETADDITIONALSELFORE 2600 +#define SCI_SETADDITIONALSELBACK 2601 +#define SCI_SETADDITIONALSELALPHA 2602 +#define SCI_GETADDITIONALSELALPHA 2603 +#define SCI_SETADDITIONALCARETFORE 2604 +#define SCI_GETADDITIONALCARETFORE 2605 +#define SCI_ROTATESELECTION 2606 +#define SCI_SWAPMAINANCHORCARET 2607 +#define SCI_CHANGELEXERSTATE 2617 +#define SCI_CONTRACTEDFOLDNEXT 2618 +#define SCI_VERTICALCENTRECARET 2619 +#define SCI_MOVESELECTEDLINESUP 2620 +#define SCI_MOVESELECTEDLINESDOWN 2621 +#define SCI_SETIDENTIFIER 2622 +#define SCI_GETIDENTIFIER 2623 +#define SCI_RGBAIMAGESETWIDTH 2624 +#define SCI_RGBAIMAGESETHEIGHT 2625 +#define SCI_MARKERDEFINERGBAIMAGE 2626 +#define SCI_REGISTERRGBAIMAGE 2627 +#define SCI_SCROLLTOSTART 2628 +#define SCI_SCROLLTOEND 2629 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 @@ -685,6 +833,15 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETPROPERTYEXPANDED 4009 #define SCI_GETPROPERTYINT 4010 #define SCI_GETSTYLEBITSNEEDED 4011 +#define SCI_GETLEXERLANGUAGE 4012 +#define SCI_PRIVATELEXERCALL 4013 +#define SCI_PROPERTYNAMES 4014 +#define SC_TYPE_BOOLEAN 0 +#define SC_TYPE_INTEGER 1 +#define SC_TYPE_STRING 2 +#define SCI_PROPERTYTYPE 4015 +#define SCI_DESCRIBEPROPERTY 4016 +#define SCI_DESCRIBEKEYWORDSETS 4017 #define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_DELETETEXT 0x2 #define SC_MOD_CHANGESTYLE 0x4 @@ -701,7 +858,15 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_STARTACTION 0x2000 #define SC_MOD_CHANGEINDICATOR 0x4000 #define SC_MOD_CHANGELINESTATE 0x8000 -#define SC_MODEVENTMASKALL 0xFFFF +#define SC_MOD_CHANGEMARGIN 0x10000 +#define SC_MOD_CHANGEANNOTATION 0x20000 +#define SC_MOD_CONTAINER 0x40000 +#define SC_MOD_LEXERSTATE 0x80000 +#define SC_MODEVENTMASKALL 0xFFFFF +#define SC_UPDATE_CONTENT 0x1 +#define SC_UPDATE_SELECTION 0x2 +#define SC_UPDATE_V_SCROLL 0x4 +#define SC_UPDATE_H_SCROLL 0x8 #define SCEN_CHANGE 768 #define SCEN_SETFOCUS 512 #define SCEN_KILLFOCUS 256 @@ -729,6 +894,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCMOD_SHIFT 1 #define SCMOD_CTRL 2 #define SCMOD_ALT 4 +#define SCMOD_SUPER 8 +#define SCMOD_META 16 #define SCN_STYLENEEDED 2000 #define SCN_CHARADDED 2001 #define SCN_SAVEPOINTREACHED 2002 @@ -753,96 +920,114 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_AUTOCSELECTION 2022 #define SCN_INDICATORCLICK 2023 #define SCN_INDICATORRELEASE 2024 -#define SCN_GETBKCOLOR 2025 #define SCN_AUTOCCANCELLED 2025 -//--Autogenerated -- end of section automatically generated from Scintilla.iface +#define SCN_AUTOCCHARDELETED 2026 +#define SCN_HOTSPOTRELEASECLICK 2027 +/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ -// These structures are defined to be exactly the same shape as the Win32 -// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. -// So older code that treats Scintilla as a RichEdit will work. +/* These structures are defined to be exactly the same shape as the Win32 + * CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. + * So older code that treats Scintilla as a RichEdit will work. */ #ifdef SCI_NAMESPACE namespace Scintilla { #endif -struct CharacterRange { +struct Sci_CharacterRange { long cpMin; long cpMax; }; -struct TextRange { - struct CharacterRange chrg; +struct Sci_TextRange { + struct Sci_CharacterRange chrg; char *lpstrText; }; -struct TextToFind { - struct CharacterRange chrg; +struct Sci_TextToFind { + struct Sci_CharacterRange chrg; char *lpstrText; - struct CharacterRange chrgText; + struct Sci_CharacterRange chrgText; }; -#ifdef PLATFORM_H +#define CharacterRange Sci_CharacterRange +#define TextRange Sci_TextRange +#define TextToFind Sci_TextToFind -// This structure is used in printing and requires some of the graphics types -// from Platform.h. Not needed by most client code. +typedef void *Sci_SurfaceID; -struct RangeToFormat { - SurfaceID hdc; - SurfaceID hdcTarget; - PRectangle rc; - PRectangle rcPage; - CharacterRange chrg; +struct Sci_Rectangle { + int left; + int top; + int right; + int bottom; }; -#endif +/* This structure is used in printing and requires some of the graphics types + * from Platform.h. Not needed by most client code. */ + +struct Sci_RangeToFormat { + Sci_SurfaceID hdc; + Sci_SurfaceID hdcTarget; + struct Sci_Rectangle rc; + struct Sci_Rectangle rcPage; + struct Sci_CharacterRange chrg; +}; + +#define RangeToFormat Sci_RangeToFormat -struct NotifyHeader { - // Compatible with Windows NMHDR. - // hwndFrom is really an environment specific window handle or pointer - // but most clients of Scintilla.h do not have this type visible. +struct Sci_NotifyHeader { + /* Compatible with Windows NMHDR. + * hwndFrom is really an environment specific window handle or pointer + * but most clients of Scintilla.h do not have this type visible. */ void *hwndFrom; uptr_t idFrom; unsigned int code; }; +#define NotifyHeader Sci_NotifyHeader + struct SCNotification { - struct NotifyHeader nmhdr; - int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND - int ch; // SCN_CHARADDED, SCN_KEY - int modifiers; // SCN_KEY - int modificationType; // SCN_MODIFIED - const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION - int length; // SCN_MODIFIED - int linesAdded; // SCN_MODIFIED - int message; // SCN_MACRORECORD - uptr_t wParam; // SCN_MACRORECORD - sptr_t lParam; // SCN_MACRORECORD - int line; // SCN_MODIFIED - int foldLevelNow; // SCN_MODIFIED - int foldLevelPrev; // SCN_MODIFIED - int margin; // SCN_MARGINCLICK - int listType; // SCN_USERLISTSELECTION - int x; // SCN_DWELLSTART, SCN_DWELLEND - int y; // SCN_DWELLSTART, SCN_DWELLEND + struct Sci_NotifyHeader nmhdr; + int position; + /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */ + /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */ + /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */ + /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ + /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ + + int ch; /* SCN_CHARADDED, SCN_KEY */ + int modifiers; + /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */ + /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ + + int modificationType; /* SCN_MODIFIED */ + const char *text; + /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ + + int length; /* SCN_MODIFIED */ + int linesAdded; /* SCN_MODIFIED */ + int message; /* SCN_MACRORECORD */ + uptr_t wParam; /* SCN_MACRORECORD */ + sptr_t lParam; /* SCN_MACRORECORD */ + int line; /* SCN_MODIFIED */ + int foldLevelNow; /* SCN_MODIFIED */ + int foldLevelPrev; /* SCN_MODIFIED */ + int margin; /* SCN_MARGINCLICK */ + int listType; /* SCN_USERLISTSELECTION */ + int x; /* SCN_DWELLSTART, SCN_DWELLEND */ + int y; /* SCN_DWELLSTART, SCN_DWELLEND */ + int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ + int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ + int updated; /* SCN_UPDATEUI */ }; #ifdef SCI_NAMESPACE } #endif -// Deprecation section listing all API features that are deprecated and will -// will be removed completely in a future version. -// To enable these features define INCLUDE_DEPRECATED_FEATURES - #ifdef INCLUDE_DEPRECATED_FEATURES -#define SCI_SETCARETPOLICY 2369 -#define CARET_CENTER 0x02 -#define CARET_XEVEN 0x08 -#define CARET_XJUMPS 0x10 - -#define SCN_POSCHANGED 2012 -#define SCN_CHECKBRACE 2007 +#define SC_CP_DBCS 1 #endif diff --git a/ext/scintilla/include/Scintilla.iface b/ext/scintilla/include/Scintilla.iface index bd2324680..72ad27464 100644 --- a/ext/scintilla/include/Scintilla.iface +++ b/ext/scintilla/include/Scintilla.iface @@ -224,9 +224,6 @@ get int GetTabWidth=2121(,) # This is the same value as CP_UTF8 in Windows val SC_CP_UTF8=65001 -# The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+. -val SC_CP_DBCS=1 - # Set the code page used to interpret the bytes of the document as characters. # The SC_CP_UTF8 value can be used to enter Unicode mode. set void SetCodePage=2037(int codePage,) @@ -262,13 +259,16 @@ val SC_MARK_CIRCLEPLUSCONNECTED=19 val SC_MARK_CIRCLEMINUS=20 val SC_MARK_CIRCLEMINUSCONNECTED=21 -# Invisible mark that only sets the line background color. +# Invisible mark that only sets the line background colour. val SC_MARK_BACKGROUND=22 val SC_MARK_DOTDOTDOT=23 val SC_MARK_ARROWS=24 val SC_MARK_PIXMAP=25 val SC_MARK_FULLRECT=26 val SC_MARK_LEFTRECT=27 +val SC_MARK_AVAILABLE=28 +val SC_MARK_UNDERLINE=29 +val SC_MARK_RGBAIMAGE=30 val SC_MARK_CHARACTER=10000 @@ -293,6 +293,12 @@ fun void MarkerSetFore=2041(int markerNumber, colour fore) # Set the background colour used for a particular marker number. fun void MarkerSetBack=2042(int markerNumber, colour back) +# Set the background colour used for a particular marker number when its folding block is selected. +fun void MarkerSetBackSelected=2292(int markerNumber, colour back) + +# Enable/disable highlight for current folding bloc (smallest one that contains the caret) +fun void MarkerEnableHighlight=2293(bool enabled,) + # Add a marker to a line, returning an ID which can be used to find or delete the marker. fun int MarkerAdd=2043(int line, int markerNumber) @@ -305,7 +311,8 @@ fun void MarkerDeleteAll=2045(int markerNumber,) # Get a bit mask of all the markers set on a line. fun int MarkerGet=2046(int line,) -# Find the next line after lineStart that includes a marker in mask. +# Find the next line at or after lineStart that includes a marker in mask. +# Return -1 when no more lines. fun int MarkerNext=2047(int lineStart, int markerMask) # Find the previous line before lineStart that includes a marker in mask. @@ -325,6 +332,8 @@ val SC_MARGIN_SYMBOL=0 val SC_MARGIN_NUMBER=1 val SC_MARGIN_BACK=2 val SC_MARGIN_FORE=3 +val SC_MARGIN_TEXT=4 +val SC_MARGIN_RTEXT=5 # Set a margin to be either numeric or symbolic. set void SetMarginTypeN=2240(int margin, int marginType) @@ -350,6 +359,12 @@ set void SetMarginSensitiveN=2246(int margin, bool sensitive) # Retrieve the mouse click sensitivity of a margin. get bool GetMarginSensitiveN=2247(int margin,) +# Set the cursor shown when the mouse is inside a margin. +set void SetMarginCursorN=2248(int margin, int cursor) + +# Retrieve the cursor shown in a margin. +get int GetMarginCursorN=2249(int margin,) + # Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. # Style 39 is for future use. enu StylesCommon=STYLE_ @@ -473,10 +488,10 @@ set void StyleSetCharacterSet=2066(int style, int characterSet) # Set a style to be a hotspot or not. set void StyleSetHotSpot=2409(int style, bool hotspot) -# Set the foreground colour of the selection and whether to use this setting. +# Set the foreground colour of the main and additional selections and whether to use this setting. fun void SetSelFore=2067(bool useSetting, colour fore) -# Set the background colour of the selection and whether to use this setting. +# Set the background colour of the main and additional selections and whether to use this setting. fun void SetSelBack=2068(bool useSetting, colour back) # Get the alpha of the selection. @@ -536,6 +551,11 @@ val INDIC_STRIKE=4 val INDIC_HIDDEN=5 val INDIC_BOX=6 val INDIC_ROUNDBOX=7 +val INDIC_STRAIGHTBOX=8 +val INDIC_DASH=9 +val INDIC_DOTS=10 +val INDIC_SQUIGGLELOW=11 +val INDIC_DOTBOX=12 val INDIC_MAX=31 val INDIC_CONTAINER=8 val INDIC0_MASK=0x20 @@ -567,6 +587,12 @@ fun void SetWhitespaceFore=2084(bool useSetting, colour fore) # Set the background colour of all whitespace and whether to use this setting. fun void SetWhitespaceBack=2085(bool useSetting, colour back) +# Set the size of the dots used to mark space characters. +set void SetWhitespaceSize=2086(int size,) + +# Get the size of the dots used to mark space characters. +get int GetWhitespaceSize=2087(,) + # Divide each styling byte into lexical class bits (default: 5) and indicator # bits (default: 3). If a lexer requires more than 32 lexical states, then this # is used to expand the possible states. @@ -777,6 +803,9 @@ set void SetSelectionEnd=2144(position pos,) # Returns the position at the end of the selection. get position GetSelectionEnd=2145(,) +# Set caret to a position, while removing any existing selection. +fun void SetEmptySelection=2556(position pos,) + # Sets the print magnification added to the point size of each style for printing. set void SetPrintMagnification=2146(int magnification,) @@ -1011,10 +1040,6 @@ enu FoldLevel=SC_FOLDLEVEL val SC_FOLDLEVELBASE=0x400 val SC_FOLDLEVELWHITEFLAG=0x1000 val SC_FOLDLEVELHEADERFLAG=0x2000 -val SC_FOLDLEVELBOXHEADERFLAG=0x4000 -val SC_FOLDLEVELBOXFOOTERFLAG=0x8000 -val SC_FOLDLEVELCONTRACTED=0x10000 -val SC_FOLDLEVELUNINDENT=0x20000 val SC_FOLDLEVELNUMBERMASK=0x0FFF # Set the fold level of a line. @@ -1058,7 +1083,6 @@ val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004 val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008 val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010 val SC_FOLDFLAG_LEVELNUMBERS=0x0040 -val SC_FOLDFLAG_BOX=0x0001 # Set some style options for folding. fun void SetFoldFlags=2233(int flags,) @@ -1132,6 +1156,17 @@ set void SetWrapStartIndent=2464(int indent,) # Retrive the start indent for wrapped lines. get int GetWrapStartIndent=2465(,) +enu WrapIndentMode=SC_WRAPINDENT_ +val SC_WRAPINDENT_FIXED=0 +val SC_WRAPINDENT_SAME=1 +val SC_WRAPINDENT_INDENT=2 + +# Sets how wrapped sublines are placed. Default is fixed. +set void SetWrapIndentMode=2472(int mode,) + +# Retrieve how wrapped sublines are placed. Default is fixed. +get int GetWrapIndentMode=2473(,) + enu LineCache=SC_CACHE_ val SC_CACHE_NONE=0 val SC_CACHE_CARET=1 @@ -1189,6 +1224,37 @@ get bool GetTwoPhaseDraw=2283(,) # and then the foreground. This avoids chopping off characters that overlap the next run. set void SetTwoPhaseDraw=2284(bool twoPhase,) +# Control font anti-aliasing. + +enu FontQuality=SC_EFF_ +val SC_EFF_QUALITY_MASK=0xF +val SC_EFF_QUALITY_DEFAULT=0 +val SC_EFF_QUALITY_NON_ANTIALIASED=1 +val SC_EFF_QUALITY_ANTIALIASED=2 +val SC_EFF_QUALITY_LCD_OPTIMIZED=3 + +# Choose the quality level for text from the FontQuality enumeration. +set void SetFontQuality=2611(int fontQuality,) + +# Retrieve the quality level for text. +get int GetFontQuality=2612(,) + +# Scroll so that a display line is at the top of the display. +set void SetFirstVisibleLine=2613(int lineDisplay,) + +enu MultiPaste=SC_MULTIPASTE_ +val SC_MULTIPASTE_ONCE=0 +val SC_MULTIPASTE_EACH=1 + +# Change the effect of pasting when there are multiple selections. +set void SetMultiPaste=2614(int multiPaste,) + +# Retrieve the effect of pasting when there are multiple selections.. +get int GetMultiPaste=2615(,) + +# Retrieve the value of a tag from a regular expression search. +fun int GetTag=2616(int tagNumber, stringresult tagValue) + # Make the target range start and end be the same as the selection range start and end. fun void TargetFromSelection=2287(,) @@ -1389,9 +1455,15 @@ fun int LineLength=2350(int line,) # Highlight the characters at two positions. fun void BraceHighlight=2351(position pos1, position pos2) +# Use specified indicator to highlight matching braces instead of changing their style. +fun void BraceHighlightIndicator=2498(bool useBraceHighlightIndicator, int indicator) + # Highlight the character at a position indicating there is no matching brace. fun void BraceBadLight=2352(position pos,) +# Use specified indicator to highlight non matching brace instead of changing its style. +fun void BraceBadLightIndicator=2499(bool useBraceBadLightIndicator, int indicator) + # Find the position of a matching brace or INVALID_POSITION if no match. fun position BraceMatch=2353(position pos,) @@ -1478,6 +1550,11 @@ set void SetFocus=2380(bool focus,) # Get internal focus flag. get bool GetFocus=2381(,) +enu Status=SC_STATUS_ +val SC_STATUS_OK=0 +val SC_STATUS_FAILURE=1 +val SC_STATUS_BADALLOC=2 + # Change error status - 0 = OK. set void SetStatus=2382(int statusCode,) # Get error status. @@ -1490,7 +1567,9 @@ get bool GetMouseDownCaptures=2385(,) enu CursorShape=SC_CURSOR val SC_CURSORNORMAL=-1 +val SC_CURSORARROW=2 val SC_CURSORWAIT=4 +val SC_CURSORREVERSEARROW=7 # Sets the cursor to one of the SC_CURSOR* values. set void SetCursor=2386(int cursorType,) # Get cursor type. @@ -1622,8 +1701,9 @@ enu SelectionMode=SC_SEL_ val SC_SEL_STREAM=0 val SC_SEL_RECTANGLE=1 val SC_SEL_LINES=2 +val SC_SEL_THIN=3 -# Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or +# Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or # by lines (SC_SEL_LINES). set void SetSelectionMode=2422(int mode,) @@ -1702,6 +1782,10 @@ fun void SetCharsDefault=2444(,) # Get currently selected item position in the auto-completion list fun int AutoCGetCurrent=2445(,) +# Get currently selected item text in the auto-completion list +# Returns the length of the item text +fun int AutoCGetCurrentText=2610(, stringresult s) + # Enlarge the document to a particular size of text bytes. fun void Allocate=2446(int bytes,) @@ -1723,10 +1807,15 @@ fun int EncodedFromUTF8=2449(string utf8, stringresult encoded) fun int FindColumn=2456(int line, int column) # Can the caret preferred x position only be changed by explicit movement commands? -get bool GetCaretSticky=2457(,) +get int GetCaretSticky=2457(,) # Stop the caret preferred x position changing when the user types. -set void SetCaretSticky=2458(bool useCaretStickyBehaviour,) +set void SetCaretSticky=2458(int useCaretStickyBehaviour,) + +enu CaretSticky=SC_CARETSTICKY_ +val SC_CARETSTICKY_OFF=0 +val SC_CARETSTICKY_ON=1 +val SC_CARETSTICKY_WHITESPACE=2 # Switch between sticky and non-sticky: meant to be bound to a key. fun void ToggleCaretSticky=2459(,) @@ -1810,6 +1899,282 @@ set void SetKeysUnicode=2521(bool keysUnicode,) # Are keys always interpreted as Unicode? get bool GetKeysUnicode=2522(,) +# Set the alpha fill colour of the given indicator. +set void IndicSetAlpha=2523(int indicator, int alpha) + +# Get the alpha fill colour of the given indicator. +get int IndicGetAlpha=2524(int indicator,) + +# Set the alpha outline colour of the given indicator. +set void IndicSetOutlineAlpha=2558(int indicator, int alpha) + +# Get the alpha outline colour of the given indicator. +get int IndicGetOutlineAlpha=2559(int indicator,) + +# Set extra ascent for each line +set void SetExtraAscent=2525(int extraAscent,) + +# Get extra ascent for each line +get int GetExtraAscent=2526(,) + +# Set extra descent for each line +set void SetExtraDescent=2527(int extraDescent,) + +# Get extra descent for each line +get int GetExtraDescent=2528(,) + +# Which symbol was defined for markerNumber with MarkerDefine +fun int MarkerSymbolDefined=2529(int markerNumber,) + +# Set the text in the text margin for a line +set void MarginSetText=2530(int line, string text) + +# Get the text in the text margin for a line +get int MarginGetText=2531(int line, stringresult text) + +# Set the style number for the text margin for a line +set void MarginSetStyle=2532(int line, int style) + +# Get the style number for the text margin for a line +get int MarginGetStyle=2533(int line,) + +# Set the style in the text margin for a line +set void MarginSetStyles=2534(int line, string styles) + +# Get the styles in the text margin for a line +get int MarginGetStyles=2535(int line, stringresult styles) + +# Clear the margin text on all lines +fun void MarginTextClearAll=2536(,) + +# Get the start of the range of style numbers used for margin text +set void MarginSetStyleOffset=2537(int style,) + +# Get the start of the range of style numbers used for margin text +get int MarginGetStyleOffset=2538(,) + +enu MarginOption=SC_MARGINOPTION_ +val SC_MARGINOPTION_NONE=0 +val SC_MARGINOPTION_SUBLINESELECT=1 + +# Set the margin options. +set void SetMarginOptions=2539(int marginOptions,) + +# Get the margin options. +get int GetMarginOptions=2557(,) + +# Set the annotation text for a line +set void AnnotationSetText=2540(int line, string text) + +# Get the annotation text for a line +get int AnnotationGetText=2541(int line, stringresult text) + +# Set the style number for the annotations for a line +set void AnnotationSetStyle=2542(int line, int style) + +# Get the style number for the annotations for a line +get int AnnotationGetStyle=2543(int line,) + +# Set the annotation styles for a line +set void AnnotationSetStyles=2544(int line, string styles) + +# Get the annotation styles for a line +get int AnnotationGetStyles=2545(int line, stringresult styles) + +# Get the number of annotation lines for a line +get int AnnotationGetLines=2546(int line,) + +# Clear the annotations from all lines +fun void AnnotationClearAll=2547(,) + +enu AnnotationVisible=ANNOTATION_ +val ANNOTATION_HIDDEN=0 +val ANNOTATION_STANDARD=1 +val ANNOTATION_BOXED=2 + +# Set the visibility for the annotations for a view +set void AnnotationSetVisible=2548(int visible,) + +# Get the visibility for the annotations for a view +get int AnnotationGetVisible=2549(,) + +# Get the start of the range of style numbers used for annotations +set void AnnotationSetStyleOffset=2550(int style,) + +# Get the start of the range of style numbers used for annotations +get int AnnotationGetStyleOffset=2551(,) + +val UNDO_MAY_COALESCE=1 + +# Add a container action to the undo stack +fun void AddUndoAction=2560(int token, int flags) + +# Find the position of a character from a point within the window. +fun position CharPositionFromPoint=2561(int x, int y) + +# Find the position of a character from a point within the window. +# Return INVALID_POSITION if not close to text. +fun position CharPositionFromPointClose=2562(int x, int y) + +# Set whether multiple selections can be made +set void SetMultipleSelection=2563(bool multipleSelection,) + +# Whether multiple selections can be made +get bool GetMultipleSelection=2564(,) + +# Set whether typing can be performed into multiple selections +set void SetAdditionalSelectionTyping=2565(bool additionalSelectionTyping,) + +# Whether typing can be performed into multiple selections +get bool GetAdditionalSelectionTyping=2566(,) + +# Set whether additional carets will blink +set void SetAdditionalCaretsBlink=2567(bool additionalCaretsBlink,) + +# Whether additional carets will blink +get bool GetAdditionalCaretsBlink=2568(,) + +# Set whether additional carets are visible +set void SetAdditionalCaretsVisible=2608(bool additionalCaretsBlink,) + +# Whether additional carets are visible +get bool GetAdditionalCaretsVisible=2609(,) + +# How many selections are there? +get int GetSelections=2570(,) + +# Clear selections to a single empty stream selection +fun void ClearSelections=2571(,) + +# Set a simple selection +fun int SetSelection=2572(int caret,int anchor) + +# Add a selection +fun int AddSelection=2573(int caret,int anchor) + +# Set the main selection +set void SetMainSelection=2574(int selection,) + +# Which selection is the main selection +get int GetMainSelection=2575(,) + +set void SetSelectionNCaret=2576(int selection, position pos) +get position GetSelectionNCaret=2577(int selection,) +set void SetSelectionNAnchor=2578(int selection, position posAnchor) +get position GetSelectionNAnchor=2579(int selection,) +set void SetSelectionNCaretVirtualSpace=2580(int selection, int space) +get int GetSelectionNCaretVirtualSpace=2581(int selection,) +set void SetSelectionNAnchorVirtualSpace=2582(int selection, int space) +get int GetSelectionNAnchorVirtualSpace=2583(int selection,) + +# Sets the position that starts the selection - this becomes the anchor. +set void SetSelectionNStart=2584(int selection, position pos) + +# Returns the position at the start of the selection. +get position GetSelectionNStart=2585(int selection,) + +# Sets the position that ends the selection - this becomes the currentPosition. +set void SetSelectionNEnd=2586(int selection, position pos,) + +# Returns the position at the end of the selection. +get position GetSelectionNEnd=2587(int selection,) + +set void SetRectangularSelectionCaret=2588(position pos,) +get position GetRectangularSelectionCaret=2589(,) +set void SetRectangularSelectionAnchor=2590(position posAnchor,) +get position GetRectangularSelectionAnchor=2591(,) +set void SetRectangularSelectionCaretVirtualSpace=2592(int space,) +get int GetRectangularSelectionCaretVirtualSpace=2593(,) +set void SetRectangularSelectionAnchorVirtualSpace=2594(int space,) +get int GetRectangularSelectionAnchorVirtualSpace=2595(,) + +enu VirtualSpace=SCVS_ +val SCVS_NONE=0 +val SCVS_RECTANGULARSELECTION=1 +val SCVS_USERACCESSIBLE=2 + +set void SetVirtualSpaceOptions=2596(int virtualSpaceOptions,) +get int GetVirtualSpaceOptions=2597(,) + +# On GTK+, allow selecting the modifier key to use for mouse-based +# rectangular selection. Often the window manager requires Alt+Mouse Drag +# for moving windows. +# Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. + +set void SetRectangularSelectionModifier=2598(int modifier,) + +# Get the modifier key used for rectangular selection. +get int GetRectangularSelectionModifier=2599(,) + +# Set the foreground colour of additional selections. +# Must have previously called SetSelFore with non-zero first argument for this to have an effect. +set void SetAdditionalSelFore=2600(colour fore,) + +# Set the background colour of additional selections. +# Must have previously called SetSelBack with non-zero first argument for this to have an effect. +set void SetAdditionalSelBack=2601(colour back,) + +# Set the alpha of the selection. +set void SetAdditionalSelAlpha=2602(int alpha,) + +# Get the alpha of the selection. +get int GetAdditionalSelAlpha=2603(,) + +# Set the foreground colour of additional carets. +set void SetAdditionalCaretFore=2604(colour fore,) + +# Get the foreground colour of additional carets. +get colour GetAdditionalCaretFore=2605(,) + +# Set the main selection to the next selection. +fun void RotateSelection=2606(,) + +# Swap that caret and anchor of the main selection. +fun void SwapMainAnchorCaret=2607(,) + +# Indicate that the internal state of a lexer has changed over a range and therefore +# there may be a need to redraw. +fun int ChangeLexerState=2617(position start, position end) + +# Find the next line at or after lineStart that is a contracted fold header line. +# Return -1 when no more lines. +fun int ContractedFoldNext=2618(int lineStart,) + +# Centre current line in window. +fun void VerticalCentreCaret=2619(,) + +# Move the selected lines up one line, shifting the line above after the selection +fun void MoveSelectedLinesUp=2620(,) + +# Move the selected lines down one line, shifting the line below before the selection +fun void MoveSelectedLinesDown=2621(,) + +# Set the identifier reported as idFrom in notification messages. +set void SetIdentifier=2622(int identifier,) + +# Get the identifier. +get int GetIdentifier=2623(,) + +# Set the width for future RGBA image data. +set void RGBAImageSetWidth=2624(int width,) + +# Set the height for future RGBA image data. +set void RGBAImageSetHeight=2625(int height,) + +# Define a marker from RGBA data. +# It has the width and height from RGBAImageSetWidth/Height +fun void MarkerDefineRGBAImage=2626(int markerNumber, string pixels) + +# Register an RGBA image for use in autocompletion lists. +# It has the width and height from RGBAImageSetWidth/Height +fun void RegisterRGBAImage=2627(int type, string pixels) + +# Scroll to start of document. +fun void ScrollToStart=2628(,) + +# Scroll to end of document. +fun void ScrollToEnd=2629(,) + # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) @@ -1854,6 +2219,30 @@ get int GetPropertyInt=4010(string key,) # Retrieve the number of bits the current lexer needs for styling. get int GetStyleBitsNeeded=4011(,) +# Retrieve the name of the lexer. +# Return the length of the text. +get int GetLexerLanguage=4012(, stringresult text) + +# For private communication between an application and a known lexer. +fun int PrivateLexerCall=4013(int operation, int pointer) + +# Retrieve a '\n' separated list of properties understood by the current lexer. +fun int PropertyNames=4014(, stringresult names) + +enu TypeProperty=SC_TYPE_ +val SC_TYPE_BOOLEAN=0 +val SC_TYPE_INTEGER=1 +val SC_TYPE_STRING=2 + +# Retrieve the type of a property. +fun int PropertyType=4015(string name,) + +# Describe a property. +fun int DescribeProperty=4016(string name, stringresult description) + +# Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. +fun int DescribeKeyWordSets=4017(, stringresult descriptions) + # 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. @@ -1875,7 +2264,17 @@ val SC_MULTILINEUNDOREDO=0x1000 val SC_STARTACTION=0x2000 val SC_MOD_CHANGEINDICATOR=0x4000 val SC_MOD_CHANGELINESTATE=0x8000 -val SC_MODEVENTMASKALL=0xFFFF +val SC_MOD_CHANGEMARGIN=0x10000 +val SC_MOD_CHANGEANNOTATION=0x20000 +val SC_MOD_CONTAINER=0x40000 +val SC_MOD_LEXERSTATE=0x80000 +val SC_MODEVENTMASKALL=0xFFFFF + +enu Update=SC_UPDATE_ +val SC_UPDATE_CONTENT=0x1 +val SC_UPDATE_SELECTION=0x2 +val SC_UPDATE_V_SCROLL=0x4 +val SC_UPDATE_H_SCROLL=0x8 # For compatibility, these go through the COMMAND notification rather than NOTIFY # and should have had exactly the same values as the EN_* constants. @@ -1916,6 +2315,8 @@ val SCMOD_NORM=0 val SCMOD_SHIFT=1 val SCMOD_CTRL=2 val SCMOD_ALT=4 +val SCMOD_SUPER=8 +val SCMOD_META=16 ################################################ # For SciLexer.h @@ -2009,12 +2410,24 @@ val SCLEX_MAGIK=87 val SCLEX_POWERSHELL=88 val SCLEX_MYSQL=89 val SCLEX_PO=90 +val SCLEX_TAL=91 +val SCLEX_COBOL=92 +val SCLEX_TACL=93 +val SCLEX_SORCUS=94 +val SCLEX_POWERPRO=95 +val SCLEX_NIMROD=96 +val SCLEX_SML=97 +val SCLEX_MARKDOWN=98 +val SCLEX_TXT2TAGS=99 +val SCLEX_A68K=100 +val SCLEX_MODULA=101 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. val SCLEX_AUTOMATIC=1000 # Lexical states for SCLEX_PYTHON lex Python=SCLEX_PYTHON SCE_P_ +lex Nimrod=SCLEX_NIMROD SCE_P_ val SCE_P_DEFAULT=0 val SCE_P_COMMENTLINE=1 val SCE_P_NUMBER=2 @@ -2033,7 +2446,6 @@ val SCE_P_WORD2=14 val SCE_P_DECORATOR=15 # Lexical states for SCLEX_CPP lex Cpp=SCLEX_CPP SCE_C_ -lex Pascal=SCLEX_PASCAL SCE_C_ lex BullAnt=SCLEX_BULLANT SCE_C_ val SCE_C_DEFAULT=0 val SCE_C_COMMENT=1 @@ -2055,6 +2467,8 @@ val SCE_C_WORD2=16 val SCE_C_COMMENTDOCKEYWORD=17 val SCE_C_COMMENTDOCKEYWORDERROR=18 val SCE_C_GLOBALCLASS=19 +val SCE_C_STRINGRAW=20 +val SCE_C_TRIPLEVERBATIM=21 # Lexical states for SCLEX_D lex D=SCLEX_D SCE_D_ val SCE_D_DEFAULT=0 @@ -2075,6 +2489,11 @@ val SCE_D_IDENTIFIER=14 val SCE_D_COMMENTLINEDOC=15 val SCE_D_COMMENTDOCKEYWORD=16 val SCE_D_COMMENTDOCKEYWORDERROR=17 +val SCE_D_STRINGB=18 +val SCE_D_STRINGR=19 +val SCE_D_WORD5=20 +val SCE_D_WORD6=21 +val SCE_D_WORD7=22 # Lexical states for SCLEX_TCL lex TCL=SCLEX_TCL SCE_TCL_ val SCE_TCL_DEFAULT=0 @@ -2264,6 +2683,16 @@ val SCE_PL_POD_VERB=31 val SCE_PL_SUB_PROTOTYPE=40 val SCE_PL_FORMAT_IDENT=41 val SCE_PL_FORMAT=42 +val SCE_PL_STRING_VAR=43 +val SCE_PL_XLAT=44 +val SCE_PL_REGEX_VAR=54 +val SCE_PL_REGSUBST_VAR=55 +val SCE_PL_BACKTICKS_VAR=57 +val SCE_PL_HERE_QQ_VAR=61 +val SCE_PL_HERE_QX_VAR=62 +val SCE_PL_STRING_QQ_VAR=64 +val SCE_PL_STRING_QX_VAR=65 +val SCE_PL_STRING_QR_VAR=66 # Lexical states for SCLEX_RUBY lex Ruby=SCLEX_RUBY SCE_RB_ val SCE_RB_DEFAULT=0 @@ -2338,6 +2767,14 @@ val SCE_L_COMMAND=1 val SCE_L_TAG=2 val SCE_L_MATH=3 val SCE_L_COMMENT=4 +val SCE_L_TAG2=5 +val SCE_L_MATH2=6 +val SCE_L_COMMENT2=7 +val SCE_L_VERBATIM=8 +val SCE_L_SHORTCMD=9 +val SCE_L_SPECIAL=10 +val SCE_L_CMDOPT=11 +val SCE_L_ERROR=12 # Lexical states for SCLEX_LUA lex Lua=SCLEX_LUA SCE_LUA_ val SCE_LUA_DEFAULT=0 @@ -2360,6 +2797,7 @@ val SCE_LUA_WORD5=16 val SCE_LUA_WORD6=17 val SCE_LUA_WORD7=18 val SCE_LUA_WORD8=19 +val SCE_LUA_LABEL=20 # Lexical states for SCLEX_ERRORLIST lex ErrorList=SCLEX_ERRORLIST SCE_ERR_ val SCE_ERR_DEFAULT=0 @@ -2569,6 +3007,7 @@ val SCE_ASM_COMMENTBLOCK=11 val SCE_ASM_CHARACTER=12 val SCE_ASM_STRINGEOL=13 val SCE_ASM_EXTINSTRUCTION=14 +val SCE_ASM_COMMENTDIRECTIVE=15 # Lexical states for SCLEX_FORTRAN lex Fortran=SCLEX_FORTRAN SCE_F_ lex F77=SCLEX_F77 SCE_F_ @@ -2611,6 +3050,7 @@ val SCE_CSS_PSEUDOELEMENT=18 val SCE_CSS_EXTENDED_IDENTIFIER=19 val SCE_CSS_EXTENDED_PSEUDOCLASS=20 val SCE_CSS_EXTENDED_PSEUDOELEMENT=21 +val SCE_CSS_MEDIA=22 # Lexical states for SCLEX_POV lex POV=SCLEX_POV SCE_POV_ val SCE_POV_DEFAULT=0 @@ -2786,8 +3226,19 @@ val SCE_ERLANG_FUNCTION_NAME=8 val SCE_ERLANG_CHARACTER=9 val SCE_ERLANG_MACRO=10 val SCE_ERLANG_RECORD=11 -val SCE_ERLANG_SEPARATOR=12 +val SCE_ERLANG_PREPROC=12 val SCE_ERLANG_NODE_NAME=13 +val SCE_ERLANG_COMMENT_FUNCTION=14 +val SCE_ERLANG_COMMENT_MODULE=15 +val SCE_ERLANG_COMMENT_DOC=16 +val SCE_ERLANG_COMMENT_DOC_MACRO=17 +val SCE_ERLANG_ATOM_QUOTED=18 +val SCE_ERLANG_MACRO_QUOTED=19 +val SCE_ERLANG_RECORD_QUOTED=20 +val SCE_ERLANG_NODE_NAME_QUOTED=21 +val SCE_ERLANG_BIFS=22 +val SCE_ERLANG_MODULES=23 +val SCE_ERLANG_MODULES_ATT=24 val SCE_ERLANG_UNKNOWN=31 # Lexical states for SCLEX_OCTAVE are identical to MatLab lex Octave=SCLEX_OCTAVE SCE_MATLAB_ @@ -2959,6 +3410,7 @@ val SCE_CAML_LINENUM=6 val SCE_CAML_OPERATOR=7 val SCE_CAML_NUMBER=8 val SCE_CAML_CHAR=9 +val SCE_CAML_WHITE=10 val SCE_CAML_STRING=11 val SCE_CAML_COMMENT=12 val SCE_CAML_COMMENT1=13 @@ -3081,7 +3533,7 @@ val SCE_ST_ASSIGN=14 val SCE_ST_CHARACTER=15 val SCE_ST_SPEC_SEL=16 # Lexical states for SCLEX_FLAGSHIP (clipper) -lex FlagShip=SCLEX_FLAGSHIP SCE_B_ +lex FlagShip=SCLEX_FLAGSHIP SCE_FS_ val SCE_FS_DEFAULT=0 val SCE_FS_COMMENT=1 val SCE_FS_COMMENTLINE=2 @@ -3101,11 +3553,19 @@ val SCE_FS_IDENTIFIER=15 val SCE_FS_DATE=16 val SCE_FS_STRINGEOL=17 val SCE_FS_CONSTANT=18 -val SCE_FS_ASM=19 -val SCE_FS_LABEL=20 -val SCE_FS_ERROR=21 -val SCE_FS_HEXNUMBER=22 -val SCE_FS_BINNUMBER=23 +val SCE_FS_WORDOPERATOR=19 +val SCE_FS_DISABLEDCODE=20 +val SCE_FS_DEFAULT_C=21 +val SCE_FS_COMMENTDOC_C=22 +val SCE_FS_COMMENTLINEDOC_C=23 +val SCE_FS_KEYWORD_C=24 +val SCE_FS_KEYWORD2_C=25 +val SCE_FS_NUMBER_C=26 +val SCE_FS_STRING_C=27 +val SCE_FS_PREPROCESSOR_C=28 +val SCE_FS_OPERATOR_C=29 +val SCE_FS_IDENTIFIER_C=30 +val SCE_FS_STRINGEOL_C=31 # Lexical states for SCLEX_CSOUND lex Csound=SCLEX_CSOUND SCE_CSOUND_ val SCE_CSOUND_DEFAULT=0 @@ -3132,7 +3592,7 @@ val SCE_INNO_KEYWORD=2 val SCE_INNO_PARAMETER=3 val SCE_INNO_SECTION=4 val SCE_INNO_PREPROC=5 -val SCE_INNO_PREPROC_INLINE=6 +val SCE_INNO_INLINE_EXPANSION=6 val SCE_INNO_COMMENT_PASCAL=7 val SCE_INNO_KEYWORD_PASCAL=8 val SCE_INNO_KEYWORD_USER=9 @@ -3312,6 +3772,9 @@ val SCE_POWERSHELL_IDENTIFIER=7 val SCE_POWERSHELL_KEYWORD=8 val SCE_POWERSHELL_CMDLET=9 val SCE_POWERSHELL_ALIAS=10 +val SCE_POWERSHELL_FUNCTION=11 +val SCE_POWERSHELL_USER1=12 +val SCE_POWERSHELL_COMMENTSTREAM=13 # Lexical state for SCLEX_MYSQL lex MySQL=SCLEX_MYSQL SCE_MYSQL_ val SCE_MYSQL_DEFAULT=0 @@ -3335,6 +3798,7 @@ val SCE_MYSQL_QUOTEDIDENTIFIER=17 val SCE_MYSQL_USER1=18 val SCE_MYSQL_USER2=19 val SCE_MYSQL_USER3=20 +val SCE_MYSQL_HIDDENCOMMAND=21 # Lexical state for SCLEX_PO lex Po=SCLEX_PO SCE_PO_ val SCE_PO_DEFAULT=0 @@ -3346,6 +3810,164 @@ val SCE_PO_MSGSTR_TEXT=5 val SCE_PO_MSGCTXT=6 val SCE_PO_MSGCTXT_TEXT=7 val SCE_PO_FUZZY=8 +# Lexical states for SCLEX_PASCAL +lex Pascal=SCLEX_PASCAL SCE_PAS_ +val SCE_PAS_DEFAULT=0 +val SCE_PAS_IDENTIFIER=1 +val SCE_PAS_COMMENT=2 +val SCE_PAS_COMMENT2=3 +val SCE_PAS_COMMENTLINE=4 +val SCE_PAS_PREPROCESSOR=5 +val SCE_PAS_PREPROCESSOR2=6 +val SCE_PAS_NUMBER=7 +val SCE_PAS_HEXNUMBER=8 +val SCE_PAS_WORD=9 +val SCE_PAS_STRING=10 +val SCE_PAS_STRINGEOL=11 +val SCE_PAS_CHARACTER=12 +val SCE_PAS_OPERATOR=13 +val SCE_PAS_ASM=14 +# Lexical state for SCLEX_SORCUS +lex SORCUS=SCLEX_SORCUS SCE_SORCUS_ +val SCE_SORCUS_DEFAULT=0 +val SCE_SORCUS_COMMAND=1 +val SCE_SORCUS_PARAMETER=2 +val SCE_SORCUS_COMMENTLINE=3 +val SCE_SORCUS_STRING=4 +val SCE_SORCUS_STRINGEOL=5 +val SCE_SORCUS_IDENTIFIER=6 +val SCE_SORCUS_OPERATOR=7 +val SCE_SORCUS_NUMBER=8 +val SCE_SORCUS_CONSTANT=9 +# Lexical state for SCLEX_POWERPRO +lex PowerPro=SCLEX_POWERPRO SCE_POWERPRO_ +val SCE_POWERPRO_DEFAULT=0 +val SCE_POWERPRO_COMMENTBLOCK=1 +val SCE_POWERPRO_COMMENTLINE=2 +val SCE_POWERPRO_NUMBER=3 +val SCE_POWERPRO_WORD=4 +val SCE_POWERPRO_WORD2=5 +val SCE_POWERPRO_WORD3=6 +val SCE_POWERPRO_WORD4=7 +val SCE_POWERPRO_DOUBLEQUOTEDSTRING=8 +val SCE_POWERPRO_SINGLEQUOTEDSTRING=9 +val SCE_POWERPRO_LINECONTINUE=10 +val SCE_POWERPRO_OPERATOR=11 +val SCE_POWERPRO_IDENTIFIER=12 +val SCE_POWERPRO_STRINGEOL=13 +val SCE_POWERPRO_VERBATIM=14 +val SCE_POWERPRO_ALTQUOTE=15 +val SCE_POWERPRO_FUNCTION=16 +# Lexical states for SCLEX_SML +lex SML=SCLEX_SML SCE_SML_ +val SCE_SML_DEFAULT=0 +val SCE_SML_IDENTIFIER=1 +val SCE_SML_TAGNAME=2 +val SCE_SML_KEYWORD=3 +val SCE_SML_KEYWORD2=4 +val SCE_SML_KEYWORD3=5 +val SCE_SML_LINENUM=6 +val SCE_SML_OPERATOR=7 +val SCE_SML_NUMBER=8 +val SCE_SML_CHAR=9 +val SCE_SML_STRING=11 +val SCE_SML_COMMENT=12 +val SCE_SML_COMMENT1=13 +val SCE_SML_COMMENT2=14 +val SCE_SML_COMMENT3=15 +# Lexical state for SCLEX_MARKDOWN +lex Markdown=SCLEX_MARKDOWN SCE_MARKDOWN_ +val SCE_MARKDOWN_DEFAULT=0 +val SCE_MARKDOWN_LINE_BEGIN=1 +val SCE_MARKDOWN_STRONG1=2 +val SCE_MARKDOWN_STRONG2=3 +val SCE_MARKDOWN_EM1=4 +val SCE_MARKDOWN_EM2=5 +val SCE_MARKDOWN_HEADER1=6 +val SCE_MARKDOWN_HEADER2=7 +val SCE_MARKDOWN_HEADER3=8 +val SCE_MARKDOWN_HEADER4=9 +val SCE_MARKDOWN_HEADER5=10 +val SCE_MARKDOWN_HEADER6=11 +val SCE_MARKDOWN_PRECHAR=12 +val SCE_MARKDOWN_ULIST_ITEM=13 +val SCE_MARKDOWN_OLIST_ITEM=14 +val SCE_MARKDOWN_BLOCKQUOTE=15 +val SCE_MARKDOWN_STRIKEOUT=16 +val SCE_MARKDOWN_HRULE=17 +val SCE_MARKDOWN_LINK=18 +val SCE_MARKDOWN_CODE=19 +val SCE_MARKDOWN_CODE2=20 +val SCE_MARKDOWN_CODEBK=21 +# Lexical state for SCLEX_TXT2TAGS +lex Txt2tags=SCLEX_TXT2TAGS SCE_TXT2TAGS_ +val SCE_TXT2TAGS_DEFAULT=0 +val SCE_TXT2TAGS_LINE_BEGIN=1 +val SCE_TXT2TAGS_STRONG1=2 +val SCE_TXT2TAGS_STRONG2=3 +val SCE_TXT2TAGS_EM1=4 +val SCE_TXT2TAGS_EM2=5 +val SCE_TXT2TAGS_HEADER1=6 +val SCE_TXT2TAGS_HEADER2=7 +val SCE_TXT2TAGS_HEADER3=8 +val SCE_TXT2TAGS_HEADER4=9 +val SCE_TXT2TAGS_HEADER5=10 +val SCE_TXT2TAGS_HEADER6=11 +val SCE_TXT2TAGS_PRECHAR=12 +val SCE_TXT2TAGS_ULIST_ITEM=13 +val SCE_TXT2TAGS_OLIST_ITEM=14 +val SCE_TXT2TAGS_BLOCKQUOTE=15 +val SCE_TXT2TAGS_STRIKEOUT=16 +val SCE_TXT2TAGS_HRULE=17 +val SCE_TXT2TAGS_LINK=18 +val SCE_TXT2TAGS_CODE=19 +val SCE_TXT2TAGS_CODE2=20 +val SCE_TXT2TAGS_CODEBK=21 +val SCE_TXT2TAGS_COMMENT=22 +val SCE_TXT2TAGS_OPTION=23 +val SCE_TXT2TAGS_PREPROC=24 +val SCE_TXT2TAGS_POSTPROC=25 +# Lexical states for SCLEX_A68K +lex A68k=SCLEX_A68K SCE_A68K_ +val SCE_A68K_DEFAULT=0 +val SCE_A68K_COMMENT=1 +val SCE_A68K_NUMBER_DEC=2 +val SCE_A68K_NUMBER_BIN=3 +val SCE_A68K_NUMBER_HEX=4 +val SCE_A68K_STRING1=5 +val SCE_A68K_OPERATOR=6 +val SCE_A68K_CPUINSTRUCTION=7 +val SCE_A68K_EXTINSTRUCTION=8 +val SCE_A68K_REGISTER=9 +val SCE_A68K_DIRECTIVE=10 +val SCE_A68K_MACRO_ARG=11 +val SCE_A68K_LABEL=12 +val SCE_A68K_STRING2=13 +val SCE_A68K_IDENTIFIER=14 +val SCE_A68K_MACRO_DECLARATION=15 +val SCE_A68K_COMMENT_WORD=16 +val SCE_A68K_COMMENT_SPECIAL=17 +val SCE_A68K_COMMENT_DOXYGEN=18 +# Lexical states for SCLEX_MODULA +lex Modula=SCLEX_MODULA SCE_MODULA_ +val SCE_MODULA_DEFAULT=0 +val SCE_MODULA_COMMENT=1 +val SCE_MODULA_DOXYCOMM=2 +val SCE_MODULA_DOXYKEY=3 +val SCE_MODULA_KEYWORD=4 +val SCE_MODULA_RESERVED=5 +val SCE_MODULA_NUMBER=6 +val SCE_MODULA_BASENUM=7 +val SCE_MODULA_FLOAT=8 +val SCE_MODULA_STRING=9 +val SCE_MODULA_STRSPEC=10 +val SCE_MODULA_CHAR=11 +val SCE_MODULA_CHARSPEC=12 +val SCE_MODULA_PROC=13 +val SCE_MODULA_PRAGMA=14 +val SCE_MODULA_PRGKEY=15 +val SCE_MODULA_OPERATOR=16 +val SCE_MODULA_BADSTR=17 # Events @@ -3356,38 +3978,30 @@ evt void SavePointLeft=2003(void) evt void ModifyAttemptRO=2004(void) # GTK+ Specific to work around focus and accelerator problems: evt void Key=2005(int ch, int modifiers) -evt void DoubleClick=2006(void) -evt void UpdateUI=2007(void) -evt void Modified=2008(int position, int modificationType, string text, int length, int linesAdded, int line, int foldLevelNow, int foldLevelPrev) +evt void DoubleClick=2006(int modifiers, int position, int line) +evt void UpdateUI=2007(int updated) +evt void Modified=2008(int position, int modificationType, string text, int length, int linesAdded, int line, int foldLevelNow, int foldLevelPrev, int token, int annotationLinesAdded) evt void MacroRecord=2009(int message, int wParam, int lParam) evt void MarginClick=2010(int modifiers, int position, int margin) evt void NeedShown=2011(int position, int length) evt void Painted=2013(void) -evt void UserListSelection=2014(int listType, string text) +evt void UserListSelection=2014(int listType, string text, int position) evt void URIDropped=2015(string text) -evt void DwellStart=2016(int position) -evt void DwellEnd=2017(int position) +evt void DwellStart=2016(int position, int x, int y) +evt void DwellEnd=2017(int position, int x, int y) evt void Zoom=2018(void) evt void HotSpotClick=2019(int modifiers, int position) evt void HotSpotDoubleClick=2020(int modifiers, int position) evt void CallTipClick=2021(int position) -evt void AutoCSelection=2022(string text) +evt void AutoCSelection=2022(string text, int position) evt void IndicatorClick=2023(int modifiers, int position) evt void IndicatorRelease=2024(int modifiers, int position) evt void AutoCCancelled=2025(void) +evt void AutoCCharDeleted=2026(void) +evt void HotSpotReleaseClick=2027(int modifiers, int position) cat Deprecated -# CARET_POLICY changed in 1.47 -fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop) -val CARET_CENTER=0x02 -val CARET_XEVEN=0x08 -val CARET_XJUMPS=0x10 - -# The old name for SCN_UPDATEUI -val SCN_CHECKBRACE=2007 -evt void PosChanged=2012(int position) - -# SCLEX_HTML should be used in preference to these. -val SCLEX_ASP=29 -val SCLEX_PHP=30 +# Deprecated in 2.21 +# The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+. +val SC_CP_DBCS=1 diff --git a/ext/scintilla/include/ScintillaWidget.h b/ext/scintilla/include/ScintillaWidget.h index d99095241..3a3c7ca92 100644 --- a/ext/scintilla/include/ScintillaWidget.h +++ b/ext/scintilla/include/ScintillaWidget.h @@ -1,21 +1,21 @@ -// Scintilla source code edit control +/* Scintilla source code edit control */ /** @file ScintillaWidget.h ** Definition of Scintilla widget for GTK+. ** Only needed by GTK+ code but is harmless on other platforms. **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. +/* Copyright 1998-2001 by Neil Hodgson + * The License.txt file describes the conditions under which this software may be distributed. */ #ifndef SCINTILLAWIDGET_H #define SCINTILLAWIDGET_H -#if PLAT_GTK +#if defined(GTK) #ifdef __cplusplus extern "C" { #endif -#define SCINTILLA(obj) GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject) +#define SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, scintilla_get_type (), ScintillaObject) #define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) #define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ()) @@ -34,21 +34,13 @@ struct _ScintillaClass { void (* notify) (ScintillaObject *ttt); }; -#if GLIB_MAJOR_VERSION < 2 -GtkType scintilla_get_type (void); -#else GType scintilla_get_type (void); -#endif GtkWidget* scintilla_new (void); void scintilla_set_id (ScintillaObject *sci, uptr_t id); sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); void scintilla_release_resources(void); -#if GTK_MAJOR_VERSION < 2 -#define SCINTILLA_NOTIFY "notify" -#else #define SCINTILLA_NOTIFY "sci-notify" -#endif #ifdef __cplusplus } diff --git a/ext/scintilla/include/WindowAccessor.h b/ext/scintilla/include/WindowAccessor.h deleted file mode 100644 index 6724e8410..000000000 --- a/ext/scintilla/include/WindowAccessor.h +++ /dev/null @@ -1,66 +0,0 @@ -// Scintilla source code edit control -/** @file WindowAccessor.h - ** Implementation of BufferAccess and StylingAccess on a Scintilla - ** rapid easy access to contents of a Scintilla. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class WindowAccessor : public Accessor { - // Private so WindowAccessor objects can not be copied - WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} - WindowAccessor &operator=(const WindowAccessor &) { return *this; } -protected: - WindowID id; - PropSet &props; - int lenDoc; - - char styleBuf[bufferSize]; - int validLen; - char chFlags; - char chWhile; - unsigned int startSeg; - - bool InternalIsLeadByte(char ch); - void Fill(int position); -public: - WindowAccessor(WindowID id_, PropSet &props_) : - Accessor(), id(id_), props(props_), - lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { - } - ~WindowAccessor(); - bool Match(int pos, const char *s); - char StyleAt(int position); - int GetLine(int position); - int LineStart(int line); - int LevelAt(int line); - int Length(); - 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); - } - char *GetProperties() { - return props.ToString(); - } - - void StartAt(unsigned int start, char chMask=31); - void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; - unsigned int GetStartSegment() { return startSeg; } - void StartSegment(unsigned int pos); - void ColourTo(unsigned int pos, int chAttr); - void SetLevel(int line, int level); - int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); - void IndicatorFill(int start, int end, int indicator, int value); -}; - -#ifdef SCI_NAMESPACE -} -#endif diff --git a/ext/scintilla/lexers/LexA68k.cxx b/ext/scintilla/lexers/LexA68k.cxx new file mode 100644 index 000000000..cbf268103 --- /dev/null +++ b/ext/scintilla/lexers/LexA68k.cxx @@ -0,0 +1,318 @@ +// Scintilla source code edit control +/** @file LexA68k.cxx + ** Lexer for Assembler, just for the MASM syntax + ** Written by Martial Demolins AKA Folco + **/ +// Copyright 2010 Martial Demolins +// The License.txt file describes the conditions under which this software +// may be distributed. + + +#include +#include +#include +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + + +// Return values for GetOperatorType +#define NO_OPERATOR 0 +#define OPERATOR_1CHAR 1 +#define OPERATOR_2CHAR 2 + + +/** + * IsIdentifierStart + * + * Return true if the given char is a valid identifier first char + */ + +static inline bool IsIdentifierStart (const int ch) +{ + return (isalpha(ch) || (ch == '_') || (ch == '\\')); +} + + +/** + * IsIdentifierChar + * + * Return true if the given char is a valid identifier char + */ + +static inline bool IsIdentifierChar (const int ch) +{ + return (isalnum(ch) || (ch == '_') || (ch == '@') || (ch == ':') || (ch == '.')); +} + + +/** + * GetOperatorType + * + * Return: + * NO_OPERATOR if char is not an operator + * OPERATOR_1CHAR if the operator is one char long + * OPERATOR_2CHAR if the operator is two chars long + */ + +static inline int GetOperatorType (const int ch1, const int ch2) +{ + int OpType = NO_OPERATOR; + + if ((ch1 == '+') || (ch1 == '-') || (ch1 == '*') || (ch1 == '/') || (ch1 == '#') || + (ch1 == '(') || (ch1 == ')') || (ch1 == '~') || (ch1 == '&') || (ch1 == '|') || (ch1 == ',')) + OpType = OPERATOR_1CHAR; + + else if ((ch1 == ch2) && (ch1 == '<' || ch1 == '>')) + OpType = OPERATOR_2CHAR; + + return OpType; +} + + +/** + * IsBin + * + * Return true if the given char is 0 or 1 + */ + +static inline bool IsBin (const int ch) +{ + return (ch == '0') || (ch == '1'); +} + + +/** + * IsDoxygenChar + * + * Return true if the char may be part of a Doxygen keyword + */ + +static inline bool IsDoxygenChar (const int ch) +{ + return isalpha(ch) || (ch == '$') || (ch == '[') || (ch == ']') || (ch == '{') || (ch == '}'); +} + + +/** + * ColouriseA68kDoc + * + * Main function, which colourises a 68k source + */ + +static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) +{ + + // Get references to keywords lists + WordList &cpuInstruction = *keywordlists[0]; + WordList ®isters = *keywordlists[1]; + WordList &directive = *keywordlists[2]; + WordList &extInstruction = *keywordlists[3]; + WordList &commentSpecial = *keywordlists[4]; + WordList &doxygenKeyword = *keywordlists[5]; + + + // Instanciate a context for our source + StyleContext sc(startPos, length, initStyle, styler); + + + /************************************************************ + * + * Parse the text + * + ************************************************************/ + + for ( ; sc.More(); sc.Forward()) + { + char Buffer[100]; + int OpType; + + // Reset style at beginning of line + if (sc.atLineStart) + sc.SetState(SCE_A68K_DEFAULT); + + + /************************************************************ + * + * Handle current state if we are not in the "default style" + * + ************************************************************/ + + if (sc.state != SCE_A68K_DEFAULT) + { + // Check if current style continue. + // If this case, we loop because there is nothing else to do + if (((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number + || ((sc.state == SCE_A68K_NUMBER_BIN) && IsBin(sc.ch)) // Binary number + || ((sc.state == SCE_A68K_NUMBER_HEX) && isxdigit(sc.ch)) // Hexa number + || ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Arg of macro + || ((sc.state == SCE_A68K_STRING1) && (sc.ch != '\'')) // String single-quoted + || ((sc.state == SCE_A68K_STRING2) && (sc.ch != '\"')) // String double-quoted + || ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument + // Label. ' ' and '\t' are needed to handle macro declarations + || ((sc.state == SCE_A68K_LABEL) && (sc.ch != ':') && (sc.ch != ' ') && (sc.ch != '\t')) + || ((sc.state == SCE_A68K_IDENTIFIER) && (sc.ch < 0x80) && IsIdentifierChar(sc.ch)) // Identifier + || ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && (sc.ch < 0x80) && IsDoxygenChar(sc.ch)) // Doxygen keyword + || ((sc.state == SCE_A68K_COMMENT_WORD) && (sc.ch < 0x80) && isalpha(sc.ch))) // Comment current word + { + continue; + } + + // Check if some states terminate at the current char: + // we must include this char in the current style context + else if (((sc.state == SCE_A68K_STRING1) && (sc.ch < 0x80) && (sc.ch == '\'')) // String single-quoted + || ((sc.state == SCE_A68K_STRING2) && (sc.ch < 0x80) && (sc.ch == '\"')) // String double-quoted + || ((sc.state == SCE_A68K_LABEL) && (sc.ch < 0x80) && (sc.ch == ':'))) // Label + { + sc.ForwardSetState(SCE_A68K_DEFAULT); + } + + // Check for special words or Doxygen keywords in comments + else if (sc.state == SCE_A68K_COMMENT) + { + if (sc.ch == '\\') { + sc.SetState(SCE_A68K_COMMENT_DOXYGEN); + } + else if ((sc.ch < 0x80) && isalpha(sc.ch)) { + sc.SetState(SCE_A68K_COMMENT_WORD); + } + continue; + } + + // Check for special words in comment + else if ((sc.state == SCE_A68K_COMMENT_WORD) && (sc.ch < 0x80) && !isalpha(sc.ch)) + { + sc.GetCurrent(Buffer, sizeof(Buffer)); + if (commentSpecial.InList(Buffer)) { + sc.ChangeState(SCE_A68K_COMMENT_SPECIAL); + } + else { + sc.ChangeState(SCE_A68K_COMMENT); + } + sc.SetState(SCE_A68K_COMMENT); + continue; + } + + // Check for Doxygen keywords + else if ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && (sc.ch < 0x80) && !IsDoxygenChar(sc.ch)) + { + sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context + if (!doxygenKeyword.InList(Buffer)) { + sc.ChangeState(SCE_A68K_COMMENT); + } + sc.SetState(SCE_A68K_COMMENT); + continue; + } + + // Check if we are in the case of a label which terminates without ':' + // It should be a macro declaration, not a label + else if ((sc.state == SCE_A68K_LABEL) && (sc.ch < 0x80) && ((sc.ch == ' ') || (sc.ch == '\t'))) + { + sc.ChangeState(SCE_A68K_MACRO_DECLARATION); + } + + // Check if we are at the end of an identifier + // In this case, colourise it if was a keyword. + else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) + { + sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context + if (cpuInstruction.InList(Buffer)) { // And check if it belongs to a keyword list + sc.ChangeState(SCE_A68K_CPUINSTRUCTION); + } + else if (extInstruction.InList(Buffer)) { + sc.ChangeState(SCE_A68K_EXTINSTRUCTION); + } + else if (registers.InList(Buffer)) { + sc.ChangeState(SCE_A68K_REGISTER); + } + else if (directive.InList(Buffer)) { + sc.ChangeState(SCE_A68K_DIRECTIVE); + } + } + + // All special contexts are now handled.Come back to default style + sc.SetState(SCE_A68K_DEFAULT); + } + + + /************************************************************ + * + * Check if we must enter a new state + * + ************************************************************/ + + // Label and macro identifiers start at the beginning of a line + // We set both as a label, but if it wasn't one (no ':' at the end), + // it will be changed as a macro identifier. + if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { + sc.SetState(SCE_A68K_LABEL); + } + else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Comment + sc.SetState(SCE_A68K_COMMENT); + } + else if ((sc.ch < 0x80) && isdigit(sc.ch)) { // Decimal numbers haven't prefix + sc.SetState(SCE_A68K_NUMBER_DEC); + } + else if ((sc.ch < 0x80) && (sc.ch == '%')) { // Binary numbers are prefixed with '%' + sc.SetState(SCE_A68K_NUMBER_BIN); + } + else if ((sc.ch < 0x80) && (sc.ch == '$')) { // Hexadecimal numbers are prefixed with '$' + sc.SetState(SCE_A68K_NUMBER_HEX); + } + else if ((sc.ch < 0x80) && (sc.ch == '\'')) { // String (single-quoted) + sc.SetState(SCE_A68K_STRING1); + } + else if ((sc.ch < 0x80) && (sc.ch == '\"')) { // String (double-quoted) + sc.SetState(SCE_A68K_STRING2); + } + else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro + sc.SetState(SCE_A68K_MACRO_ARG); + } + else if ((sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { // An identifier: constant, label, etc... + sc.SetState(SCE_A68K_IDENTIFIER); + } + else { + if (sc.ch < 0x80) { + OpType = GetOperatorType(sc.ch, sc.chNext); // Check if current char is an operator + if (OpType != NO_OPERATOR) { + sc.SetState(SCE_A68K_OPERATOR); + if (OpType == OPERATOR_2CHAR) { // Check if the operator is 2 bytes long + sc.ForwardSetState(SCE_A68K_OPERATOR); // (>> or <<) + } + } + } + } + } // End of for() + sc.Complete(); +} + + +// Names of the keyword lists + +static const char * const a68kWordListDesc[] = +{ + "CPU instructions", + "Registers", + "Directives", + "Extended instructions", + "Comment special words", + "Doxygen keywords", + 0 +}; + +LexerModule lmA68k(SCLEX_A68K, ColouriseA68kDoc, "a68k", 0, a68kWordListDesc); diff --git a/ext/scintilla/src/LexAPDL.cxx b/ext/scintilla/lexers/LexAPDL.cxx similarity index 94% rename from ext/scintilla/src/LexAPDL.cxx rename to ext/scintilla/lexers/LexAPDL.cxx index a9a6c5407..5df1d6507 100644 --- a/ext/scintilla/src/LexAPDL.cxx +++ b/ext/scintilla/lexers/LexAPDL.cxx @@ -8,18 +8,21 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; diff --git a/ext/scintilla/src/LexASY.cxx b/ext/scintilla/lexers/LexASY.cxx similarity index 94% rename from ext/scintilla/src/LexASY.cxx rename to ext/scintilla/lexers/LexASY.cxx index 8a1785a52..d58fb4baf 100644 --- a/ext/scintilla/src/LexASY.cxx +++ b/ext/scintilla/lexers/LexASY.cxx @@ -4,25 +4,26 @@ #include #include -#include #include #include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" #include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif -static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle, +static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; @@ -118,7 +119,7 @@ static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_ASY_IDENTIFIER); } else if (sc.Match('/', '*')) { sc.SetState(SCE_ASY_COMMENT); - sc.Forward(); // + sc.Forward(); // } else if (sc.Match('/', '/')) { sc.SetState(SCE_ASY_COMMENTLINE); } else if (sc.ch == '\"') { @@ -162,14 +163,14 @@ static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) length++; ch=styler.SafeGetCharAt(pos+length); } - word[length]=0; + word[length]=0; return length; } static bool IsASYDrawingLine(int line, Accessor &styler) { int pos = styler.LineStart(line); int eol_pos = styler.LineStart(line + 1) - 1; - + int startpos = pos; char buffer[100]=""; @@ -181,11 +182,11 @@ static bool IsASYDrawingLine(int line, Accessor &styler) { if (!drawcommands && ch!=' ') return false; else if (drawcommands) return true; startpos++; - } + } return false; } -static void FoldAsyDoc(unsigned int startPos, int length, int initStyle, +static void FoldAsyDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; @@ -236,7 +237,7 @@ static void FoldAsyDoc(unsigned int startPos, int length, int initStyle, else if (lineCurrent!=0 && IsASYDrawingLine(lineCurrent - 1, styler) && !IsASYDrawingLine(lineCurrent+1, styler)) levelNext--; - } + } if (atEOL) { int levelUse = levelCurrent; diff --git a/ext/scintilla/src/LexAU3.cxx b/ext/scintilla/lexers/LexAU3.cxx similarity index 90% rename from ext/scintilla/src/LexAU3.cxx rename to ext/scintilla/lexers/LexAU3.cxx index 795d50b86..d09c52f9d 100644 --- a/ext/scintilla/src/LexAU3.cxx +++ b/ext/scintilla/lexers/LexAU3.cxx @@ -1,15 +1,15 @@ // Scintilla source code edit control // @file LexAU3.cxx // Lexer for AutoIt3 http://www.hiddensoft.com/autoit3 -// by Jos van der Zande, jvdzande@yahoo.com +// by Jos van der Zande, jvdzande@yahoo.com // // Changes: // March 28, 2004 - Added the standard Folding code // April 21, 2004 - Added Preprosessor Table + Syntax Highlighting // Fixed Number highlighting // Changed default isoperator to IsAOperator to have a better match to AutoIt3 -// Fixed "#comments_start" -> "#comments-start" -// Fixed "#comments_end" -> "#comments-end" +// Fixed "#comments_start" -> "#comments-start" +// Fixed "#comments_end" -> "#comments-end" // Fixed Sendkeys in Strings when not terminated with } // Added support for Sendkey strings that have second parameter e.g. {UP 5} or {a down} // April 26, 2004 - Fixed # pre-processor statement inside of comment block would invalidly change the color. @@ -25,9 +25,9 @@ // Added fold.compact support set with fold.compact=1 // Changed folding inside of #cs-#ce. Default is no keyword folding inside comment blocks when fold.comment=1 // it will now only happen when fold.comment=2. -// Sep 5, 2004 - Added logic to handle colourizing words on the last line. +// Sep 5, 2004 - Added logic to handle colourizing words on the last line. // Typed Characters now show as "default" till they match any table. -// Oct 10, 2004 - Added logic to show Comments in "Special" directives. +// Oct 10, 2004 - Added logic to show Comments in "Special" directives. // Nov 1, 2004 - Added better testing for Numbers supporting x and e notation. // Nov 28, 2004 - Added logic to handle continuation lines for syntax highlighting. // Jan 10, 2005 - Added Abbreviations Keyword used for expansion @@ -52,18 +52,21 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -127,7 +130,7 @@ static int GetSendKey(const char *szLine, char *szKey) } else if (cTemp == ' ') { - // skip other spaces + // skip other spaces } else if (nFlag == 0) { @@ -139,7 +142,7 @@ static int GetSendKey(const char *szLine, char *szKey) // Save second portion into var... szSpecial[nSpecPos++] = cTemp; // check if Second portion is all numbers for repeat fuction - if (isdigit(cTemp) == false) {nSpecNum = 0;} + if (isdigit(cTemp) == false) {nSpecNum = 0;} } } nPos++; // skip to next char @@ -151,7 +154,7 @@ static int GetSendKey(const char *szLine, char *szKey) szKey[nKeyPos] = '\0'; szSpecial[nSpecPos] = '\0'; if (strcmp(szSpecial,"down")== 0 || strcmp(szSpecial,"up")== 0 || - strcmp(szSpecial,"on")== 0 || strcmp(szSpecial,"off")== 0 || + strcmp(szSpecial,"on")== 0 || strcmp(szSpecial,"off")== 0 || strcmp(szSpecial,"toggle")== 0 || nSpecNum == 1 ) { nFlag = 0; @@ -160,13 +163,13 @@ static int GetSendKey(const char *szLine, char *szKey) { nFlag = 1; } - return nFlag; // 1 is bad, 0 is good + return nFlag; // 1 is bad, 0 is good -} // GetSendKey() +} // GetSendKey() // // Routine to check the last "none comment" character on a line to see if its a continuation -// +// static bool IsContinuationLine(unsigned int szLine, Accessor &styler) { int nsPos = styler.LineStart(szLine); @@ -192,7 +195,7 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler) // // syntax highlighting logic -static void ColouriseAU3Doc(unsigned int startPos, +static void ColouriseAU3Doc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { @@ -214,19 +217,19 @@ static void ColouriseAU3Doc(unsigned int startPos, (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) { lineCurrent--; startPos = styler.LineStart(lineCurrent); // get start position - initStyle = 0; // reset the start style to 0 + initStyle = 0; // reset the start style to 0 } } // Set the new length to include it from the start and set the start position length = length + s_startPos - startPos; // correct the total length to process styler.StartAt(startPos); - + StyleContext sc(startPos, length, initStyle, styler); char si; // string indicator "=1 '=2 char ni; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3 - char ci; // comment indicator 0=not linecomment(;) + char ci; // comment indicator 0=not linecomment(;) char s_save[100]; - si=0; + si=0; ni=0; ci=0; //$$$ @@ -234,11 +237,11 @@ static void ColouriseAU3Doc(unsigned int startPos, char s[100]; sc.GetCurrentLowered(s, sizeof(s)); // ********************************************** - // save the total current word for eof processing - if (IsAWordChar(sc.ch) || sc.ch == '}') + // save the total current word for eof processing + if (IsAWordChar(sc.ch) || sc.ch == '}') { strcpy(s_save,s); - int tp = strlen(s_save); + int tp = static_cast(strlen(s_save)); if (tp < 99) { s_save[tp] = static_cast(tolower(sc.ch)); s_save[tp+1] = '\0'; @@ -253,11 +256,12 @@ static void ColouriseAU3Doc(unsigned int startPos, //Reset at line end if (sc.atLineEnd) { ci=0; - if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) - if (sc.atLineEnd) + if (strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0) { + if (sc.atLineEnd) sc.SetState(SCE_AU3_DEFAULT); - else + else sc.SetState(SCE_AU3_COMMENTBLOCK); + } break; } //skip rest of line when a ; is encountered @@ -266,9 +270,9 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.SetState(SCE_AU3_COMMENTBLOCK); } // skip rest of the line - if (ci==2) + if (ci==2) break; - // check when first character is detected on the line + // check when first character is detected on the line if (ci==0) { if (IsAWordStart(static_cast(sc.ch)) || IsAOperator(static_cast(sc.ch))) { ci=1; @@ -291,10 +295,10 @@ static void ColouriseAU3Doc(unsigned int startPos, } case SCE_AU3_OPERATOR: { - // check if its a COMobject + // check if its a COMobject if (sc.chPrev == '.' && IsAWordChar(sc.ch)) { sc.SetState(SCE_AU3_COMOBJ); - } + } else { sc.SetState(SCE_AU3_DEFAULT); } @@ -359,7 +363,7 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.SetState(SCE_AU3_DEFAULT); } } - } + } if (sc.atLineEnd) { sc.SetState(SCE_AU3_DEFAULT);} break; @@ -432,7 +436,7 @@ static void ColouriseAU3Doc(unsigned int startPos, case SCE_AU3_STRING: { // check for " to end a double qouted string or - // check for ' to end a single qouted string + // check for ' to end a single qouted string if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>')) { sc.ForwardSetState(SCE_AU3_DEFAULT); @@ -444,7 +448,7 @@ static void ColouriseAU3Doc(unsigned int startPos, si=0; // at line end and not found a continuation char then reset to default int lineCurrent = styler.GetLine(sc.currentPos); - if (!IsContinuationLine(lineCurrent,styler)) + if (!IsContinuationLine(lineCurrent,styler)) { sc.SetState(SCE_AU3_DEFAULT); break; @@ -455,27 +459,27 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.SetState(SCE_AU3_SENT);} break; } - + case SCE_AU3_SENT: { - // Send key string ended - if (sc.chPrev == '}' && sc.ch != '}') + // Send key string ended + if (sc.chPrev == '}' && sc.ch != '}') { // set color to SENDKEY when valid sendkey .. else set back to regular string char sk[100]; // split {111 222} and return {111} and check if 222 is valid. // if return code = 1 then invalid 222 so must be string - if (GetSendKey(s,sk)) + if (GetSendKey(s,sk)) { sc.ChangeState(SCE_AU3_STRING); } // if single char between {?} then its ok as sendkey for a single character - else if (strlen(sk) == 3) + else if (strlen(sk) == 3) { sc.ChangeState(SCE_AU3_SENT); } // if sendkey {111} is in table then ok as sendkey - else if (keywords4.InList(sk)) + else if (keywords4.InList(sk)) { sc.ChangeState(SCE_AU3_SENT); } @@ -491,9 +495,9 @@ static void ColouriseAU3Doc(unsigned int startPos, int nPos = 0; int nState = 1; char cTemp; - while (!(nState == 2) && ((cTemp = s[nPos]) != '\0')) + while (!(nState == 2) && ((cTemp = s[nPos]) != '\0')) { - if (cTemp == '{' && nState == 1) + if (cTemp == '{' && nState == 1) { nState = 2; } @@ -508,14 +512,14 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.ChangeState(SCE_AU3_STRING); sc.SetState(SCE_AU3_STRING); } - // If invalid character found then assume its a regular string + // If invalid character found then assume its a regular string if (nState == 0) { sc.ChangeState(SCE_AU3_STRING); sc.SetState(SCE_AU3_STRING); } } // check if next portion is again a sendkey - if (sc.atLineEnd) + if (sc.atLineEnd) { sc.ChangeState(SCE_AU3_STRING); sc.SetState(SCE_AU3_DEFAULT); @@ -546,14 +550,14 @@ static void ColouriseAU3Doc(unsigned int startPos, else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);} else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);} //else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);} - else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include + else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include else if (sc.ch == '\"') { sc.SetState(SCE_AU3_STRING); si = 1; } else if (sc.ch == '\'') { sc.SetState(SCE_AU3_STRING); si = 2; } - else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) + else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_AU3_NUMBER); ni = 0; @@ -565,7 +569,7 @@ static void ColouriseAU3Doc(unsigned int startPos, } //for (; sc.More(); sc.Forward()) //************************************* - // Colourize the last word correctly + // Colourize the last word correctly //************************************* if (sc.state == SCE_AU3_KEYWORD) { @@ -609,24 +613,24 @@ static void ColouriseAU3Doc(unsigned int startPos, } if (sc.state == SCE_AU3_SENT) { - // Send key string ended - if (sc.chPrev == '}' && sc.ch != '}') + // Send key string ended + if (sc.chPrev == '}' && sc.ch != '}') { // set color to SENDKEY when valid sendkey .. else set back to regular string char sk[100]; // split {111 222} and return {111} and check if 222 is valid. // if return code = 1 then invalid 222 so must be string - if (GetSendKey(s_save,sk)) + if (GetSendKey(s_save,sk)) { sc.ChangeState(SCE_AU3_STRING); } // if single char between {?} then its ok as sendkey for a single character - else if (strlen(sk) == 3) + else if (strlen(sk) == 3) { sc.ChangeState(SCE_AU3_SENT); } // if sendkey {111} is in table then ok as sendkey - else if (keywords4.InList(sk)) + else if (keywords4.InList(sk)) { sc.ChangeState(SCE_AU3_SENT); } @@ -637,7 +641,7 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.SetState(SCE_AU3_STRING); } // check if next portion is again a sendkey - if (sc.atLineEnd) + if (sc.atLineEnd) { sc.ChangeState(SCE_AU3_STRING); sc.SetState(SCE_AU3_DEFAULT); @@ -654,7 +658,7 @@ static bool IsStreamCommentStyle(int style) { // // Routine to find first none space on the current line and return its Style -// needed for comment lines not starting on pos 1 +// needed for comment lines not starting on pos 1 static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) { int nsPos = styler.LineStart(szLine); @@ -686,7 +690,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc startPos = styler.LineStart(lineCurrent); } } - // vars for style of previous/current/next lines + // vars for style of previous/current/next lines int style = GetStyleFirstWord(lineCurrent,styler); int stylePrev = 0; // find the first previous line without continuation character at the end @@ -711,7 +715,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; - // + // int visibleChars = 0; char chNext = styler.SafeGetCharAt(startPos); char chPrev = ' '; @@ -736,7 +740,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc } } } - // start the capture of the first word + // start the capture of the first word if (!(FirstWordStart)) { if (IsAWordChar(ch) || IsAWordStart(ch) || ch == ';') { FirstWordStart = true; @@ -748,7 +752,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc if (ThenFoundLast) { if (IsAWordChar(ch)) { ThenFoundLast = false; - } + } } // find out if the word "then" is the last on a "if" line if (FirstWordEnd && strcmp(szKeyword,"if") == 0) { @@ -769,21 +773,21 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc } } } - // End of Line found so process the information + // End of Line found so process the information if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { // ************************** // Folding logic for Keywords // ************************** // if a keyword is found on the current line and the line doesn't end with _ (continuation) // and we are not inside a commentblock. - if (szKeywordlen > 0 && (!(chPrev == '_')) && + if (szKeywordlen > 0 && (!(chPrev == '_')) && ((!(IsStreamCommentStyle(style)) || foldInComment)) ) { szKeyword[szKeywordlen] = '\0'; // only fold "if" last keyword is "then" (else its a one line if) if (strcmp(szKeyword,"if") == 0 && ThenFoundLast) { levelNext++; } - // create new fold for these words + // create new fold for these words if (strcmp(szKeyword,"do") == 0 || strcmp(szKeyword,"for") == 0 || strcmp(szKeyword,"func") == 0 || strcmp(szKeyword,"while") == 0|| strcmp(szKeyword,"with") == 0 || strcmp(szKeyword,"#region") == 0 ) { @@ -796,12 +800,12 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc } // end the fold for these words before the current line if (strcmp(szKeyword,"endfunc") == 0 || strcmp(szKeyword,"endif") == 0 || - strcmp(szKeyword,"next") == 0 || strcmp(szKeyword,"until") == 0 || + strcmp(szKeyword,"next") == 0 || strcmp(szKeyword,"until") == 0 || strcmp(szKeyword,"endwith") == 0 ||strcmp(szKeyword,"wend") == 0){ levelNext--; levelCurrent--; } - // end the fold for these words before the current line and Start new fold + // end the fold for these words before the current line and Start new fold if (strcmp(szKeyword,"case") == 0 || strcmp(szKeyword,"else") == 0 || strcmp(szKeyword,"elseif") == 0 ) { levelCurrent--; @@ -840,16 +844,16 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc // Start of a comment block if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) { levelNext++; - } + } // fold till the last line for normal comment lines - else if (IsStreamCommentStyle(stylePrev) + else if (IsStreamCommentStyle(stylePrev) && !(styleNext == SCE_AU3_COMMENT) - && stylePrev == SCE_AU3_COMMENT + && stylePrev == SCE_AU3_COMMENT && style == SCE_AU3_COMMENT) { levelNext--; } // fold till the one but last line for Blockcomment lines - else if (IsStreamCommentStyle(stylePrev) + else if (IsStreamCommentStyle(stylePrev) && !(styleNext == SCE_AU3_COMMENTBLOCK) && style == SCE_AU3_COMMENTBLOCK) { levelNext--; diff --git a/ext/scintilla/src/LexAVE.cxx b/ext/scintilla/lexers/LexAVE.cxx similarity index 94% rename from ext/scintilla/src/LexAVE.cxx rename to ext/scintilla/lexers/LexAVE.cxx index 49ccbac80..e7d260555 100644 --- a/ext/scintilla/src/LexAVE.cxx +++ b/ext/scintilla/lexers/LexAVE.cxx @@ -9,18 +9,21 @@ #include #include -#include -#include #include +#include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -42,7 +45,7 @@ inline bool IsAWordStart(const int ch) { } inline bool isAveOperator(char ch) { - if (isalnum(ch)) + if (isascii(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || diff --git a/ext/scintilla/src/LexAbaqus.cxx b/ext/scintilla/lexers/LexAbaqus.cxx similarity index 96% rename from ext/scintilla/src/LexAbaqus.cxx rename to ext/scintilla/lexers/LexAbaqus.cxx index 051a8f4e7..267449f3a 100644 --- a/ext/scintilla/src/LexAbaqus.cxx +++ b/ext/scintilla/lexers/LexAbaqus.cxx @@ -10,18 +10,21 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; diff --git a/ext/scintilla/src/LexAda.cxx b/ext/scintilla/lexers/LexAda.cxx similarity index 91% rename from ext/scintilla/src/LexAda.cxx rename to ext/scintilla/lexers/LexAda.cxx index 9d1b45702..7bf5a1307 100644 --- a/ext/scintilla/src/LexAda.cxx +++ b/ext/scintilla/lexers/LexAda.cxx @@ -6,18 +6,23 @@ // The License.txt file describes the conditions under which this software may be distributed. #include -#include #include #include +#include +#include -#include "Platform.h" +#include +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "PropSet.h" -#include "KeyWords.h" -#include "SciLexer.h" -#include "SString.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -62,8 +67,8 @@ static inline bool IsDelimiterCharacter(int ch); static inline bool IsNumberStartCharacter(int ch); static inline bool IsNumberCharacter(int ch); static inline bool IsSeparatorOrDelimiterCharacter(int ch); -static bool IsValidIdentifier(const SString& identifier); -static bool IsValidNumber(const SString& number); +static bool IsValidIdentifier(const std::string& identifier); +static bool IsValidNumber(const std::string& number); static inline bool IsWordStartCharacter(int ch); static inline bool IsWordCharacter(int ch); @@ -117,7 +122,7 @@ static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostroph sc.Forward(); sc.Forward(); - SString identifier; + std::string identifier; while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { identifier += static_cast(tolower(sc.ch)); @@ -144,7 +149,7 @@ static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostroph static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) { apostropheStartsAttribute = true; - SString number; + std::string number; sc.SetState(SCE_ADA_NUMBER); // Get all characters up to a delimiter or a separator, including points, but excluding @@ -192,7 +197,7 @@ static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostrophe apostropheStartsAttribute = true; sc.SetState(SCE_ADA_IDENTIFIER); - SString word; + std::string word; while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { word += static_cast(tolower(sc.ch)); @@ -321,7 +326,7 @@ static inline bool IsSeparatorOrDelimiterCharacter(int ch) { return IsASpace(ch) || IsDelimiterCharacter(ch); } -static bool IsValidIdentifier(const SString& identifier) { +static bool IsValidIdentifier(const std::string& identifier) { // First character can't be '_', so initialize the flag to true bool lastWasUnderscore = true; @@ -355,8 +360,8 @@ static bool IsValidIdentifier(const SString& identifier) { return true; } -static bool IsValidNumber(const SString& number) { - int hashPos = number.search("#"); +static bool IsValidNumber(const std::string& number) { + size_t hashPos = number.find("#"); bool seenDot = false; size_t i = 0; @@ -366,7 +371,7 @@ static bool IsValidNumber(const SString& number) { return false; // Just in case // Decimal number - if (hashPos == -1) { + if (hashPos == std::string::npos) { bool canBeSpecial = false; for (; i < length; i++) { diff --git a/ext/scintilla/lexers/LexAsm.cxx b/ext/scintilla/lexers/LexAsm.cxx new file mode 100644 index 000000000..c28a8e927 --- /dev/null +++ b/ext/scintilla/lexers/LexAsm.cxx @@ -0,0 +1,464 @@ +// Scintilla source code edit control +/** @file LexAsm.cxx + ** Lexer for Assembler, just for the MASM syntax + ** Written by The Black Horus + ** Enhancements and NASM stuff by Kein-Hong Man, 2003-10 + ** SCE_ASM_COMMENTBLOCK and SCE_ASM_CHARACTER are for future GNU as colouring + ** Converted to lexer object and added further folding features/properties by "Udo Lechner" + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable: 4786) +#endif + +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +#include "OptionSet.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '.' || + ch == '_' || ch == '?'); +} + +static inline bool IsAWordStart(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || + ch == '%' || ch == '@' || ch == '$' || ch == '?'); +} + +static inline bool IsAsmOperator(const int ch) { + if ((ch < 0x80) && (isalnum(ch))) + return false; + // '.' left out as it is used to make up numbers + if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || + ch == '(' || ch == ')' || ch == '=' || ch == '^' || + ch == '[' || ch == ']' || ch == '<' || ch == '&' || + ch == '>' || ch == ',' || ch == '|' || ch == '~' || + ch == '%' || ch == ':') + return true; + return false; +} + +static bool IsStreamCommentStyle(int style) { + return style == SCE_ASM_COMMENTDIRECTIVE || style == SCE_ASM_COMMENTBLOCK; +} + +static inline int LowerCase(int c) { + if (c >= 'A' && c <= 'Z') + return 'a' + c - 'A'; + return c; +} + +// An individual named option for use in an OptionSet + +// Options used for LexerAsm +struct OptionsAsm { + std::string delimiter; + bool fold; + bool foldSyntaxBased; + bool foldCommentMultiline; + bool foldCommentExplicit; + std::string foldExplicitStart; + std::string foldExplicitEnd; + bool foldExplicitAnywhere; + bool foldCompact; + OptionsAsm() { + delimiter = ""; + fold = false; + foldSyntaxBased = true; + foldCommentMultiline = false; + foldCommentExplicit = false; + foldExplicitStart = ""; + foldExplicitEnd = ""; + foldExplicitAnywhere = false; + foldCompact = true; + } +}; + +static const char * const asmWordListDesc[] = { + "CPU instructions", + "FPU instructions", + "Registers", + "Directives", + "Directive operands", + "Extended instructions", + "Directives4Foldstart", + "Directives4Foldend", + 0 +}; + +struct OptionSetAsm : public OptionSet { + OptionSetAsm() { + DefineProperty("lexer.asm.comment.delimiter", &OptionsAsm::delimiter, + "Character used for COMMENT directive's delimiter, replacing the standard \"~\"."); + + DefineProperty("fold", &OptionsAsm::fold); + + DefineProperty("fold.asm.syntax.based", &OptionsAsm::foldSyntaxBased, + "Set this property to 0 to disable syntax based folding."); + + DefineProperty("fold.asm.comment.multiline", &OptionsAsm::foldCommentMultiline, + "Set this property to 1 to enable folding multi-line comments."); + + DefineProperty("fold.asm.comment.explicit", &OptionsAsm::foldCommentExplicit, + "This option enables folding explicit fold points when using the Asm lexer. " + "Explicit fold points allows adding extra folding by placing a ;{ comment at the start and a ;} " + "at the end of a section that should fold."); + + DefineProperty("fold.asm.explicit.start", &OptionsAsm::foldExplicitStart, + "The string to use for explicit fold start points, replacing the standard ;{."); + + DefineProperty("fold.asm.explicit.end", &OptionsAsm::foldExplicitEnd, + "The string to use for explicit fold end points, replacing the standard ;}."); + + DefineProperty("fold.asm.explicit.anywhere", &OptionsAsm::foldExplicitAnywhere, + "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); + + DefineProperty("fold.compact", &OptionsAsm::foldCompact); + + DefineWordListSets(asmWordListDesc); + } +}; + +class LexerAsm : public ILexer { + WordList cpuInstruction; + WordList mathInstruction; + WordList registers; + WordList directive; + WordList directiveOperand; + WordList extInstruction; + WordList directives4foldstart; + WordList directives4foldend; + OptionsAsm options; + OptionSetAsm osAsm; +public: + LexerAsm() { + } + ~LexerAsm() { + } + void SCI_METHOD Release() { + delete this; + } + int SCI_METHOD Version() const { + return lvOriginal; + } + const char * SCI_METHOD PropertyNames() { + return osAsm.PropertyNames(); + } + int SCI_METHOD PropertyType(const char *name) { + return osAsm.PropertyType(name); + } + const char * SCI_METHOD DescribeProperty(const char *name) { + return osAsm.DescribeProperty(name); + } + int SCI_METHOD PropertySet(const char *key, const char *val); + const char * SCI_METHOD DescribeWordListSets() { + return osAsm.DescribeWordListSets(); + } + int SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + + void * SCI_METHOD PrivateCall(int, void *) { + return 0; + } + + static ILexer *LexerFactoryAsm() { + return new LexerAsm(); + } +}; + +int SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) { + if (osAsm.PropertySet(&options, key, val)) { + return 0; + } + return -1; +} + +int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { + WordList *wordListN = 0; + switch (n) { + case 0: + wordListN = &cpuInstruction; + break; + case 1: + wordListN = &mathInstruction; + break; + case 2: + wordListN = ®isters; + break; + case 3: + wordListN = &directive; + break; + case 4: + wordListN = &directiveOperand; + break; + case 5: + wordListN = &extInstruction; + break; + case 6: + wordListN = &directives4foldstart; + break; + case 7: + wordListN = &directives4foldend; + break; + } + int firstModification = -1; + if (wordListN) { + WordList wlNew; + wlNew.Set(wl); + if (*wordListN != wlNew) { + wordListN->Set(wl); + firstModification = 0; + } + } + return firstModification; +} + +void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + LexAccessor styler(pAccess); + + // Do not leak onto next line + if (initStyle == SCE_ASM_STRINGEOL) + initStyle = SCE_ASM_DEFAULT; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) + { + + // Prevent SCE_ASM_STRINGEOL from leaking back to previous line + if (sc.atLineStart && (sc.state == SCE_ASM_STRING)) { + sc.SetState(SCE_ASM_STRING); + } else if (sc.atLineStart && (sc.state == SCE_ASM_CHARACTER)) { + sc.SetState(SCE_ASM_CHARACTER); + } + + // 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; + } + } + + // Determine if the current state should terminate. + if (sc.state == SCE_ASM_OPERATOR) { + if (!IsAsmOperator(sc.ch)) { + sc.SetState(SCE_ASM_DEFAULT); + } + } else if (sc.state == SCE_ASM_NUMBER) { + if (!IsAWordChar(sc.ch)) { + sc.SetState(SCE_ASM_DEFAULT); + } + } else if (sc.state == SCE_ASM_IDENTIFIER) { + if (!IsAWordChar(sc.ch) ) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + bool IsDirective = false; + + if (cpuInstruction.InList(s)) { + sc.ChangeState(SCE_ASM_CPUINSTRUCTION); + } else if (mathInstruction.InList(s)) { + sc.ChangeState(SCE_ASM_MATHINSTRUCTION); + } else if (registers.InList(s)) { + sc.ChangeState(SCE_ASM_REGISTER); + } else if (directive.InList(s)) { + sc.ChangeState(SCE_ASM_DIRECTIVE); + IsDirective = true; + } else if (directiveOperand.InList(s)) { + sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND); + } else if (extInstruction.InList(s)) { + sc.ChangeState(SCE_ASM_EXTINSTRUCTION); + } + sc.SetState(SCE_ASM_DEFAULT); + if (IsDirective && !strcmp(s, "comment")) { + char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0]; + while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) { + sc.ForwardSetState(SCE_ASM_DEFAULT); + } + if (sc.ch == delimiter) { + sc.SetState(SCE_ASM_COMMENTDIRECTIVE); + } + } + } + } else if (sc.state == SCE_ASM_COMMENTDIRECTIVE) { + char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0]; + if (sc.ch == delimiter) { + while (!sc.atLineEnd) { + sc.Forward(); + } + sc.SetState(SCE_ASM_DEFAULT); + } + } else if (sc.state == SCE_ASM_COMMENT ) { + if (sc.atLineEnd) { + sc.SetState(SCE_ASM_DEFAULT); + } + } else if (sc.state == SCE_ASM_STRING) { + if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_ASM_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_ASM_STRINGEOL); + sc.ForwardSetState(SCE_ASM_DEFAULT); + } + } else if (sc.state == SCE_ASM_CHARACTER) { + if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_ASM_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_ASM_STRINGEOL); + sc.ForwardSetState(SCE_ASM_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_ASM_DEFAULT) { + if (sc.ch == ';'){ + sc.SetState(SCE_ASM_COMMENT); + } else if (isascii(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && isascii(sc.chNext) && isdigit(sc.chNext)))) { + sc.SetState(SCE_ASM_NUMBER); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_ASM_IDENTIFIER); + } else if (sc.ch == '\"') { + sc.SetState(SCE_ASM_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_ASM_CHARACTER); + } else if (IsAsmOperator(sc.ch)) { + sc.SetState(SCE_ASM_OPERATOR); + } + } + + } + sc.Complete(); +} + +// Store both the current line's fold level and the next lines in the +// level store to make it easy to pick up with each increment +// and to make it possible to fiddle the current level for "else". + +void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + + if (!options.fold) + return; + + LexAccessor styler(pAccess); + + 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 levelNext = levelCurrent; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + char word[100]; + int wordlen = 0; + const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (options.foldCommentMultiline && IsStreamCommentStyle(style)) { + if (!IsStreamCommentStyle(stylePrev)) { + levelNext++; + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + // Comments don't end at end of line and the next character may be unstyled. + levelNext--; + } + } + if (options.foldCommentExplicit && ((style == SCE_ASM_COMMENT) || options.foldExplicitAnywhere)) { + if (userDefinedFoldMarkers) { + if (styler.Match(i, options.foldExplicitStart.c_str())) { + levelNext++; + } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { + levelNext--; + } + } else { + if (ch == ';') { + if (chNext == '{') { + levelNext++; + } else if (chNext == '}') { + levelNext--; + } + } + } + } + if (options.foldSyntaxBased && (style == SCE_ASM_DIRECTIVE)) { + word[wordlen++] = static_cast(LowerCase(ch)); + if (wordlen == 100) { // prevent overflow + word[0] = '\0'; + wordlen = 1; + } + if (styleNext != SCE_ASM_DIRECTIVE) { // reading directive ready + word[wordlen] = '\0'; + wordlen = 0; + if (directives4foldstart.InList(word)) { + levelNext++; + } else if (directives4foldend.InList(word)){ + levelNext--; + } + } + } + if (!IsASpace(ch)) + visibleChars++; + if (atEOL || (i == endPos-1)) { + int levelUse = levelCurrent; + int lev = levelUse | levelNext << 16; + if (visibleChars == 0 && options.foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if (levelUse < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelCurrent = levelNext; + if (atEOL && (i == static_cast(styler.Length()-1))) { + // There is an empty line at end of file so give it same level and empty + styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); + } + visibleChars = 0; + } + } +} + +LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc); + diff --git a/ext/scintilla/src/LexAsn1.cxx b/ext/scintilla/lexers/LexAsn1.cxx similarity index 94% rename from ext/scintilla/src/LexAsn1.cxx rename to ext/scintilla/lexers/LexAsn1.cxx index 28bf6d919..dd168a744 100644 --- a/ext/scintilla/src/LexAsn1.cxx +++ b/ext/scintilla/lexers/LexAsn1.cxx @@ -5,20 +5,23 @@ // Copyright 2004 by Herr Pfarrer rpfarrer yahoo de // Last Updated: 20/07/2004 // The License.txt file describes the conditions under which this software may be distributed. + #include #include -#include #include #include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; diff --git a/ext/scintilla/src/LexBaan.cxx b/ext/scintilla/lexers/LexBaan.cxx similarity index 94% rename from ext/scintilla/src/LexBaan.cxx rename to ext/scintilla/lexers/LexBaan.cxx index 97dd1f4b8..1542150c4 100644 --- a/ext/scintilla/src/LexBaan.cxx +++ b/ext/scintilla/lexers/LexBaan.cxx @@ -8,18 +8,21 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; diff --git a/ext/scintilla/src/LexBash.cxx b/ext/scintilla/lexers/LexBash.cxx similarity index 62% rename from ext/scintilla/src/LexBash.cxx rename to ext/scintilla/lexers/LexBash.cxx index 5418137e1..97d8c86d5 100644 --- a/ext/scintilla/src/LexBash.cxx +++ b/ext/scintilla/lexers/LexBash.cxx @@ -2,44 +2,53 @@ /** @file LexBash.cxx ** Lexer for Bash. **/ -// Copyright 2004-2008 by Neil Hodgson +// Copyright 2004-2010 by Neil Hodgson // Adapted from LexPerl by Kein-Hong Man 2004 // The License.txt file describes the conditions under which this software may be distributed. #include #include -#include #include #include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" #include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif -#define HERE_DELIM_MAX 256 +#define HERE_DELIM_MAX 256 // define this if you want 'invalid octals' to be marked as errors // usually, this is not a good idea, permissive lexing is better #undef PEDANTIC_OCTAL -#define BASH_BASE_ERROR 65 -#define BASH_BASE_DECIMAL 66 -#define BASH_BASE_HEX 67 +#define BASH_BASE_ERROR 65 +#define BASH_BASE_DECIMAL 66 +#define BASH_BASE_HEX 67 #ifdef PEDANTIC_OCTAL -#define BASH_BASE_OCTAL 68 -#define BASH_BASE_OCTAL_ERROR 69 +#define BASH_BASE_OCTAL 68 +#define BASH_BASE_OCTAL_ERROR 69 #endif +// state constants for parts of a bash command segment +#define BASH_CMD_BODY 0 +#define BASH_CMD_START 1 +#define BASH_CMD_WORD 2 +#define BASH_CMD_TEST 3 +#define BASH_CMD_ARITH 4 +#define BASH_CMD_DELIM 5 + static inline int translateBashDigit(int ch) { if (ch >= '0' && ch <= '9') { return ch - '0'; @@ -80,11 +89,15 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; + WordList cmdDelimiter, bashStruct, bashStruct_in; + cmdDelimiter.Set("| || |& & && ; ;; ( ) { }"); + bashStruct.Set("if elif fi while until else then do done esac eval"); + bashStruct_in.Set("for case select"); CharacterSet setWordStart(CharacterSet::setAlpha, "_"); // note that [+-] are often parts of identifiers in shell scripts CharacterSet setWord(CharacterSet::setAlphaNum, "._+-"); - CharacterSet setBashOperator(CharacterSet::setNone, "^&\\%()-+=|{}[]:;>,*/,*/ 1) && (styler.StyleAt(startPos) != SCE_SH_HERE_DELIM)) { - startPos--; - } - startPos = styler.LineStart(styler.GetLine(startPos)); - initStyle = styler.StyleAt(startPos - 1); - } - // Bash strings can be multi-line with embedded newlines, so backtrack. - // Bash numbers have additional state during lexing, so backtrack too. - if (initStyle == SCE_SH_STRING - || initStyle == SCE_SH_BACKTICKS - || initStyle == SCE_SH_CHARACTER - || initStyle == SCE_SH_NUMBER - || initStyle == SCE_SH_IDENTIFIER - || initStyle == SCE_SH_COMMENTLINE) { - while ((startPos > 1) && (styler.StyleAt(startPos - 1) == initStyle)) { - startPos--; - } - initStyle = SCE_SH_DEFAULT; + // Always backtracks to the start of a line that is not a continuation + // of the previous line (i.e. start of a bash command segment) + int ln = styler.GetLine(startPos); + for (;;) { + startPos = styler.LineStart(ln); + if (ln == 0 || styler.GetLineState(ln) == BASH_CMD_START) + break; + ln--; } + initStyle = SCE_SH_DEFAULT; StyleContext sc(startPos, endPos - startPos, initStyle, styler); for (; sc.More(); sc.Forward()) { + // handle line continuation, updates per-line stored state + if (sc.atLineStart) { + ln = styler.GetLine(sc.currentPos); + if (sc.state == SCE_SH_STRING + || sc.state == SCE_SH_BACKTICKS + || sc.state == SCE_SH_CHARACTER + || sc.state == SCE_SH_HERE_Q + || sc.state == SCE_SH_COMMENTLINE + || sc.state == SCE_SH_PARAM) { + // force backtrack while retaining cmdState + styler.SetLineState(ln, BASH_CMD_BODY); + } else { + if (ln > 0) { + if ((sc.GetRelative(-3) == '\\' && sc.GetRelative(-2) == '\r' && sc.chPrev == '\n') + || sc.GetRelative(-2) == '\\') { // handle '\' line continuation + // retain last line's state + } else + cmdState = BASH_CMD_START; + } + styler.SetLineState(ln, cmdState); + } + } + + // controls change of cmdState at the end of a non-whitespace element + // states BODY|TEST|ARITH persist until the end of a command segment + // state WORD persist, but ends with 'in' or 'do' construct keywords + int cmdStateNew = BASH_CMD_BODY; + if (cmdState == BASH_CMD_TEST || cmdState == BASH_CMD_ARITH || cmdState == BASH_CMD_WORD) + cmdStateNew = cmdState; + int stylePrev = sc.state; + // Determine if the current state should terminate. switch (sc.state) { case SCE_SH_OPERATOR: sc.SetState(SCE_SH_DEFAULT); + if (cmdState == BASH_CMD_DELIM) // if command delimiter, start new command + cmdStateNew = BASH_CMD_START; + else if (sc.chPrev == '\\') // propagate command state if line continued + cmdStateNew = cmdState; break; case SCE_SH_WORD: // "." never used in Bash variable names but used in file names if (!setWord.Contains(sc.ch)) { - char s[1000]; + char s[500]; + char s2[10]; sc.GetCurrent(s, sizeof(s)); - if (s[0] != '-' && // for file operators - !keywords.InList(s)) { + // allow keywords ending in a whitespace or command delimiter + s2[0] = static_cast(sc.ch); + s2[1] = '\0'; + bool keywordEnds = IsASpace(sc.ch) || cmdDelimiter.InList(s2); + // 'in' or 'do' may be construct keywords + if (cmdState == BASH_CMD_WORD) { + if (strcmp(s, "in") == 0 && keywordEnds) + cmdStateNew = BASH_CMD_BODY; + else if (strcmp(s, "do") == 0 && keywordEnds) + cmdStateNew = BASH_CMD_START; + else + sc.ChangeState(SCE_SH_IDENTIFIER); + sc.SetState(SCE_SH_DEFAULT); + break; + } + // a 'test' keyword starts a test expression + if (strcmp(s, "test") == 0) { + if (cmdState == BASH_CMD_START && keywordEnds) { + cmdStateNew = BASH_CMD_TEST; + testExprType = 0; + } else + sc.ChangeState(SCE_SH_IDENTIFIER); + } + // detect bash construct keywords + else if (bashStruct.InList(s)) { + if (cmdState == BASH_CMD_START && keywordEnds) + cmdStateNew = BASH_CMD_START; + else + sc.ChangeState(SCE_SH_IDENTIFIER); + } + // 'for'|'case'|'select' needs 'in'|'do' to be highlighted later + else if (bashStruct_in.InList(s)) { + if (cmdState == BASH_CMD_START && keywordEnds) + cmdStateNew = BASH_CMD_WORD; + else + sc.ChangeState(SCE_SH_IDENTIFIER); + } + // disambiguate option items and file test operators + else if (s[0] == '-') { + if (cmdState != BASH_CMD_TEST) + sc.ChangeState(SCE_SH_IDENTIFIER); + } + // disambiguate keywords and identifiers + else if (cmdState != BASH_CMD_START + || !(keywords.InList(s) && keywordEnds)) { sc.ChangeState(SCE_SH_IDENTIFIER); } sc.SetState(SCE_SH_DEFAULT); @@ -248,14 +330,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SH_DEFAULT); break; case SCE_SH_COMMENTLINE: - if (sc.ch == '\\' && (sc.chNext == '\r' || sc.chNext == '\n')) { - // comment continuation - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - } else if (sc.atLineEnd) { - sc.ForwardSetState(SCE_SH_DEFAULT); + if (sc.atLineEnd && sc.chPrev != '\\') { + sc.SetState(SCE_SH_DEFAULT); } break; case SCE_SH_HERE_DELIM: @@ -294,23 +370,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, HereDoc.State = 1; } } else if (HereDoc.State == 1) { // collect the delimiter - if (HereDoc.Quoted) { // a quoted here-doc delimiter - if (sc.ch == HereDoc.Quote) { // closing quote => end of delimiter - sc.ForwardSetState(SCE_SH_DEFAULT); - } else { - if (sc.ch == '\\' && sc.chNext == HereDoc.Quote) { // escaped quote - sc.Forward(); - } - HereDoc.Append(sc.ch); - } - } else { // an unquoted here-doc delimiter - if (setHereDoc2.Contains(sc.ch)) { - HereDoc.Append(sc.ch); - } else if (sc.ch == '\\') { - // skip escape prefix - } else { - sc.SetState(SCE_SH_DEFAULT); - } + if (setHereDoc2.Contains(sc.ch) || sc.chPrev == '\\') { + HereDoc.Append(sc.ch); + } else if (HereDoc.Quoted && sc.ch == HereDoc.Quote) { // closing quote => end of delimiter + sc.ForwardSetState(SCE_SH_DEFAULT); + } else if (sc.ch == '\\') { + // skip escape prefix + } else { + sc.SetState(SCE_SH_DEFAULT); } if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup sc.SetState(SCE_SH_ERROR); @@ -334,9 +401,13 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, } char s[HERE_DELIM_MAX]; sc.GetCurrent(s, sizeof(s)); + if (sc.LengthCurrent() == 0) + break; + if (s[strlen(s) - 1] == '\r') + s[strlen(s) - 1] = '\0'; if (strcmp(HereDoc.Delimiter, s) == 0) { - if ((prefixws > 0 && HereDoc.Indent) || // indentation rule - (prefixws == 0 && !HereDoc.Indent)) { + if ((prefixws == 0) || // indentation rule + (prefixws > 0 && HereDoc.Indent)) { sc.SetState(SCE_SH_DEFAULT); break; } @@ -387,10 +458,17 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SH_HERE_Q); } + // update cmdState about the current command segment + if (stylePrev != SCE_SH_DEFAULT && sc.state == SCE_SH_DEFAULT) { + cmdState = cmdStateNew; + } // Determine if a new state should be entered. if (sc.state == SCE_SH_DEFAULT) { - if (sc.ch == '\\') { // escaped character + if (sc.ch == '\\') { + // Bash can escape any non-newline as a literal sc.SetState(SCE_SH_IDENTIFIER); + if (sc.chNext == '\r' || sc.chNext == '\n') + sc.SetState(SCE_SH_OPERATOR); } else if (IsADigit(sc.ch)) { sc.SetState(SCE_SH_NUMBER); numBase = BASH_BASE_DECIMAL; @@ -420,6 +498,10 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SH_BACKTICKS); Quote.Start(sc.ch); } else if (sc.ch == '$') { + if (sc.Match("$((")) { + sc.SetState(SCE_SH_OPERATOR); // handle '((' later + continue; + } sc.SetState(SCE_SH_SCALAR); sc.Forward(); if (sc.ch == '{') { @@ -430,9 +512,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.ChangeState(SCE_SH_STRING); } else if (sc.ch == '(' || sc.ch == '`') { sc.ChangeState(SCE_SH_BACKTICKS); - if (sc.chNext == '(') { // $(( is lexed as operator - sc.ChangeState(SCE_SH_OPERATOR); - } } else { continue; // scalar has no delimiter pair } @@ -449,9 +528,66 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SH_WORD); sc.Forward(); } else if (setBashOperator.Contains(sc.ch)) { + char s[10]; + bool isCmdDelim = false; sc.SetState(SCE_SH_OPERATOR); + // handle opening delimiters for test/arithmetic expressions - ((,[[,[ + if (cmdState == BASH_CMD_START + || cmdState == BASH_CMD_BODY) { + if (sc.Match('(', '(')) { + cmdState = BASH_CMD_ARITH; + sc.Forward(); + } else if (sc.Match('[', '[') && IsASpace(sc.GetRelative(2))) { + cmdState = BASH_CMD_TEST; + testExprType = 1; + sc.Forward(); + } else if (sc.ch == '[' && IsASpace(sc.chNext)) { + cmdState = BASH_CMD_TEST; + testExprType = 2; + } + } + // special state -- for ((x;y;z)) in ... looping + if (cmdState == BASH_CMD_WORD && sc.Match('(', '(')) { + cmdState = BASH_CMD_ARITH; + sc.Forward(); + continue; + } + // handle command delimiters in command START|BODY|WORD state, also TEST if 'test' + if (cmdState == BASH_CMD_START + || cmdState == BASH_CMD_BODY + || cmdState == BASH_CMD_WORD + || (cmdState == BASH_CMD_TEST && testExprType == 0)) { + s[0] = static_cast(sc.ch); + if (setBashOperator.Contains(sc.chNext)) { + s[1] = static_cast(sc.chNext); + s[2] = '\0'; + isCmdDelim = cmdDelimiter.InList(s); + if (isCmdDelim) + sc.Forward(); + } + if (!isCmdDelim) { + s[1] = '\0'; + isCmdDelim = cmdDelimiter.InList(s); + } + if (isCmdDelim) { + cmdState = BASH_CMD_DELIM; + continue; + } + } + // handle closing delimiters for test/arithmetic expressions - )),]],] + if (cmdState == BASH_CMD_ARITH && sc.Match(')', ')')) { + cmdState = BASH_CMD_BODY; + sc.Forward(); + } else if (cmdState == BASH_CMD_TEST && IsASpace(sc.chPrev)) { + if (sc.Match(']', ']') && testExprType == 1) { + sc.Forward(); + cmdState = BASH_CMD_BODY; + } else if (sc.ch == ']' && testExprType == 2) { + cmdState = BASH_CMD_BODY; + } + } } - } + }// sc.state } sc.Complete(); } @@ -503,6 +639,14 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[], levelCurrent--; } } + // Here Document folding + if (style == SCE_SH_HERE_DELIM) { + if (ch == '<' && chNext == '<') { + levelCurrent++; + } + } else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_PL_DEFAULT) { + levelCurrent--; + } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) diff --git a/ext/scintilla/src/LexBasic.cxx b/ext/scintilla/lexers/LexBasic.cxx similarity index 55% rename from ext/scintilla/src/LexBasic.cxx rename to ext/scintilla/lexers/LexBasic.cxx index 9a52186b9..a27b8e9a0 100644 --- a/ext/scintilla/src/LexBasic.cxx +++ b/ext/scintilla/lexers/LexBasic.cxx @@ -1,6 +1,7 @@ // Scintilla source code edit control /** @file LexBasic.cxx ** Lexer for BlitzBasic and PureBasic. + ** Converted to lexer object and added further folding features/properties by "Udo Lechner" **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. @@ -19,18 +20,28 @@ #include #include #include -#include #include +#include +#include -#include "Platform.h" +#ifdef _MSC_VER +#pragma warning(disable: 4786) +#endif -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" +#include +#include + +#include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +#include "OptionSet.h" + #ifdef SCI_NAMESPACE using namespace Scintilla; #endif @@ -86,8 +97,213 @@ static int LowerCase(int c) return c; } -static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler, char comment_char) { +static int CheckBlitzFoldPoint(char const *token, int &level) { + if (!strcmp(token, "function") || + !strcmp(token, "type")) { + level |= SC_FOLDLEVELHEADERFLAG; + return 1; + } + if (!strcmp(token, "end function") || + !strcmp(token, "end type")) { + return -1; + } + return 0; +} + +static int CheckPureFoldPoint(char const *token, int &level) { + if (!strcmp(token, "procedure") || + !strcmp(token, "enumeration") || + !strcmp(token, "interface") || + !strcmp(token, "structure")) { + level |= SC_FOLDLEVELHEADERFLAG; + return 1; + } + if (!strcmp(token, "endprocedure") || + !strcmp(token, "endenumeration") || + !strcmp(token, "endinterface") || + !strcmp(token, "endstructure")) { + return -1; + } + return 0; +} + +static int CheckFreeFoldPoint(char const *token, int &level) { + if (!strcmp(token, "function") || + !strcmp(token, "sub") || + !strcmp(token, "type")) { + level |= SC_FOLDLEVELHEADERFLAG; + return 1; + } + if (!strcmp(token, "end function") || + !strcmp(token, "end sub") || + !strcmp(token, "end type")) { + return -1; + } + return 0; +} + +// An individual named option for use in an OptionSet + +// Options used for LexerBasic +struct OptionsBasic { + bool fold; + bool foldSyntaxBased; + bool foldCommentExplicit; + std::string foldExplicitStart; + std::string foldExplicitEnd; + bool foldExplicitAnywhere; + bool foldCompact; + OptionsBasic() { + fold = false; + foldSyntaxBased = true; + foldCommentExplicit = false; + foldExplicitStart = ""; + foldExplicitEnd = ""; + foldExplicitAnywhere = false; + foldCompact = true; + } +}; + +static const char * const blitzbasicWordListDesc[] = { + "BlitzBasic Keywords", + "user1", + "user2", + "user3", + 0 +}; + +static const char * const purebasicWordListDesc[] = { + "PureBasic Keywords", + "PureBasic PreProcessor Keywords", + "user defined 1", + "user defined 2", + 0 +}; + +static const char * const freebasicWordListDesc[] = { + "FreeBasic Keywords", + "FreeBasic PreProcessor Keywords", + "user defined 1", + "user defined 2", + 0 +}; + +struct OptionSetBasic : public OptionSet { + OptionSetBasic(const char * const wordListDescriptions[]) { + DefineProperty("fold", &OptionsBasic::fold); + + DefineProperty("fold.basic.syntax.based", &OptionsBasic::foldSyntaxBased, + "Set this property to 0 to disable syntax based folding."); + + DefineProperty("fold.basic.comment.explicit", &OptionsBasic::foldCommentExplicit, + "This option enables folding explicit fold points when using the Basic lexer. " + "Explicit fold points allows adding extra folding by placing a ;{ (BB/PB) or '{ (FB) comment at the start " + "and a ;} (BB/PB) or '} (FB) at the end of a section that should be folded."); + + DefineProperty("fold.basic.explicit.start", &OptionsBasic::foldExplicitStart, + "The string to use for explicit fold start points, replacing the standard ;{ (BB/PB) or '{ (FB)."); + + DefineProperty("fold.basic.explicit.end", &OptionsBasic::foldExplicitEnd, + "The string to use for explicit fold end points, replacing the standard ;} (BB/PB) or '} (FB)."); + + DefineProperty("fold.basic.explicit.anywhere", &OptionsBasic::foldExplicitAnywhere, + "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); + + DefineProperty("fold.compact", &OptionsBasic::foldCompact); + + DefineWordListSets(wordListDescriptions); + } +}; + +class LexerBasic : public ILexer { + char comment_char; + int (*CheckFoldPoint)(char const *, int &); + WordList keywordlists[4]; + OptionsBasic options; + OptionSetBasic osBasic; +public: + LexerBasic(char comment_char_, int (*CheckFoldPoint_)(char const *, int &), const char * const wordListDescriptions[]) : + comment_char(comment_char_), + CheckFoldPoint(CheckFoldPoint_), + osBasic(wordListDescriptions) { + } + ~LexerBasic() { + } + void SCI_METHOD Release() { + delete this; + } + int SCI_METHOD Version() const { + return lvOriginal; + } + const char * SCI_METHOD PropertyNames() { + return osBasic.PropertyNames(); + } + int SCI_METHOD PropertyType(const char *name) { + return osBasic.PropertyType(name); + } + const char * SCI_METHOD DescribeProperty(const char *name) { + return osBasic.DescribeProperty(name); + } + int SCI_METHOD PropertySet(const char *key, const char *val); + const char * SCI_METHOD DescribeWordListSets() { + return osBasic.DescribeWordListSets(); + } + int SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + + void * SCI_METHOD PrivateCall(int, void *) { + return 0; + } + static ILexer *LexerFactoryBlitzBasic() { + return new LexerBasic(';', CheckBlitzFoldPoint, blitzbasicWordListDesc); + } + static ILexer *LexerFactoryPureBasic() { + return new LexerBasic(';', CheckPureFoldPoint, purebasicWordListDesc); + } + static ILexer *LexerFactoryFreeBasic() { + return new LexerBasic('\'', CheckFreeFoldPoint, freebasicWordListDesc ); + } +}; + +int SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) { + if (osBasic.PropertySet(&options, key, val)) { + return 0; + } + return -1; +} + +int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { + WordList *wordListN = 0; + switch (n) { + case 0: + wordListN = &keywordlists[0]; + break; + case 1: + wordListN = &keywordlists[1]; + break; + case 2: + wordListN = &keywordlists[2]; + break; + case 3: + wordListN = &keywordlists[3]; + break; + } + int firstModification = -1; + if (wordListN) { + WordList wlNew; + wlNew.Set(wl); + if (*wordListN != wlNew) { + wordListN->Set(wl); + firstModification = 0; + } + } + return firstModification; +} + +void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + LexAccessor styler(pAccess); + bool wasfirst = true, isfirst = true; // true if first token in a line styler.StartAt(startPos); @@ -111,7 +327,7 @@ static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle, }; sc.GetCurrentLowered(s, sizeof(s)); for (int i = 0; i < 4; i++) { - if (keywordlists[i]->InList(s)) { + if (keywordlists[i].InList(s)) { sc.ChangeState(kstates[i]); } } @@ -202,66 +418,30 @@ static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle, sc.Complete(); } -static int CheckBlitzFoldPoint(char const *token, int &level) { - if (!strcmp(token, "function") || - !strcmp(token, "type")) { - level |= SC_FOLDLEVELHEADERFLAG; - return 1; - } - if (!strcmp(token, "end function") || - !strcmp(token, "end type")) { - return -1; - } - return 0; -} -static int CheckPureFoldPoint(char const *token, int &level) { - if (!strcmp(token, "procedure") || - !strcmp(token, "enumeration") || - !strcmp(token, "interface") || - !strcmp(token, "structure")) { - level |= SC_FOLDLEVELHEADERFLAG; - return 1; - } - if (!strcmp(token, "endprocedure") || - !strcmp(token, "endenumeration") || - !strcmp(token, "endinterface") || - !strcmp(token, "endstructure")) { - return -1; - } - return 0; -} +void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initStyle */, IDocument *pAccess) { -static int CheckFreeFoldPoint(char const *token, int &level) { - if (!strcmp(token, "function") || - !strcmp(token, "sub") || - !strcmp(token, "type")) { - level |= SC_FOLDLEVELHEADERFLAG; - return 1; - } - if (!strcmp(token, "end function") || - !strcmp(token, "end sub") || - !strcmp(token, "end type")) { - return -1; - } - return 0; -} + if (!options.fold) + return; + + LexAccessor styler(pAccess); -static void FoldBasicDoc(unsigned int startPos, int length, - Accessor &styler, int (*CheckFoldPoint)(char const *, int &)) { int line = styler.GetLine(startPos); int level = styler.LevelAt(line); int go = 0, done = 0; int endPos = startPos + length; char word[256]; int wordlen = 0; - int i; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); + int cNext = styler[startPos]; + // Scan for tokens at the start of the line (they may include // whitespace, for tokens like "End Function" - for (i = startPos; i < endPos; i++) { - int c = styler.SafeGetCharAt(i); - if (!done && !go) { + for (int i = startPos; i < endPos; i++) { + int c = cNext; + cNext = styler.SafeGetCharAt(i + 1); + bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n'); + if (options.foldSyntaxBased && !done && !go) { if (wordlen) { // are we scanning a token already? word[wordlen] = static_cast(LowerCase(c)); if (!IsIdentifier(c)) { // done with token @@ -291,8 +471,27 @@ static void FoldBasicDoc(unsigned int startPos, int length, } } } - if (c == '\n') { // line end - if (!done && wordlen == 0 && foldCompact) // line was only space + if (options.foldCommentExplicit && ((styler.StyleAt(i) == SCE_B_COMMENT) || options.foldExplicitAnywhere)) { + if (userDefinedFoldMarkers) { + if (styler.Match(i, options.foldExplicitStart.c_str())) { + level |= SC_FOLDLEVELHEADERFLAG; + go = 1; + } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { + go = -1; + } + } else { + if (c == comment_char) { + if (cNext == '{') { + level |= SC_FOLDLEVELHEADERFLAG; + go = 1; + } else if (cNext == '}') { + go = -1; + } + } + } + } + if (atEOL) { // line end + if (!done && wordlen == 0 && options.foldCompact) // line was only space level |= SC_FOLDLEVELWHITEFLAG; if (level != styler.LevelAt(line)) styler.SetLevel(line, level); @@ -308,66 +507,8 @@ static void FoldBasicDoc(unsigned int startPos, int length, } } -static void ColouriseBlitzBasicDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, ';'); -} - -static void ColourisePureBasicDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, ';'); -} - -static void ColouriseFreeBasicDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, '\''); -} - -static void FoldBlitzBasicDoc(unsigned int startPos, int length, int, - WordList *[], Accessor &styler) { - FoldBasicDoc(startPos, length, styler, CheckBlitzFoldPoint); -} - -static void FoldPureBasicDoc(unsigned int startPos, int length, int, - WordList *[], Accessor &styler) { - FoldBasicDoc(startPos, length, styler, CheckPureFoldPoint); -} - -static void FoldFreeBasicDoc(unsigned int startPos, int length, int, - WordList *[], Accessor &styler) { - FoldBasicDoc(startPos, length, styler, CheckFreeFoldPoint); -} - -static const char * const blitzbasicWordListDesc[] = { - "BlitzBasic Keywords", - "user1", - "user2", - "user3", - 0 -}; - -static const char * const purebasicWordListDesc[] = { - "PureBasic Keywords", - "PureBasic PreProcessor Keywords", - "user defined 1", - "user defined 2", - 0 -}; - -static const char * const freebasicWordListDesc[] = { - "FreeBasic Keywords", - "FreeBasic PreProcessor Keywords", - "user defined 1", - "user defined 2", - 0 -}; - -LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, ColouriseBlitzBasicDoc, "blitzbasic", - FoldBlitzBasicDoc, blitzbasicWordListDesc); - -LexerModule lmPureBasic(SCLEX_PUREBASIC, ColourisePureBasicDoc, "purebasic", - FoldPureBasicDoc, purebasicWordListDesc); +LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, LexerBasic::LexerFactoryBlitzBasic, "blitzbasic", blitzbasicWordListDesc); -LexerModule lmFreeBasic(SCLEX_FREEBASIC, ColouriseFreeBasicDoc, "freebasic", - FoldFreeBasicDoc, freebasicWordListDesc); +LexerModule lmPureBasic(SCLEX_PUREBASIC, LexerBasic::LexerFactoryPureBasic, "purebasic", purebasicWordListDesc); +LexerModule lmFreeBasic(SCLEX_FREEBASIC, LexerBasic::LexerFactoryFreeBasic, "freebasic", freebasicWordListDesc); diff --git a/ext/scintilla/src/LexBullant.cxx b/ext/scintilla/lexers/LexBullant.cxx similarity index 93% rename from ext/scintilla/src/LexBullant.cxx rename to ext/scintilla/lexers/LexBullant.cxx index b476ee5be..fabfd8c34 100644 --- a/ext/scintilla/src/LexBullant.cxx +++ b/ext/scintilla/lexers/LexBullant.cxx @@ -3,24 +3,29 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; + s[0] = '\0'; for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { s[i] = static_cast(tolower(styler[start + i])); s[i + 1] = '\0'; @@ -111,7 +116,7 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle } blockChange=0; */ } - if (!isspace(ch)) + if (!(isascii(ch) && isspace(ch))) visibleChars++; if (styler.IsLeadByte(ch)) { diff --git a/ext/scintilla/src/LexCLW.cxx b/ext/scintilla/lexers/LexCLW.cxx similarity index 94% rename from ext/scintilla/src/LexCLW.cxx rename to ext/scintilla/lexers/LexCLW.cxx index 3416bf205..dbe067f9e 100644 --- a/ext/scintilla/src/LexCLW.cxx +++ b/ext/scintilla/lexers/LexCLW.cxx @@ -10,16 +10,19 @@ #include #include #include +#include #include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -60,10 +63,10 @@ inline bool IsALabelStart(const int iChar) { // Is a label character inline bool IsALabelCharacter(const int iChar) { - return(isalnum(iChar) || iChar == '_' || iChar == ':'); + return(isalnum(iChar) || iChar == '_' || iChar == ':'); } -// Is the character is a ! and the the next character is not a ! +// Is the character is a ! and the the next character is not a ! inline bool IsACommentStart(const int iChar) { return(iChar == '!'); @@ -126,7 +129,7 @@ inline bool SetNumericConstantState(StyleContext &scDoc) { break; default : break; - } + } } // If points found (can be more than one for improper formatted number if (iPoints > 0) { @@ -186,12 +189,12 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS WordList &wlLabelReservedWords = *wlKeywords[7]; // Clarion Reserved Keywords (Labels) WordList &wlProcLabelReservedWords = *wlKeywords[8]; // Clarion Reserved Keywords (Procedure Labels) - const char wlProcReservedKeywordList[] = + const char wlProcReservedKeywordList[] = "PROCEDURE FUNCTION"; WordList wlProcReservedKeywords; wlProcReservedKeywords.Set(wlProcReservedKeywordList); - const char wlCompilerKeywordList[] = + const char wlCompilerKeywordList[] = "COMPILE OMIT"; WordList wlCompilerKeywords; wlCompilerKeywords.Set(wlCompilerKeywordList); @@ -243,7 +246,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS // change the label to error state scDoc.ChangeState(SCE_CLW_ERROR); } - // Else if UPPERCASE label string is + // Else if UPPERCASE label string is else if (wlProcLabelReservedWords.InList(cLabel) && iColumn1Label) { char cWord[512]; // Word buffer // Get the next word from the current position @@ -368,13 +371,13 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS // Increment the parenthese level iParenthesesLevel++; } - // Else if the character is a ) (close parenthese) + // Else if the character is a ) (close parenthese) else if (scDoc.ch == ')') { // If the parenthese level is set to zero // parentheses matched if (!iParenthesesLevel) { scDoc.SetState(SCE_CLW_DEFAULT); - } + } // Else parenthese level is greater than zero // still looking for matching parentheses else { @@ -399,7 +402,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS || IsAHexCharacter(scDoc.ch, bCaseSensitive) || scDoc.ch == '.' || IsANumericBaseCharacter(scDoc.ch, bCaseSensitive))) { - // If the number was a real + // If the number was a real if (SetNumericConstantState(scDoc)) { // Colour the matched string to the real constant state scDoc.ChangeState(SCE_CLW_REAL_CONSTANT); @@ -461,7 +464,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS } // Default Handling else { - // If in default state + // If in default state if (scDoc.state == SCE_CLW_DEFAULT) { // If is a letter could be a possible statement if (isalpha(scDoc.ch)) { @@ -477,10 +480,10 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS else if (IsACommentStart(scDoc.ch) || scDoc.ch == '|') { // then set the state to comment. scDoc.SetState(SCE_CLW_COMMENT); - } + } // else if the character is a ' (single quote) else if (scDoc.ch == '\'') { - // If the character is also a ' (single quote) + // If the character is also a ' (single quote) // Embedded Apostrophe if (scDoc.chNext == '\'') { // Move forward colouring it as default state @@ -490,7 +493,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS // move to the next character and then set the state to comment. scDoc.ForwardSetState(SCE_CLW_STRING); } - } + } // else the character is an @ (ampersand) else if (scDoc.ch == '@') { // Case insensitive. @@ -509,7 +512,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS scDoc.SetState(SCE_CLW_PICTURE_STRING); } } - } + } } } } @@ -616,7 +619,7 @@ static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, iStyle = iStyleNext; iStyleNext = accStyler.StyleAt(uiPos + 1); bool bEOL = (chChar == '\r' && chNext != '\n') || (chChar == '\n'); - + if (iStylePrev == SCE_CLW_DEFAULT) { if (iStyle == SCE_CLW_KEYWORD || iStyle == SCE_CLW_STRUCTURE_DATA_TYPE) { // Store last word start point. @@ -647,7 +650,7 @@ static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, iLevelPrev = iLevelCurrent; iVisibleChars = 0; } - + if (!isspacechar(chChar)) iVisibleChars++; } diff --git a/ext/scintilla/lexers/LexCOBOL.cxx b/ext/scintilla/lexers/LexCOBOL.cxx new file mode 100644 index 000000000..4fe09742a --- /dev/null +++ b/ext/scintilla/lexers/LexCOBOL.cxx @@ -0,0 +1,379 @@ +// Scintilla source code edit control +/** @file LexCOBOL.cxx + ** Lexer for COBOL + ** Based on LexPascal.cxx + ** Written by Laurent le Tynevez + ** Updated by Simon Steele September 2002 + ** Updated by Mathias Rauen May 2003 (Delphi adjustments) + ** Updated by Rod Falck, Aug 2006 Converted to COBOL + **/ + +#include +#include +#include +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#define IN_DIVISION 0x01 +#define IN_DECLARATIVES 0x02 +#define IN_SECTION 0x04 +#define IN_PARAGRAPH 0x08 +#define IN_FLAGS 0xF +#define NOT_HEADER 0x10 + +inline bool isCOBOLoperator(char ch) + { + return isoperator(ch); + } + +inline bool isCOBOLwordchar(char ch) + { + return isascii(ch) && (isalnum(ch) || ch == '-'); + + } + +inline bool isCOBOLwordstart(char ch) + { + return isascii(ch) && isalnum(ch); + } + +static int CountBits(int nBits) + { + int count = 0; + for (int i = 0; i < 32; ++i) + { + count += nBits & 1; + nBits >>= 1; + } + return count; + } + +static void getRange(unsigned int start, + unsigned int end, + Accessor &styler, + char *s, + unsigned int len) { + unsigned int i = 0; + while ((i < end - start + 1) && (i < len-1)) { + s[i] = static_cast(tolower(styler[start + i])); + i++; + } + s[i] = '\0'; +} + +static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) { + styler.ColourTo(end, attr); +} + + +static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { + int ret = 0; + + WordList& a_keywords = *keywordlists[0]; + WordList& b_keywords = *keywordlists[1]; + WordList& c_keywords = *keywordlists[2]; + + char s[100]; + getRange(start, end, styler, s, sizeof(s)); + + char chAttr = SCE_C_IDENTIFIER; + if (isdigit(s[0]) || (s[0] == '.') || (s[0] == 'v')) { + chAttr = SCE_C_NUMBER; + char *p = s + 1; + while (*p) { + if ((!isdigit(*p) && (*p) != 'v') && isCOBOLwordchar(*p)) { + chAttr = SCE_C_IDENTIFIER; + break; + } + ++p; + } + } + else { + if (a_keywords.InList(s)) { + chAttr = SCE_C_WORD; + } + else if (b_keywords.InList(s)) { + chAttr = SCE_C_WORD2; + } + else if (c_keywords.InList(s)) { + chAttr = SCE_C_UUID; + } + } + if (*bAarea) { + if (strcmp(s, "division") == 0) { + ret = IN_DIVISION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "declaratives") == 0) { + ret = IN_DIVISION | IN_DECLARATIVES; + if (nContainment & IN_DECLARATIVES) + ret |= NOT_HEADER | IN_SECTION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "section") == 0) { + ret = (nContainment &~ IN_PARAGRAPH) | IN_SECTION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "end") == 0 && (nContainment & IN_DECLARATIVES)) { + ret = IN_DIVISION | IN_DECLARATIVES | IN_SECTION | NOT_HEADER; + } else { + ret = nContainment | IN_PARAGRAPH; + } + } + ColourTo(styler, end, chAttr); + return ret; +} + +static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + styler.StartAt(startPos); + + int state = initStyle; + 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 nContainment; + + int currentLine = styler.GetLine(startPos); + if (currentLine > 0) { + styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); + nContainment = styler.GetLineState(currentLine); + nContainment &= ~NOT_HEADER; + } else { + styler.SetLineState(currentLine, 0); + nContainment = 0; + } + + styler.StartSegment(startPos); + bool bNewLine = true; + bool bAarea = !isspacechar(chNext); + int column = 0; + for (unsigned int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + + chNext = styler.SafeGetCharAt(i + 1); + + ++column; + + if (bNewLine) { + column = 0; + } + if (column <= 1 && !bAarea) { + bAarea = !isspacechar(ch); + } + bool bSetNewLine = false; + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + // 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_CHARACTER) { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + styler.SetLineState(currentLine, nContainment); + currentLine++; + bSetNewLine = true; + if (nContainment & NOT_HEADER) + nContainment &= ~(NOT_HEADER | IN_DECLARATIVES | IN_SECTION); + } + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (isCOBOLwordstart(ch) || (ch == '$' && isascii(chNext) && isalpha(chNext))) { + ColourTo(styler, i-1, state); + state = SCE_C_IDENTIFIER; + } else if (column == 6 && ch == '*') { + // Cobol comment line: asterisk in column 7. + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTLINE; + } else if (ch == '*' && chNext == '>') { + // Cobol inline comment: asterisk, followed by greater than. + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTLINE; + } else if (column == 0 && ch == '*' && chNext != '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTLINE; + } else if (column == 0 && ch == '/' && chNext != '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTLINE; + } else if (column == 0 && ch == '*' && chNext == '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTDOC; + } else if (column == 0 && ch == '/' && chNext == '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTDOC; + } else if (ch == '"') { + ColourTo(styler, i-1, state); + state = SCE_C_STRING; + } else if (ch == '\'') { + ColourTo(styler, i-1, state); + state = SCE_C_CHARACTER; + } else if (ch == '?' && column == 0) { + ColourTo(styler, i-1, state); + state = SCE_C_PREPROCESSOR; + } else if (isCOBOLoperator(ch)) { + ColourTo(styler, i-1, state); + ColourTo(styler, i, SCE_C_OPERATOR); + } + } else if (state == SCE_C_IDENTIFIER) { + if (!isCOBOLwordchar(ch)) { + int lStateChange = classifyWordCOBOL(styler.GetStartSegment(), i - 1, keywordlists, styler, nContainment, &bAarea); + + if(lStateChange != 0) { + styler.SetLineState(currentLine, lStateChange); + nContainment = lStateChange; + } + + state = SCE_C_DEFAULT; + chNext = styler.SafeGetCharAt(i + 1); + if (ch == '"') { + state = SCE_C_STRING; + } else if (ch == '\'') { + state = SCE_C_CHARACTER; + } else if (isCOBOLoperator(ch)) { + ColourTo(styler, i, SCE_C_OPERATOR); + } + } + } else { + if (state == SCE_C_PREPROCESSOR) { + if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { + ColourTo(styler, i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_COMMENT) { + if (ch == '\r' || ch == '\n') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_COMMENTDOC) { + if (ch == '\r' || ch == '\n') { + if (((i > styler.GetStartSegment() + 2) || ( + (initStyle == SCE_C_COMMENTDOC) && + (styler.GetStartSegment() == static_cast(startPos))))) { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + ColourTo(styler, i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + if (ch == '"') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_CHARACTER) { + if (ch == '\'') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } + } + chPrev = ch; + bNewLine = bSetNewLine; + if (bNewLine) + { + bAarea = false; + } + } + ColourTo(styler, lengthDoc - 1, state); +} + +static void FoldCOBOLDoc(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); + int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF; + char chNext = styler[startPos]; + + bool bNewLine = true; + bool bAarea = !isspacechar(chNext); + int column = 0; + bool bComment = false; + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + ++column; + + if (bNewLine) { + column = 0; + bComment = (ch == '*' || ch == '/' || ch == '?'); + } + if (column <= 1 && !bAarea) { + bAarea = !isspacechar(ch); + } + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (atEOL) { + int nContainment = styler.GetLineState(lineCurrent); + int lev = CountBits(nContainment & IN_FLAGS) | SC_FOLDLEVELBASE; + if (bAarea && !bComment) + --lev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((bAarea) && (visibleChars > 0) && !(nContainment & NOT_HEADER) && !bComment) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + if ((lev & SC_FOLDLEVELNUMBERMASK) <= (levelPrev & SC_FOLDLEVELNUMBERMASK)) { + // this level is at the same level or less than the previous line + // therefore these is nothing for the previous header to collapse, so remove the header + styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG); + } + levelPrev = lev; + visibleChars = 0; + bAarea = false; + bNewLine = true; + lineCurrent++; + } else { + bNewLine = false; + } + + + if (!isspacechar(ch)) + visibleChars++; + } + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const COBOLWordListDesc[] = { + "A Keywords", + "B Keywords", + "Extended Keywords", + 0 +}; + +LexerModule lmCOBOL(SCLEX_COBOL, ColouriseCOBOLDoc, "COBOL", FoldCOBOLDoc, COBOLWordListDesc); diff --git a/ext/scintilla/lexers/LexCPP.cxx b/ext/scintilla/lexers/LexCPP.cxx new file mode 100644 index 000000000..80348235e --- /dev/null +++ b/ext/scintilla/lexers/LexCPP.cxx @@ -0,0 +1,1181 @@ +// Scintilla source code edit control +/** @file LexCPP.cxx + ** Lexer for C++, C, Java, and JavaScript. + ** Further folding features and configuration properties added by "Udo Lechner" + **/ +// Copyright 1998-2005 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable: 4786) +#endif + +#include +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +#include "OptionSet.h" +#include "SparseState.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static bool IsSpaceEquiv(int state) { + return (state <= SCE_C_COMMENTDOC) || + // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE + (state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) || + (state == SCE_C_COMMENTDOCKEYWORDERROR); +} + +// Preconditions: sc.currentPos points to a character after '+' or '-'. +// The test for pos reaching 0 should be redundant, +// and is in only for safety measures. +// Limitation: this code will give the incorrect answer for code like +// a = b+++/ptn/... +// Putting a space between the '++' post-inc operator and the '+' binary op +// fixes this, and is highly recommended for readability anyway. +static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { + int pos = (int) sc.currentPos; + while (--pos > 0) { + char ch = styler[pos]; + if (ch == '+' || ch == '-') { + return styler[pos - 1] == ch; + } + } + return false; +} + +static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { + // Don't look at styles, so no need to flush. + int pos = (int) sc.currentPos; + int currentLine = styler.GetLine(pos); + int lineStartPos = styler.LineStart(currentLine); + char ch; + while (--pos > lineStartPos) { + ch = styler.SafeGetCharAt(pos); + if (ch != ' ' && ch != '\t') { + break; + } + } + const char *retBack = "nruter"; + const char *s = retBack; + while (*s + && pos >= lineStartPos + && styler.SafeGetCharAt(pos) == *s) { + s++; + pos--; + } + return !*s; +} + +static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) { + std::string restOfLine; + int i =0; + char ch = styler.SafeGetCharAt(start + i, '\n'); + while ((ch != '\r') && (ch != '\n')) { + if (allowSpace || (ch != ' ')) + restOfLine += ch; + i++; + ch = styler.SafeGetCharAt(start + i, '\n'); + } + return restOfLine; +} + +static bool IsStreamCommentStyle(int style) { + return style == SCE_C_COMMENT || + style == SCE_C_COMMENTDOC || + style == SCE_C_COMMENTDOCKEYWORD || + style == SCE_C_COMMENTDOCKEYWORDERROR; +} + +static std::vector Tokenize(const std::string &s) { + // Break into space separated tokens + std::string word; + std::vector tokens; + for (const char *cp = s.c_str(); *cp; cp++) { + if ((*cp == ' ') || (*cp == '\t')) { + if (!word.empty()) { + tokens.push_back(word); + word = ""; + } + } else { + word += *cp; + } + } + if (!word.empty()) { + tokens.push_back(word); + } + return tokens; +} + +struct PPDefinition { + int line; + std::string key; + std::string value; + PPDefinition(int line_, const std::string &key_, const std::string &value_) : + line(line_), key(key_), value(value_) { + } +}; + +class LinePPState { + int state; + int ifTaken; + int level; + bool ValidLevel() const { + return level >= 0 && level < 32; + } + int maskLevel() const { + return 1 << level; + } +public: + LinePPState() : state(0), ifTaken(0), level(-1) { + } + bool IsInactive() const { + return state != 0; + } + bool CurrentIfTaken() { + return (ifTaken & maskLevel()) != 0; + } + void StartSection(bool on) { + level++; + if (ValidLevel()) { + if (on) { + state &= ~maskLevel(); + ifTaken |= maskLevel(); + } else { + state |= maskLevel(); + ifTaken &= ~maskLevel(); + } + } + } + void EndSection() { + if (ValidLevel()) { + state &= ~maskLevel(); + ifTaken &= ~maskLevel(); + } + level--; + } + void InvertCurrentLevel() { + if (ValidLevel()) { + state ^= maskLevel(); + ifTaken |= maskLevel(); + } + } +}; + +// Hold the preprocessor state for each line seen. +// Currently one entry per line but could become sparse with just one entry per preprocessor line. +class PPStates { + std::vector vlls; +public: + LinePPState ForLine(int line) { + if ((line > 0) && (vlls.size() > static_cast(line))) { + return vlls[line]; + } else { + return LinePPState(); + } + } + void Add(int line, LinePPState lls) { + vlls.resize(line+1); + vlls[line] = lls; + } +}; + +// An individual named option for use in an OptionSet + +// Options used for LexerCPP +struct OptionsCPP { + bool stylingWithinPreprocessor; + bool identifiersAllowDollars; + bool trackPreprocessor; + bool updatePreprocessor; + bool triplequotedStrings; + bool fold; + bool foldSyntaxBased; + bool foldComment; + bool foldCommentMultiline; + bool foldCommentExplicit; + std::string foldExplicitStart; + std::string foldExplicitEnd; + bool foldExplicitAnywhere; + bool foldPreprocessor; + bool foldCompact; + bool foldAtElse; + OptionsCPP() { + stylingWithinPreprocessor = false; + identifiersAllowDollars = true; + trackPreprocessor = true; + updatePreprocessor = true; + triplequotedStrings = false; + fold = false; + foldSyntaxBased = true; + foldComment = false; + foldCommentMultiline = true; + foldCommentExplicit = true; + foldExplicitStart = ""; + foldExplicitEnd = ""; + foldExplicitAnywhere = false; + foldPreprocessor = false; + foldCompact = false; + foldAtElse = false; + } +}; + +static const char *const cppWordLists[] = { + "Primary keywords and identifiers", + "Secondary keywords and identifiers", + "Documentation comment keywords", + "Global classes and typedefs", + "Preprocessor definitions", + 0, +}; + +struct OptionSetCPP : public OptionSet { + OptionSetCPP() { + DefineProperty("styling.within.preprocessor", &OptionsCPP::stylingWithinPreprocessor, + "For C++ code, determines whether all preprocessor code is styled in the " + "preprocessor style (0, the default) or only from the initial # to the end " + "of the command word(1)."); + + DefineProperty("lexer.cpp.allow.dollars", &OptionsCPP::identifiersAllowDollars, + "Set to 0 to disallow the '$' character in identifiers with the cpp lexer."); + + DefineProperty("lexer.cpp.track.preprocessor", &OptionsCPP::trackPreprocessor, + "Set to 1 to interpret #if/#else/#endif to grey out code that is not active."); + + DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor, + "Set to 1 to update preprocessor definitions when #define found."); + + DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings, + "Set to 1 to enable highlighting of triple-quoted strings."); + + DefineProperty("fold", &OptionsCPP::fold); + + DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased, + "Set this property to 0 to disable syntax based folding."); + + DefineProperty("fold.comment", &OptionsCPP::foldComment, + "This option enables folding multi-line comments and explicit fold points when using the C++ lexer. " + "Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} " + "at the end of a section that should fold."); + + DefineProperty("fold.cpp.comment.multiline", &OptionsCPP::foldCommentMultiline, + "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); + + DefineProperty("fold.cpp.comment.explicit", &OptionsCPP::foldCommentExplicit, + "Set this property to 0 to disable folding explicit fold points when fold.comment=1."); + + DefineProperty("fold.cpp.explicit.start", &OptionsCPP::foldExplicitStart, + "The string to use for explicit fold start points, replacing the standard //{."); + + DefineProperty("fold.cpp.explicit.end", &OptionsCPP::foldExplicitEnd, + "The string to use for explicit fold end points, replacing the standard //}."); + + DefineProperty("fold.cpp.explicit.anywhere", &OptionsCPP::foldExplicitAnywhere, + "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); + + DefineProperty("fold.preprocessor", &OptionsCPP::foldPreprocessor, + "This option enables folding preprocessor directives when using the C++ lexer. " + "Includes C#'s explicit #region and #endregion folding directives."); + + DefineProperty("fold.compact", &OptionsCPP::foldCompact); + + DefineProperty("fold.at.else", &OptionsCPP::foldAtElse, + "This option enables C++ folding on a \"} else {\" line of an if statement."); + + DefineWordListSets(cppWordLists); + } +}; + +class LexerCPP : public ILexer { + bool caseSensitive; + CharacterSet setWord; + CharacterSet setNegationOp; + CharacterSet setArithmethicOp; + CharacterSet setRelOp; + CharacterSet setLogicalOp; + PPStates vlls; + std::vector ppDefineHistory; + WordList keywords; + WordList keywords2; + WordList keywords3; + WordList keywords4; + WordList ppDefinitions; + std::map preprocessorDefinitionsStart; + OptionsCPP options; + OptionSetCPP osCPP; + SparseState rawStringTerminators; + enum { activeFlag = 0x40 }; +public: + LexerCPP(bool caseSensitive_) : + caseSensitive(caseSensitive_), + setWord(CharacterSet::setAlphaNum, "._", 0x80, true), + setNegationOp(CharacterSet::setNone, "!"), + setArithmethicOp(CharacterSet::setNone, "+-/*%"), + setRelOp(CharacterSet::setNone, "=!<>"), + setLogicalOp(CharacterSet::setNone, "|&") { + } + ~LexerCPP() { + } + void SCI_METHOD Release() { + delete this; + } + int SCI_METHOD Version() const { + return lvOriginal; + } + const char * SCI_METHOD PropertyNames() { + return osCPP.PropertyNames(); + } + int SCI_METHOD PropertyType(const char *name) { + return osCPP.PropertyType(name); + } + const char * SCI_METHOD DescribeProperty(const char *name) { + return osCPP.DescribeProperty(name); + } + int SCI_METHOD PropertySet(const char *key, const char *val); + const char * SCI_METHOD DescribeWordListSets() { + return osCPP.DescribeWordListSets(); + } + int SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + + void * SCI_METHOD PrivateCall(int, void *) { + return 0; + } + + static ILexer *LexerFactoryCPP() { + return new LexerCPP(true); + } + static ILexer *LexerFactoryCPPInsensitive() { + return new LexerCPP(false); + } + static int MaskActive(int style) { + return style & ~activeFlag; + } + void EvaluateTokens(std::vector &tokens); + bool EvaluateExpression(const std::string &expr, const std::map &preprocessorDefinitions); +}; + +int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { + if (osCPP.PropertySet(&options, key, val)) { + return 0; + } + return -1; +} + +int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { + WordList *wordListN = 0; + switch (n) { + case 0: + wordListN = &keywords; + break; + case 1: + wordListN = &keywords2; + break; + case 2: + wordListN = &keywords3; + break; + case 3: + wordListN = &keywords4; + break; + case 4: + wordListN = &ppDefinitions; + break; + } + int firstModification = -1; + if (wordListN) { + WordList wlNew; + wlNew.Set(wl); + if (*wordListN != wlNew) { + wordListN->Set(wl); + firstModification = 0; + if (n == 4) { + // Rebuild preprocessorDefinitions + preprocessorDefinitionsStart.clear(); + for (int nDefinition = 0; nDefinition < ppDefinitions.len; nDefinition++) { + char *cpDefinition = ppDefinitions.words[nDefinition]; + char *cpEquals = strchr(cpDefinition, '='); + if (cpEquals) { + std::string name(cpDefinition, cpEquals - cpDefinition); + std::string val(cpEquals+1); + preprocessorDefinitionsStart[name] = val; + } else { + std::string name(cpDefinition); + std::string val("1"); + preprocessorDefinitionsStart[name] = val; + } + } + } + } + } + return firstModification; +} + +// Functor used to truncate history +struct After { + int line; + After(int line_) : line(line_) {} + bool operator()(PPDefinition &p) const { + return p.line > line; + } +}; + +void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + LexAccessor styler(pAccess); + + CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); + CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); + + CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); + + CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); + + if (options.identifiersAllowDollars) { + setWordStart.Add('$'); + setWord.Add('$'); + } + + int chPrevNonWhite = ' '; + int visibleChars = 0; + bool lastWordWasUUID = false; + int styleBeforeDCKeyword = SCE_C_DEFAULT; + bool continuationLine = false; + bool isIncludePreprocessor = false; + + int lineCurrent = styler.GetLine(startPos); + if ((initStyle == SCE_C_PREPROCESSOR) || + (initStyle == SCE_C_COMMENTLINE) || + (initStyle == SCE_C_COMMENTLINEDOC)) { + // Set continuationLine if last character of previous line is '\' + if (lineCurrent > 0) { + int chBack = styler.SafeGetCharAt(startPos-1, 0); + int chBack2 = styler.SafeGetCharAt(startPos-2, 0); + int lineEndChar = '!'; + if (chBack2 == '\r' && chBack == '\n') { + lineEndChar = styler.SafeGetCharAt(startPos-3, 0); + } else if (chBack == '\n' || chBack == '\r') { + lineEndChar = chBack2; + } + continuationLine = lineEndChar == '\\'; + } + } + + // look back to set chPrevNonWhite properly for better regex colouring + if (startPos > 0) { + int back = startPos; + while (--back && IsSpaceEquiv(styler.StyleAt(back))) + ; + if (styler.StyleAt(back) == SCE_C_OPERATOR) { + chPrevNonWhite = styler.SafeGetCharAt(back); + } + } + + StyleContext sc(startPos, length, initStyle, styler, 0x7f); + LinePPState preproc = vlls.ForLine(lineCurrent); + + bool definitionsChanged = false; + + // Truncate ppDefineHistory before current line + + if (!options.updatePreprocessor) + ppDefineHistory.clear(); + + std::vector::iterator itInvalid = std::find_if(ppDefineHistory.begin(), ppDefineHistory.end(), After(lineCurrent-1)); + if (itInvalid != ppDefineHistory.end()) { + ppDefineHistory.erase(itInvalid, ppDefineHistory.end()); + definitionsChanged = true; + } + + std::map preprocessorDefinitions = preprocessorDefinitionsStart; + for (std::vector::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) { + preprocessorDefinitions[itDef->key] = itDef->value; + } + + std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1); + SparseState rawSTNew(lineCurrent); + + int activitySet = preproc.IsInactive() ? activeFlag : 0; + + for (; sc.More(); sc.Forward()) { + + if (sc.atLineStart) { + if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) { + // Prevent SCE_C_STRINGEOL from leaking back to previous line which + // ends with a line continuation by locking in the state upto this position. + sc.SetState(sc.state); + } + // Reset states to begining of colourise so no surprises + // if different sets of lines lexed. + visibleChars = 0; + lastWordWasUUID = false; + isIncludePreprocessor = false; + if (preproc.IsInactive()) { + activitySet = activeFlag; + sc.SetState(sc.state | activitySet); + } + if (activitySet) { + if (sc.ch == '#') { + if (sc.Match("#else") || sc.Match("#end") || sc.Match("#if")) { + //activitySet = 0; + } + } + } + } + + if (sc.atLineEnd) { + lineCurrent++; + vlls.Add(lineCurrent, preproc); + if (rawStringTerminator != "") { + rawSTNew.Set(lineCurrent-1, rawStringTerminator); + } + } + + // 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(); + } + continuationLine = true; + continue; + } + } + + const bool atLineEndBeforeSwitch = sc.atLineEnd; + + // Determine if the current state should terminate. + switch (MaskActive(sc.state)) { + case SCE_C_OPERATOR: + sc.SetState(SCE_C_DEFAULT|activitySet); + break; + case SCE_C_NUMBER: + // We accept almost anything because of hex. and number suffixes + if (!(setWord.Contains(sc.ch) || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } + break; + case SCE_C_IDENTIFIER: + if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { + char s[1000]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + if (keywords.InList(s)) { + lastWordWasUUID = strcmp(s, "uuid") == 0; + sc.ChangeState(SCE_C_WORD|activitySet); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_C_WORD2|activitySet); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_C_GLOBALCLASS|activitySet); + } + const bool literalString = sc.ch == '\"'; + if (literalString || sc.ch == '\'') { + size_t lenS = strlen(s); + const bool raw = literalString && sc.chPrev == 'R'; + if (raw) + s[lenS--] = '\0'; + bool valid = + (lenS == 0) || + ((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) || + ((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8')); + if (valid) { + if (literalString) + sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet); + else + sc.ChangeState(SCE_C_CHARACTER|activitySet); + } + } + sc.SetState(SCE_C_DEFAULT|activitySet); + } + break; + case SCE_C_PREPROCESSOR: + if (sc.atLineStart && !continuationLine) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } else if (options.stylingWithinPreprocessor) { + if (IsASpace(sc.ch)) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } + } else { + if (sc.Match('/', '*') || sc.Match('/', '/')) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } + } + break; + case SCE_C_COMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + } + break; + case SCE_C_COMMENTDOC: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support + // Verify that we have the conditions to mark a comment-doc-keyword + if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { + styleBeforeDCKeyword = SCE_C_COMMENTDOC; + sc.SetState(SCE_C_COMMENTDOCKEYWORD|activitySet); + } + } + break; + case SCE_C_COMMENTLINE: + if (sc.atLineStart && !continuationLine) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } + break; + case SCE_C_COMMENTLINEDOC: + if (sc.atLineStart && !continuationLine) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support + // Verify that we have the conditions to mark a comment-doc-keyword + if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { + styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC; + sc.SetState(SCE_C_COMMENTDOCKEYWORD|activitySet); + } + } + break; + case SCE_C_COMMENTDOCKEYWORD: + if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) { + sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); + sc.Forward(); + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + } else if (!setDoxygen.Contains(sc.ch)) { + char s[100]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { + sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); + } + sc.SetState(styleBeforeDCKeyword); + } + break; + case SCE_C_STRING: + if (sc.atLineEnd) { + sc.ChangeState(SCE_C_STRINGEOL|activitySet); + } else if (isIncludePreprocessor) { + if (sc.ch == '>') { + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + isIncludePreprocessor = false; + } + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + } + break; + case SCE_C_STRINGRAW: + if (sc.Match(rawStringTerminator.c_str())) { + for (size_t termPos=rawStringTerminator.size(); termPos; termPos--) + sc.Forward(); + sc.SetState(SCE_C_DEFAULT|activitySet); + rawStringTerminator = ""; + } + break; + case SCE_C_CHARACTER: + if (sc.atLineEnd) { + sc.ChangeState(SCE_C_STRINGEOL|activitySet); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + } + break; + case SCE_C_REGEX: + if (sc.atLineStart) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } else if (sc.ch == '/') { + sc.Forward(); + while ((sc.ch < 0x80) && islower(sc.ch)) + sc.Forward(); // gobble regex flags + sc.SetState(SCE_C_DEFAULT|activitySet); + } else if (sc.ch == '\\') { + // Gobble up the quoted character + if (sc.chNext == '\\' || sc.chNext == '/') { + sc.Forward(); + } + } + break; + case SCE_C_STRINGEOL: + if (sc.atLineStart) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } + break; + case SCE_C_VERBATIM: + if (sc.ch == '\"') { + if (sc.chNext == '\"') { + sc.Forward(); + } else { + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + } + } + break; + case SCE_C_TRIPLEVERBATIM: + if (sc.Match("\"\"\"")) { + while (sc.Match('"')) { + sc.Forward(); + } + sc.SetState(SCE_C_DEFAULT|activitySet); + } + break; + case SCE_C_UUID: + if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') { + sc.SetState(SCE_C_DEFAULT|activitySet); + } + } + + if (sc.atLineEnd && !atLineEndBeforeSwitch) { + // State exit processing consumed characters up to end of line. + lineCurrent++; + vlls.Add(lineCurrent, preproc); + } + + // Determine if a new state should be entered. + if (MaskActive(sc.state) == SCE_C_DEFAULT) { + if (sc.Match('@', '\"')) { + sc.SetState(SCE_C_VERBATIM|activitySet); + sc.Forward(); + } else if (options.triplequotedStrings && sc.Match("\"\"\"")) { + sc.SetState(SCE_C_TRIPLEVERBATIM|activitySet); + sc.Forward(2); + } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + if (lastWordWasUUID) { + sc.SetState(SCE_C_UUID|activitySet); + lastWordWasUUID = false; + } else { + sc.SetState(SCE_C_NUMBER|activitySet); + } + } else if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { + if (lastWordWasUUID) { + sc.SetState(SCE_C_UUID|activitySet); + lastWordWasUUID = false; + } else { + sc.SetState(SCE_C_IDENTIFIER|activitySet); + } + } else if (sc.Match('/', '*')) { + if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style + sc.SetState(SCE_C_COMMENTDOC|activitySet); + } else { + sc.SetState(SCE_C_COMMENT|activitySet); + } + sc.Forward(); // Eat the * so it isn't used for the end of the comment + } else if (sc.Match('/', '/')) { + if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) + // Support of Qt/Doxygen doc. style + sc.SetState(SCE_C_COMMENTLINEDOC|activitySet); + else + sc.SetState(SCE_C_COMMENTLINE|activitySet); + } else if (sc.ch == '/' + && (setOKBeforeRE.Contains(chPrevNonWhite) + || followsReturnKeyword(sc, styler)) + && (!setCouldBePostOp.Contains(chPrevNonWhite) + || !FollowsPostfixOperator(sc, styler))) { + sc.SetState(SCE_C_REGEX|activitySet); // JavaScript's RegEx + } else if (sc.ch == '\"') { + if (sc.chPrev == 'R') { + styler.Flush(); + if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) { + sc.SetState(SCE_C_STRINGRAW|activitySet); + rawStringTerminator = ")"; + for (int termPos = sc.currentPos + 1;; termPos++) { + char chTerminator = styler.SafeGetCharAt(termPos, '('); + if (chTerminator == '(') + break; + rawStringTerminator += chTerminator; + } + rawStringTerminator += '\"'; + } else { + sc.SetState(SCE_C_STRING|activitySet); + } + } else { + sc.SetState(SCE_C_STRING|activitySet); + } + isIncludePreprocessor = false; // ensure that '>' won't end the string + } else if (isIncludePreprocessor && sc.ch == '<') { + sc.SetState(SCE_C_STRING|activitySet); + } else if (sc.ch == '\'') { + sc.SetState(SCE_C_CHARACTER|activitySet); + } else if (sc.ch == '#' && visibleChars == 0) { + // Preprocessor commands are alone on their line + sc.SetState(SCE_C_PREPROCESSOR|activitySet); + // Skip whitespace between # and preprocessor word + do { + sc.Forward(); + } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); + if (sc.atLineEnd) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } else if (sc.Match("include")) { + isIncludePreprocessor = true; + } else { + if (options.trackPreprocessor) { + if (sc.Match("ifdef") || sc.Match("ifndef")) { + bool isIfDef = sc.Match("ifdef"); + int i = isIfDef ? 5 : 6; + std::string restOfLine = GetRestOfLine(styler, sc.currentPos + i + 1, false); + bool foundDef = preprocessorDefinitions.find(restOfLine) != preprocessorDefinitions.end(); + preproc.StartSection(isIfDef == foundDef); + } else if (sc.Match("if")) { + std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true); + bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions); + preproc.StartSection(ifGood); + } else if (sc.Match("else")) { + if (!preproc.CurrentIfTaken()) { + preproc.InvertCurrentLevel(); + activitySet = preproc.IsInactive() ? activeFlag : 0; + if (!activitySet) + sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); + } else if (!preproc.IsInactive()) { + preproc.InvertCurrentLevel(); + activitySet = preproc.IsInactive() ? activeFlag : 0; + if (!activitySet) + sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); + } + } else if (sc.Match("elif")) { + // Ensure only one chosen out of #if .. #elif .. #elif .. #else .. #endif + if (!preproc.CurrentIfTaken()) { + // Similar to #if + std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true); + bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions); + if (ifGood) { + preproc.InvertCurrentLevel(); + activitySet = preproc.IsInactive() ? activeFlag : 0; + if (!activitySet) + sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); + } + } else if (!preproc.IsInactive()) { + preproc.InvertCurrentLevel(); + activitySet = preproc.IsInactive() ? activeFlag : 0; + if (!activitySet) + sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); + } + } else if (sc.Match("endif")) { + preproc.EndSection(); + activitySet = preproc.IsInactive() ? activeFlag : 0; + sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); + } else if (sc.Match("define")) { + if (options.updatePreprocessor && !preproc.IsInactive()) { + std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true); + if (restOfLine.find(")") == std::string::npos) { // Don't handle macros with arguments + std::vector tokens = Tokenize(restOfLine); + std::string key; + std::string value("1"); + if (tokens.size() >= 1) { + key = tokens[0]; + if (tokens.size() >= 2) { + value = tokens[1]; + } + preprocessorDefinitions[key] = value; + ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value)); + definitionsChanged = true; + } + } + } + } + } + } + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_C_OPERATOR|activitySet); + } + } + + if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) { + chPrevNonWhite = sc.ch; + visibleChars++; + } + continuationLine = false; + } + const bool rawStringsChanged = rawStringTerminators.Merge(rawSTNew, lineCurrent); + if (definitionsChanged || rawStringsChanged) + styler.ChangeLexerState(startPos, startPos + length); + sc.Complete(); +} + +// Store both the current line's fold level and the next lines in the +// level store to make it easy to pick up with each increment +// and to make it possible to fiddle the current level for "} else {". + +void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + + if (!options.fold) + return; + + LexAccessor styler(pAccess); + + 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 = MaskActive(styler.StyleAt(startPos)); + int style = MaskActive(initStyle); + const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = MaskActive(styler.StyleAt(i + 1)); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) { + if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) { + levelNext++; + } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) { + // Comments don't end at end of line and the next character may be unstyled. + levelNext--; + } + } + if (options.foldComment && options.foldCommentExplicit && ((style == SCE_C_COMMENTLINE) || options.foldExplicitAnywhere)) { + if (userDefinedFoldMarkers) { + if (styler.Match(i, options.foldExplicitStart.c_str())) { + levelNext++; + } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { + levelNext--; + } + } else { + if ((ch == '/') && (chNext == '/')) { + char chNext2 = styler.SafeGetCharAt(i + 2); + if (chNext2 == '{') { + levelNext++; + } else if (chNext2 == '}') { + levelNext--; + } + } + } + } + if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { + if (ch == '#') { + unsigned int j = i + 1; + while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { + j++; + } + if (styler.Match(j, "region") || styler.Match(j, "if")) { + levelNext++; + } else if (styler.Match(j, "end")) { + levelNext--; + } + } + } + if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) { + if (ch == '{') { + // Measure the minimum before a '{' to allow + // folding on "} else {" + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + levelNext++; + } else if (ch == '}') { + levelNext--; + } + } + if (!IsASpace(ch)) + visibleChars++; + if (atEOL || (i == endPos-1)) { + int levelUse = levelCurrent; + if (options.foldSyntaxBased && options.foldAtElse) { + levelUse = levelMinCurrent; + } + int lev = levelUse | levelNext << 16; + if (visibleChars == 0 && options.foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if (levelUse < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelCurrent = levelNext; + levelMinCurrent = levelCurrent; + if (atEOL && (i == static_cast(styler.Length()-1))) { + // There is an empty line at end of file so give it same level and empty + styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); + } + visibleChars = 0; + } + } +} + +void LexerCPP::EvaluateTokens(std::vector &tokens) { + + // Evaluate defined() statements to either 0 or 1 + for (size_t i=0; (i+2)) + tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4); + val = "1"; + } + tokens[i] = val; + } else { + i++; + } + } + + // Find bracketed subexpressions and recurse on them + std::vector::iterator itBracket = std::find(tokens.begin(), tokens.end(), "("); + std::vector::iterator itEndBracket = std::find(tokens.begin(), tokens.end(), ")"); + while ((itBracket != tokens.end()) && (itEndBracket != tokens.end()) && (itEndBracket > itBracket)) { + std::vector inBracket(itBracket + 1, itEndBracket); + EvaluateTokens(inBracket); + + // The insertion is done before the removal because there were failures with the opposite approach + tokens.insert(itBracket, inBracket.begin(), inBracket.end()); + itBracket = std::find(tokens.begin(), tokens.end(), "("); + itEndBracket = std::find(tokens.begin(), tokens.end(), ")"); + tokens.erase(itBracket, itEndBracket + 1); + + itBracket = std::find(tokens.begin(), tokens.end(), "("); + itEndBracket = std::find(tokens.begin(), tokens.end(), ")"); + } + + // Evaluate logical negations + for (size_t j=0; (j+1)::iterator itInsert = + tokens.erase(tokens.begin() + j, tokens.begin() + j + 2); + tokens.insert(itInsert, isTrue ? "1" : "0"); + } else { + j++; + } + } + + // Evaluate expressions in precedence order + enum precedence { precArithmetic, precRelative, precLogical }; + for (int prec=precArithmetic; prec <= precLogical; prec++) { + // Looking at 3 tokens at a time so end at 2 before end + for (size_t k=0; (k+2)") + result = valA > valB; + else if (tokens[k+1] == ">=") + result = valA >= valB; + else if (tokens[k+1] == "==") + result = valA == valB; + else if (tokens[k+1] == "!=") + result = valA != valB; + else if (tokens[k+1] == "||") + result = valA || valB; + else if (tokens[k+1] == "&&") + result = valA && valB; + char sResult[30]; + sprintf(sResult, "%d", result); + std::vector::iterator itInsert = + tokens.erase(tokens.begin() + k, tokens.begin() + k + 3); + tokens.insert(itInsert, sResult); + } else { + k++; + } + } + } +} + +bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map &preprocessorDefinitions) { + // Break into tokens, replacing with definitions + std::string word; + std::vector tokens; + const char *cp = expr.c_str(); + for (;;) { + if (setWord.Contains(*cp)) { + word += *cp; + } else { + std::map::const_iterator it = preprocessorDefinitions.find(word); + if (it != preprocessorDefinitions.end()) { + tokens.push_back(it->second); + } else if (!word.empty() && ((word[0] >= '0' && word[0] <= '9') || (word == "defined"))) { + tokens.push_back(word); + } + word = ""; + if (!*cp) { + break; + } + if ((*cp != ' ') && (*cp != '\t')) { + std::string op(cp, 1); + if (setRelOp.Contains(*cp)) { + if (setRelOp.Contains(cp[1])) { + op += cp[1]; + cp++; + } + } else if (setLogicalOp.Contains(*cp)) { + if (setLogicalOp.Contains(cp[1])) { + op += cp[1]; + cp++; + } + } + tokens.push_back(op); + } + } + cp++; + } + + EvaluateTokens(tokens); + + // "0" or "" -> false else true + bool isFalse = tokens.empty() || + ((tokens.size() == 1) && ((tokens[0] == "") || tokens[0] == "0")); + return !isFalse; +} + +LexerModule lmCPP(SCLEX_CPP, LexerCPP::LexerFactoryCPP, "cpp", cppWordLists); +LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, LexerCPP::LexerFactoryCPPInsensitive, "cppnocase", cppWordLists); diff --git a/ext/scintilla/src/LexCSS.cxx b/ext/scintilla/lexers/LexCSS.cxx similarity index 91% rename from ext/scintilla/src/LexCSS.cxx rename to ext/scintilla/lexers/LexCSS.cxx index 32a0068b8..17e8a8f9d 100644 --- a/ext/scintilla/src/LexCSS.cxx +++ b/ext/scintilla/lexers/LexCSS.cxx @@ -9,18 +9,21 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -62,6 +65,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo int lastState = -1; // before operator int lastStateC = -1; // before comment + int lastStateS = -1; // before single-quoted/double-quoted string int op = ' '; // last operator int opPrev = ' '; // last operator @@ -105,7 +109,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo i--; if ((sc.currentPos - i) % 2 == 1) continue; - sc.ForwardSetState(SCE_CSS_VALUE); + sc.ForwardSetState(lastStateS); } if (sc.state == SCE_CSS_OPERATOR) { @@ -140,9 +144,9 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo sc.SetState(SCE_CSS_TAG); break; case '{': - if (lastState == SCE_CSS_DIRECTIVE) + if (lastState == SCE_CSS_MEDIA) sc.SetState(SCE_CSS_DEFAULT); - else if (lastState == SCE_CSS_TAG) + else if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DIRECTIVE) sc.SetState(SCE_CSS_IDENTIFIER); break; case '}': @@ -219,7 +223,8 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT || sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || - sc.state == SCE_CSS_IMPORTANT + sc.state == SCE_CSS_IMPORTANT || + sc.state == SCE_CSS_DIRECTIVE )) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); @@ -263,6 +268,10 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo if (strcmp(s2, "important") != 0) sc.ChangeState(SCE_CSS_VALUE); break; + case SCE_CSS_DIRECTIVE: + if (op == '@' && strcmp(s2, "media") == 0) + sc.ChangeState(SCE_CSS_MEDIA); + break; } } @@ -280,12 +289,14 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo lastStateC = sc.state; sc.SetState(SCE_CSS_COMMENT); sc.Forward(); - } else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) { + } else if ((sc.state == SCE_CSS_VALUE || sc.state == SCE_CSS_ATTRIBUTE) + && (sc.ch == '\"' || sc.ch == '\'')) { + lastStateS = sc.state; sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); } else if (IsCssOperator(sc.ch) && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') - && (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{') + && ((sc.state != SCE_CSS_DIRECTIVE && sc.state != SCE_CSS_MEDIA) || sc.ch == ';' || sc.ch == '{') ) { if (sc.state != SCE_CSS_OPERATOR) lastState = sc.state; diff --git a/ext/scintilla/src/LexCaml.cxx b/ext/scintilla/lexers/LexCaml.cxx similarity index 67% rename from ext/scintilla/src/LexCaml.cxx rename to ext/scintilla/lexers/LexCaml.cxx index 845ac657e..982384f7a 100644 --- a/ext/scintilla/src/LexCaml.cxx +++ b/ext/scintilla/lexers/LexCaml.cxx @@ -2,7 +2,7 @@ /** @file LexCaml.cxx ** Lexer for Objective Caml. **/ -// Copyright 2005 by Robert Roessler +// Copyright 2005-2009 by Robert Roessler // The License.txt file describes the conditions under which this software may be distributed. /* Release History 20050204 Initial release. @@ -15,27 +15,31 @@ 20051125 Added 2nd "optional" keywords class. 20051129 Support "magic" (read-only) comments for RCaml. 20051204 Swtich to using StyleContext infrastructure. + 20090629 Add full Standard ML '97 support. */ #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" // Since the Microsoft __iscsym[f] funcs are not ANSI... inline int iscaml(int c) {return isalnum(c) || c == '_';} inline int iscamlf(int c) {return isalpha(c) || c == '_';} -inline int iscamld(int c) {return isdigit(c) || c == '_';} static const int baseT[24] = { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A - L */ @@ -50,9 +54,13 @@ using namespace Scintilla; /* (actually seems to work!) */ +#include #include "WindowAccessor.h" #include "ExternalLexer.h" +#undef EXT_LEXER_DECL +#define EXT_LEXER_DECL __declspec( dllexport ) __stdcall + #if PLAT_WIN #include #endif @@ -143,7 +151,7 @@ static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props) { // create and initialize a WindowAccessor (including contained PropSet) - PropSet ps; + PropSetSimple ps; ps.SetMultiple(props); WindowAccessor wa(window, ps); // create and initialize WordList(s) @@ -179,25 +187,27 @@ void ColouriseCamlDoc( { // initialize styler StyleContext sc(startPos, length, initStyle, styler); - // set up [initial] state info (terminating states that shouldn't "bleed") - int nesting = 0; - if (sc.state < SCE_CAML_STRING) - sc.state = SCE_CAML_DEFAULT; - if (sc.state >= SCE_CAML_COMMENT) - nesting = (sc.state & 0x0f) - SCE_CAML_COMMENT; int chBase = 0, chToken = 0, chLit = 0; WordList& keywords = *keywordlists[0]; WordList& keywords2 = *keywordlists[1]; WordList& keywords3 = *keywordlists[2]; + const bool isSML = keywords.InList("andalso"); const int useMagic = styler.GetPropertyInt("lexer.caml.magic", 0); + // set up [initial] state info (terminating states that shouldn't "bleed") + const int state_ = sc.state & 0x0f; + if (state_ <= SCE_CAML_CHAR + || (isSML && state_ == SCE_CAML_STRING)) + sc.state = SCE_CAML_DEFAULT; + int nesting = (state_ >= SCE_CAML_COMMENT)? (state_ - SCE_CAML_COMMENT): 0; + // foreach char in range... while (sc.More()) { // set up [per-char] state info - int state2 = -1; // (ASSUME no state change) + int state2 = -1; // (ASSUME no state change) int chColor = sc.currentPos - 1;// (ASSUME standard coloring range) - bool advance = true; // (ASSUME scanner "eats" 1 char) + bool advance = true; // (ASSUME scanner "eats" 1 char) // step state machine switch (sc.state & 0x0f) { @@ -206,25 +216,38 @@ void ColouriseCamlDoc( // it's wide open; what do we have? if (iscamlf(sc.ch)) state2 = SCE_CAML_IDENTIFIER; - else if (sc.Match('`') && iscamlf(sc.chNext)) + else if (!isSML && sc.Match('`') && iscamlf(sc.chNext)) state2 = SCE_CAML_TAGNAME; - else if (sc.Match('#') && isdigit(sc.chNext)) + else if (!isSML && sc.Match('#') && isdigit(sc.chNext)) state2 = SCE_CAML_LINENUM; else if (isdigit(sc.ch)) { + // it's a number, assume base 10 state2 = SCE_CAML_NUMBER, chBase = 10; - if (sc.Match('0') && strchr("bBoOxX", sc.chNext)) - chBase = baseT[tolower(sc.chNext) - 'a'], sc.Forward(); - } else if (sc.Match('\'')) /* (char literal?) */ + if (sc.Match('0')) { + // there MAY be a base specified... + const char* baseC = "bBoOxX"; + if (isSML) { + if (sc.chNext == 'w') + sc.Forward(); // (consume SML "word" indicator) + baseC = "x"; + } + // ... change to specified base AS REQUIRED + if (strchr(baseC, sc.chNext)) + chBase = baseT[tolower(sc.chNext) - 'a'], sc.Forward(); + } + } else if (!isSML && sc.Match('\'')) // (Caml char literal?) state2 = SCE_CAML_CHAR, chLit = 0; - else if (sc.Match('\"')) + else if (isSML && sc.Match('#', '"')) // (SML char literal?) + state2 = SCE_CAML_CHAR, sc.Forward(); + else if (sc.Match('"')) state2 = SCE_CAML_STRING; else if (sc.Match('(', '*')) - state2 = SCE_CAML_COMMENT, - sc.ch = ' ', // (make SURE "(*)" isn't seen as a closed comment) - sc.Forward(); - else if (strchr("!?~" /* Caml "prefix-symbol" */ - "=<>@^|&+-*/$%" /* Caml "infix-symbol" */ - "()[]{};,:.#", sc.ch)) /* Caml "bracket" or ;,:.# */ + state2 = SCE_CAML_COMMENT, sc.Forward(), sc.ch = ' '; // (*)... + else if (strchr("!?~" /* Caml "prefix-symbol" */ + "=<>@^|&+-*/$%" /* Caml "infix-symbol" */ + "()[]{};,:.#", sc.ch) // Caml "bracket" or ;,:.# + // SML "extra" ident chars + || (isSML && (sc.Match('\\') || sc.Match('`')))) state2 = SCE_CAML_OPERATOR; break; @@ -273,9 +296,12 @@ void ColouriseCamlDoc( case SCE_CAML_OPERATOR: { // [try to] interpret as [additional] operator char const char* o = 0; - if (iscaml(sc.ch) || isspace(sc.ch) /* ident or whitespace */ - || (o = strchr(")]};,\'\"`#", sc.ch),o)/* "termination" chars */ - || !strchr("!$%&*+-./:<=>?@^|~", sc.ch)/* "operator" chars */) { + if (iscaml(sc.ch) || isspace(sc.ch) // ident or whitespace + || (o = strchr(")]};,\'\"#", sc.ch),o) // "termination" chars + || (!isSML && sc.Match('`')) // Caml extra term char + || (!strchr("!$%&*+-./:<=>?@^|~", sc.ch)// "operator" chars + // SML extra ident chars + && !(isSML && (sc.Match('\\') || sc.Match('`'))))) { // check for INCLUSIVE termination if (o && strchr(")]};,", sc.ch)) { if ((sc.Match(')') && sc.chPrev == '(') @@ -292,24 +318,27 @@ void ColouriseCamlDoc( case SCE_CAML_NUMBER: // [try to] interpret as [additional] numeric literal char - // N.B. - improperly accepts "extra" digits in base 2 or 8 literals - if (iscamld(sc.ch) || IsADigit(sc.ch, chBase)) + if ((!isSML && sc.Match('_')) || IsADigit(sc.ch, chBase)) break; // how about an integer suffix? - if ((sc.Match('l') || sc.Match('L') || sc.Match('n')) - && (iscamld(sc.chPrev) || IsADigit(sc.chPrev, chBase))) + if (!isSML && (sc.Match('l') || sc.Match('L') || sc.Match('n')) + && (sc.chPrev == '_' || IsADigit(sc.chPrev, chBase))) break; // or a floating-point literal? if (chBase == 10) { // with a decimal point? - if (sc.Match('.') && iscamld(sc.chPrev)) + if (sc.Match('.') + && ((!isSML && sc.chPrev == '_') + || IsADigit(sc.chPrev, chBase))) break; // with an exponent? (I) if ((sc.Match('e') || sc.Match('E')) - && (iscamld(sc.chPrev) || sc.chPrev == '.')) + && ((!isSML && (sc.chPrev == '.' || sc.chPrev == '_')) + || IsADigit(sc.chPrev, chBase))) break; // with an exponent? (II) - if ((sc.Match('+') || sc.Match('-')) + if (((!isSML && (sc.Match('+') || sc.Match('-'))) + || (isSML && sc.Match('~'))) && (sc.chPrev == 'e' || sc.chPrev == 'E')) break; } @@ -318,29 +347,56 @@ void ColouriseCamlDoc( break; case SCE_CAML_CHAR: - // [try to] interpret as [additional] char literal char - if (sc.Match('\\')) { - chLit = 1; // (definitely IS a char literal) - if (sc.chPrev == '\\') - sc.ch = ' '; // (so termination test isn't fooled) + if (!isSML) { + // [try to] interpret as [additional] char literal char + if (sc.Match('\\')) { + chLit = 1; // (definitely IS a char literal) + if (sc.chPrev == '\\') + sc.ch = ' '; // (...\\') + // should we be terminating - one way or another? + } else if ((sc.Match('\'') && sc.chPrev != '\\') + || sc.atLineEnd) { + state2 = SCE_CAML_DEFAULT; + if (sc.Match('\'')) + chColor++; + else + sc.ChangeState(SCE_CAML_IDENTIFIER); + // ... maybe a char literal, maybe not + } else if (chLit < 1 && sc.currentPos - chToken >= 2) + sc.ChangeState(SCE_CAML_IDENTIFIER), advance = false; + break; + }/* else + // fall through for SML char literal (handle like string) */ + + case SCE_CAML_STRING: + // [try to] interpret as [additional] [SML char/] string literal char + if (isSML && sc.Match('\\') && sc.chPrev != '\\' && isspace(sc.chNext)) + state2 = SCE_CAML_WHITE; + else if (sc.Match('\\') && sc.chPrev == '\\') + sc.ch = ' '; // (...\\") // should we be terminating - one way or another? - } else if ((sc.Match('\'') && sc.chPrev != '\\') || sc.atLineEnd) { + else if ((sc.Match('"') && sc.chPrev != '\\') + || (isSML && sc.atLineEnd)) { state2 = SCE_CAML_DEFAULT; - if (sc.Match('\'')) + if (sc.Match('"')) chColor++; - else - sc.ChangeState(SCE_CAML_IDENTIFIER); - // ... maybe a char literal, maybe not - } else if (chLit < 1 && sc.currentPos - chToken >= 2) - sc.ChangeState(SCE_CAML_IDENTIFIER), advance = false; + } break; - case SCE_CAML_STRING: - // [try to] interpret as [additional] string literal char - if (sc.Match('\\') && sc.chPrev == '\\') - sc.ch = ' '; // (so '\\' doesn't cause us trouble) - else if (sc.Match('\"') && sc.chPrev != '\\') - state2 = SCE_CAML_DEFAULT, chColor++; + case SCE_CAML_WHITE: + // [try to] interpret as [additional] SML embedded whitespace char + if (sc.Match('\\')) { + // style this puppy NOW... + state2 = SCE_CAML_STRING, sc.ch = ' ' /* (...\") */, chColor++, + styler.ColourTo(chColor, SCE_CAML_WHITE), styler.Flush(); + // ... then backtrack to determine original SML literal type + int p = chColor - 2; + for (; p >= 0 && styler.StyleAt(p) == SCE_CAML_WHITE; p--) ; + if (p >= 0) + state2 = static_cast(styler.StyleAt(p)); + // take care of state change NOW + sc.ChangeState(state2), state2 = -1; + } break; case SCE_CAML_COMMENT: @@ -350,8 +406,7 @@ void ColouriseCamlDoc( // we're IN a comment - does this start a NESTED comment? if (sc.Match('(', '*')) state2 = sc.state + 1, chToken = sc.currentPos, - sc.ch = ' ', // (make SURE "(*)" isn't seen as a closed comment) - sc.Forward(), nesting++; + sc.Forward(), sc.ch = ' ' /* (*)... */, nesting++; // [try to] interpret as [additional] comment char else if (sc.Match(')') && sc.chPrev == '*') { if (nesting) @@ -366,7 +421,7 @@ void ColouriseCamlDoc( break; } - // handle state change and char coloring as required + // handle state change and char coloring AS REQUIRED if (state2 >= 0) styler.ColourTo(chColor, sc.state), sc.ChangeState(state2); // move to next char UNLESS re-scanning current char @@ -382,13 +437,11 @@ void ColouriseCamlDoc( static #endif /* BUILD_AS_EXTERNAL_LEXER */ void FoldCamlDoc( - unsigned int startPos, int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) + unsigned int, int, + int, + WordList *[], + Accessor &) { - // below useless evaluation(s) to supress "not used" warnings - startPos || length || initStyle || keywordlists[0] || styler.Length(); } static const char * const camlWordListDesc[] = { diff --git a/ext/scintilla/src/LexCmake.cxx b/ext/scintilla/lexers/LexCmake.cxx similarity index 96% rename from ext/scintilla/src/LexCmake.cxx rename to ext/scintilla/lexers/LexCmake.cxx index c29d73909..7242cfec6 100644 --- a/ext/scintilla/src/LexCmake.cxx +++ b/ext/scintilla/lexers/LexCmake.cxx @@ -5,20 +5,25 @@ // Copyright 2007 by Cristian Adam // based on the NSIS lexer // The License.txt file describes the conditions under which this software may be distributed. + #include #include -#include #include #include +#include +#include -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + #ifdef SCI_NAMESPACE using namespace Scintilla; #endif diff --git a/ext/scintilla/src/LexConf.cxx b/ext/scintilla/lexers/LexConf.cxx similarity index 85% rename from ext/scintilla/src/LexConf.cxx rename to ext/scintilla/lexers/LexConf.cxx index d39317409..f26458bf8 100644 --- a/ext/scintilla/src/LexConf.cxx +++ b/ext/scintilla/lexers/LexConf.cxx @@ -2,7 +2,7 @@ /** @file LexConf.cxx ** Lexer for Apache Configuration Files. ** - ** First working version contributed by Ahmad Zawawi on October 28, 2000. + ** First working version contributed by Ahmad Zawawi on October 28, 2000. ** i created this lexer because i needed something pretty when dealing ** when Apache Configuration files... **/ @@ -11,18 +11,22 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + #ifdef SCI_NAMESPACE using namespace Scintilla; #endif @@ -70,17 +74,17 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k } else if( ch == '"') { state = SCE_CONF_STRING; styler.ColourTo(i,SCE_CONF_STRING); - } else if( ispunct(ch) ) { + } else if( isascii(ch) && ispunct(ch) ) { // signals an operator... // no state jump necessary for this // simple case... styler.ColourTo(i,SCE_CONF_OPERATOR); - } else if( isalpha(ch) ) { + } else if( isascii(ch) && isalpha(ch) ) { // signals the start of an identifier bufferCount = 0; buffer[bufferCount++] = static_cast(tolower(ch)); state = SCE_CONF_IDENTIFIER; - } else if( isdigit(ch) ) { + } else if( isascii(ch) && isdigit(ch) ) { // signals the start of a number bufferCount = 0; buffer[bufferCount++] = ch; @@ -107,7 +111,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k // if we find a non-alphanumeric char, // we simply go to default state // else we're still dealing with an extension... - if( isalnum(ch) || (ch == '_') || + if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '$') || (ch == '/') || (ch == '.') || (ch == '*') ) { @@ -129,7 +133,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k case SCE_CONF_IDENTIFIER: // stay in CONF_IDENTIFIER state until we find a non-alphanumeric - if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) { + if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) { buffer[bufferCount++] = static_cast(tolower(ch)); } else { state = SCE_CONF_DEFAULT; @@ -154,7 +158,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k case SCE_CONF_NUMBER: // stay in CONF_NUMBER state until we find a non-numeric - if( isdigit(ch) || ch == '.') { + if( (isascii(ch) && isdigit(ch)) || ch == '.') { buffer[bufferCount++] = ch; } else { state = SCE_CONF_DEFAULT; diff --git a/ext/scintilla/src/LexCrontab.cxx b/ext/scintilla/lexers/LexCrontab.cxx similarity index 91% rename from ext/scintilla/src/LexCrontab.cxx rename to ext/scintilla/lexers/LexCrontab.cxx index 6f9ba149a..ea7483565 100644 --- a/ext/scintilla/src/LexCrontab.cxx +++ b/ext/scintilla/lexers/LexCrontab.cxx @@ -9,18 +9,22 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + #ifdef SCI_NAMESPACE using namespace Scintilla; #endif @@ -94,12 +98,12 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi // signals an asterisk // no state jump necessary for this simple case... styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK); - } else if( isalpha(ch) || ch == '<' ) { + } else if( (isascii(ch) && isalpha(ch)) || ch == '<' ) { // signals the start of an identifier bufferCount = 0; buffer[bufferCount++] = ch; state = SCE_NNCRONTAB_IDENTIFIER; - } else if( isdigit(ch) ) { + } else if( isascii(ch) && isdigit(ch) ) { // signals the start of a number bufferCount = 0; buffer[bufferCount++] = ch; @@ -167,7 +171,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi case SCE_NNCRONTAB_IDENTIFIER: // stay in CONF_IDENTIFIER state until we find a non-alphanumeric - if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') || + if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') || (ch == '@') ) { buffer[bufferCount++] = ch; @@ -196,7 +200,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi case SCE_NNCRONTAB_NUMBER: // stay in CONF_NUMBER state until we find a non-numeric - if( isdigit(ch) /* || ch == '.' */ ) { + if( isascii(ch) && isdigit(ch) /* || ch == '.' */ ) { buffer[bufferCount++] = ch; } else { state = SCE_NNCRONTAB_DEFAULT; diff --git a/ext/scintilla/src/LexCsound.cxx b/ext/scintilla/lexers/LexCsound.cxx similarity index 93% rename from ext/scintilla/src/LexCsound.cxx rename to ext/scintilla/lexers/LexCsound.cxx index fd9d2b401..c31ad939c 100644 --- a/ext/scintilla/src/LexCsound.cxx +++ b/ext/scintilla/lexers/LexCsound.cxx @@ -8,18 +8,22 @@ #include #include -#include #include #include -#include "Platform.h" +#include +#include -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" +#include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + #ifdef SCI_NAMESPACE using namespace Scintilla; #endif @@ -35,7 +39,7 @@ static inline bool IsAWordStart(const int ch) { } static inline bool IsCsoundOperator(char ch) { - if (isalnum(ch)) + if (isascii(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || @@ -72,7 +76,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, continue; } } - + // Determine if the current state should terminate. if (sc.state == SCE_CSOUND_OPERATOR) { if (!IsCsoundOperator(static_cast(sc.ch))) { @@ -119,7 +123,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_CSOUND_DEFAULT); } } - + // Determine if a new state should be entered. if (sc.state == SCE_CSOUND_DEFAULT) { if (sc.ch == ';'){ @@ -146,7 +150,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, sc.Complete(); } -static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[], +static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[], Accessor &styler) { unsigned int lengthDoc = startPos + length; int visibleChars = 0; diff --git a/ext/scintilla/lexers/LexD.cxx b/ext/scintilla/lexers/LexD.cxx new file mode 100644 index 000000000..810d95257 --- /dev/null +++ b/ext/scintilla/lexers/LexD.cxx @@ -0,0 +1,572 @@ +/** @file LexD.cxx + ** Lexer for D. + ** + ** Copyright (c) 2006 by Waldemar Augustyn + ** Converted to lexer object and added further folding features/properties by "Udo Lechner" + **/ +// Copyright 1998-2005 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable: 4786) +#endif + +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +#include "OptionSet.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/* Nested comments require keeping the value of the nesting level for every + position in the document. But since scintilla always styles line by line, + we only need to store one value per line. The non-negative number indicates + nesting level at the end of the line. +*/ + +// Underscore, letter, digit and universal alphas from C99 Appendix D. + +static bool IsWordStart(int ch) { + return (isascii(ch) && (isalpha(ch) || ch == '_')) || !isascii(ch); +} + +static bool IsWord(int ch) { + return (isascii(ch) && (isalnum(ch) || ch == '_')) || !isascii(ch); +} + +static bool IsDoxygen(int ch) { + if (isascii(ch) && islower(ch)) + return true; + if (ch == '$' || ch == '@' || ch == '\\' || + ch == '&' || ch == '#' || ch == '<' || ch == '>' || + ch == '{' || ch == '}' || ch == '[' || ch == ']') + return true; + return false; +} + +static bool IsStringSuffix(int ch) { + return ch == 'c' || ch == 'w' || ch == 'd'; +} + +static bool IsStreamCommentStyle(int style) { + return style == SCE_D_COMMENT || + style == SCE_D_COMMENTDOC || + style == SCE_D_COMMENTDOCKEYWORD || + style == SCE_D_COMMENTDOCKEYWORDERROR; +} + +// An individual named option for use in an OptionSet + +// Options used for LexerD +struct OptionsD { + bool fold; + bool foldSyntaxBased; + bool foldComment; + bool foldCommentMultiline; + bool foldCommentExplicit; + std::string foldExplicitStart; + std::string foldExplicitEnd; + bool foldExplicitAnywhere; + bool foldCompact; + int foldAtElseInt; + bool foldAtElse; + OptionsD() { + fold = false; + foldSyntaxBased = true; + foldComment = false; + foldCommentMultiline = true; + foldCommentExplicit = true; + foldExplicitStart = ""; + foldExplicitEnd = ""; + foldExplicitAnywhere = false; + foldCompact = true; + foldAtElseInt = -1; + foldAtElse = false; + } +}; + +static const char * const dWordLists[] = { + "Primary keywords and identifiers", + "Secondary keywords and identifiers", + "Documentation comment keywords", + "Type definitions and aliases", + "Keywords 5", + "Keywords 6", + "Keywords 7", + 0, + }; + +struct OptionSetD : public OptionSet { + OptionSetD() { + DefineProperty("fold", &OptionsD::fold); + + DefineProperty("fold.d.syntax.based", &OptionsD::foldSyntaxBased, + "Set this property to 0 to disable syntax based folding."); + + DefineProperty("fold.comment", &OptionsD::foldComment); + + DefineProperty("fold.d.comment.multiline", &OptionsD::foldCommentMultiline, + "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); + + DefineProperty("fold.d.comment.explicit", &OptionsD::foldCommentExplicit, + "Set this property to 0 to disable folding explicit fold points when fold.comment=1."); + + DefineProperty("fold.d.explicit.start", &OptionsD::foldExplicitStart, + "The string to use for explicit fold start points, replacing the standard //{."); + + DefineProperty("fold.d.explicit.end", &OptionsD::foldExplicitEnd, + "The string to use for explicit fold end points, replacing the standard //}."); + + DefineProperty("fold.d.explicit.anywhere", &OptionsD::foldExplicitAnywhere, + "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); + + DefineProperty("fold.compact", &OptionsD::foldCompact); + + DefineProperty("lexer.d.fold.at.else", &OptionsD::foldAtElseInt, + "This option enables D folding on a \"} else {\" line of an if statement."); + + DefineProperty("fold.at.else", &OptionsD::foldAtElse); + + DefineWordListSets(dWordLists); + } +}; + +class LexerD : public ILexer { + bool caseSensitive; + WordList keywords; + WordList keywords2; + WordList keywords3; + WordList keywords4; + WordList keywords5; + WordList keywords6; + WordList keywords7; + OptionsD options; + OptionSetD osD; +public: + LexerD(bool caseSensitive_) : + caseSensitive(caseSensitive_) { + } + ~LexerD() { + } + void SCI_METHOD Release() { + delete this; + } + int SCI_METHOD Version() const { + return lvOriginal; + } + const char * SCI_METHOD PropertyNames() { + return osD.PropertyNames(); + } + int SCI_METHOD PropertyType(const char *name) { + return osD.PropertyType(name); + } + const char * SCI_METHOD DescribeProperty(const char *name) { + return osD.DescribeProperty(name); + } + int SCI_METHOD PropertySet(const char *key, const char *val); + const char * SCI_METHOD DescribeWordListSets() { + return osD.DescribeWordListSets(); + } + int SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + + void * SCI_METHOD PrivateCall(int, void *) { + return 0; + } + + static ILexer *LexerFactoryD() { + return new LexerD(true); + } + static ILexer *LexerFactoryDInsensitive() { + return new LexerD(false); + } +}; + +int SCI_METHOD LexerD::PropertySet(const char *key, const char *val) { + if (osD.PropertySet(&options, key, val)) { + return 0; + } + return -1; +} + +int SCI_METHOD LexerD::WordListSet(int n, const char *wl) { + WordList *wordListN = 0; + switch (n) { + case 0: + wordListN = &keywords; + break; + case 1: + wordListN = &keywords2; + break; + case 2: + wordListN = &keywords3; + break; + case 3: + wordListN = &keywords4; + break; + case 4: + wordListN = &keywords5; + break; + case 5: + wordListN = &keywords6; + break; + case 6: + wordListN = &keywords7; + break; + } + int firstModification = -1; + if (wordListN) { + WordList wlNew; + wlNew.Set(wl); + if (*wordListN != wlNew) { + wordListN->Set(wl); + firstModification = 0; + } + } + return firstModification; +} + +void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + LexAccessor styler(pAccess); + + int styleBeforeDCKeyword = SCE_D_DEFAULT; + + StyleContext sc(startPos, length, initStyle, styler); + + int curLine = styler.GetLine(startPos); + int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0; + bool numFloat = false; // Float literals have '+' and '-' signs + bool numHex = false; + + for (; sc.More(); sc.Forward()) { + + if (sc.atLineStart) { + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + } + + // Determine if the current state should terminate. + switch (sc.state) { + case SCE_D_OPERATOR: + sc.SetState(SCE_D_DEFAULT); + break; + case SCE_D_NUMBER: + // We accept almost anything because of hex. and number suffixes + if (isascii(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) { + continue; + } else if (sc.ch == '.' && sc.chNext != '.' && !numFloat) { + // Don't parse 0..2 as number. + numFloat=true; + continue; + } else if ( ( sc.ch == '-' || sc.ch == '+' ) && ( /*sign and*/ + ( !numHex && ( sc.chPrev == 'e' || sc.chPrev == 'E' ) ) || /*decimal or*/ + ( sc.chPrev == 'p' || sc.chPrev == 'P' ) ) ) { /*hex*/ + // Parse exponent sign in float literals: 2e+10 0x2e+10 + continue; + } else { + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_IDENTIFIER: + if (!IsWord(sc.ch)) { + char s[1000]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + if (keywords.InList(s)) { + sc.ChangeState(SCE_D_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_D_WORD2); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_D_TYPEDEF); + } else if (keywords5.InList(s)) { + sc.ChangeState(SCE_D_WORD5); + } else if (keywords6.InList(s)) { + sc.ChangeState(SCE_D_WORD6); + } else if (keywords7.InList(s)) { + sc.ChangeState(SCE_D_WORD7); + } + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENTDOC: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support + // Verify that we have the conditions to mark a comment-doc-keyword + if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { + styleBeforeDCKeyword = SCE_D_COMMENTDOC; + sc.SetState(SCE_D_COMMENTDOCKEYWORD); + } + } + break; + case SCE_D_COMMENTLINE: + if (sc.atLineStart) { + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENTLINEDOC: + if (sc.atLineStart) { + sc.SetState(SCE_D_DEFAULT); + } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support + // Verify that we have the conditions to mark a comment-doc-keyword + if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { + styleBeforeDCKeyword = SCE_D_COMMENTLINEDOC; + sc.SetState(SCE_D_COMMENTDOCKEYWORD); + } + } + break; + case SCE_D_COMMENTDOCKEYWORD: + if ((styleBeforeDCKeyword == SCE_D_COMMENTDOC) && sc.Match('*', '/')) { + sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } else if (!IsDoxygen(sc.ch)) { + char s[100]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { + sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); + } + sc.SetState(styleBeforeDCKeyword); + } + break; + case SCE_D_COMMENTNESTED: + if (sc.Match('+', '/')) { + if (curNcLevel > 0) + curNcLevel -= 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.Forward(); + if (curNcLevel == 0) { + sc.ForwardSetState(SCE_D_DEFAULT); + } + } else if (sc.Match('/','+')) { + curNcLevel += 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.Forward(); + } + break; + case SCE_D_STRING: + if (sc.ch == '\\') { + if (sc.chNext == '"' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '"') { + if(IsStringSuffix(sc.chNext)) + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_CHARACTER: + if (sc.atLineEnd) { + sc.ChangeState(SCE_D_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + // Char has no suffixes + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_STRINGEOL: + if (sc.atLineStart) { + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_STRINGB: + if (sc.ch == '`') { + if(IsStringSuffix(sc.chNext)) + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_STRINGR: + if (sc.ch == '"') { + if(IsStringSuffix(sc.chNext)) + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + } + + // Determine if a new state should be entered. + if (sc.state == SCE_D_DEFAULT) { + if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_D_NUMBER); + numFloat = sc.ch == '.'; + // Remember hex literal + numHex = sc.ch == '0' && ( sc.chNext == 'x' || sc.chNext == 'X' ); + } else if ( (sc.ch == 'r' || sc.ch == 'x' || sc.ch == 'q') + && sc.chNext == '"' ) { + // Limited support for hex and delimited strings: parse as r"" + sc.SetState(SCE_D_STRINGR); + sc.Forward(); + } else if (IsWordStart(sc.ch) || sc.ch == '$') { + sc.SetState(SCE_D_IDENTIFIER); + } else if (sc.Match('/','+')) { + curNcLevel += 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.SetState(SCE_D_COMMENTNESTED); + sc.Forward(); + } else if (sc.Match('/', '*')) { + if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style + sc.SetState(SCE_D_COMMENTDOC); + } else { + sc.SetState(SCE_D_COMMENT); + } + sc.Forward(); // Eat the * so it isn't used for the end of the comment + } else if (sc.Match('/', '/')) { + if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) + // Support of Qt/Doxygen doc. style + sc.SetState(SCE_D_COMMENTLINEDOC); + else + sc.SetState(SCE_D_COMMENTLINE); + } else if (sc.ch == '"') { + sc.SetState(SCE_D_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_D_CHARACTER); + } else if (sc.ch == '`') { + sc.SetState(SCE_D_STRINGB); + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_D_OPERATOR); + if (sc.ch == '.' && sc.chNext == '.') sc.Forward(); // Range operator + } + } + } + sc.Complete(); +} + +// Store both the current line's fold level and the next lines in the +// level store to make it easy to pick up with each increment +// and to make it possible to fiddle the current level for "} else {". + +void SCI_METHOD LexerD::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + + if (!options.fold) + return; + + LexAccessor styler(pAccess); + + 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 = initStyle; + bool foldAtElse = options.foldAtElseInt >= 0 ? options.foldAtElseInt != 0 : options.foldAtElse; + const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) { + if (!IsStreamCommentStyle(stylePrev)) { + levelNext++; + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + // Comments don't end at end of line and the next character may be unstyled. + levelNext--; + } + } + if (options.foldComment && options.foldCommentExplicit && ((style == SCE_D_COMMENTLINE) || options.foldExplicitAnywhere)) { + if (userDefinedFoldMarkers) { + if (styler.Match(i, options.foldExplicitStart.c_str())) { + levelNext++; + } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { + levelNext--; + } + } else { + if ((ch == '/') && (chNext == '/')) { + char chNext2 = styler.SafeGetCharAt(i + 2); + if (chNext2 == '{') { + levelNext++; + } else if (chNext2 == '}') { + levelNext--; + } + } + } + } + if (options.foldSyntaxBased && (style == SCE_D_OPERATOR)) { + if (ch == '{') { + // Measure the minimum before a '{' to allow + // folding on "} else {" + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + levelNext++; + } else if (ch == '}') { + levelNext--; + } + } + if (atEOL || (i == endPos-1)) { + if (options.foldComment && options.foldCommentMultiline) { // Handle nested comments + int nc; + nc = styler.GetLineState(lineCurrent); + nc -= lineCurrent>0? styler.GetLineState(lineCurrent-1): 0; + levelNext += nc; + } + int levelUse = levelCurrent; + if (options.foldSyntaxBased && foldAtElse) { + levelUse = levelMinCurrent; + } + int lev = levelUse | levelNext << 16; + if (visibleChars == 0 && options.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 (!IsASpace(ch)) + visibleChars++; + } +} + +LexerModule lmD(SCLEX_D, LexerD::LexerFactoryD, "d", dWordLists); diff --git a/ext/scintilla/src/LexEScript.cxx b/ext/scintilla/lexers/LexEScript.cxx similarity index 95% rename from ext/scintilla/src/LexEScript.cxx rename to ext/scintilla/lexers/LexEScript.cxx index 3e53627e4..d11d4215c 100644 --- a/ext/scintilla/src/LexEScript.cxx +++ b/ext/scintilla/lexers/LexEScript.cxx @@ -9,15 +9,18 @@ #include #include #include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -198,7 +201,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++; diff --git a/ext/scintilla/src/LexEiffel.cxx b/ext/scintilla/lexers/LexEiffel.cxx similarity index 95% rename from ext/scintilla/src/LexEiffel.cxx rename to ext/scintilla/lexers/LexEiffel.cxx index 4f8e7e246..204d45806 100644 --- a/ext/scintilla/src/LexEiffel.cxx +++ b/ext/scintilla/lexers/LexEiffel.cxx @@ -7,18 +7,21 @@ #include #include -#include -#include #include +#include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; diff --git a/ext/scintilla/lexers/LexErlang.cxx b/ext/scintilla/lexers/LexErlang.cxx new file mode 100644 index 000000000..d8e15ccd1 --- /dev/null +++ b/ext/scintilla/lexers/LexErlang.cxx @@ -0,0 +1,623 @@ +// Scintilla source code edit control +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. +/** @file LexErlang.cxx + ** Lexer for Erlang. + ** Enhanced by Etienne 'Lenain' Girondel (lenaing@gmail.com) + ** Originally wrote by Peter-Henry Mander, + ** based on Matlab lexer by José Fonseca. + **/ + +#include +#include +#include +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static int is_radix(int radix, int ch) { + int digit; + + if (36 < radix || 2 > radix) + return 0; + + if (isdigit(ch)) { + digit = ch - '0'; + } else if (isalnum(ch)) { + digit = toupper(ch) - 'A' + 10; + } else { + return 0; + } + + return (digit < radix); +} + +typedef enum { + STATE_NULL, + COMMENT, + COMMENT_FUNCTION, + COMMENT_MODULE, + COMMENT_DOC, + COMMENT_DOC_MACRO, + ATOM_UNQUOTED, + ATOM_QUOTED, + NODE_NAME_UNQUOTED, + NODE_NAME_QUOTED, + MACRO_START, + MACRO_UNQUOTED, + MACRO_QUOTED, + RECORD_START, + RECORD_UNQUOTED, + RECORD_QUOTED, + NUMERAL_START, + NUMERAL_BASE_VALUE, + NUMERAL_FLOAT, + NUMERAL_EXPONENT, + PREPROCESSOR +} atom_parse_state_t; + +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (ch != ' ') && (isalnum(ch) || ch == '_'); +} + +static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + StyleContext sc(startPos, length, initStyle, styler); + WordList &reservedWords = *keywordlists[0]; + WordList &erlangBIFs = *keywordlists[1]; + WordList &erlangPreproc = *keywordlists[2]; + WordList &erlangModulesAtt = *keywordlists[3]; + WordList &erlangDoc = *keywordlists[4]; + WordList &erlangDocMacro = *keywordlists[5]; + int radix_digits = 0; + int exponent_digits = 0; + atom_parse_state_t parse_state = STATE_NULL; + atom_parse_state_t old_parse_state = STATE_NULL; + bool to_late_to_comment = false; + char cur[100]; + int old_style = SCE_ERLANG_DEFAULT; + + styler.StartAt(startPos); + + for (; sc.More(); sc.Forward()) { + int style = SCE_ERLANG_DEFAULT; + if (STATE_NULL != parse_state) { + + switch (parse_state) { + + case STATE_NULL : sc.SetState(SCE_ERLANG_DEFAULT); break; + + /* COMMENTS ------------------------------------------------------*/ + case COMMENT : { + if (sc.ch != '%') { + to_late_to_comment = true; + } else if (!to_late_to_comment && sc.ch == '%') { + // Switch to comment level 2 (Function) + sc.ChangeState(SCE_ERLANG_COMMENT_FUNCTION); + old_style = SCE_ERLANG_COMMENT_FUNCTION; + parse_state = COMMENT_FUNCTION; + sc.Forward(); + } + } + // V--- Falling through! + case COMMENT_FUNCTION : { + if (sc.ch != '%') { + to_late_to_comment = true; + } else if (!to_late_to_comment && sc.ch == '%') { + // Switch to comment level 3 (Module) + sc.ChangeState(SCE_ERLANG_COMMENT_MODULE); + old_style = SCE_ERLANG_COMMENT_MODULE; + parse_state = COMMENT_MODULE; + sc.Forward(); + } + } + // V--- Falling through! + case COMMENT_MODULE : { + if (parse_state != COMMENT) { + // Search for comment documentation + if (sc.chNext == '@') { + old_parse_state = parse_state; + parse_state = ('{' == sc.ch) + ? COMMENT_DOC_MACRO + : COMMENT_DOC; + sc.ForwardSetState(sc.state); + } + } + + // All comments types fall here. + if (sc.atLineEnd) { + to_late_to_comment = false; + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case COMMENT_DOC : + // V--- Falling through! + case COMMENT_DOC_MACRO : { + + if (!isalnum(sc.ch)) { + // Try to match documentation comment + sc.GetCurrent(cur, sizeof(cur)); + + if (parse_state == COMMENT_DOC_MACRO + && erlangDocMacro.InList(cur)) { + sc.ChangeState(SCE_ERLANG_COMMENT_DOC_MACRO); + while (sc.ch != '}' && !sc.atLineEnd) + sc.Forward(); + } else if (erlangDoc.InList(cur)) { + sc.ChangeState(SCE_ERLANG_COMMENT_DOC); + } else { + sc.ChangeState(old_style); + } + + // Switch back to old state + sc.SetState(old_style); + parse_state = old_parse_state; + } + + if (sc.atLineEnd) { + to_late_to_comment = false; + sc.ChangeState(old_style); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* -------------------------------------------------------------- */ + /* Atoms ---------------------------------------------------------*/ + case ATOM_UNQUOTED : { + if ('@' == sc.ch){ + parse_state = NODE_NAME_UNQUOTED; + } else if (sc.ch == ':') { + // Searching for module name + if (sc.chNext == ' ') { + // error + sc.ChangeState(SCE_ERLANG_UNKNOWN); + parse_state = STATE_NULL; + } else { + sc.Forward(); + if (isalnum(sc.ch)) { + sc.GetCurrent(cur, sizeof(cur)); + sc.ChangeState(SCE_ERLANG_MODULES); + sc.SetState(SCE_ERLANG_MODULES); + } + } + } else if (!IsAWordChar(sc.ch)) { + + sc.GetCurrent(cur, sizeof(cur)); + if (reservedWords.InList(cur)) { + style = SCE_ERLANG_KEYWORD; + } else if (erlangBIFs.InList(cur) + && strcmp(cur,"erlang:")){ + style = SCE_ERLANG_BIFS; + } else if (sc.ch == '(' || '/' == sc.ch){ + style = SCE_ERLANG_FUNCTION_NAME; + } else { + style = SCE_ERLANG_ATOM; + } + + sc.ChangeState(style); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + + } break; + + case ATOM_QUOTED : { + if ( '@' == sc.ch ){ + parse_state = NODE_NAME_QUOTED; + } else if ('\'' == sc.ch && '\\' != sc.chPrev) { + sc.ChangeState(SCE_ERLANG_ATOM); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* -------------------------------------------------------------- */ + /* Node names ----------------------------------------------------*/ + case NODE_NAME_UNQUOTED : { + if ('@' == sc.ch) { + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else if (!IsAWordChar(sc.ch)) { + sc.ChangeState(SCE_ERLANG_NODE_NAME); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case NODE_NAME_QUOTED : { + if ('@' == sc.ch) { + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else if ('\'' == sc.ch && '\\' != sc.chPrev) { + sc.ChangeState(SCE_ERLANG_NODE_NAME_QUOTED); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* -------------------------------------------------------------- */ + /* Records -------------------------------------------------------*/ + case RECORD_START : { + if ('\'' == sc.ch) { + parse_state = RECORD_QUOTED; + } else if (isalpha(sc.ch) && islower(sc.ch)) { + parse_state = RECORD_UNQUOTED; + } else { // error + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case RECORD_UNQUOTED : { + if (!IsAWordChar(sc.ch)) { + sc.ChangeState(SCE_ERLANG_RECORD); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case RECORD_QUOTED : { + if ('\'' == sc.ch && '\\' != sc.chPrev) { + sc.ChangeState(SCE_ERLANG_RECORD_QUOTED); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* -------------------------------------------------------------- */ + /* Macros --------------------------------------------------------*/ + case MACRO_START : { + if ('\'' == sc.ch) { + parse_state = MACRO_QUOTED; + } else if (isalpha(sc.ch)) { + parse_state = MACRO_UNQUOTED; + } else { // error + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case MACRO_UNQUOTED : { + if (!IsAWordChar(sc.ch)) { + sc.ChangeState(SCE_ERLANG_MACRO); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + case MACRO_QUOTED : { + if ('\'' == sc.ch && '\\' != sc.chPrev) { + sc.ChangeState(SCE_ERLANG_MACRO_QUOTED); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* -------------------------------------------------------------- */ + /* Numerics ------------------------------------------------------*/ + /* Simple integer */ + case NUMERAL_START : { + if (isdigit(sc.ch)) { + radix_digits *= 10; + radix_digits += sc.ch - '0'; // Assuming ASCII here! + } else if ('#' == sc.ch) { + if (2 > radix_digits || 36 < radix_digits) { + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + parse_state = NUMERAL_BASE_VALUE; + } + } else if ('.' == sc.ch && isdigit(sc.chNext)) { + radix_digits = 0; + parse_state = NUMERAL_FLOAT; + } else if ('e' == sc.ch || 'E' == sc.ch) { + exponent_digits = 0; + parse_state = NUMERAL_EXPONENT; + } else { + radix_digits = 0; + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* Integer in other base than 10 (x#yyy) */ + case NUMERAL_BASE_VALUE : { + if (!is_radix(radix_digits,sc.ch)) { + radix_digits = 0; + + if (!isalnum(sc.ch)) + sc.ChangeState(SCE_ERLANG_NUMBER); + + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* Float (x.yyy) */ + case NUMERAL_FLOAT : { + if ('e' == sc.ch || 'E' == sc.ch) { + exponent_digits = 0; + parse_state = NUMERAL_EXPONENT; + } else if (!isdigit(sc.ch)) { + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + /* Exponent, either integer or float (xEyy, x.yyEzzz) */ + case NUMERAL_EXPONENT : { + if (('-' == sc.ch || '+' == sc.ch) + && (isdigit(sc.chNext))) { + sc.Forward(); + } else if (!isdigit(sc.ch)) { + if (0 < exponent_digits) + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + ++exponent_digits; + } + } break; + + /* -------------------------------------------------------------- */ + /* Preprocessor --------------------------------------------------*/ + case PREPROCESSOR : { + if (!IsAWordChar(sc.ch)) { + + sc.GetCurrent(cur, sizeof(cur)); + if (erlangPreproc.InList(cur)) { + style = SCE_ERLANG_PREPROC; + } else if (erlangModulesAtt.InList(cur)) { + style = SCE_ERLANG_MODULES_ATT; + } + + sc.ChangeState(style); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } break; + + } + + } /* End of : STATE_NULL != parse_state */ + else + { + switch (sc.state) { + case SCE_ERLANG_VARIABLE : { + if (!IsAWordChar(sc.ch)) + sc.SetState(SCE_ERLANG_DEFAULT); + } break; + case SCE_ERLANG_STRING : { + if (sc.ch == '\"' && sc.chPrev != '\\') + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } break; + case SCE_ERLANG_COMMENT : { + if (sc.atLineEnd) + sc.SetState(SCE_ERLANG_DEFAULT); + } break; + case SCE_ERLANG_CHARACTER : { + if (sc.chPrev == '\\') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else if (sc.ch != '\\') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } + } break; + case SCE_ERLANG_OPERATOR : { + if (sc.chPrev == '.') { + if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' + || sc.ch == '^') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else { + sc.SetState(SCE_ERLANG_DEFAULT); + } + } else { + sc.SetState(SCE_ERLANG_DEFAULT); + } + } break; + } + } + + if (sc.state == SCE_ERLANG_DEFAULT) { + bool no_new_state = false; + + switch (sc.ch) { + case '\"' : sc.SetState(SCE_ERLANG_STRING); break; + case '$' : sc.SetState(SCE_ERLANG_CHARACTER); break; + case '%' : { + parse_state = COMMENT; + sc.SetState(SCE_ERLANG_COMMENT); + } break; + case '#' : { + parse_state = RECORD_START; + sc.SetState(SCE_ERLANG_UNKNOWN); + } break; + case '?' : { + parse_state = MACRO_START; + sc.SetState(SCE_ERLANG_UNKNOWN); + } break; + case '\'' : { + parse_state = ATOM_QUOTED; + sc.SetState(SCE_ERLANG_UNKNOWN); + } break; + case '+' : + case '-' : { + if (IsADigit(sc.chNext)) { + parse_state = NUMERAL_START; + radix_digits = 0; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (sc.ch != '+') { + parse_state = PREPROCESSOR; + sc.SetState(SCE_ERLANG_UNKNOWN); + } + } break; + default : no_new_state = true; + } + + if (no_new_state) { + if (isdigit(sc.ch)) { + parse_state = NUMERAL_START; + radix_digits = sc.ch - '0'; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (isupper(sc.ch) || '_' == sc.ch) { + sc.SetState(SCE_ERLANG_VARIABLE); + } else if (isalpha(sc.ch)) { + parse_state = ATOM_UNQUOTED; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (isoperator(static_cast(sc.ch)) + || sc.ch == '\\') { + sc.SetState(SCE_ERLANG_OPERATOR); + } + } + } + + } + sc.Complete(); +} + +static int ClassifyErlangFoldPoint( + Accessor &styler, + int styleNext, + int keyword_start +) { + int lev = 0; + if (styler.Match(keyword_start,"case") + || ( + styler.Match(keyword_start,"fun") + && (SCE_ERLANG_FUNCTION_NAME != styleNext) + ) + || styler.Match(keyword_start,"if") + || styler.Match(keyword_start,"query") + || styler.Match(keyword_start,"receive") + ) { + ++lev; + } else if (styler.Match(keyword_start,"end")) { + --lev; + } + + return lev; +} + +static void FoldErlangDoc( + unsigned int startPos, int length, int initStyle, + WordList** /*keywordlists*/, Accessor &styler +) { + unsigned int endPos = startPos + length; + int currentLine = styler.GetLine(startPos); + int lev; + int previousLevel = styler.LevelAt(currentLine) & SC_FOLDLEVELNUMBERMASK; + int currentLevel = previousLevel; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + int stylePrev; + int keyword_start = 0; + char ch; + char chNext = styler.SafeGetCharAt(startPos); + bool atEOL; + + for (unsigned int i = startPos; i < endPos; i++) { + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + // Get styles + stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + atEOL = ((ch == '\r') && (chNext != '\n')) || (ch == '\n'); + + if (stylePrev != SCE_ERLANG_KEYWORD + && style == SCE_ERLANG_KEYWORD) { + keyword_start = i; + } + + // Fold on keywords + if (stylePrev == SCE_ERLANG_KEYWORD + && style != SCE_ERLANG_KEYWORD + && style != SCE_ERLANG_ATOM + ) { + currentLevel += ClassifyErlangFoldPoint(styler, + styleNext, + keyword_start); + } + + // Fold on comments + if (style == SCE_ERLANG_COMMENT + || style == SCE_ERLANG_COMMENT_MODULE + || style == SCE_ERLANG_COMMENT_FUNCTION) { + + if (ch == '%' && chNext == '{') { + currentLevel++; + } else if (ch == '%' && chNext == '}') { + currentLevel--; + } + } + + // Fold on braces + if (style == SCE_ERLANG_OPERATOR) { + if (ch == '{' || ch == '(' || ch == '[') { + currentLevel++; + } else if (ch == '}' || ch == ')' || ch == ']') { + currentLevel--; + } + } + + + if (atEOL) { + lev = previousLevel; + + if (currentLevel > previousLevel) + lev |= SC_FOLDLEVELHEADERFLAG; + + if (lev != styler.LevelAt(currentLine)) + styler.SetLevel(currentLine, lev); + + currentLine++; + previousLevel = currentLevel; + } + + } + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + styler.SetLevel(currentLine, + previousLevel + | (styler.LevelAt(currentLine) & ~SC_FOLDLEVELNUMBERMASK)); +} + +static const char * const erlangWordListDesc[] = { + "Erlang Reserved words", + "Erlang BIFs", + "Erlang Preprocessor", + "Erlang Module Attributes", + "Erlang Documentation", + "Erlang Documentation Macro", + 0 +}; + +LexerModule lmErlang( + SCLEX_ERLANG, + ColouriseErlangDoc, + "erlang", + FoldErlangDoc, + erlangWordListDesc); diff --git a/ext/scintilla/lexers/LexFlagship.cxx b/ext/scintilla/lexers/LexFlagship.cxx new file mode 100644 index 000000000..013521bc4 --- /dev/null +++ b/ext/scintilla/lexers/LexFlagship.cxx @@ -0,0 +1,354 @@ +// Scintilla source code edit control +/** @file LexFlagShip.cxx + ** Lexer for Harbour and FlagShip. + ** (Syntactically compatible to other xBase dialects, like Clipper, dBase, Clip, FoxPro etc.) + **/ +// Copyright 2005 by Randy Butler +// Copyright 2010 by Xavi (Harbour) +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +// Extended to accept accented characters +static inline bool IsAWordChar(int ch) +{ + return ch >= 0x80 || + (isalnum(ch) || ch == '_'); +} + +static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) +{ + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + WordList &keywords4 = *keywordlists[3]; + WordList &keywords5 = *keywordlists[4]; + + // property lexer.flagship.styling.within.preprocessor + // For Harbour code, determines whether all preprocessor code is styled in the preprocessor style (0) or only from the + // initial # to the end of the command word(1, the default). It also determines how to present text, dump, and disabled code. + bool stylingWithinPreprocessor = styler.GetPropertyInt("lexer.flagship.styling.within.preprocessor", 1) != 0; + + CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); + + int visibleChars = 0; + int closeStringChar = 0; + int styleBeforeDCKeyword = SCE_FS_DEFAULT; + bool bEnableCode = initStyle < SCE_FS_DISABLEDCODE; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + // Determine if the current state should terminate. + switch (sc.state) { + case SCE_FS_OPERATOR: + case SCE_FS_OPERATOR_C: + case SCE_FS_WORDOPERATOR: + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + break; + case SCE_FS_IDENTIFIER: + case SCE_FS_IDENTIFIER_C: + if (!IsAWordChar(sc.ch)) { + char s[64]; + sc.GetCurrentLowered(s, sizeof(s)); + if (keywords.InList(s)) { + sc.ChangeState(bEnableCode ? SCE_FS_KEYWORD : SCE_FS_KEYWORD_C); + } else if (keywords2.InList(s)) { + sc.ChangeState(bEnableCode ? SCE_FS_KEYWORD2 : SCE_FS_KEYWORD2_C); + } else if (bEnableCode && keywords3.InList(s)) { + sc.ChangeState(SCE_FS_KEYWORD3); + } else if (bEnableCode && keywords4.InList(s)) { + sc.ChangeState(SCE_FS_KEYWORD4); + }// Else, it is really an identifier... + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } + break; + case SCE_FS_NUMBER: + if (!IsAWordChar(sc.ch) && !(sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_FS_DEFAULT); + } + break; + case SCE_FS_NUMBER_C: + if (!IsAWordChar(sc.ch) && sc.ch != '.') { + sc.SetState(SCE_FS_DEFAULT_C); + } + break; + case SCE_FS_CONSTANT: + if (!IsAWordChar(sc.ch)) { + sc.SetState(SCE_FS_DEFAULT); + } + break; + case SCE_FS_STRING: + case SCE_FS_STRING_C: + if (sc.ch == closeStringChar) { + sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } else if (sc.atLineEnd) { + sc.ChangeState(bEnableCode ? SCE_FS_STRINGEOL : SCE_FS_STRINGEOL_C); + } + break; + case SCE_FS_STRINGEOL: + case SCE_FS_STRINGEOL_C: + if (sc.atLineStart) { + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } + break; + case SCE_FS_COMMENTDOC: + case SCE_FS_COMMENTDOC_C: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support + // Verify that we have the conditions to mark a comment-doc-keyword + if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { + styleBeforeDCKeyword = bEnableCode ? SCE_FS_COMMENTDOC : SCE_FS_COMMENTDOC_C; + sc.SetState(SCE_FS_COMMENTDOCKEYWORD); + } + } + break; + case SCE_FS_COMMENT: + case SCE_FS_COMMENTLINE: + if (sc.atLineStart) { + sc.SetState(SCE_FS_DEFAULT); + } + break; + case SCE_FS_COMMENTLINEDOC: + case SCE_FS_COMMENTLINEDOC_C: + if (sc.atLineStart) { + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support + // Verify that we have the conditions to mark a comment-doc-keyword + if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { + styleBeforeDCKeyword = bEnableCode ? SCE_FS_COMMENTLINEDOC : SCE_FS_COMMENTLINEDOC_C; + sc.SetState(SCE_FS_COMMENTDOCKEYWORD); + } + } + break; + case SCE_FS_COMMENTDOCKEYWORD: + if ((styleBeforeDCKeyword == SCE_FS_COMMENTDOC || styleBeforeDCKeyword == SCE_FS_COMMENTDOC_C) && + sc.Match('*', '/')) { + sc.ChangeState(SCE_FS_COMMENTDOCKEYWORDERROR); + sc.Forward(); + sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } else if (!setDoxygen.Contains(sc.ch)) { + char s[64]; + sc.GetCurrentLowered(s, sizeof(s)); + if (!IsASpace(sc.ch) || !keywords5.InList(s + 1)) { + sc.ChangeState(SCE_FS_COMMENTDOCKEYWORDERROR); + } + sc.SetState(styleBeforeDCKeyword); + } + break; + case SCE_FS_PREPROCESSOR: + case SCE_FS_PREPROCESSOR_C: + if (sc.atLineEnd) { + if (!(sc.chPrev == ';' || sc.GetRelative(-2) == ';')) { + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } + } else if (stylingWithinPreprocessor) { + if (IsASpaceOrTab(sc.ch)) { + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } + } else if (sc.Match('/', '*') || sc.Match('/', '/') || sc.Match('&', '&')) { + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } + break; + case SCE_FS_DISABLEDCODE: + if (sc.ch == '#' && visibleChars == 0) { + sc.SetState(bEnableCode ? SCE_FS_PREPROCESSOR : SCE_FS_PREPROCESSOR_C); + do { // Skip whitespace between # and preprocessor word + sc.Forward(); + } while (IsASpaceOrTab(sc.ch) && sc.More()); + if (sc.MatchIgnoreCase("pragma")) { + sc.Forward(6); + do { // Skip more whitespace until keyword + sc.Forward(); + } while (IsASpaceOrTab(sc.ch) && sc.More()); + if (sc.MatchIgnoreCase("enddump") || sc.MatchIgnoreCase("__endtext")) { + bEnableCode = true; + sc.SetState(SCE_FS_DISABLEDCODE); + sc.Forward(sc.ch == '_' ? 8 : 6); + sc.ForwardSetState(SCE_FS_DEFAULT); + } else { + sc.ChangeState(SCE_FS_DISABLEDCODE); + } + } else { + sc.ChangeState(SCE_FS_DISABLEDCODE); + } + } + break; + case SCE_FS_DATE: + if (sc.ch == '}') { + sc.ForwardSetState(SCE_FS_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_FS_STRINGEOL); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_FS_DEFAULT || sc.state == SCE_FS_DEFAULT_C) { + if (bEnableCode && + (sc.MatchIgnoreCase(".and.") || sc.MatchIgnoreCase(".not."))) { + sc.SetState(SCE_FS_WORDOPERATOR); + sc.Forward(4); + } else if (bEnableCode && sc.MatchIgnoreCase(".or.")) { + sc.SetState(SCE_FS_WORDOPERATOR); + sc.Forward(3); + } else if (bEnableCode && + (sc.MatchIgnoreCase(".t.") || sc.MatchIgnoreCase(".f.") || + (!IsAWordChar(sc.GetRelative(3)) && sc.MatchIgnoreCase("nil")))) { + sc.SetState(SCE_FS_CONSTANT); + sc.Forward(2); + } else if (sc.Match('/', '*')) { + sc.SetState(bEnableCode ? SCE_FS_COMMENTDOC : SCE_FS_COMMENTDOC_C); + sc.Forward(); + } else if (bEnableCode && sc.Match('&', '&')) { + sc.SetState(SCE_FS_COMMENTLINE); + sc.Forward(); + } else if (sc.Match('/', '/')) { + sc.SetState(bEnableCode ? SCE_FS_COMMENTLINEDOC : SCE_FS_COMMENTLINEDOC_C); + sc.Forward(); + } else if (bEnableCode && sc.ch == '*' && visibleChars == 0) { + sc.SetState(SCE_FS_COMMENT); + } else if (sc.ch == '\"' || sc.ch == '\'') { + sc.SetState(bEnableCode ? SCE_FS_STRING : SCE_FS_STRING_C); + closeStringChar = sc.ch; + } else if (closeStringChar == '>' && sc.ch == '<') { + sc.SetState(bEnableCode ? SCE_FS_STRING : SCE_FS_STRING_C); + } else if (sc.ch == '#' && visibleChars == 0) { + sc.SetState(bEnableCode ? SCE_FS_PREPROCESSOR : SCE_FS_PREPROCESSOR_C); + do { // Skip whitespace between # and preprocessor word + sc.Forward(); + } while (IsASpaceOrTab(sc.ch) && sc.More()); + if (sc.atLineEnd) { + sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); + } else if (sc.MatchIgnoreCase("include")) { + if (stylingWithinPreprocessor) { + closeStringChar = '>'; + } + } else if (sc.MatchIgnoreCase("pragma")) { + sc.Forward(6); + do { // Skip more whitespace until keyword + sc.Forward(); + } while (IsASpaceOrTab(sc.ch) && sc.More()); + if (sc.MatchIgnoreCase("begindump") || sc.MatchIgnoreCase("__cstream")) { + bEnableCode = false; + if (stylingWithinPreprocessor) { + sc.SetState(SCE_FS_DISABLEDCODE); + sc.Forward(8); + sc.ForwardSetState(SCE_FS_DEFAULT_C); + } else { + sc.SetState(SCE_FS_DISABLEDCODE); + } + } else if (sc.MatchIgnoreCase("enddump") || sc.MatchIgnoreCase("__endtext")) { + bEnableCode = true; + sc.SetState(SCE_FS_DISABLEDCODE); + sc.Forward(sc.ch == '_' ? 8 : 6); + sc.ForwardSetState(SCE_FS_DEFAULT); + } + } + } else if (bEnableCode && sc.ch == '{') { + int p = 0; + int chSeek; + unsigned int endPos(startPos + length); + do { // Skip whitespace + chSeek = sc.GetRelative(++p); + } while (IsASpaceOrTab(chSeek) && (sc.currentPos + p < endPos)); + if (chSeek == '^') { + sc.SetState(SCE_FS_DATE); + } else { + sc.SetState(SCE_FS_OPERATOR); + } + } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(bEnableCode ? SCE_FS_NUMBER : SCE_FS_NUMBER_C); + } else if (IsAWordChar(sc.ch)) { + sc.SetState(bEnableCode ? SCE_FS_IDENTIFIER : SCE_FS_IDENTIFIER_C); + } else if (isoperator(static_cast(sc.ch)) || (bEnableCode && sc.ch == '@')) { + sc.SetState(bEnableCode ? SCE_FS_OPERATOR : SCE_FS_OPERATOR_C); + } + } + + if (sc.atLineEnd) { + visibleChars = 0; + closeStringChar = 0; + } + if (!IsASpace(sc.ch)) { + visibleChars++; + } + } + sc.Complete(); +} + +static void FoldFlagShipDoc(unsigned int startPos, int length, int, + WordList *[], Accessor &styler) +{ + + int endPos = startPos + length; + + // Backtrack to previous line in case need to fix its fold status + int lineCurrent = styler.GetLine(startPos); + if (startPos > 0 && lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + } + int spaceFlags = 0; + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); + char chNext = styler[startPos]; + for (int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos-1)) { + int lev = indentCurrent; + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags); + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { + int spaceFlags2 = 0; + int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2); + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + } + } + indentCurrent = indentNext; + styler.SetLevel(lineCurrent, lev); + lineCurrent++; + } + } +} + +static const char * const FSWordListDesc[] = { + "Keywords Commands", + "Std Library Functions", + "Procedure, return, exit", + "Class (oop)", + "Doxygen keywords", + 0 +}; + +LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc); diff --git a/ext/scintilla/lexers/LexForth.cxx b/ext/scintilla/lexers/LexForth.cxx new file mode 100644 index 000000000..ee95e3172 --- /dev/null +++ b/ext/scintilla/lexers/LexForth.cxx @@ -0,0 +1,179 @@ +// Scintilla source code edit control +/** @file LexForth.cxx + ** Lexer for FORTH + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsAWordChar(int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '.' || + ch == '_' || ch == '?' || ch == '"' || ch == '@' || + ch == '!' || ch == '[' || ch == ']' || ch == '/' || + ch == '+' || ch == '-' || ch == '*' || ch == '<' || + ch == '>' || ch == '=' || ch == ';' || ch == '(' || + ch == ')' ); +} + +static inline bool IsAWordStart(int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); +} + +static inline bool IsANumChar(int ch) { + return (ch < 0x80) && (isxdigit(ch) || ch == '.' || ch == 'e' || ch == 'E' ); +} + +static inline bool IsASpaceChar(int ch) { + return (ch < 0x80) && isspace(ch); +} + +static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle, WordList *keywordLists[], + Accessor &styler) { + + WordList &control = *keywordLists[0]; + WordList &keyword = *keywordLists[1]; + WordList &defword = *keywordLists[2]; + WordList &preword1 = *keywordLists[3]; + WordList &preword2 = *keywordLists[4]; + WordList &strings = *keywordLists[5]; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) + { + // Determine if the current state should terminate. + if (sc.state == SCE_FORTH_COMMENT) { + if (sc.atLineEnd) { + sc.SetState(SCE_FORTH_DEFAULT); + } + }else if (sc.state == SCE_FORTH_COMMENT_ML) { + if (sc.ch == ')') { + sc.ForwardSetState(SCE_FORTH_DEFAULT); + } + }else if (sc.state == SCE_FORTH_IDENTIFIER || sc.state == SCE_FORTH_NUMBER) { + // handle numbers here too, because what we thought was a number might + // turn out to be a keyword e.g. 2DUP + if (IsASpaceChar(sc.ch) ) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + int newState = sc.state == SCE_FORTH_NUMBER ? SCE_FORTH_NUMBER : SCE_FORTH_DEFAULT; + if (control.InList(s)) { + sc.ChangeState(SCE_FORTH_CONTROL); + } else if (keyword.InList(s)) { + sc.ChangeState(SCE_FORTH_KEYWORD); + } else if (defword.InList(s)) { + sc.ChangeState(SCE_FORTH_DEFWORD); + } else if (preword1.InList(s)) { + sc.ChangeState(SCE_FORTH_PREWORD1); + } else if (preword2.InList(s)) { + sc.ChangeState(SCE_FORTH_PREWORD2); + } else if (strings.InList(s)) { + sc.ChangeState(SCE_FORTH_STRING); + newState = SCE_FORTH_STRING; + } + sc.SetState(newState); + } + if (sc.state == SCE_FORTH_NUMBER) { + if (IsASpaceChar(sc.ch)) { + sc.SetState(SCE_FORTH_DEFAULT); + } else if (!IsANumChar(sc.ch)) { + sc.ChangeState(SCE_FORTH_IDENTIFIER); + } + } + }else if (sc.state == SCE_FORTH_STRING) { + if (sc.ch == '\"') { + sc.ForwardSetState(SCE_FORTH_DEFAULT); + } + }else if (sc.state == SCE_FORTH_LOCALE) { + if (sc.ch == '}') { + sc.ForwardSetState(SCE_FORTH_DEFAULT); + } + }else if (sc.state == SCE_FORTH_DEFWORD) { + if (IsASpaceChar(sc.ch)) { + sc.SetState(SCE_FORTH_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_FORTH_DEFAULT) { + if (sc.ch == '\\'){ + sc.SetState(SCE_FORTH_COMMENT); + } else if (sc.ch == '(' && + (sc.atLineStart || IsASpaceChar(sc.chPrev)) && + (sc.atLineEnd || IsASpaceChar(sc.chNext))) { + sc.SetState(SCE_FORTH_COMMENT_ML); + } else if ( (sc.ch == '$' && (isascii(sc.chNext) && isxdigit(sc.chNext))) ) { + // number starting with $ is a hex number + sc.SetState(SCE_FORTH_NUMBER); + while(sc.More() && isascii(sc.chNext) && isxdigit(sc.chNext)) + sc.Forward(); + } else if ( (sc.ch == '%' && (isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) { + // number starting with % is binary + sc.SetState(SCE_FORTH_NUMBER); + while(sc.More() && isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1')) + sc.Forward(); + } else if ( isascii(sc.ch) && + (isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && isascii(sc.chNext) && isxdigit(sc.chNext)) ) + ){ + sc.SetState(SCE_FORTH_NUMBER); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_FORTH_IDENTIFIER); + } else if (sc.ch == '{') { + sc.SetState(SCE_FORTH_LOCALE); + } else if (sc.ch == ':' && isascii(sc.chNext) && isspace(sc.chNext)) { + // highlight word definitions e.g. : GCD ( n n -- n ) ..... ; + // ^ ^^^ + sc.SetState(SCE_FORTH_DEFWORD); + while(sc.More() && isascii(sc.chNext) && isspace(sc.chNext)) + sc.Forward(); + } else if (sc.ch == ';' && + (sc.atLineStart || IsASpaceChar(sc.chPrev)) && + (sc.atLineEnd || IsASpaceChar(sc.chNext)) ) { + // mark the ';' that ends a word + sc.SetState(SCE_FORTH_DEFWORD); + sc.ForwardSetState(SCE_FORTH_DEFAULT); + } + } + + } + sc.Complete(); +} + +static void FoldForthDoc(unsigned int, int, int, WordList *[], + Accessor &) { +} + +static const char * const forthWordLists[] = { + "control keywords", + "keywords", + "definition words", + "prewords with one argument", + "prewords with two arguments", + "string definition keywords", + 0, + }; + +LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth", FoldForthDoc, forthWordLists); + + diff --git a/ext/scintilla/src/LexFortran.cxx b/ext/scintilla/lexers/LexFortran.cxx similarity index 94% rename from ext/scintilla/src/LexFortran.cxx rename to ext/scintilla/lexers/LexFortran.cxx index 22c02444a..669860502 100644 --- a/ext/scintilla/src/LexFortran.cxx +++ b/ext/scintilla/lexers/LexFortran.cxx @@ -8,18 +8,23 @@ /***************************************/ #include #include -#include #include #include +#include +#include /***************************************/ -#include "Platform.h" -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" +#include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +/***************************************/ + #ifdef SCI_NAMESPACE using namespace Scintilla; #endif @@ -83,7 +88,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle // Handle the fix format generically int toLineStart = sc.currentPos - posLineStart; if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) { - if (toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') { + if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') { if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") || sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") || @@ -252,7 +257,7 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c lev = 0; else lev = 1; - } else if (strcmp(s, "end") == 0 && chNextNonBlank != '=' + } else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=') || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0 || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0 || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0 @@ -261,7 +266,7 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c || strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0 || strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0 || strcmp(s, "endwhere") == 0 - || strcmp(s, "procedure") == 0 ) { // Take care of the module procedure statement + || (strcmp(s, "procedure") == 0 && strcmp(prevWord,"module")==0) ) { // Take care of the module procedure statement lev = -1; } else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if lev = 0; diff --git a/ext/scintilla/src/LexGAP.cxx b/ext/scintilla/lexers/LexGAP.cxx similarity index 93% rename from ext/scintilla/src/LexGAP.cxx rename to ext/scintilla/lexers/LexGAP.cxx index bec53b7d0..f37884e58 100644 --- a/ext/scintilla/src/LexGAP.cxx +++ b/ext/scintilla/lexers/LexGAP.cxx @@ -8,25 +8,28 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline bool IsGAPOperator(char ch) { - if (isalnum(ch)) return false; + if (isascii(ch) && isalnum(ch)) return false; if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '^' || ch == ',' || ch == '!' || ch == '.' || ch == '=' || ch == '<' || ch == '>' || ch == '(' || diff --git a/ext/scintilla/src/LexGui4Cli.cxx b/ext/scintilla/lexers/LexGui4Cli.cxx similarity index 95% rename from ext/scintilla/src/LexGui4Cli.cxx rename to ext/scintilla/lexers/LexGui4Cli.cxx index a587aac88..8136425eb 100644 --- a/ext/scintilla/src/LexGui4Cli.cxx +++ b/ext/scintilla/lexers/LexGui4Cli.cxx @@ -23,18 +23,21 @@ val SCE_GC_OPERATOR=9 #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; diff --git a/ext/scintilla/src/LexHTML.cxx b/ext/scintilla/lexers/LexHTML.cxx similarity index 81% rename from ext/scintilla/src/LexHTML.cxx rename to ext/scintilla/lexers/LexHTML.cxx index 20ce6fd6f..d20d688b1 100644 --- a/ext/scintilla/src/LexHTML.cxx +++ b/ext/scintilla/lexers/LexHTML.cxx @@ -7,19 +7,21 @@ #include #include -#include #include #include +#include +#include -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "WordList.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" #include "CharacterSet.h" +#include "LexerModule.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -54,21 +56,30 @@ inline bool IsOperator(int ch) { return false; } -static inline int MakeLowerCase(int ch) { - if (ch < 'A' || ch > 'Z') - return ch; - else - return ch - 'A' + 'a'; -} - static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) { - size_t i = 0; + unsigned int i = 0; for (; (i < end - start + 1) && (i < len-1); i++) { s[i] = static_cast(MakeLowerCase(styler[start + i])); } s[i] = '\0'; } +static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, size_t sLen) { + + unsigned int i = 0; + for (; i < sLen-1; i++) { + char ch = static_cast(styler.SafeGetCharAt(start + i)); + if ((i == 0) && !IsAWordStart(ch)) + break; + if ((i > 0) && !IsAWordChar(ch)) + break; + s[i] = ch; + } + s[i] = '\0'; + + return s; +} + static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); @@ -274,17 +285,30 @@ static int classifyTagHTML(unsigned int start, unsigned int end, s[i] = '\0'; // No keywords -> all are known - // Name of a closing tag starts at s + 1 char chAttr = SCE_H_TAGUNKNOWN; if (s[0] == '!') { chAttr = SCE_H_SGML_DEFAULT; - } else if (!keywords || keywords.InList(s[0] == '/' ? s + 1 : s)) { + } else if (!keywords || keywords.InList(s)) { chAttr = SCE_H_TAG; } styler.ColourTo(end, chAttr); if (chAttr == SCE_H_TAG) { if (allowScripts && 0 == strcmp(s, "script")) { - chAttr = SCE_H_SCRIPT; + // check to see if this is a self-closing tag by sniffing ahead + bool isSelfClose = false; + for (unsigned int cPos = end; cPos <= end + 100; cPos++) { + char ch = styler.SafeGetCharAt(cPos, '\0'); + if (ch == '\0' || ch == '>') + break; + else if (ch == '/' && styler.SafeGetCharAt(cPos + 1, '\0') == '>') { + isSelfClose = true; + break; + } + } + + // do not enter a script state if the tag self-closed + if (!isSelfClose) + chAttr = SCE_H_SCRIPT; } else if (!isXml && 0 == strcmp(s, "comment")) { chAttr = SCE_H_COMMENT; } @@ -294,19 +318,19 @@ 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 s[30 + 1]; + unsigned int i = 0; + for (; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + } + s[i] = '\0'; + char chAttr = SCE_HJ_WORD; - bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); - if (wordIsNumber) + bool wordIsNumber = IsADigit(s[0]) || ((s[0] == '.') && IsADigit(s[1])); + if (wordIsNumber) { chAttr = SCE_HJ_NUMBER; - else { - char s[30 + 1]; - unsigned int i = 0; - for (; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - } - s[i] = '\0'; - if (keywords.InList(s)) - chAttr = SCE_HJ_KEYWORD; + } else if (keywords.InList(s)) { + chAttr = SCE_HJ_KEYWORD; } styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); } @@ -332,7 +356,7 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw return SCE_HB_DEFAULT; } -static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType) { +static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) { bool wordIsNumber = IsADigit(styler[start]); char s[30 + 1]; unsigned int i = 0; @@ -349,6 +373,8 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key chAttr = SCE_HP_NUMBER; else if (keywords.InList(s)) chAttr = SCE_HP_WORD; + else if (isMako && 0 == strcmp(s, "block")) + chAttr = SCE_HP_WORD; styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); strcpy(prevWord, s); } @@ -461,6 +487,38 @@ static bool isOKBeforeRE(int ch) { return (ch == '(') || (ch == '=') || (ch == ','); } +static bool isMakoBlockEnd(const int ch, const int chNext, const char *blockType) { + if (strlen(blockType) == 0) { + return ((ch == '%') && (chNext == '>')); + } else if ((0 == strcmp(blockType, "inherit")) || + (0 == strcmp(blockType, "namespace")) || + (0 == strcmp(blockType, "include")) || + (0 == strcmp(blockType, "page"))) { + return ((ch == '/') && (chNext == '>')); + } else if (0 == strcmp(blockType, "%")) { + if (ch == '/' && isLineEnd(chNext)) + return 1; + else + return isLineEnd(ch); + } else if (0 == strcmp(blockType, "{")) { + return ch == '}'; + } else { + return (ch == '>'); + } +} + +static bool isDjangoBlockEnd(const int ch, const int chNext, const char *blockType) { + if (strlen(blockType) == 0) { + return 0; + } else if (0 == strcmp(blockType, "%")) { + return ((ch == '%') && (chNext == '}')); + } else if (0 == strcmp(blockType, "{")) { + return ((ch == '}') && (chNext == '}')); + } else { + return 0; + } +} + static bool isPHPStringState(int state) { return (state == SCE_HPHP_HSTRING) || @@ -533,6 +591,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty phpStringDelimiter[0] = '\0'; int StateToPrint = initStyle; int state = stateForPrintState(StateToPrint); + char makoBlockType[200]; + makoBlockType[0] = '\0'; + int makoComment = 0; + char djangoBlockType[2]; + djangoBlockType[0] = '\0'; // If inside a tag, it may be a script tag, so reread from the start to ensure any language tags are seen if (InTagState(state)) { @@ -557,10 +620,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty int lineCurrent = styler.GetLine(startPos); int lineState; if (lineCurrent > 0) { - lineState = styler.GetLineState(lineCurrent); + lineState = styler.GetLineState(lineCurrent-1); } else { // Default client and ASP scripting language is JavaScript lineState = eScriptJS << 8; + + // property asp.default.language + // Script in ASP code is initially assumed to be in JavaScript. + // To change this to VBScript set asp.default.language to 2. Python is 3. lineState |= styler.GetPropertyInt("asp.default.language", eScriptJS) << 4; } script_mode inScriptType = script_mode((lineState >> 0) & 0x03); // 2 bits of scripting mode @@ -576,16 +643,49 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) { scriptLanguage = eScriptComment; } + script_type beforeLanguage = ScriptOfState(beforePreProc); + // property fold.html + // Folding is turned on or off for HTML and XML files with this option. + // The fold option must also be on for folding to occur. const bool foldHTML = styler.GetPropertyInt("fold.html", 0) != 0; + const bool fold = foldHTML && styler.GetPropertyInt("fold", 0); + + // property fold.html.preprocessor + // Folding is turned on or off for scripts embedded in HTML files with this option. + // The default is on. const bool foldHTMLPreprocessor = foldHTML && styler.GetPropertyInt("fold.html.preprocessor", 1); + const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + + // property fold.hypertext.comment + // Allow folding for comments in scripts embedded in HTML. + // The default is off. const bool foldComment = fold && styler.GetPropertyInt("fold.hypertext.comment", 0) != 0; + + // property fold.hypertext.heredoc + // Allow folding for heredocs in scripts embedded in HTML. + // The default is off. const bool foldHeredoc = fold && styler.GetPropertyInt("fold.hypertext.heredoc", 0) != 0; + + // property html.tags.case.sensitive + // For XML and HTML, setting this property to 1 will make tags match in a case + // sensitive way which is the expected behaviour for XML and XHTML. const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0; + + // property lexer.xml.allow.scripts + // Set to 0 to disable scripts in XML. const bool allowScripts = styler.GetPropertyInt("lexer.xml.allow.scripts", 1) != 0; + // property lexer.html.mako + // Set to 1 to enable the mako template language. + const bool isMako = styler.GetPropertyInt("lexer.html.mako", 0) != 0; + + // property lexer.html.django + // Set to 1 to enable the django template language. + const bool isDjango = styler.GetPropertyInt("lexer.html.django", 0) != 0; + const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true); const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true); const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true); @@ -593,6 +693,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int visibleChars = 0; + int lineStartVisibleChars = 0; int chPrev = ' '; int ch = ' '; @@ -633,6 +734,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if ((!IsASpace(ch) || !foldCompact) && fold) visibleChars++; + if (!IsASpace(ch)) + lineStartVisibleChars++; // decide what is the current state to print (depending of the script tag) StateToPrint = statePrintForState(state, inScriptType); @@ -647,15 +750,25 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC) && (!isStringState(state))) { //Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle); //if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) { - if ((ch == '{') || (ch == '}') || (foldComment && (ch == '/') && (chNext == '*'))) { - levelCurrent += ((ch == '{') || (ch == '/')) ? 1 : -1; + if (ch == '#') { + int j = i + 1; + while ((j < lengthDoc) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { + j++; + } + if (styler.Match(j, "region") || styler.Match(j, "if")) { + levelCurrent++; + } else if (styler.Match(j, "end")) { + levelCurrent--; + } + } else if ((ch == '{') || (ch == '}') || (foldComment && (ch == '/') && (chNext == '*'))) { + levelCurrent += (((ch == '{') || (ch == '/')) ? 1 : -1); } } else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT)) && foldComment && (ch == '*') && (chNext == '/')) { levelCurrent--; } break; case eScriptPython: - if (state != SCE_HP_COMMENTLINE) { + if (state != SCE_HP_COMMENTLINE && !isMako) { if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) { levelCurrent++; } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) { @@ -700,7 +813,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty visibleChars = 0; levelPrev = levelCurrent; } - lineCurrent++; styler.SetLineState(lineCurrent, ((inScriptType & 0x03) << 0) | ((tagOpened & 0x01) << 2) | @@ -708,6 +820,25 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty ((aspScript & 0x0F) << 4) | ((clientScript & 0x0F) << 8) | ((beforePreProc & 0xFF) << 12)); + lineCurrent++; + lineStartVisibleChars = 0; + } + + // handle start of Mako comment line + if (isMako && ch == '#' && chNext == '#') { + makoComment = 1; + } + + // handle end of Mako comment line + else if (isMako && makoComment && (ch == '\r' || ch == '\n')) { + makoComment = 0; + styler.ColourTo(i, SCE_HP_COMMENTLINE); + state = SCE_HP_DEFAULT; + } + + // Allow falling through to mako handling code if newline is going to end a block + if (((ch == '\r' && chNext != '\n') || (ch == '\n')) && + (!isMako || (0 != strcmp(makoBlockType, "%")))) { } // generic end of script processing @@ -766,9 +897,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty else if ((state != SCE_H_ASPAT) && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT) && + (state != SCE_HPHP_COMMENTLINE) && (ch == '<') && (chNext == '?') && - !IsScriptCommentState(state) ) { + !IsScriptCommentState(state)) { + beforeLanguage = scriptLanguage; scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 6, eScriptPHP); if (scriptLanguage != eScriptPHP && isStringState(state)) continue; styler.ColourTo(i - 1, StateToPrint); @@ -794,8 +927,107 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty continue; } + // handle the start Mako template Python code + else if (isMako && scriptLanguage == eScriptNone && ((ch == '<' && chNext == '%') || + (lineStartVisibleChars == 1 && ch == '%') || + (lineStartVisibleChars == 1 && ch == '/' && chNext == '%') || + (ch == '$' && chNext == '{') || + (ch == '<' && chNext == '/' && chNext2 == '%'))) { + if (ch == '%' || ch == '/') + strcpy(makoBlockType, "%"); + else if (ch == '$') + strcpy(makoBlockType, "{"); + else if (chNext == '/') + GetNextWord(styler, i+3, makoBlockType, sizeof(makoBlockType)); + else + GetNextWord(styler, i+2, makoBlockType, sizeof(makoBlockType)); + styler.ColourTo(i - 1, StateToPrint); + beforePreProc = state; + if (inScriptType == eNonHtmlScript) + inScriptType = eNonHtmlScriptPreProc; + else + inScriptType = eNonHtmlPreProc; + + if (chNext == '/') { + i += 2; + visibleChars += 2; + } else if (ch != '%') { + i++; + visibleChars++; + } + state = SCE_HP_START; + scriptLanguage = eScriptPython; + styler.ColourTo(i, SCE_H_ASP); + + if (ch != '%' && ch != '$' && ch != '/') { + i += static_cast(strlen(makoBlockType)); + visibleChars += static_cast(strlen(makoBlockType)); + if (keywords4.InList(makoBlockType)) + styler.ColourTo(i, SCE_HP_WORD); + else + styler.ColourTo(i, SCE_H_TAGUNKNOWN); + } + + ch = static_cast(styler.SafeGetCharAt(i)); + continue; + } + + // handle the start/end of Django comment + else if (isDjango && state != SCE_H_COMMENT && (ch == '{' && chNext == '#')) { + styler.ColourTo(i - 1, StateToPrint); + beforePreProc = state; + beforeLanguage = scriptLanguage; + if (inScriptType == eNonHtmlScript) + inScriptType = eNonHtmlScriptPreProc; + else + inScriptType = eNonHtmlPreProc; + i += 1; + visibleChars += 1; + scriptLanguage = eScriptComment; + state = SCE_H_COMMENT; + styler.ColourTo(i, SCE_H_ASP); + ch = static_cast(styler.SafeGetCharAt(i)); + continue; + } else if (isDjango && state == SCE_H_COMMENT && (ch == '#' && chNext == '}')) { + styler.ColourTo(i - 1, StateToPrint); + i += 1; + visibleChars += 1; + styler.ColourTo(i, SCE_H_ASP); + state = beforePreProc; + if (inScriptType == eNonHtmlScriptPreProc) + inScriptType = eNonHtmlScript; + else + inScriptType = eHtml; + scriptLanguage = beforeLanguage; + continue; + } + + // handle the start Django template code + else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' || chNext == '{'))) { + if (chNext == '%') + strcpy(djangoBlockType, "%"); + else + strcpy(djangoBlockType, "{"); + styler.ColourTo(i - 1, StateToPrint); + beforePreProc = state; + if (inScriptType == eNonHtmlScript) + inScriptType = eNonHtmlScriptPreProc; + else + inScriptType = eNonHtmlPreProc; + + i += 1; + visibleChars += 1; + state = SCE_HP_START; + beforeLanguage = scriptLanguage; + scriptLanguage = eScriptPython; + styler.ColourTo(i, SCE_H_ASP); + + ch = static_cast(styler.SafeGetCharAt(i)); + continue; + } + // handle the start of ASP pre-processor = Non-HTML - else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) { + else if (!isMako && !isDjango && !isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) { styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; if (inScriptType == eNonHtmlScript) @@ -840,7 +1072,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty (ch == '!') && (StateToPrint != SCE_H_CDATA) && (!IsCommentState(StateToPrint)) && - (!IsScriptCommentState(StateToPrint)) ) { + (!IsScriptCommentState(StateToPrint))) { beforePreProc = state; styler.ColourTo(i - 2, StateToPrint); if ((chNext == '-') && (chNext2 == '-')) { @@ -855,17 +1087,75 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty state = SCE_H_SGML_COMMAND; // wait for a pending command } // fold whole tag (-- when closing the tag) - if (foldHTMLPreprocessor) + if (foldHTMLPreprocessor || (state == SCE_H_COMMENT)) levelCurrent++; continue; } + // handle the end of Mako Python code + else if (isMako && + ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && + (scriptLanguage != eScriptNone) && stateAllowsTermination(state) && + isMakoBlockEnd(ch, chNext, makoBlockType)) { + if (state == SCE_H_ASPAT) { + aspScript = segIsScriptingIndicator(styler, + styler.GetStartSegment(), i - 1, aspScript); + } + if (state == SCE_HP_WORD) { + classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); + } else { + styler.ColourTo(i - 1, StateToPrint); + } + if (0 != strcmp(makoBlockType, "%") && (0 != strcmp(makoBlockType, "{")) && ch != '>') { + i++; + visibleChars++; + } + else if (0 == strcmp(makoBlockType, "%") && ch == '/') { + i++; + visibleChars++; + } + if (0 != strcmp(makoBlockType, "%") || ch == '/') { + styler.ColourTo(i, SCE_H_ASP); + } + state = beforePreProc; + if (inScriptType == eNonHtmlScriptPreProc) + inScriptType = eNonHtmlScript; + else + inScriptType = eHtml; + scriptLanguage = eScriptNone; + continue; + } + + // handle the end of Django template code + else if (isDjango && + ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && + (scriptLanguage != eScriptNone) && stateAllowsTermination(state) && + isDjangoBlockEnd(ch, chNext, djangoBlockType)) { + if (state == SCE_H_ASPAT) { + aspScript = segIsScriptingIndicator(styler, + styler.GetStartSegment(), i - 1, aspScript); + } + if (state == SCE_HP_WORD) { + classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); + } else { + styler.ColourTo(i - 1, StateToPrint); + } + i += 1; + visibleChars += 1; + styler.ColourTo(i, SCE_H_ASP); + state = beforePreProc; + if (inScriptType == eNonHtmlScriptPreProc) + inScriptType = eNonHtmlScript; + else + inScriptType = eHtml; + scriptLanguage = beforeLanguage; + continue; + } + // handle the end of a pre-processor = Non-HTML - else if (( - ((inScriptType == eNonHtmlPreProc) - || (inScriptType == eNonHtmlScriptPreProc)) && ( - ((scriptLanguage != eScriptNone) && stateAllowsTermination(state) && ((ch == '%') || (ch == '?'))) - ) && (chNext == '>')) || + else if ((!isMako && !isDjango && ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && + (((scriptLanguage != eScriptNone) && stateAllowsTermination(state))) && + (((ch == '%') || (ch == '?')) && (chNext == '>'))) || ((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) { if (state == SCE_H_ASPAT) { aspScript = segIsScriptingIndicator(styler, @@ -880,7 +1170,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType); break; case SCE_HP_WORD: - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType); + classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); break; case SCE_HPHP_WORD: classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler); @@ -913,7 +1203,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) { levelCurrent--; } - scriptLanguage = eScriptNone; + scriptLanguage = beforeLanguage; continue; } ///////////////////////////////////// @@ -1091,7 +1381,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } if (ch != '#' && !(isascii(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway... && ch != '.' && ch != '-' && ch != '_' && ch != ':') { // valid in XML - styler.ColourTo(i, SCE_H_TAGUNKNOWN); + if (!isascii(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style + styler.ColourTo(i-1, SCE_H_TAGUNKNOWN); + else + styler.ColourTo(i, SCE_H_TAGUNKNOWN); state = SCE_H_DEFAULT; } break; @@ -1393,7 +1686,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty i += 2; } else if (isLineEnd(ch)) { styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_STRINGEOL; + if (chPrev != '\\' && (chPrev2 != '\\' || chPrev != '\r' || ch != '\n')) { + state = SCE_HJ_STRINGEOL; + } } break; case SCE_HJ_STRINGEOL: @@ -1537,7 +1832,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty break; case SCE_HP_WORD: if (!IsAWordChar(ch)) { - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType); + classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); state = SCE_HP_DEFAULT; if (ch == '#') { state = SCE_HP_COMMENTLINE; @@ -1688,7 +1983,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i, StateToPrint); state = SCE_HPHP_DEFAULT; } else if (isLineEnd(chPrev)) { - const int psdLength = strlen(phpStringDelimiter); + const int psdLength = static_cast(strlen(phpStringDelimiter)); const char chAfterPsd = styler.SafeGetCharAt(i + psdLength); const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1); if (isLineEnd(chAfterPsd) || @@ -1711,7 +2006,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty state = SCE_HPHP_DEFAULT; } } else if (isLineEnd(chPrev) && styler.Match(i, phpStringDelimiter)) { - const int psdLength = strlen(phpStringDelimiter); + const int psdLength = static_cast(strlen(phpStringDelimiter)); const char chAfterPsd = styler.SafeGetCharAt(i + psdLength); const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1); if (isLineEnd(chAfterPsd) || @@ -1826,7 +2121,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, styler, inScriptType); break; case SCE_HP_WORD: - classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, styler, prevWord, inScriptType); + classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, styler, prevWord, inScriptType, isMako); break; case SCE_HPHP_WORD: classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, styler); @@ -1856,299 +2151,6 @@ static void ColouriseHTMLDoc(unsigned int startPos, int length, int initStyle, W ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, false); } -static bool isASPScript(int state) { - return - (state >= SCE_HJA_START && state <= SCE_HJA_REGEX) || - (state >= SCE_HBA_START && state <= SCE_HBA_STRINGEOL) || - (state >= SCE_HPA_DEFAULT && state <= SCE_HPA_IDENTIFIER); -} - -static void ColouriseHBAPiece(StyleContext &sc, WordList *keywordlists[]) { - WordList &keywordsVBS = *keywordlists[2]; - if (sc.state == SCE_HBA_WORD) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywordsVBS.InList(s)) { - if (strcmp(s, "rem") == 0) { - sc.ChangeState(SCE_HBA_COMMENTLINE); - if (sc.atLineEnd) { - sc.SetState(SCE_HBA_DEFAULT); - } - } else { - sc.SetState(SCE_HBA_DEFAULT); - } - } else { - sc.ChangeState(SCE_HBA_IDENTIFIER); - sc.SetState(SCE_HBA_DEFAULT); - } - } - } else if (sc.state == SCE_HBA_NUMBER) { - if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_HBA_DEFAULT); - } - } else if (sc.state == SCE_HBA_STRING) { - if (sc.ch == '\"') { - sc.ForwardSetState(SCE_HBA_DEFAULT); - } else if (sc.ch == '\r' || sc.ch == '\n') { - sc.ChangeState(SCE_HBA_STRINGEOL); - sc.ForwardSetState(SCE_HBA_DEFAULT); - } - } else if (sc.state == SCE_HBA_COMMENTLINE) { - if (sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_HBA_DEFAULT); - } - } - - if (sc.state == SCE_HBA_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_HBA_NUMBER); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_HBA_WORD); - } else if (sc.ch == '\'') { - sc.SetState(SCE_HBA_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_HBA_STRING); - } - } -} - -static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) { - WordList &keywordsTags = *keywordlists[0]; - if (sc.state == SCE_H_COMMENT) { - if (sc.Match("-->")) { - sc.Forward(); - sc.Forward(); - sc.ForwardSetState(SCE_H_DEFAULT); - } - } else if (sc.state == SCE_H_ENTITY) { - if (sc.ch == ';') { - sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.ch != '#' && (sc.ch < 0x80) && !isalnum(sc.ch) // Should check that '#' follows '&', but it is unlikely anyway... - && sc.ch != '.' && sc.ch != '-' && sc.ch != '_' && sc.ch != ':') { // valid in XML - sc.ChangeState(SCE_H_TAGUNKNOWN); - sc.SetState(SCE_H_DEFAULT); - } - } else if (sc.state == SCE_H_TAGUNKNOWN) { - if (!ishtmlwordchar(sc.ch) && !((sc.ch == '/') && (sc.chPrev == '<')) && sc.ch != '[') { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (s[1] == '/') { - if (keywordsTags.InList(s + 2)) { - sc.ChangeState(SCE_H_TAG); - } - } else { - if (keywordsTags.InList(s + 1)) { - sc.ChangeState(SCE_H_TAG); - } - } - if (sc.ch == '>') { - sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.Match('/', '>')) { - sc.SetState(SCE_H_TAGEND); - sc.Forward(); - sc.ForwardSetState(SCE_H_DEFAULT); - } else { - sc.SetState(SCE_H_OTHER); - } - } - } else if (sc.state == SCE_H_ATTRIBUTE) { - if (!ishtmlwordchar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (!keywordsTags.InList(s)) { - sc.ChangeState(SCE_H_ATTRIBUTEUNKNOWN); - } - sc.SetState(SCE_H_OTHER); - } - } else if (sc.state == SCE_H_OTHER) { - if (sc.ch == '>') { - sc.SetState(SCE_H_TAG); - sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.Match('/', '>')) { - sc.SetState(SCE_H_TAG); - sc.Forward(); - sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.chPrev == '=') { - sc.SetState(SCE_H_VALUE); - } - } else if (sc.state == SCE_H_DOUBLESTRING) { - if (sc.ch == '\"') { - sc.ForwardSetState(SCE_H_OTHER); - } - } else if (sc.state == SCE_H_SINGLESTRING) { - if (sc.ch == '\'') { - sc.ForwardSetState(SCE_H_OTHER); - } - } else if (sc.state == SCE_H_NUMBER) { - if (!IsADigit(sc.ch)) { - sc.SetState(SCE_H_OTHER); - } - } - - if (sc.state == SCE_H_DEFAULT) { - if (sc.ch == '<') { - if (sc.Match("" in definition): + definition = definition.replace(" -->", "") listid = 0 if definition[0] in string.digits: listid = int(definition[:1]) @@ -107,18 +110,19 @@ def UpdateFile(filename, updated): infile = open(filename, "rb") except IOError: # File is not there yet out = open(filename, "wb") - out.write(updated) + out.write(updated.encode('utf-8')) out.close() - print "New", filename + print("New %s" % filename) return original = infile.read() infile.close() + original = original.decode('utf-8') if updated != original: os.unlink(filename) out = open(filename, "wb") - out.write(updated) + out.write(updated.encode('utf-8')) out.close() - print "Changed", filename + print("Changed %s " % filename) #~ else: #~ print "Unchanged", filename @@ -132,12 +136,13 @@ def Generate(inpath, outpath, commentPrefix, eolType, *lists): #print "generate '%s' -> '%s' (comment prefix: %r, eols: %r)"\ # % (inpath, outpath, commentPrefix, eolType) try: - infile = open(inpath, "r") + infile = open(inpath, "rb") except IOError: - print "Can not open", inpath + print("Can not open %s" % inpath) return original = infile.read() infile.close() + original = original.decode('utf-8') updated = CopyWithInsertion(original, commentPrefix, inpath == outpath, eolType, *lists) UpdateFile(outpath, updated) @@ -160,6 +165,8 @@ def FindModules(lexFile): modules.append(l.split()[1]) return modules +# Properties that start with lexer. or fold. are automatically found but there are some +# older properties that don't follow this pattern so must be explicitly listed. knownIrregularProperties = [ "fold", "styling.within.preprocessor", @@ -174,10 +181,10 @@ knownIrregularProperties = [ ] def FindProperties(lexFile): - properties = set() + properties = {} f = open(lexFile) for l in f.readlines(): - if "GetProperty" in l: + if ("GetProperty" in l or "DefineProperty" in l) and "\"" in l: l = l.strip() if not l.startswith("//"): # Drop comments propertyName = l.split("\"")[1] @@ -186,51 +193,110 @@ def FindProperties(lexFile): if propertyName in knownIrregularProperties or \ propertyName.startswith("fold.") or \ propertyName.startswith("lexer."): - properties.add(propertyName) + properties[propertyName] = 1 return properties +def FindPropertyDocumentation(lexFile): + documents = {} + f = open(lexFile) + name = "" + for l in f.readlines(): + l = l.strip() + if "// property " in l: + propertyName = l.split()[2] + if propertyName.lower() == propertyName: + # Only allow lower case property names + name = propertyName + documents[name] = "" + elif "DefineProperty" in l and "\"" in l: + propertyName = l.split("\"")[1] + if propertyName.lower() == propertyName: + # Only allow lower case property names + name = propertyName + documents[name] = "" + elif name: + if l.startswith("//"): + if documents[name]: + documents[name] += " " + documents[name] += l[2:].strip() + elif l.startswith("\""): + l = l[1:].strip() + if l.endswith(";"): + l = l[:-1].strip() + if l.endswith(")"): + l = l[:-1].strip() + if l.endswith("\""): + l = l[:-1] + # Fix escaped double quotes + l = l.replace("\\\"", "\"") + documents[name] += l + else: + name = "" + for name in list(documents.keys()): + if documents[name] == "": + del documents[name] + return documents + def ciCompare(a,b): return cmp(a.lower(), b.lower()) +def ciKey(a): + return a.lower() + +def sortListInsensitive(l): + try: # Try key function + l.sort(key=ciKey) + except TypeError: # Earlier version of Python, so use comparison function + l.sort(ciCompare) + def RegenerateAll(): root="../../" # Find all the lexer source code files - lexFilePaths = glob.glob(root + "scintilla/src/Lex*.cxx") + lexFilePaths = glob.glob(root + "scintilla/lexers/Lex*.cxx") + sortListInsensitive(lexFilePaths) lexFiles = [os.path.basename(f)[:-4] for f in lexFilePaths] - print lexFiles + print(lexFiles) lexerModules = [] - lexerProperties = set() + lexerProperties = {} + propertyDocuments = {} for lexFile in lexFilePaths: lexerModules.extend(FindModules(lexFile)) - lexerProperties.update(FindProperties(lexFile)) - lexerModules.sort(ciCompare) - lexerProperties.remove("fold.comment.python") - lexerProperties = list(lexerProperties) - lexerProperties.sort(ciCompare) + for k in FindProperties(lexFile).keys(): + lexerProperties[k] = 1 + documents = FindPropertyDocumentation(lexFile) + for k in documents.keys(): + propertyDocuments[k] = documents[k] + sortListInsensitive(lexerModules) + lexerProperties = list(lexerProperties.keys()) + sortListInsensitive(lexerProperties) + + # Generate HTML to document each property + # This is done because tags can not be safely put inside comments in HTML + documentProperties = list(propertyDocuments.keys()) + sortListInsensitive(documentProperties) + propertiesHTML = [] + for k in documentProperties: + propertiesHTML.append("\t\n\t%s\n\t%s\n\t" % + (k, propertyDocuments[k])) # Find all the SciTE properties files otherProps = ["abbrev.properties", "Embedded.properties", "SciTEGlobal.properties", "SciTE.properties"] if os.path.exists(root + "scite"): propFilePaths = glob.glob(root + "scite/src/*.properties") + sortListInsensitive(propFilePaths) propFiles = [os.path.basename(f) for f in propFilePaths if os.path.basename(f) not in otherProps] - propFiles.sort(ciCompare) - print propFiles + sortListInsensitive(propFiles) + print(propFiles) - Regenerate(root + "scintilla/src/KeyWords.cxx", "//", NATIVE, lexerModules) - Regenerate(root + "scintilla/win32/makefile", "#", NATIVE, lexFiles) + Regenerate(root + "scintilla/src/Catalogue.cxx", "//", NATIVE, lexerModules) Regenerate(root + "scintilla/win32/scintilla.mak", "#", NATIVE, lexFiles) Regenerate(root + "scintilla/win32/scintilla_vc6.mak", "#", NATIVE, lexFiles) - # Use Unix EOLs for gtk Makefiles so they work for Linux users when - # extracted from the Scintilla source ZIP (typically created on - # Windows). - Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles) - Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles) - Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles) if os.path.exists(root + "scite"): - Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles) - Regenerate(root + "scite/win32/scite.mak", "#", NATIVE, lexFiles, propFiles) + Regenerate(root + "scite/win32/makefile", "#", NATIVE, propFiles) + Regenerate(root + "scite/win32/scite.mak", "#", NATIVE, propFiles) Regenerate(root + "scite/src/SciTEProps.cxx", "//", NATIVE, lexerProperties) + Regenerate(root + "scite/doc/SciTEDoc.html", "